GCC Bugzilla – Bug 8694
<string> breaks <ctype.h> on HP-UX 10.20
Last modified: 2003-07-25 17:33:46 UTC
Including <string> breaks <ctype.h> on HP-UX 10.20 with gcc 3.1 or gcc 3.2. For example compiling the attached foo.cc results in an error: $ #################################### $ # with the gcc-3.2 compiler: ERROR # $ #################################### $ /usr/local/gcc-3.2.1/bin/g++ -v Reading specs from /usr/local/gcc-3.2.1/lib/gcc-lib/hppa1.1-hp-hpux10.20/3.2.1/specs Configured with: ../gcc-3.2.1/configure --prefix=/usr/local/gcc-3.2.1 --enable-shared --with-gnu-as --with-as=/opt/binutils/bin/as --without-gnu-ld Thread model: single gcc version 3.2.1 $ /usr/local/gcc-3.2.1/bin/g++ -c foo.cc foo.cc: In function `int main()': foo.cc:4: `_isprint' undeclared (first use this function) foo.cc:4: (Each undeclared identifier is reported only once for each function it appears in.) $ $ ################################# $ # with the gcc-3.0 compiler: OK # $ ################################# $ /opt/gcc-3.0.2/bin/g++ -v Reading specs from /opt/gcc-3.0.2/lib/gcc-lib/hppa1.1-hp-hpux10.20/3.0.2/specs Configured with: /tmp/gcc-3.0.2/configure --prefix=/opt/gcc-3.0.2 --enable-shared --with-gnu-as --without-gnu-ld --enable-languages=c++ Thread model: single gcc version 3.0.2 $ /opt/gcc-3.0.2/bin/g++ -c foo.cc $ The error seems to be caused by <string> defining _SB_CTYPE_MACROS, which breaks <ctype.h> on HP-UX 10.20. This error has been introduced in gcc-3.1. It looks like a regression caused by this bad fix: http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6501 The broken file is: include/c++/3.2.1/hppa1.1-hp-hpux10.20/bits/os_defines.h and it looks like: // Use macro form of ctype functions to ensure __SB_masks is defined. #define _SB_CTYPE_MACROS 1 Release: gcc-3.2.1 Environment: $ uname -srvmi HP-UX B.10.20 A 9000/715 2000649461 How-To-Repeat: compile the attached file on HP-UX 10.20 using gcc-3.1 or gcc-3.2
Fix: I suggest teh bad fix from: http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6501 is reverted. Macro _SB_CTYPE_MACROS was not defined in gcc-3.0 and it used to work just fine.
Responsible-Changed-From-To: unassigned->danglin Responsible-Changed-Why: Fixed.
State-Changed-From-To: open->closed State-Changed-Why: Fixed 3.2, 3.3 and trunk. <http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00779.html>.