Patch to fixincludes sys/queue.h

Jason Merrill jason@cygnus.com
Thu Feb 25 21:35:00 GMT 1999


'struct queue' clashes with the STL, and isn't referenced by users' code.
Applied.

Thu Feb 25 21:32:34 1999  Jason Merrill  <jason@yorick.cygnus.com>

	* fixinc.wrap: Also handle struct queue in sys/stream.h.
	* fixinc.svr4: Likewise.

Index: fixinc.svr4
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/fixinc.svr4,v
retrieving revision 1.5
diff -c -p -r1.5 fixinc.svr4
*** fixinc.svr4	1999/01/06 20:44:26	1.5
--- fixinc.svr4	1999/02/26 05:34:37
***************
*** 1,7 ****
  #! /bin/sh
  # Install modified versions of certain ANSI-incompatible
  # native System V Release 4 system include files.
! # Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
  # Contributed by Ron Guilmette (rfg@monkeys.com).
  #
  # This file is part of GNU CC.
--- 1,7 ----
  #! /bin/sh
  # Install modified versions of certain ANSI-incompatible
  # native System V Release 4 system include files.
! # Copyright (C) 1994, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
  # Contributed by Ron Guilmette (rfg@monkeys.com).
  #
  # This file is part of GNU CC.
*************** if [ \! -z "$file_to_fix" ]; then
*** 1520,1525 ****
--- 1520,1559 ----
      true
    else
      echo Fixed $file_to_fix
+     rm -f ${LIB}/$file
+     cp /tmp/$base ${LIB}/$file
+     chmod a+r ${LIB}/$file
+   fi
+   rm -f /tmp/$base
+ fi
+ 
+ # 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
Index: fixinc.wrap
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/fixinc.wrap,v
retrieving revision 1.2
diff -c -p -r1.2 fixinc.wrap
*** fixinc.wrap	1998/12/16 20:55:37	1.2
--- fixinc.wrap	1999/02/26 05:34:37
*************** __EOF__
*** 53,58 ****
--- 53,87 ----
    fi
  fi
  
+ # Similarly for struct queue in sys/stream.h.
+ file=sys/stream.h
+ if [ -r $INPUT/$file ]; then
+   echo Checking $INPUT/$file
+   if grep 'struct[ 	]*queue' $INPUT/$file >/dev/null
+   then
+     echo Fixed $file
+     mkdir -p $LIB/`dirname $file`
+     rm -f $LIB/$file
+     cat <<'__EOF__' >$LIB/$file
+ #ifndef _SYS_STREAM_H_WRAPPER
+ #ifdef __cplusplus
+ # define queue __stream_queue
+ #endif
+ #include_next <sys/stream.h>
+ #ifdef __cplusplus
+ # undef queue
+ #endif
+ #define _SYS_STREAM_H_WRAPPER
+ #endif /* _SYS_STREAM_H_WRAPPER */
+ __EOF__
+     # Define _SYS_STREAM_H_WRAPPER at the end of the wrapper, not the start,
+     # so that if #include_next gets another instance of the wrapper,
+     # this will follow the #include_next chain until we arrive at
+     # the real <sys/stream.h>.
+     chmod a+r $LIB/$file
+   fi
+ fi
+ 
  # Avoid the definition of the bool type in the Solaris 2.x curses.h when using
  # g++, since it's now an official type in the C++ language.
  file=curses.h


More information about the Gcc-patches mailing list