aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Korb <bkorb@gnu.org>2000-05-09 16:21:08 +0000
committerBruce Korb <korbb@gcc.gnu.org>2000-05-09 16:21:08 +0000
commit7a544ce153d84b697ec10a5acfd9b2e35a94fd87 (patch)
tree640a3c27e50bfcbf7ee30515df4bc60221c9b95a
parentc8c6d887a57ba81e74f5604b527339b6aaef917e (diff)
downloadgcc-7a544ce153d84b697ec10a5acfd9b2e35a94fd87.zip
gcc-7a544ce153d84b697ec10a5acfd9b2e35a94fd87.tar.gz
gcc-7a544ce153d84b697ec10a5acfd9b2e35a94fd87.tar.bz2
Added 'test_text' for many fixes
From-SVN: r33801
-rw-r--r--gcc/ChangeLog2
-rw-r--r--gcc/fixinc/check.tpl78
-rw-r--r--gcc/fixinc/inclhack.def112
3 files changed, 163 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a2a1e12..3f33f4f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,7 @@
2000-05-09 Bruce Korb <bkorb@gnu.org>
+ * fixinc/check.tpl: Template for checking fixes
+ * fixinc/inclhack.def: Added 'test_text' for many fixes
* fixinc/fixinc.sco: Oh, yes, we don't need this any more.
Tue May 9 16:30:27 MET DST 2000 Jan Hubicka <jh@suse.cz>
diff --git a/gcc/fixinc/check.tpl b/gcc/fixinc/check.tpl
new file mode 100644
index 0000000..bf71036
--- /dev/null
+++ b/gcc/fixinc/check.tpl
@@ -0,0 +1,78 @@
+[= autogen template sh=check.sh =]
+[=
+#
+# This file contanes the shell template to run tests on the fixes
+#
+=]#!/bin/sh
+
+set -e
+[ -d testdir ] && rm -rf testdir
+mkdir testdir
+cd testdir
+
+TARGET_MACHINE='*'
+DESTDIR=`pwd`/res
+SRCDIR=`pwd`/inc
+FIND_BASE='.'
+
+export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE
+
+mkdir ${DESTDIR} ${SRCDIR}
+
+( cd ${SRCDIR}
+ mkdir sys X11 Xm sundev sunwindow )
+
+[=
+
+_FOR fix =][=
+
+ _IF test_text _exist ! =][=
+ _IF replace _exist ! =]
+echo No test for [=hackname=][=
+ _ENDIF =][=
+ _ELSE =]
+cat >> inc/[=
+ _IF files _exist =][=
+ files[0] =][=
+ _ELSE =]testing.h[=
+ _ENDIF =] <<- '_HACK_EOF_'
+
+
+ #ifndef [=hackname _up=]_CHECK
+ #define [=hackname _up=]_CHECK
+[=test_text "\t" _prefix=]
+ #endif /* [=hackname _up=]_CHECK */
+_HACK_EOF_
+[=_ENDIF =][=
+
+/fix
+
+=]
+
+cd inc
+find . -type f | ../../fixincl
+cd ..
+diff -cr inc res | \
+ sed -e 's;^\(\*\*\* inc/[^ ]*\) .*$;\1;' \
+ -e 's;^\(--- res/[^ ]*\) .*$;\1;' > NEWDIFF
+echo
+echo Test output check:
+[=
+
+_FOR fix =][=
+
+ _IF test_text _exist =]
+fgrep [=hackname _up=]_CHECK NEWDIFF > /dev/null 2>&1 || \
+ echo "[=_eval hackname _get "#%32s test failed. See inc/"
+ _printf =][=
+ _IF files _exist =][=
+ files[0] =][=
+ _ELSE =]testing.h[=
+ _ENDIF =]"[=
+ _ENDIF =][=
+
+/fix
+
+=][=
+_eval _outfile "chmod +x %s" _printf _shell
+=]
diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def
index 145048d..6249130 100644
--- a/gcc/fixinc/inclhack.def
+++ b/gcc/fixinc/inclhack.def
@@ -1,7 +1,7 @@
/* -*- Mode: C -*- */
-autogen definitions inclhack;
+autogen definitions fixincl;
/* Define all the fixes we know about for repairing damaged headers.
Please see the README before adding or changing entries in this file.
@@ -521,11 +521,12 @@ fix = {
* of struct rusage, so the prototype (added by fixproto) causes havoc.
*/
fix = {
- hackname = aix_syswait;
- files = sys/wait.h;
- select = "bos325,";
+ hackname = aix_syswait;
+ files = sys/wait.h;
+ select = "bos325,";
sed = "/^extern pid_t wait3();$/i\\\n"
"struct rusage;\n";
+ test_text = "/* bos325, */\nextern pid_t wait3();";
};
@@ -536,11 +537,12 @@ fix = {
* required by ANSI C.
*/
fix = {
- hackname = aix_volatile;
- files = sys/signal.h;
- select = "typedef volatile int sig_atomic_t";
+ hackname = aix_volatile;
+ files = sys/signal.h;
+ select = "typedef volatile int sig_atomic_t";
sed = "s/typedef volatile int sig_atomic_t"
"/typedef int sig_atomic_t/";
+ test_text = "typedef volatile int sig_atomic_t;";
};
@@ -548,12 +550,13 @@ fix = {
* Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
*/
fix = {
- hackname = alpha_getopt;
- files = "stdio.h";
- files = "stdlib.h";
- select = 'getopt\(int, char \*\[';
+ hackname = alpha_getopt;
+ files = "stdio.h";
+ files = "stdlib.h";
+ select = 'getopt\(int, char \*\[\], *char \*\)';
sed = 's/getopt(int, char \*\[\],[ ]*char \*)/'
'getopt(int, char *const[], const char *)/';
+ test_text = 'extern int getopt(int, char *[], char *);';
};
@@ -561,10 +564,11 @@ fix = {
* Remove erroneous parentheses in sym.h on Alpha OSF/1.
*/
fix = {
- hackname = alpha_parens;
- files = sym.h;
- select = '#ifndef\(__mips64\)';
+ hackname = alpha_parens;
+ files = sym.h;
+ select = '#ifndef\(__mips64\)';
sed = "s/#ifndef(__mips64)/#ifndef __mips64/";
+ test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
};
@@ -576,6 +580,7 @@ fix = {
files = unistd.h;
select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";
+ test_text = "extern char* sbrk(ptrdiff_t increment);";
};
@@ -584,10 +589,11 @@ fix = {
* hint that is specific to the Norcroft compiler.
*/
fix = {
- hackname = arm_norcroft_hint;
- select = "___type p_type";
- files = "X11/Intrinsic.h";
+ hackname = arm_norcroft_hint;
+ select = "___type p_type";
+ files = "X11/Intrinsic.h";
sed = "s/___type p_type/p_type/";
+ test_text = "___type p_type mumble;";
};
@@ -601,6 +607,10 @@ fix = {
select = "#[ \t]*define[ \t]*__wchar_t";
sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
sed = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
+ test_text =
+ "# ifndef \t __wchar_t /* we don't have wchar_t yet, ... */\n"
+ "# define __wchar_t short\n"
+ "# endif /* __wchar_t */";
};
@@ -614,6 +624,9 @@ fix = {
select = "#ifndef NOINLINE";
sed = "s|#ifndef NOINLINE"
"|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|";
+ test_text =
+ "#ifndef NOINLINE /* ain't got no inline, so we got it */\n"
+ "#endif /* NOINLINE */";
};
@@ -661,6 +674,8 @@ fix = {
sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n"
"#endif\n";
+ test_text = "# define bool\t char \n"
+ "typedef unsigned int\tbool \t; /* bool type */";
};
@@ -673,6 +688,7 @@ fix = {
select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
sed = "s/^[ \t]*typedef[ \t][ \t]*"
"\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
+ test_text = 'typedef struct term;';
};
@@ -684,6 +700,7 @@ fix = {
hackname = badquote;
files = sundev/vuid_event.h;
sed = "s/doesn't/does not/";
+ test_text = "/* doesn't have matched single quotes */";
};
@@ -699,7 +716,7 @@ fix = {
fix = {
hackname = bad_lval;
- select = "^[ \t]*#[ \t]*pragma[ \t][ \t]*extern_prefix";
+ select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
files = libgen.h;
files = dirent.h;
@@ -716,8 +733,13 @@ fix = {
files = time.h;
files = unistd.h;
sed =
- "s/^[ \t]*#[ \t]*define[ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
+ "s/^[ \t]*#[ \t]*define[ \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 otherwise(x,y,z) BAR_Something(x,y,z)\n"
+ "#define mumble _FOOmumble";
};
@@ -728,9 +750,10 @@ fix = {
hackname = broken_assert_stdio;
files = assert.h;
select = stderr;
- bypass = "include.*stdio.h";
+ bypass = "include.*stdio\\.h";
sed = "1i\\\n"
"#include <stdio.h>\n";
+ test_text = "extern FILE* stderr;";
};
@@ -741,11 +764,12 @@ fix = {
hackname = broken_assert_stdlib;
files = assert.h;
select = 'exit *\(|abort *\(';
- bypass = "include.*stdlib.h";
+ bypass = "include.*stdlib\\.h";
sed = "1i\\\n"
"#ifdef __cplusplus\\\n"
"#include <stdlib.h>\\\n"
"#endif\n";
+ test_text = "extern void exit ( int );";
};
@@ -759,6 +783,11 @@ fix = {
select = '^extern double cabs';
sed = '/^extern double cabs();/d';
sed = '/^extern double cabs(struct dbl_hypot);/d';
+ test_text = "#ifdef __STDC__\n"
+ "extern double cabs(struct dbl_hypot);\n"
+ "#else\n"
+ "extern double cabs();\n"
+ "#endif";
};
@@ -773,6 +802,10 @@ fix = {
sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
"#endif\n";
+ test_text =
+ "float fasm {\n"
+ " ... asm stuff ...\n"
+ "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
};
@@ -784,6 +817,7 @@ fix = {
files = "sunwindow/win_lock.h";
files = "sunwindow/win_cursor.h";
sed = "s/ecd.cursor/ecd_cursor/";
+ test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
};
@@ -797,6 +831,7 @@ fix = {
select = 'include.*"\.\./machine/';
sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
+ test_text = '# include "../machine/fumble.h"';
};
@@ -804,10 +839,11 @@ fix = {
* Check for (...) in C++ code in HP/UX sys/file.h.
*/
fix = {
- hackname = hp_sysfile;
- files = sys/file.h;
- select = "HPUX_SOURCE";
+ hackname = hp_sysfile;
+ files = sys/file.h;
+ select = "HPUX_SOURCE";
sed = 's/(\.\.\.)/(struct file *, ...)/';
+ test_text = "extern void foo(...); /* bad varargs */";
};
@@ -841,13 +877,15 @@ fix = {
* HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
*/
fix = {
- hackname = hpux_maxint;
- files = sys/param.h;
+ hackname = hpux_maxint;
+ files = sys/param.h;
+ select = "^#[ \t]*define[ \t]*MAXINT[ \t]";
sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
"#ifndef MAXINT\n";
sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
"#endif\n";
+ test_text = '#define MAXINT 0x7FFFFFFF';
};
@@ -859,6 +897,7 @@ fix = {
files = sys/time.h;
select = "^extern struct sigevent;";
sed = "s/^extern struct sigevent;/struct sigevent;/";
+ test_text = 'extern struct sigevent;';
};
@@ -895,8 +934,10 @@ fix = {
fix = {
hackname = hpux11_uint32_c;
files = inttypes.h;
- select = "^#define UINT32_C\\(__c\\)[ \t]*__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
+ select = "^#define UINT32_C\\(__c\\)[ \t]*"
+ "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
sed = "s/^#define UINT32_C(__c)\\([ \t]*\\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\\1__CONCAT__(__c,ul)/";
+ c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
};
/*
@@ -915,10 +956,12 @@ fix = {
files = "sys/fcntl.h";
files = "sys/dirent.h";
- select = "defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)";
-
+ select = "!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)";
+
sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
"!defined(_POSIX_SOURCE)/";
+ test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
+ "\nint foo;\n#endif";
};
/*
@@ -2506,6 +2549,7 @@ fix = {
files = time.h;
select = "uint_t[ \t][ \t]*_clocks_per_sec";
sed = "s/uint_t/unsigned int/";
+ test_text = "uint_t\t_clocks_per_sec;";
};
@@ -2562,6 +2606,10 @@ fix = {
"#else\n";
sed = "/char \\*class;/a\\\n"
"#endif\n";
+ test_text =
+ "struct {\n"
+ " char *class;\n"
+ "} mumble;\n";
};
@@ -2573,6 +2621,7 @@ fix = {
files = Xm/BaseClassI.h;
bypass = "__cplusplus";
sed = "s/ class[)]/ c_class)/g";
+ test_text = "extern mumble (int class);\n";
};
@@ -2593,6 +2642,10 @@ fix = {
"#endif\n";
sed = "s/Widget new,/Widget c_new,/g";
+ test_text =
+ "struct wedge {\n"
+ " Widget\told, new; /* fix the new */\n"
+ "};\nextern Wedged( Widget new, Widget old );";
};
@@ -2608,6 +2661,7 @@ fix = {
sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
"extern char *\tsprintf();\\\n"
"#endif /* !defined __STDC__ */,";
+ test_text = "extern char *\tsprintf();";
};
/*EOF*/