This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/5798: problem with sys/socket.h


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]