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

* Re: Does C++ std::queue really conflict with C header 'struct queue'?
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Edwards @ 2003-07-30 20:14 UTC (permalink / raw)
  To: Nathanael Nerode; +Cc: gcc

On Sat, Jul 26, 2003 at 12:25:29AM -0400, Nathanael Nerode wrote:
> I doubt that Solaris comes out of config.guess as "*-*-svr4*", though, 

It doesn't.

> so I think it doesn't use the fixinc.svr4 script, the only one
> which still has that fix.

How do I check?


> 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.)

I removed both the queue and the exception fixes, and bootstrap+test didn't
behave any differently.  Which, as you say, probably means the file wasn't
even being looked at.  :-)


Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams

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

* Re: Does C++ std::queue really conflict with C header 'struct queue'?
  2003-07-30 20:14 ` Phil Edwards
@ 2003-07-30 23:31   ` Nathanael Nerode
  0 siblings, 0 replies; 5+ messages in thread
From: Nathanael Nerode @ 2003-07-30 23:31 UTC (permalink / raw)
  To: Phil Edwards; +Cc: gcc

Phil Edwards wrote:
> On Sat, Jul 26, 2003 at 12:25:29AM -0400, Nathanael Nerode wrote:
<snip>
>>so I think it doesn't use the fixinc.svr4 script, the only one
>>which still has that fix.
> 
> How do I check?
It doesn't use it.  Don't worry about it.  ;-)

>>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.)
> 
> 
> I removed both the queue and the exception fixes, and bootstrap+test didn't
> behave any differently.  Which, as you say, probably means the file wasn't
> even being looked at.  :-)

OK.  Run fixincludes on Solaris ('make stmp-fixinc' in the gcc directory 
should do the trick) and see whether the 'math-exception' fix is listed 
in the list of fixes applied.  If it *isn't*, testing on that machine's 
headers will be of no use to me.  If it *is*, I'll tell you what to test.

Thanks for your help.

--Nathanael


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

* Re: 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, 0 replies; 5+ messages in thread
From: Phil Edwards @ 2003-07-26 12:08 UTC (permalink / raw)
  To: Nathanael Nerode; +Cc: gcc

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.


Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams

^ 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).