This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/5798: problem with sys/socket.h
- From: Craig Rodrigues <rodrigc at attbi dot com>
- To: "Breuer, Markus" <markus dot breuer at materna dot de>
- Cc: "'rodrigc at gcc dot gnu dot org'" <rodrigc at gcc dot gnu dot org>, "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>, "'gcc-prs at gcc dot gnu dot org'" <gcc-prs at gcc dot gnu dot org>, "'markus dot breuer at gmx dot de'" <markus dot breuer at gmx dot de>, "'nobody at gcc dot gnu dot org'" <nobody at gcc dot gnu dot org>, "'gcc-gnats at gcc dot gnu dot org'" <gcc-gnats at gcc dot gnu dot org>
- Date: Mon, 4 Mar 2002 20:20:14 -0500
- Subject: Re: c/5798: problem with sys/socket.h
- References: <73B855B4F72FD411A1CF009027B113C4026BA90B@taxis.materna.de>
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