Subject: [Boost-bugs] [Boost C++ Libraries] #3931: Build boost libraries under HP-UX with GNU C/C++
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-02-14 16:38:03
#3931: Build boost libraries under HP-UX with GNU C/C++
------------------------------+---------------------------------------------
Reporter: vovata@⦠| Owner: vladimir_prus
Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: program_options
Version: Boost 1.42.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------------------------
I tried build boost, with program_options, under HP-UX (B.11.23 U ia64)
with GNU C/C++ compiler version 4.3.1, using bjam. I fpund a problem with
the define WCHAR_MAX in the system headers of HP-UX, it is defined there
with type cast, and an error arrives in the build:[[BR]]
In file included from libs/program_options/src/utf8_codecvt_facet.cpp:15:
libs/program_options/src/../../detail/utf8_codecvt_facet.cpp:255:7: error:
missing binary operator before token "("[[BR]]
The problematic define is in the system wchar.h:[[BR]]
# if defined(_INCLUDE_STDC__SOURCE_199901)[[BR]]
# define WCHAR_MAX UINT_MAX /* max value of an unsigned
integer */[[BR]]
# define WCHAR_MIN 0[[BR]]
# else[[BR]]
'''# define WCHAR_MAX (wchar_t)UINT_MAX /* max value of an
unsigned integer */[[BR]]
# define WCHAR_MIN (wchar_t)0'''[[BR]]
# endif[[BR]]
I fixed the problem with a little modification of
libs/detail/utf8_codecvt_facet.cpp, I replaced [[BR]]
#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier[[BR]]
return 2;[[BR]]
#elif WCHAR_MAX > 0x10000[[BR]]
if (word < 0x10000) {[[BR]]
return 2;[[BR]]
}[[BR]]
if (word < 0x200000) {[[BR]]
return 3;[[BR]]
}[[BR]]
if (word < 0x4000000) {[[BR]]
return 4;[[BR]]
}[[BR]]
return 5;[[BR]]
#else[[BR]]
return 2;[[BR]]
#endif[[BR]]
with this one[[BR]]
#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier[[BR]]
return 2;[[BR]]
#else[[BR]]
if (WCHAR_MAX > 0x10000) {[[BR]]
if (word < 0x10000) {[[BR]]
return 2;[[BR]]
}[[BR]]
if (word < 0x200000) {[[BR]]
return 3;[[BR]]
}[[BR]]
if (word < 0x4000000) {[[BR]]
return 4;[[BR]]
}[[BR]]
return 5;[[BR]]
} [[BR]]
else { [[BR]]
return 2;[[BR]]
} [[BR]]
#endif[[BR]]
The comparision WCHAR_MAX > 0x10000 will be done on runtime, and not at
compile time, but on runtime the type cast is ok.[[BR]]
Regards,[[BR]]
Vladimir Penev
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3931> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC