c/5798: problem with sys/socket.h

Craig Rodrigues rodrigc@attbi.com
Mon Mar 4 17:26:00 GMT 2002


The following reply was made to PR c/5798; it has been noted by GNATS.

From: Craig Rodrigues <rodrigc@attbi.com>
To: "Breuer, Markus" <markus.breuer@materna.de>
Cc: "'rodrigc@gcc.gnu.org'" <rodrigc@gcc.gnu.org>,
   "'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>,
   "'gcc-prs@gcc.gnu.org'" <gcc-prs@gcc.gnu.org>,
   "'markus.breuer@gmx.de'" <markus.breuer@gmx.de>,
   "'nobody@gcc.gnu.org'" <nobody@gcc.gnu.org>,
   "'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>
Subject: Re: c/5798: problem with sys/socket.h
Date: Mon, 4 Mar 2002 20:20:14 -0500

 On Mon, Mar 04, 2002 at 09:16:57AM +0100, Breuer, Markus wrote:
 > Hello,
 > 
 > i followed the thread within the refrenced link. The thread ended with no
 > real solution or alternative.
 > Possibly i found out a solution for the problem. The code within
 > sys/socket.h looks like following:
 > 
 > --- snipp ---
 > #ifdef  _XPG4_2
 > #ifdef  __PRAGMA_REDEFINE_EXTNAME
 > #pragma redefine_extname bind __xnet_bind
 
 What is #pragma redefine_extname?  Who uses it?
 The Sun compiler and Sun linker?  I don't think
 this is a gcc pragma.
 
 > [...]
 > #else   /* __PRAGMA_REDEFINE_EXTNAME */
 > #define bind    __xnet_bind
 > [...]
 > #endif  /* __PRAGMA_REDEFINE_EXTNAME */
 > --- snipp ---
 > 
 > When defining -D_XOPEN_SOURCE=500 only, the compiler uses the else branch of
 > the if-def directive. This uses the preprocessor for replacement. But when
 > -D__PRAGMA_REDEFINE_EXTNAME is additionally defined, the compiler uses the
 > #pragma directive. It acts after compiling, when the symbol names are
 > generated. It replaces the symbolname.
 > 
 > Is there any reason to avoid this workaround? My (sample) application work's
 > fine when using it.
 > 
 > regards, Markus
 > 
 
 I do not know enough about Solaris to say if your
 solution is workable or not, but it is certainly interesting.
 
 If you could test out the following and report back the results
 to us, that would be helpful:
 
 Edit gcc/config/sparc/sol2.h, change the following lines from:
 /* For C++ we need to add some additional macro definitions required
    by the C++ standard library.  */
 #define CPLUSPLUS_CPP_SPEC "\
 -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 \
 -D__EXTENSIONS__ \
 %(cpp) \
 "
 
 
 to:
 
 /* For C++ we need to add some additional macro definitions required
    by the C++ standard library.  */
 #define CPLUSPLUS_CPP_SPEC "\
 -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 \
 -D__EXTENSIONS__ -D__PRAGMA_REDEFINE_EXTNAME \
 %(cpp) \
 "
 
 
 Then you would have to:
 - configure
 - make boostrap
 - make check
 
 Also, report to us if you are using GNU binutils or
 the Sun linker/assembler.
 
 Thanks.
 -- 
 Craig Rodrigues        
 http://www.gis.net/~craigr    
 rodrigc@attbi.com



More information about the Gcc-prs mailing list