duplicate/buggy include fixes [patch]

Zack Weinberg zack@wolery.cumb.org
Tue Jan 11 17:00:00 GMT 2000


This patch removes some duplicated fixes from inclhack.def and converts
a couple of others to use 'replace =' instead of sed.  Also, a test that
used a filename glob is changed to use the glob's expansion.

Generated files are not diffed.

zw

	* inclhack.def (sun_memcpy): Move to AAB_sun_memcpy, use 'replace'.
	(ultrix_ansi_compat): Likewise.
	(interactv_add1): Rename to 'isc_omits_with_stdc', remove shell test,
	add egrep test.
	(interactv_add2, interactv_add3): Delete.
	(x11_sprintf): Don't use filename glob.

===================================================================
Index: inclhack.def
--- inclhack.def	1999/12/29 22:58:06	1.45
+++ inclhack.def	2000/01/12 00:54:51
@@ -283,6 +283,45 @@ fix = {
 
 
 /*
+ *  Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
+ *  declaration on Sun OS 4.x.  We must only fix this on Sun OS 4.x, because
+ *  many other systems have similar text but correct versions of the file.
+ *  To ensure only Sun's is fixed, we grep for a likely unique string.
+ *  Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
+ */
+fix = {
+    hackname = AAB_sun_memcpy;
+    files    = memory.h;
+    select = "/\\*\t@\\(#\\)"
+             "(head/memory.h\t50.1\t "
+             "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
+
+    replace =
+'/* This file was generated by fixincludes */
+\#ifndef __memory_h__
+\#define __memory_h__
+
+\#ifdef __STDC__
+extern void *memccpy();
+extern void *memchr();
+extern void *memcpy();
+extern void *memset();
+\#else
+extern char *memccpy();
+extern char *memchr();
+extern char *memcpy();
+extern char *memset();
+\#endif /* __STDC__ */
+
+extern int memcmp();
+
+\#endif /* __memory_h__ */
+';
+
+};
+
+
+/*
  *  Completely replace <sys/byteorder.h>; with a file that implements gcc's
  *  optimized byteswapping.  Restricted to "SVR4" machines until either
  *  it is shown to be safe to replace this file always, or we get bolder ;-)
@@ -469,6 +508,17 @@ fix = {
 
 
 /*
+ *  Cancel out ansi_compat.h on Ultrix.  Replace it with an empty file.
+ */
+fix = {
+    hackname = AAB_ultrix_ansi_compat;
+    files    = ansi_compat.h;
+    select   = ULTRIX;
+    replace  = "/* This file intentionally left blank.  */\n";
+};
+
+
+/*
  *  sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
  *  of struct rusage, so the prototype (added by fixproto) causes havoc.
  */
@@ -898,18 +948,13 @@ fix = {
 };
 
 /*
- *  Determine if we're on Interactive Unix 2.2 or later, in which case we
- *  need to fix some additional files.  This is the same test for ISC that
- *  Autoconf uses.  On Interactive 2.2, certain traditional Unix
- *  definitions (notably getc and putc in stdio.h) are omitted if __STDC__
- *  is defined, not just if _POSIX_SOURCE is defined.  This makes it
+ *  On Interactive Unix 2.2, certain traditional Unix definitions
+ *  (notably getc and putc in stdio.h) are omitted if __STDC__ is
+ *  defined, not just if _POSIX_SOURCE is defined.  This makes it
  *  impossible to compile any nontrivial program except with -posix.
  */
 fix = {
-    hackname = interactv_add1;
-
-    test   = " -d /etc/conf/kconfig.d";
-    test   = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
+    hackname = isc_omits_with_stdc;
 
     files  = "stdio.h";
     files  = "math.h";
@@ -918,33 +963,12 @@ fix = {
     files  = "sys/fcntl.h";
     files  = "sys/dirent.h";
 
+    select = "defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)";
+    
     sed    = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
                "!defined(_POSIX_SOURCE)/";
 };
 
-fix = {
-    hackname = interactv_add2;
-
-    test   = " -d /etc/conf/kconfig.d";
-    test   = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
-
-    files  = math.h;
-    sed    = "s/fmod(double)/fmod(double, double)/";
-};
-
-fix = {
-    hackname = interactv_add3;
-
-    test   = " -d /etc/conf/kconfig.d";
-    test   = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
-
-    files  = sys/limits.h;
-
-    sed    = "/CHILD_MAX/s,/\\* Max, Max,";
-    sed    = "/OPEN_MAX/s,/\\* Max, Max,";
-};
-
-
 /*
  *  Fix various _IO* defines, but do *not* quote the characters cgxtf.
  */
@@ -1838,41 +1862,6 @@ fix = {
 
 
 /*
- *  Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
- *  declaration on Sun OS 4.x.  We must only fix this on Sun OS 4.x, because
- *  many other systems have similar text but correct versions of the file.
- *  To ensure only Sun's is fixed, we grep for a likely unique string.
- *  Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
- */
-fix = {
-    hackname = sun_memcpy;
-    files    = memory.h;
-    select = "/\\*\t@\\(#\\)"
-             "(head/memory.h\t50.1\t "
-             "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
-
-    sed    = "1i\\\n/* This file was generated by fixincludes */\\\n"
-             "#ifndef __memory_h__\\\n"
-             "#define __memory_h__\\\n\\\n"
-             "#ifdef __STDC__\\\n"
-             "extern void *memccpy();\\\n"
-             "extern void *memchr();\\\n"
-             "extern void *memcpy();\\\n"
-             "extern void *memset();\\\n"
-             "#else\\\n"
-             "extern char *memccpy();\\\n"
-             "extern char *memchr();\\\n"
-             "extern char *memcpy();\\\n"
-             "extern char *memset();\\\n"
-             "#endif /* __STDC__ */\\\n\\\n"
-             "extern int memcmp();\\\n\\\n"
-             "#endif /* __memory_h__ */\n";
-
-    sed    = "1,$d";
-};
-
-
-/*
  *  Check for yet more missing ';' in struct (in SunOS 4.0.x)
  */
 fix = {
@@ -2456,18 +2445,6 @@ fix = {
 
 
 /*
- *  Cancel out ansi_compat.h on Ultrix.  Replace it with empty file.
- */
-fix = {
-    hackname = ultrix_ansi_compat;
-    files    = ansi_compat.h;
-    select   = ULTRIX;
-    sed      = "1i\\\n/* This file intentionally left blank. */\n";
-    sed      = "1,$d";
-};
-
-
-/*
  * Ultrix V4.[35] puts the declaration of uname before the definition
  * of struct utsname, so the prototype (added by fixproto) causes havoc.
  */
@@ -2758,7 +2735,10 @@ fix = {
  */
 fix = {
     hackname = x11_sprintf;
-    files    = X11*/Xmu.h;
+    files    = X11/Xmu.h;
+    files    = X11/Xmu/Xmu.h;
+    select   = 'sprintf\(\)';
+
     sed      = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
                "extern char *\tsprintf();\\\n"
                "#endif /* !defined __STDC__ */,";


More information about the Gcc-patches mailing list