problem with WCHAR_MIN using gcc-4.1.1 on hpux11.11

Hi, On HP-UX 11.11, there is a weird definition of WCHAR_MIN: $ grep WCHAR_MIN /usr/include/*.h /usr/include/wchar.h:# define WCHAR_MIN (wchar_t)0 When using gcc-4.1.1 on this platform, each time WCHAR_MIN is tested by preprocessor-directive against zero, g++ spits: gcc-C++-action ../../../bin/boost/libs/regex/build/libboost_regex.a/gcc/debug/c_regex_traits.o In file included from ../src/c_regex_traits.cpp:29: <snip>/boost_1_34_0rc/boost/regex/v4/regex_traits_defaults.hpp:87:94: error: missing binary operator before token "0" This appears in boost/regex/v4/perl_matcher.hpp: line 53 and boost/regex/v4/regex_traits_defaults.hpp: line 87 Both of them are hidden for aCC with "#if !defined(__HP_aCC)", so maybe they should also be hidden for gcc on hpux ? This problem does not appear with gcc-3.4.5 because of this: gcc-3.4.5 (don't exactly know until which version) did not define _INCLUDE__STDC_A1_SOURCE as builtin, which enables that definition of WCHAR_MIN in /usr/include/wchar.h Initially I had this with 1.33.0, but it is the same for rc-1.34.0. Thanks, haubi -- Michael Haubenwallner SALOMON Automation GmbH Forschung & Entwicklung A-8114 Friesach bei Graz mailto:michael.haubenwallner@salomon.at http://www.salomon.at No HTML/MIME please, see http://expita.com/nomime.html

Michael Haubenwallner wrote:
On HP-UX 11.11, there is a weird definition of WCHAR_MIN:
$ grep WCHAR_MIN /usr/include/*.h /usr/include/wchar.h:# define WCHAR_MIN (wchar_t)0
When using gcc-4.1.1 on this platform, each time WCHAR_MIN is tested by preprocessor-directive against zero, g++ spits:
gcc-C++-action gcc-C++../../../bin/boost/libs/regex/build/libboost_regex.a/gc c/debug/c_ gcc-C++regex_traits.o In file included from ../src/c_regex_traits.cpp:29: <snip>/boost_1_34_0rc/boost/regex/v4/regex_traits_defaults.hpp
:87:94: error: missing binary operator before token "0"
This appears in boost/regex/v4/perl_matcher.hpp: line 53 and boost/regex/v4/regex_traits_defaults.hpp: line 87
Both of them are hidden for aCC with "#if !defined(__HP_aCC)", so maybe they should also be hidden for gcc on hpux ?
This problem does not appear with gcc-3.4.5 because of this:
gcc-3.4.5 (don't exactly know until which version) did not define _INCLUDE__STDC_A1_SOURCE as builtin, which enables that definition of WCHAR_MIN in /usr/include/wchar.h
Initially I had this with 1.33.0, but it is the same for rc-1.34.0.
The ISO C++ Standard [3.9.1] and the ISO C Standard [7.18.3] both specify that WCHAR_MIN must be a "constant expression suitable for use in #if preprocessing directives". HP/UX's definition of WCHAR_MIN does not conform with this requirement, as the preprocessor has no idea what to make of the expression "(wchar_t)0". You can fix this as follows: #include <wchar.h> #undef WCHAR_MIN /* (wchar_t)0 */ #define WCHAR_MIN 0 Moshe

On Thu, 2006-09-21 at 17:18 +0300, Moshe Matitya wrote:
Michael Haubenwallner wrote:
On HP-UX 11.11, there is a weird definition of WCHAR_MIN:
$ grep WCHAR_MIN /usr/include/*.h /usr/include/wchar.h:# define WCHAR_MIN (wchar_t)0
When using gcc-4.1.1 on this platform, each time WCHAR_MIN is tested by preprocessor-directive against zero, g++ spits:
gcc-C++-action gcc-C++../../../bin/boost/libs/regex/build/libboost_regex.a/gc c/debug/c_ gcc-C++regex_traits.o In file included from ../src/c_regex_traits.cpp:29: <snip>/boost_1_34_0rc/boost/regex/v4/regex_traits_defaults.hpp
:87:94: error: missing binary operator before token "0"
This appears in boost/regex/v4/perl_matcher.hpp: line 53 and boost/regex/v4/regex_traits_defaults.hpp: line 87
Both of them are hidden for aCC with "#if !defined(__HP_aCC)", so maybe they should also be hidden for gcc on hpux ?
This problem does not appear with gcc-3.4.5 because of this:
gcc-3.4.5 (don't exactly know until which version) did not define _INCLUDE__STDC_A1_SOURCE as builtin, which enables that definition of WCHAR_MIN in /usr/include/wchar.h
Initially I had this with 1.33.0, but it is the same for rc-1.34.0.
The ISO C++ Standard [3.9.1] and the ISO C Standard [7.18.3] both specify that WCHAR_MIN must be a "constant expression suitable for use in #if preprocessing directives". HP/UX's definition of WCHAR_MIN does not conform with this requirement, as the preprocessor has no idea what to make of the expression "(wchar_t)0".
You can fix this as follows:
#include <wchar.h> #undef WCHAR_MIN /* (wchar_t)0 */ #define WCHAR_MIN 0
Er... I do not have this problem within my code, but while building boost itself - where within boost is best place to do so ? And should I file a gcc-bug ? -haubi-

Michael Haubenwallner wrote:
On Thu, 2006-09-21 at 17:18 +0300, Moshe Matitya wrote:
Michael Haubenwallner wrote:
On HP-UX 11.11, there is a weird definition of WCHAR_MIN:
$ grep WCHAR_MIN /usr/include/*.h /usr/include/wchar.h:# define WCHAR_MIN (wchar_t)0
When using gcc-4.1.1 on this platform, each time
WCHAR_MIN is tested
by preprocessor-directive against zero, g++ spits:
gcc-C++-action gcc-C++../../../bin/boost/libs/regex/build/libboost_regex.a/gc c/debug/c_ gcc-C++regex_traits.o In file included from ../src/c_regex_traits.cpp:29: <snip>/boost_1_34_0rc/boost/regex/v4/regex_traits_defaults.hpp :87:94: error: missing binary operator before token "0"
This appears in boost/regex/v4/perl_matcher.hpp: line 53 and boost/regex/v4/regex_traits_defaults.hpp: line 87
Both of them are hidden for aCC with "#if !defined(__HP_aCC)", so maybe they should also be hidden for gcc on hpux ?
This problem does not appear with gcc-3.4.5 because of this:
gcc-3.4.5 (don't exactly know until which version) did not define _INCLUDE__STDC_A1_SOURCE as builtin, which enables that definition of WCHAR_MIN in /usr/include/wchar.h
Initially I had this with 1.33.0, but it is the same for rc-1.34.0.
The ISO C++ Standard [3.9.1] and the ISO C Standard [7.18.3] both specify that WCHAR_MIN must be a "constant expression suitable for use in #if preprocessing directives". HP/UX's definition of WCHAR_MIN does not conform with this requirement, as the preprocessor has no idea what to make of the expression "(wchar_t)0".
You can fix this as follows:
#include <wchar.h> #undef WCHAR_MIN /* (wchar_t)0 */ #define WCHAR_MIN 0
Er... I do not have this problem within my code, but while building boost itself - where within boost is best place to do so ?
And should I file a gcc-bug ?
Sorry, I'm not sure where would be the proper place in Boost to insert such a workaround. Is there someone on this list who can advise? Also, if I'm understanding this correctly, then this is an HP/UX CRT library bug, not a GCC bug. Moshe

Michael Haubenwallner wrote:
You can fix this as follows:
#include <wchar.h> #undef WCHAR_MIN /* (wchar_t)0 */ #define WCHAR_MIN 0
Er... I do not have this problem within my code, but while building boost itself - where within boost is best place to do so ?
And should I file a gcc-bug ?
I'll look into patching Boost.Regex to work around this. The folks at HP are aware of the issue BTW, but patching/changing OS headers is unlikely in the short term at least. Thanks for the report, John.

On Thu, 2006-09-21 at 17:22 +0100, John Maddock wrote:
Michael Haubenwallner wrote:
You can fix this as follows:
#include <wchar.h> #undef WCHAR_MIN /* (wchar_t)0 */ #define WCHAR_MIN 0
Er... I do not have this problem within my code, but while building boost itself - where within boost is best place to do so ?
And should I file a gcc-bug ?
I'll look into patching Boost.Regex to work around this. The folks at HP are aware of the issue BTW, but patching/changing OS headers is unlikely in the short term at least.
Did dig somewhat into gcc-repository, this problem should occur since gcc-4.0.0. Currently, I'm trying applied workaround. Maybe redefinition of WCHAR_MAX is not necessary. -haubi- -- Michael Haubenwallner SALOMON Automation GmbH Forschung & Entwicklung A-8114 Friesach bei Graz mailto:michael.haubenwallner@salomon.at http://www.salomon.at No HTML/MIME please, see http://expita.com/nomime.html

This is fixed in HP-UX 11.31 to be released in Dec. 2006. w.cpp ------ #include <wchar.h> WCHAR_MIN WCHAR_MAX bash-2.05b$ uname -r B.11.31 bash-2.05b$ aCC -E w.cpp | tail -2 0 4294967295U bash-2.05b$ ----- Original Message ----- From: "Michael Haubenwallner" <michael.haubenwallner@salomon.at> To: <boost@lists.boost.org> Sent: Thursday, September 21, 2006 9:31 AM Subject: [boost] problem with WCHAR_MIN using gcc-4.1.1 on hpux11.11
Hi,
On HP-UX 11.11, there is a weird definition of WCHAR_MIN:
$ grep WCHAR_MIN /usr/include/*.h /usr/include/wchar.h:# define WCHAR_MIN (wchar_t)0
When using gcc-4.1.1 on this platform, each time WCHAR_MIN is tested by preprocessor-directive against zero, g++ spits:
gcc-C++-action ../../../bin/boost/libs/regex/build/libboost_regex.a/gcc/debug/c_regex_traits.o In file included from ../src/c_regex_traits.cpp:29: <snip>/boost_1_34_0rc/boost/regex/v4/regex_traits_defaults.hpp:87:94: error: missing binary operator before token "0"
This appears in boost/regex/v4/perl_matcher.hpp: line 53 and boost/regex/v4/regex_traits_defaults.hpp: line 87
Both of them are hidden for aCC with "#if !defined(__HP_aCC)", so maybe they should also be hidden for gcc on hpux ?
This problem does not appear with gcc-3.4.5 because of this:
gcc-3.4.5 (don't exactly know until which version) did not define _INCLUDE__STDC_A1_SOURCE as builtin, which enables that definition of WCHAR_MIN in /usr/include/wchar.h
Initially I had this with 1.33.0, but it is the same for rc-1.34.0.
Thanks, haubi -- Michael Haubenwallner SALOMON Automation GmbH Forschung & Entwicklung A-8114 Friesach bei Graz mailto:michael.haubenwallner@salomon.at http://www.salomon.at No HTML/MIME please, see http://expita.com/nomime.html
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On Thu, 2006-09-21 at 12:26 -0400, Boris Gubenko wrote:
This is fixed in HP-UX 11.31 to be released in Dec. 2006.
Well, on 11.23 already both variants are in /usr/include/wchar.h: #define WCHAR_MIN 0 #define WCHAR_MIN (wchar_t)0 Seems that I'm lucky and the right one gets used :) (just to be noted) -haubi- -- Michael Haubenwallner SALOMON Automation GmbH Forschung & Entwicklung A-8114 Friesach bei Graz mailto:michael.haubenwallner@salomon.at http://www.salomon.at No HTML/MIME please, see http://expita.com/nomime.html

From Michael Haubenwallner <michael.haubenwallner@salomon.at>
On Thu, 2006-09-21 at 12:26 -0400, Boris Gubenko wrote:
This is fixed in HP-UX 11.31 to be released in Dec. 2006.
Well, on 11.23 already both variants are in /usr/include/wchar.h: #define WCHAR_MIN 0 #define WCHAR_MIN (wchar_t)0
This is correct, but, unfortunately, the C99-compliant definition is under the _INCLUDE_STDC__SOURCE_199901 macro which C++ compiler does not predefine. Boris
participants (4)
-
Boris Gubenko
-
John Maddock
-
Michael Haubenwallner
-
Moshe Matitya