This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fixincludes corrections for FreeBSD


fixincludes is run on FreeBSD, and it makes a number of unnecessary
changes and misses one it should make.  This patch corrects that.
The fixes I modified are run on other systems also, but I doubt it
will cause problems.

Thanks to Gerald Pfiefer for the guest account I used to test this.

zw

2000-01-21  Zack Weinberg  <zack@wolery.cumb.org>

	* fixinc/inclhack.def: Tweaks for FreeBSD:
	(cxx_unready): Add select expression.
	(irix_multiline_cmnt, irix_sockaddr):  Swap comments.
	(irix_sockaddr): Add bypass expression.
	(machine_ansi_h_va_list): New fix.
	(stdio_va_list):  Bypass on #include <stdarg.h> or
	#include <machine/ansi.h>, not on __gnuc_va_list.  Do not mess
	with _BSD_VA_LIST_.
	(systypes): Correct comment.
	(systypes_for_aix): Rename to systypes_stdlib_size_t.  Apply
	to stdlib.h also,  Bypass on _BSD_SIZE_T as well as
	_GCC_SIZE_T.  Update comment.
	(sysv68_string): Correct comment.
	(sysz_stdlib_for_sun): Remove duplicate size_t fix.
	(ultrix_ifdef): Narrow select expression.

===================================================================
Index: fixinc/inclhack.def
--- fixinc/inclhack.def	2000/01/20 18:25:12	1.49
+++ fixinc/inclhack.def	2000/01/22 00:46:28
@@ -861,7 +861,9 @@ fix = {
     hackname = cxx_unready;
     files    = sys/mman.h;
     files    = rpc/types.h;
-    bypass = '"C"|__BEGIN_DECLS';
+    select   = '[^#]+malloc.*;';  /* Should catch any form of a declaration
+				     but not mention within a macro.  */
+    bypass   = '"C"|__BEGIN_DECLS';
 
     sed      = "1i\\\n"
                "#ifdef __cplusplus\\\n"
@@ -1012,8 +1014,7 @@ fix = {
 
 
 /*
- *  IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
- *  in prototype without previous definition.
+ *  Some IRIX header files contain the string "//"
  */
 fix = {
     hackname = irix_multiline_cmnt;
@@ -1025,12 +1026,14 @@ fix = {
 
 
 /*
- *  Some IRIX header files contain the string "//"
+ *  IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
+ *  in prototype without previous definition.
  */
 fix = {
     hackname = irix_sockaddr;
     files    = rpc/auth.h;
     select   = "authdes_create.*struct sockaddr";
+    bypass   = "<sys/socket\.h>";
     sed      = "/authdes_create.*struct sockaddr/i\\\n"
                "struct sockaddr;\n";
 };
@@ -1252,6 +1255,19 @@ fix = {
 
 
 /*
+ * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
+ */
+fix = {
+    hackname = machine_ansi_h_va_list;
+    files    = machine/ansi.h;
+    select   = '_BSD_VA_LIST_';
+    bypass   = '__builtin_va_list';
+
+    sed	     = "s/\\(_BSD_VA_LIST_[ \t][ \t]*\\).*$/\\1__builtin_va_list/";
+};
+
+
+/*
  *  Fix non-ansi machine name defines
  */
 fix = {
@@ -1660,34 +1676,26 @@ fix = {
 fix = {
     hackname = stdio_va_list;
     files    = stdio.h;
-    bypass   = "__gnuc_va_list";
+    bypass   = "stdarg\.h|machine/ansi\.h";
 
     /*
      * Use __gnuc_va_list in arg types in place of va_list.
      * On 386BSD use __gnuc_va_list instead of _VA_LIST_.  We're hoping the
      * trailing parentheses and semicolon save all other systems from this.
-     * Define __not_va_list__ (something harmless and unused) instead of va_list.
+     * Define __not_va_list__ (something harmless and unused)
+     * instead of va_list.
      * Don't claim to have defined va_list.
      */
-    shell =
- "if ( egrep \"__need___va_list\" $file ) > /dev/null 2>&1 ; then
-    :
-  else
-    echo \"#define __need___va_list\"
-    echo \"#include <stdarg.h>\"
-  fi
-
-  sed -e 's@ va_list @ __gnuc_va_list @' \\
-      -e 's@ va_list)@ __gnuc_va_list)@' \\
-      -e 's@ _BSD_VA_LIST_))@ __gnuc_va_list))@' \\
-      -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \\
-      -e 's@ va_list@ __not_va_list__@' \\
-      -e 's@\\*va_list@*__not_va_list__@' \\
-      -e 's@ __va_list)@ __gnuc_va_list)@' \\
-      -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \\
-      -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \\
-      -e 's@VA_LIST@DUMMY_VA_LIST@' \\
-      -e 's@_Va_LIST@_VA_LIST@'";
+    sed = "s@ va_list @ __gnuc_va_list @\n"
+          "s@ va_list)@ __gnuc_va_list)@\n"
+          "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
+          "s@ va_list@ __not_va_list__@\n"
+          "s@\\*va_list@*__not_va_list__@\n"
+          "s@ __va_list)@ __gnuc_va_list)@\n"
+          "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
+          "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
+          "s@VA_LIST@DUMMY_VA_LIST@\n"
+          "s@_Va_LIST@_VA_LIST@";
 };
 
 
@@ -2174,15 +2182,9 @@ fix = {
     sed      = "/#define[ \t]*__i386.*/d";
 };
 #endif /*  SVR5 */
-
 
-/*
- *  Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
- *  in string.h on sysV68
- *  Correct the return type for strlen in string.h on Lynx.
- *  Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
- *  Add missing const for strdup on OSF/1 V3.0.
- *  On sysV88 layout is slightly different.
+/* Fix these files to use the same types that we think they should.
+ * XXX - extremely dubious changes here.
  */
 fix = {
     hackname = systypes;
@@ -2235,15 +2237,15 @@ fix = {
 
 
 /*
- *  Fix this file to avoid interfering with stddef.h,
- *  but don't mistakenly match ssize_t present in AIX for the ps/2,
- *  or typedefs which use (but do not set) size_t.
+ * Fix files that may contain a stray definition of size_t.  Take care
+ * not to match ssize_t or mere uses of size_t.
  */
 fix = {
-    hackname = systypes_for_aix;
+    hackname = systypes_stdlib_size_t;
     files    = sys/types.h;
+    files    = stdlib.h;
     select   = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";
-    bypass   = "_GCC_SIZE_T";
+    bypass   = "_(GCC|BSD)_SIZE_T";
 
     sed    = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
                  "#ifndef _GCC_SIZE_T\\\n"
@@ -2255,9 +2257,12 @@ fix = {
 
 
 /*
- *  Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
- *  Also wrap protection around size_t for m88k-sysv3 systems.
- *  We use a funny name to ensure it follows 'systypes' fix.
+ *  Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
+ *  in string.h on sysV68
+ *  Correct the return type for strlen in string.h on Lynx.
+ *  Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
+ *  Add missing const for strdup on OSF/1 V3.0.
+ *  On sysV88 layout is slightly different.
  */
 fix = {
     hackname = sysv68_string;
@@ -2278,7 +2283,6 @@ fix = {
 
 /*
  *  Fix return type of exit and abort in <stdlib.h>
- *  Also wrap protection around size_t.
  */
 fix = {
     hackname = sysz_stdlib_for_sun;
@@ -2291,13 +2295,6 @@ fix = {
     sed   = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
     sed   = "s/char[ \t]*\\*[ \t]*bsearch/void \\*\tbsearch/g";
     sed   = "s/int[ \t][ \t]*exit/void\texit/g";
-
-    sed   = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/i\\\n"
-                "#ifndef _GCC_SIZE_T\\\n"
-                "#define _GCC_SIZE_T\n";
-
-    sed   = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/a\\\n"
-                "#endif\n";
 };
 
 
@@ -2395,7 +2392,7 @@ fix = {
  */
 fix = {
     hackname = ultrix_ifdef;
-    select   = "#ifdef KERNEL";
+    select   = "#ifdef KERNEL[ \t]*[^ \t]";
     files    = sys/file.h;
     sed      = "s/#ifdef KERNEL/#if defined(KERNEL)/";
 };

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]