Bug 8694 - <string> breaks <ctype.h> on HP-UX 10.20
<string> breaks <ctype.h> on HP-UX 10.20
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: libstdc++
3.2.1
: P3 normal
: ---
Assigned To: John David Anglin
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-11-24 10:46 UTC by dimitri, at,
Modified: 2003-07-25 17:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
foo.cc (70 bytes, application/octet-stream)
2003-05-21 15:17 UTC, dimitri, at,
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dimitri, at, 2002-11-24 10:46:01 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
Comment 1 dimitri, at, 2002-11-24 10:46:01 UTC
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.
Comment 2 John David Anglin 2003-02-13 00:11:33 UTC
Responsible-Changed-From-To: unassigned->danglin
Responsible-Changed-Why: Fixed.
Comment 3 John David Anglin 2003-02-13 00:11:33 UTC
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>.