This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
use STDC_0_IN_SYSTEM_HEADERS more widely
- To: gcc-patches at gcc dot gnu dot org
- Subject: use STDC_0_IN_SYSTEM_HEADERS more widely
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Fri, 28 Apr 2000 15:42:14 -0700
This is a completely untested patch (as I don't have any of the
affected targets) which applies STDC_0_IN_SYSTEM_HEADERS to a few more
targets that can use it. It then gets rid of the obsolete STDC_VALUE
define and some fixinc widgetry.
Note that one of the modified fixinc scripts is fixinc.svr4, which is
applied to all targets matching *-*-sysv4*, which is dozens of them.
Many don't have a more specific target header than <arch>/svr4.h. I
did not add STDC_0_IN_SYSTEM_HEADERS to any of these, because that
would have knock-on effects on all the places that use svr4.h. And
that includes most of the active targets, and they mostly don't need
this crud.
Test reports and tweaks would be greatly appreciated. Also, are the
Windows NT 3.5 target files used anymore? Could we throw them away?
(Why am I dinking with fixinc? Because I accidentally blew away two
days worth of real work and I can't face doing it over right now.)
zw
* fixinc.interix, fixinc.sco, fixinc.svr4, fixinc.winnt: Don't
modify tests for __STDC__ == 0.
* interix.h, i386/sco.h, i386/scodbx.h, i386/sysv5.h,
winnt/win-nt.h: Define STDC_0_IN_SYSTEM_HEADERS. Remove
definition of STDC_VALUE, if present.
* i386/sco4.h, i386/sco4dbx.h: Undefine
STDC_0_IN_SYSTEM_HEADERS again.
===================================================================
Index: fixinc/fixinc.interix
--- fixinc/fixinc.interix 1999/04/11 11:35:44 1.2
+++ fixinc/fixinc.interix 2000/04/28 22:38:01
@@ -126,14 +126,6 @@ while [ $# != 0 ]; do
cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file"
chmod +w,a+r $2/$file
-# The following have been removed from the sed command below
-# because it is more useful to leave these things in.
-# The only reason to remove them was for -pedantic,
-# which isn't much of a reason. -- rms.
-# ??? above/below
-# /^[ ]*#[ ]*ident/d
-# s/!__STDC__/!defined (__STRICT_ANSI__)/g
-
sed -e '/#[ ]*include.*[<"][A-Za-z]:\\/ s,\\,/,g' \
-e '/#[ ]*include.*[<"][A-Za-z]:\// s,\([A-Za-z]\):/,//\1/,' \
-e '\,#[ ]*include.*[<"]//[A-Za-z]/, y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,' \
===================================================================
Index: fixinc/fixinc.sco
--- fixinc/fixinc.sco 2000/04/02 22:50:55 1.8
+++ fixinc/fixinc.sco 2000/04/28 22:38:06
@@ -25,17 +25,13 @@
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
-# This script munges the native include files provided with SCO
-# 3.2v4 systems so as to provide a reasonable namespace when
-# compiling with gcc. The header files by default do not
-# provide many essential definitions and declarations if
-# __STDC__ is 1. This script modifies the header files to check
-# for __STRICT_ANSI__ being defined instead. Once munged, the
-# resulting new system include files are placed in a directory
-# that GNU C will search *before* searching the /usr/include
-# directory. This script should work properly for most SCO
-# 3.2v4 systems. For other types of systems, you should use the
-# `fixincludes' or the `fixinc.svr4' script instead.
+# This script munges the native include files provided with SCO 3.2v4
+# systems to correct various problems when compiling with gcc. The
+# resulting new system include files are placed in a directory that
+# GNU C will search *before* searching the /usr/include directory.
+# This script should work properly for most SCO 3.2v4 systems.
+# For other types of systems, you should use the `fixincludes'
+# or the `fixinc.svr4' script instead.
#
# See README-fixinc for more information.
@@ -143,43 +139,6 @@ if $LINKS; then
done
fi
-set - $treetops
-while [ $# != 0 ]; do
- # $1 is an old directory to copy, and $2 is the new directory to copy to.
- echo "Finding header files in $1:"
- cd ${INPUT}
- cd $1
- files=`find . -name '*.h' -type f -print`
- echo 'Checking header files:'
- for file in $files; do
- if egrep '!__STDC__' $file >/dev/null; then
- if [ -r $file ]; then
- cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w $2/$file
- chmod a+r $2/$file
-
-# The following have been removed from the sed command below
-# because it is more useful to leave these things in.
-# The only reason to remove them was for -pedantic,
-# which isn't much of a reason. -- rms.
-# /^[ ]*#[ ]*ident/d
-
- sed -e '
- s/!__STDC__/!defined (__STRICT_ANSI__)/g
- ' $2/$file > $2/$file.sed
- mv $2/$file.sed $2/$file
- if cmp $file $2/$file >/dev/null 2>&1; then
- rm $2/$file
- else
- echo Fixed $file
- fi
- fi
- fi
- done
- shift; shift
-done
-
-# We shouldn't stay in the directory we just copied.
cd ${INPUT}
# Fix first broken decl of getcwd present on some svr4 systems.
===================================================================
Index: fixinc/fixinc.svr4
--- fixinc/fixinc.svr4 2000/02/17 00:32:50 1.9
+++ fixinc/fixinc.svr4 2000/04/28 22:38:06
@@ -167,12 +167,6 @@ while [ $# != 0 ]; do
chmod +w $2/$file
chmod a+r $2/$file
-# The following have been removed from the sed command below
-# because it is more useful to leave these things in.
-# The only reason to remove them was for -pedantic,
-# which isn't much of a reason. -- rms.
-# /^[ ]*#[ ]*ident/d
-
# This code makes Solaris SCSI fail, because it changes the
# alignment within some critical structures. See <sys/scsi/impl/commands.h>.
# s/u_char\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
@@ -207,12 +201,6 @@ while [ $# != 0 ]; do
/#[a-z]*if.*[ (]ns32000/ s/\([^_]\)ns32000/\1__ns32000__/g
/#[a-z]*if.*[ (]pyr/ s/\([^_]\)pyr/\1__pyr__/g
/#[a-z]*if.*[ (]is68k/ s/\([^_]\)is68k/\1__is68k__/g
- s/__STDC__[ ][ ]*==[ ][ ]*0/!defined (__STRICT_ANSI__)/g
- s/__STDC__[ ][ ]*==[ ][ ]*1/defined (__STRICT_ANSI__)/g
- s/__STDC__[ ][ ]*!=[ ][ ]*0/defined (__STRICT_ANSI__)/g
- s/__STDC__[ ][ ]*!=[ ][ ]*1/!defined (__STRICT_ANSI__)/g
- s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
- s/__STDC__ - 0 == 1/defined (__STRICT_ANSI__)/g
/^typedef[ ][ ]*[unsigned ]*long[ ][ ]*[u_]*longlong_t;/s/long/long long/
' $2/$file > $2/$file.sed
mv $2/$file.sed $2/$file
===================================================================
Index: fixinc/fixinc.winnt
--- fixinc/fixinc.winnt 2000/02/01 21:42:05 1.6
+++ fixinc/fixinc.winnt 2000/04/28 22:38:07
@@ -23,31 +23,13 @@
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
-# This script munges the native include files provided with Windows NT
-# 3.5 SDK systems so as to provide a reasonable namespace when
-# compiling with gcc. The header files by default do not
-# provide many essential definitions and declarations if
-# __STDC__ is 1. This script modifies the header files to check
-# for __STRICT_ANSI__ being defined instead. Once munged, the
-# resulting new system include files are placed in a directory
-# that GNU C will search *before* searching the Include
-# directory.
-#
-# See README-fixinc for more information.
+# This script munges the native include files provided with
+# Windows NT 3.5 SDK systems so as to remove things which are
+# violations of the ANSI C standard. Once munged, the resulting
+# new system include files are placed in a directory that GNU C
+# will search *before* searching the /usr/include directory.
ORIG_DIR=`pwd`
-
-# Directory containing the original header files.
-cd $2; SEDFILE=`${PWDCMD-pwd}`/fixinc-nt.sed
-echo $SEDFILE
-if [ ! -f $SEDFILE ]
-then echo fixincludes: sed script 'fixinc-nt.sed' not found
-exit 1
-fi
-echo 'Using sed script: ' ${SEDFILE}
-
-cd $ORIG_DIR
-
INPUT=${INCLUDE}
echo 'Using the Include environment variable to find header files to fix'
@@ -105,42 +87,6 @@ done
# of old directories to copy
# and the new directories to copy to.
treetops="${INPUT} ${LIB}"
-
-set - $treetops
-while [ $# != 0 ]; do
- # $1 is an old directory to copy, and $2 is the new directory to copy to.
- echo "Finding header files in $1:"
- cd ${INPUT}
- cd $1
- files=`find . -name '*.[hH]' -type f -print`
- echo 'Checking header files:'
- for file in $files; do
- echo $file
- if egrep "!__STDC__" $file >NUL; then
- if [ -r $file ]; then
- cp $file $2/$file >NUL 2>&1 || echo "Can't copy $file"
- chmod +w,a+r $2/$file
-
-# The following have been removed from the sed command below
-# because it is more useful to leave these things in.
-# The only reason to remove them was for -pedantic,
-# which isn't much of a reason. -- rms.
-# /^[ ]*#[ ]*ident/d
-
- sed -e '
- s/!__STDC__/!defined (__STRICT_ANSI__)/g
- ' $2/$file > $2/$file.sed
- mv $2/$file.sed $2/$file
- if cmp $file $2/$file >NUL 2>&1; then
- rm $2/$file
- else
- echo Fixed $file
- fi
- fi
- fi
- done
- shift; shift
-done
# Fix first broken decl of getcwd present on some svr4 systems.
===================================================================
Index: config/interix.h
--- config/interix.h 1999/09/15 21:41:13 1.3
+++ config/interix.h 2000/04/28 22:38:07
@@ -81,8 +81,8 @@ for windows/multi thread */
#endif /* 0 */
-#undef STDC_VALUE
-#define STDC_VALUE 0
+/* The system headers expect __STDC__ == 0. */
+#define STDC_0_IN_SYSTEM_HEADERS
#define HANDLE_SYSV_PRAGMA
#undef HANDLE_PRAGMA_WEAK /* until the link format can handle it */
===================================================================
Index: config/i386/sco.h
--- config/i386/sco.h 2000/01/31 07:28:05 1.7
+++ config/i386/sco.h 2000/04/28 22:38:08
@@ -111,3 +111,6 @@ Boston, MA 02111-1307, USA. */
/* Handle #pragma pack. */
#define HANDLE_SYSV_PRAGMA
+
+/* The system headers expect __STDC__ == 0. */
+#define STDC_0_IN_SYSTEM_HEADERS
===================================================================
Index: config/i386/sco4.h
--- config/i386/sco4.h 1998/12/16 21:03:59 1.3
+++ config/i386/sco4.h 2000/04/28 22:38:08
@@ -82,5 +82,7 @@ Boston, MA 02111-1307, USA. */
%{scointl:-D_M_INTERNAT -DM_INTERNAT} \
%{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE}}}}"
-/* The system headers are C++-aware. */
+/* The system headers are C++-aware and don't need special
+ treatment of __STDC__. */
#define NO_IMPLICIT_EXTERN_C
+#undef STDC_0_IN_SYSTEM_HEADERS
===================================================================
Index: config/i386/sco4dbx.h
--- config/i386/sco4dbx.h 1998/12/16 21:04:00 1.3
+++ config/i386/sco4dbx.h 2000/04/28 22:38:08
@@ -79,3 +79,8 @@ Boston, MA 02111-1307, USA. */
-DM_COFF -DM_BITFIELDS -DM_WORDSWAP \
%{scointl:-D_M_INTERNAT -DM_INTERNAT} \
%{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE}}}}"
+
+/* The system headers are C++-aware and don't need special
+ treatment of __STDC__. */
+#define NO_IMPLICIT_EXTERN_C
+#undef STDC_0_IN_SYSTEM_HEADERS
===================================================================
Index: config/i386/scodbx.h
--- config/i386/scodbx.h 2000/01/31 07:28:05 1.6
+++ config/i386/scodbx.h 2000/04/28 22:38:08
@@ -86,3 +86,6 @@ Boston, MA 02111-1307, USA. */
/* Handle #pragma pack. */
#define HANDLE_SYSV_PRAGMA
+
+/* The system headers expect __STDC__ == 0. */
+#define STDC_0_IN_SYSTEM_HEADERS
===================================================================
Index: config/i386/sysv5.h
--- config/i386/sysv5.h 2000/01/31 07:28:05 1.4
+++ config/i386/sysv5.h 2000/04/28 22:38:08
@@ -34,3 +34,5 @@ Boston, MA 02111-1307, USA. */
#undef CPP_SPEC
#define CPP_SPEC "%(cpp_cpu) %{pthread:-D_REENTRANT} %{pthreadT:-D_REENTRANT}"
+
+#define STDC_0_IN_SYSTEM_HEADERS
===================================================================
Index: config/winnt/win-nt.h
--- config/winnt/win-nt.h 1998/12/16 21:14:52 1.3
+++ config/winnt/win-nt.h 2000/04/28 22:38:09
@@ -54,8 +54,8 @@ Boston, MA 02111-1307, USA. */
{ 0, 0, 0, 0 } \
}
-#undef STDC_VALUE
-#define STDC_VALUE 0
-
/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
+
+/* The system headers expect __STDC__ == 0. */
+#define STDC_0_IN_SYSTEM_HEADERS