This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Does C++ std::queue really conflict with C header 'struct queue'?
- From: neroden at twcny dot rr dot com (Nathanael Nerode)
- To: gcc at gcc dot gnu dot org
- Date: Fri, 25 Jul 2003 22:17:16 -0400
- Subject: Does C++ std::queue really conflict with C header 'struct queue'?
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