public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Does C++ std::queue really conflict with C header 'struct queue'?
@ 2003-07-26 12:42 Nathanael Nerode
  2003-07-30 20:14 ` Phil Edwards
  0 siblings, 1 reply; 5+ messages in thread
From: Nathanael Nerode @ 2003-07-26 12:42 UTC (permalink / raw)
  To: phil; +Cc: gcc

Phil Edwards wrote:
>On Fri, Jul 25, 2003 at 10:17:16PM -0400, Nathanael Nerode wrote:
>> The following hunk of code from fixinc.svr4 purports to fix a 
>problem, 
>which I
>> think may not be a problem.
>> 
>> The claim is that 'struct queue' in sys/stream.h conflicts with the
>> 'queue' class in C++ headers.  This seems wrong to me because the C++
>> queue class is in namespace std, and I don't see why the sys/stream.h
>> version would be.
>
>My guess is that it dates from the days when gcc didn't have proper
>namespace support.  Tomorrow I'll try removing that fix and see whether
>anything breaks on solaris.

Thanks for picking up on this!  That's what I guessed, but I wasn't 
comfortable with it until a C++ person said it.  :-)

I doubt that Solaris comes out of config.guess as "*-*-svr4*", though, 
so I think it doesn't use the fixinc.svr4 script, the only one
which still has that fix.

There is a similar issue related to math.h defining 'struct exception', 
which also appears in regular fixincludes.  Is this essentially the 
same situation, or is there some added wrinkle introduced because of the 
forwarding headers or something?  (If so, is this better fixed in 
'fixincludes' or in the forwarding headers?)  

If this is essentially the same case, you could try removing *that* fix
(hackname 'math_exception').  (I can't check that either, since my only 
machine uses glibc, which already has essentially incorporated the 
fixincludes fix into its math.h.)

Mantra: Anything I can delete is a good thing.  :-)

-- 
Nathanael Nerode  <neroden at gcc.gnu.org>
http://home.twcny.rr.com/nerode/neroden/fdl.html

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Does C++ std::queue really conflict with C header 'struct queue'?
@ 2003-07-26  5:16 Nathanael Nerode
  2003-07-26 12:08 ` Phil Edwards
  0 siblings, 1 reply; 5+ messages in thread
From: Nathanael Nerode @ 2003-07-26  5:16 UTC (permalink / raw)
  To: gcc

The following hunk of code from fixinc.svr4 purports to fix a problem, which I
think may not be a problem.

The claim is that 'struct queue' in sys/stream.h conflicts with the
'queue' class in C++ headers.  This seems wrong to me because the C++
queue class is in namespace std, and I don't see why the sys/stream.h
version would be.

Am I missing something?  If the fix is still needed I will add this fix into 
standard fixincludes; if not I will delete it entirely.

--Nathanael

---
# Similarly for struct queue in sys/stream.h.
file=sys/stream.h
base=`basename $file`.$$
if [ -r ${LIB}/$file ]; then
  file_to_fix=${LIB}/$file
else
  if [ -r ${INPUT}/$file ]; then
    file_to_fix=${INPUT}/$file
  else
    file_to_fix=""
  fi
fi
if [ \! -z "$file_to_fix" ]; then
  echo Checking $file_to_fix
  sed -e '/struct[ 	]*queue/i\
#ifdef __cplusplus\
#define queue __stream_queue\
#endif'\
      -e '/struct[ 	]*queue/a\
#ifdef __cplusplus\
#undef queue\
#endif' $file_to_fix > /tmp/$base
  if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
    true
  else
    echo Fixed $file_to_fix
    mkdir -p $LIB/`dirname $file`
    rm -f ${LIB}/$file
    cp /tmp/$base ${LIB}/$file
    chmod a+r ${LIB}/$file
  fi
  rm -f /tmp/$base
fi


-- 
Nathanael Nerode  <neroden at gcc.gnu.org>
http://home.twcny.rr.com/nerode/neroden/fdl.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-07-30 21:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-26 12:42 Does C++ std::queue really conflict with C header 'struct queue'? Nathanael Nerode
2003-07-30 20:14 ` Phil Edwards
2003-07-30 23:31   ` Nathanael Nerode
  -- strict thread matches above, loose matches on Subject: below --
2003-07-26  5:16 Nathanael Nerode
2003-07-26 12:08 ` Phil Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).