This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.4/3.5 PATCH: Restrict bad_lval fixincludes hack to Tru64 UNIX
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Bruce Korb <bkorb at gnu dot org>
- Date: Fri, 23 Jan 2004 21:24:03 +0100 (MET)
- Subject: 3.4/3.5 PATCH: Restrict bad_lval fixincludes hack to Tru64 UNIX
As promised, here's the patch to remove the file list in the bad_lval
fixincludes hack (which had become incomplete and thus a maintenance
nightmare), instead applying the (appropritately renamed) hack only on
alpha*-dec-osf*.
This passes make check in gcc/fixinc. Bootstrapped on alpha-dec-osf4.0f
(3.4 branch and mainline) and alpha-dec-osf5.1b (mainline only). While the
bootstrap aborted due to the nan problem in libstdc++-v3, fixincludes was
run and the resulting gcc/include dir was identical with and without the
patch.
Besides, I've checked that the bad_lval hack wasn't applied on any of
sparc-sun-solaris2.8, i386-pc-solaris2.9, mips-sgi-irix6.5, or
mips-sgi-irix5.3.
Ok for 3.4 branch and mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Tue Jan 20 12:03:22 2004 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* fixinc/inclhack.def (bad_lval): Renamed to ...
(alpha_bad_lval): ... this.
Removed file list.
Restrict to alpha*-dec-osf*.
* fixinc/fixincl.x: Regenerate.
* fixinc/tests/base/dirent.h: Remove, moving test ...
* fixinc/tests/base/testing.h: ... here, reflecting new name.
Index: gcc/fixinc/inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.193
diff -u -p -r1.193 inclhack.def
--- gcc/fixinc/inclhack.def 21 Jan 2004 20:08:19 -0000 1.193
+++ gcc/fixinc/inclhack.def 23 Jan 2004 17:35:35 -0000
@@ -592,6 +592,37 @@ fix = {
/*
+ * Fix #defines under Alpha OSF/1:
+ * The following files contain '#pragma extern_prefix "_FOO"' followed by
+ * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
+ * statements is to reduce namespace pollution. While these macros work
+ * properly in most cases, they don't allow you to take a pointer to the
+ * "something" being modified. To get around this limitation, change these
+ * statements to be of the form '#define something _FOOsomething'.
+ *
+ * sed ain't egrep, lesson 2463: sed can use self-referential
+ * regular expressions. In the substitute expression below,
+ * "\\1" and "\\2" refer to subexpressions found earlier in the
+ * same match. So, we continue to use sed. "extern_prefix" will
+ * be a rare match anyway...
+ */
+fix = {
+ hackname = alpha_bad_lval;
+
+ select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
+ mach = "alpha*-dec-osf*";
+
+ sed =
+ "s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
+ "\\(_.*\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
+
+ test_text = '#pragma extern_prefix "_FOO"'"\n"
+ "#define something(x,y,z) _FOOsomething(x,y,z)\n"
+ "#define mumble _FOOmumble";
+};
+
+
+/*
* Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
*/
fix = {
@@ -753,62 +784,6 @@ fix = {
c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
-};
-
-
-/*
- * Fix #defines under Alpha OSF/1:
- * The following files contain '#pragma extern_prefix "_FOO"' followed by
- * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
- * statements is to reduce namespace pollution. While these macros work
- * properly in most cases, they don't allow you to take a pointer to the
- * "something" being modified. To get around this limitation, change these
- * statements to be of the form '#define something _FOOsomething'.
- *
- * sed ain't egrep, lesson 2463: sed can use self-referential
- * regular expressions. In the substitute expression below,
- * "\\1" and "\\2" refer to subexpressions found earlier in the
- * same match. So, we continue to use sed. "extern_prefix" will
- * be a rare match anyway...
- */
-fix = {
- hackname = bad_lval;
-
- select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
-
- files = dirent.h;
- files = ftw.h;
- files = grp.h;
- files = libgen.h;
- files = ndbm.h;
- files = pthread.h;
- files = pwd.h;
- files = signal.h;
- files = standards.h;
- files = stdio.h;
- files = stdlib.h;
- files = string.h;
- files = stropts.h;
- files = sys/mount.h;
- files = sys/resource.h;
- files = sys/signal.h;
- files = sys/socket.h;
- files = sys/stat.h;
- files = sys/stropts.h;
- files = sys/uio.h;
- files = time.h;
- files = unistd.h;
- files = utmp.h;
- files = utmpx.h;
- files = wchar.h;
-
- sed =
- "s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
- "\\(_.*\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
-
- test_text = '#pragma extern_prefix "_FOO"'"\n"
- "#define something(x,y,z) _FOOsomething(x,y,z)\n"
- "#define mumble _FOOmumble";
};
Index: gcc/fixinc/tests/base/dirent.h
===================================================================
RCS file: gcc/fixinc/tests/base/dirent.h
diff -N gcc/fixinc/tests/base/dirent.h
--- gcc/fixinc/tests/base/dirent.h 16 Jan 2004 20:58:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-/* DO NOT EDIT THIS FILE.
-
- It has been auto-edited by fixincludes from:
-
- "fixinc/tests/inc/dirent.h"
-
- This had to be done to correct non-standard usages in the
- original, manufacturer supplied header file. */
-
-
-
-#if defined( BAD_LVAL_CHECK )
-#pragma extern_prefix "_FOO"
-#define something _FOOsomething
-#define mumble _FOOmumble
-#endif /* BAD_LVAL_CHECK */
Index: gcc/fixinc/tests/base/testing.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/tests/base/testing.h,v
retrieving revision 1.13
diff -u -p -r1.13 testing.h
--- gcc/fixinc/tests/base/testing.h 16 Jan 2004 20:58:26 -0000 1.13
+++ gcc/fixinc/tests/base/testing.h 23 Jan 2004 17:35:35 -0000
@@ -19,6 +19,13 @@
#endif /* ALPHA___EXTERN_PREFIX_CHECK */
+#if defined( ALPHA_BAD_LVAL_CHECK )
+#pragma extern_prefix "_FOO"
+#define something _FOOsomething
+#define mumble _FOOmumble
+#endif /* ALPHA_BAD_LVAL_CHECK */
+
+
#if defined( AVOID_WCHAR_T_TYPE_CHECK )
#ifndef __cplusplus
typedef unsigned short wchar_t ;