Commit 7a544ce1 by Bruce Korb Committed by Bruce Korb

Added 'test_text' for many fixes

From-SVN: r33801
parent c8c6d887
2000-05-09 Bruce Korb <bkorb@gnu.org> 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. * 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> Tue May 9 16:30:27 MET DST 2000 Jan Hubicka <jh@suse.cz>
......
[= 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
=]
/* -*- Mode: C -*- */ /* -*- Mode: C -*- */
autogen definitions inclhack; autogen definitions fixincl;
/* Define all the fixes we know about for repairing damaged headers. /* Define all the fixes we know about for repairing damaged headers.
Please see the README before adding or changing entries in this file. Please see the README before adding or changing entries in this file.
...@@ -521,11 +521,12 @@ fix = { ...@@ -521,11 +521,12 @@ fix = {
* of struct rusage, so the prototype (added by fixproto) causes havoc. * of struct rusage, so the prototype (added by fixproto) causes havoc.
*/ */
fix = { fix = {
hackname = aix_syswait; hackname = aix_syswait;
files = sys/wait.h; files = sys/wait.h;
select = "bos325,"; select = "bos325,";
sed = "/^extern pid_t wait3();$/i\\\n" sed = "/^extern pid_t wait3();$/i\\\n"
"struct rusage;\n"; "struct rusage;\n";
test_text = "/* bos325, */\nextern pid_t wait3();";
}; };
...@@ -536,11 +537,12 @@ fix = { ...@@ -536,11 +537,12 @@ fix = {
* required by ANSI C. * required by ANSI C.
*/ */
fix = { fix = {
hackname = aix_volatile; hackname = aix_volatile;
files = sys/signal.h; files = sys/signal.h;
select = "typedef volatile int sig_atomic_t"; select = "typedef volatile int sig_atomic_t";
sed = "s/typedef volatile int sig_atomic_t" sed = "s/typedef volatile int sig_atomic_t"
"/typedef int sig_atomic_t/"; "/typedef int sig_atomic_t/";
test_text = "typedef volatile int sig_atomic_t;";
}; };
...@@ -548,12 +550,13 @@ fix = { ...@@ -548,12 +550,13 @@ fix = {
* Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX. * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
*/ */
fix = { fix = {
hackname = alpha_getopt; hackname = alpha_getopt;
files = "stdio.h"; files = "stdio.h";
files = "stdlib.h"; files = "stdlib.h";
select = 'getopt\(int, char \*\['; select = 'getopt\(int, char \*\[\], *char \*\)';
sed = 's/getopt(int, char \*\[\],[ ]*char \*)/' sed = 's/getopt(int, char \*\[\],[ ]*char \*)/'
'getopt(int, char *const[], const char *)/'; 'getopt(int, char *const[], const char *)/';
test_text = 'extern int getopt(int, char *[], char *);';
}; };
...@@ -561,10 +564,11 @@ fix = { ...@@ -561,10 +564,11 @@ fix = {
* Remove erroneous parentheses in sym.h on Alpha OSF/1. * Remove erroneous parentheses in sym.h on Alpha OSF/1.
*/ */
fix = { fix = {
hackname = alpha_parens; hackname = alpha_parens;
files = sym.h; files = sym.h;
select = '#ifndef\(__mips64\)'; select = '#ifndef\(__mips64\)';
sed = "s/#ifndef(__mips64)/#ifndef __mips64/"; sed = "s/#ifndef(__mips64)/#ifndef __mips64/";
test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
}; };
...@@ -576,6 +580,7 @@ fix = { ...@@ -576,6 +580,7 @@ fix = {
files = unistd.h; files = unistd.h;
select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\("; select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/"; sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";
test_text = "extern char* sbrk(ptrdiff_t increment);";
}; };
...@@ -584,10 +589,11 @@ fix = { ...@@ -584,10 +589,11 @@ fix = {
* hint that is specific to the Norcroft compiler. * hint that is specific to the Norcroft compiler.
*/ */
fix = { fix = {
hackname = arm_norcroft_hint; hackname = arm_norcroft_hint;
select = "___type p_type"; select = "___type p_type";
files = "X11/Intrinsic.h"; files = "X11/Intrinsic.h";
sed = "s/___type p_type/p_type/"; sed = "s/___type p_type/p_type/";
test_text = "___type p_type mumble;";
}; };
...@@ -601,6 +607,10 @@ fix = { ...@@ -601,6 +607,10 @@ fix = {
select = "#[ \t]*define[ \t]*__wchar_t"; select = "#[ \t]*define[ \t]*__wchar_t";
sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/"; sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
sed = "s/\\(#[ \t]*define[ \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 = { ...@@ -614,6 +624,9 @@ fix = {
select = "#ifndef NOINLINE"; select = "#ifndef NOINLINE";
sed = "s|#ifndef NOINLINE" sed = "s|#ifndef NOINLINE"
"|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|"; "|#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 = { ...@@ -661,6 +674,8 @@ fix = {
sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n" sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n"
"#endif\n"; "#endif\n";
test_text = "# define bool\t char \n"
"typedef unsigned int\tbool \t; /* bool type */";
}; };
...@@ -673,6 +688,7 @@ fix = { ...@@ -673,6 +688,7 @@ fix = {
select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;"; select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
sed = "s/^[ \t]*typedef[ \t][ \t]*" sed = "s/^[ \t]*typedef[ \t][ \t]*"
"\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/"; "\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
test_text = 'typedef struct term;';
}; };
...@@ -684,6 +700,7 @@ fix = { ...@@ -684,6 +700,7 @@ fix = {
hackname = badquote; hackname = badquote;
files = sundev/vuid_event.h; files = sundev/vuid_event.h;
sed = "s/doesn't/does not/"; sed = "s/doesn't/does not/";
test_text = "/* doesn't have matched single quotes */";
}; };
...@@ -699,7 +716,7 @@ fix = { ...@@ -699,7 +716,7 @@ fix = {
fix = { fix = {
hackname = bad_lval; hackname = bad_lval;
select = "^[ \t]*#[ \t]*pragma[ \t][ \t]*extern_prefix"; select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
files = libgen.h; files = libgen.h;
files = dirent.h; files = dirent.h;
...@@ -716,8 +733,13 @@ fix = { ...@@ -716,8 +733,13 @@ fix = {
files = time.h; files = time.h;
files = unistd.h; files = unistd.h;
sed = sed =
"s/^[ \t]*#[ \t]*define[ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*" "s/^[ \t]*#[ \t]*define[ \t]+\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
"\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/"; "\\(_.\\)\\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 = { ...@@ -728,9 +750,10 @@ fix = {
hackname = broken_assert_stdio; hackname = broken_assert_stdio;
files = assert.h; files = assert.h;
select = stderr; select = stderr;
bypass = "include.*stdio.h"; bypass = "include.*stdio\\.h";
sed = "1i\\\n" sed = "1i\\\n"
"#include <stdio.h>\n"; "#include <stdio.h>\n";
test_text = "extern FILE* stderr;";
}; };
...@@ -741,11 +764,12 @@ fix = { ...@@ -741,11 +764,12 @@ fix = {
hackname = broken_assert_stdlib; hackname = broken_assert_stdlib;
files = assert.h; files = assert.h;
select = 'exit *\(|abort *\('; select = 'exit *\(|abort *\(';
bypass = "include.*stdlib.h"; bypass = "include.*stdlib\\.h";
sed = "1i\\\n" sed = "1i\\\n"
"#ifdef __cplusplus\\\n" "#ifdef __cplusplus\\\n"
"#include <stdlib.h>\\\n" "#include <stdlib.h>\\\n"
"#endif\n"; "#endif\n";
test_text = "extern void exit ( int );";
}; };
...@@ -759,6 +783,11 @@ fix = { ...@@ -759,6 +783,11 @@ fix = {
select = '^extern double cabs'; select = '^extern double cabs';
sed = '/^extern double cabs();/d'; sed = '/^extern double cabs();/d';
sed = '/^extern double cabs(struct dbl_hypot);/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 = { ...@@ -773,6 +802,10 @@ fix = {
sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n"; sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n" sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
"#endif\n"; "#endif\n";
test_text =
"float fasm {\n"
" ... asm stuff ...\n"
"};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
}; };
...@@ -784,6 +817,7 @@ fix = { ...@@ -784,6 +817,7 @@ fix = {
files = "sunwindow/win_lock.h"; files = "sunwindow/win_lock.h";
files = "sunwindow/win_cursor.h"; files = "sunwindow/win_cursor.h";
sed = "s/ecd.cursor/ecd_cursor/"; sed = "s/ecd.cursor/ecd_cursor/";
test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
}; };
...@@ -797,6 +831,7 @@ fix = { ...@@ -797,6 +831,7 @@ fix = {
select = 'include.*"\.\./machine/'; select = 'include.*"\.\./machine/';
sed = "s,\"../machine/inline.h\",<machine/inline.h>,"; sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
sed = "s,\"../machine/psl.h\",<machine/psl.h>,"; sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
test_text = '# include "../machine/fumble.h"';
}; };
...@@ -804,10 +839,11 @@ fix = { ...@@ -804,10 +839,11 @@ fix = {
* Check for (...) in C++ code in HP/UX sys/file.h. * Check for (...) in C++ code in HP/UX sys/file.h.
*/ */
fix = { fix = {
hackname = hp_sysfile; hackname = hp_sysfile;
files = sys/file.h; files = sys/file.h;
select = "HPUX_SOURCE"; select = "HPUX_SOURCE";
sed = 's/(\.\.\.)/(struct file *, ...)/'; sed = 's/(\.\.\.)/(struct file *, ...)/';
test_text = "extern void foo(...); /* bad varargs */";
}; };
...@@ -841,13 +877,15 @@ fix = { ...@@ -841,13 +877,15 @@ fix = {
* HPUX 10.x sys/param.h defines MAXINT which clashes with values.h * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
*/ */
fix = { fix = {
hackname = hpux_maxint; hackname = hpux_maxint;
files = sys/param.h; files = sys/param.h;
select = "^#[ \t]*define[ \t]*MAXINT[ \t]";
sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n" sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
"#ifndef MAXINT\n"; "#ifndef MAXINT\n";
sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n" sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
"#endif\n"; "#endif\n";
test_text = '#define MAXINT 0x7FFFFFFF';
}; };
...@@ -859,6 +897,7 @@ fix = { ...@@ -859,6 +897,7 @@ fix = {
files = sys/time.h; files = sys/time.h;
select = "^extern struct sigevent;"; select = "^extern struct sigevent;";
sed = "s/^extern struct sigevent;/struct sigevent;/"; sed = "s/^extern struct sigevent;/struct sigevent;/";
test_text = 'extern struct sigevent;';
}; };
...@@ -895,8 +934,10 @@ fix = { ...@@ -895,8 +934,10 @@ fix = {
fix = { fix = {
hackname = hpux11_uint32_c; hackname = hpux11_uint32_c;
files = inttypes.h; 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)/"; 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 = { ...@@ -915,10 +956,12 @@ fix = {
files = "sys/fcntl.h"; files = "sys/fcntl.h";
files = "sys/dirent.h"; files = "sys/dirent.h";
select = "defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)"; select = "!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)";
sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/" sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
"!defined(_POSIX_SOURCE)/"; "!defined(_POSIX_SOURCE)/";
test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
"\nint foo;\n#endif";
}; };
/* /*
...@@ -2506,6 +2549,7 @@ fix = { ...@@ -2506,6 +2549,7 @@ fix = {
files = time.h; files = time.h;
select = "uint_t[ \t][ \t]*_clocks_per_sec"; select = "uint_t[ \t][ \t]*_clocks_per_sec";
sed = "s/uint_t/unsigned int/"; sed = "s/uint_t/unsigned int/";
test_text = "uint_t\t_clocks_per_sec;";
}; };
...@@ -2562,6 +2606,10 @@ fix = { ...@@ -2562,6 +2606,10 @@ fix = {
"#else\n"; "#else\n";
sed = "/char \\*class;/a\\\n" sed = "/char \\*class;/a\\\n"
"#endif\n"; "#endif\n";
test_text =
"struct {\n"
" char *class;\n"
"} mumble;\n";
}; };
...@@ -2573,6 +2621,7 @@ fix = { ...@@ -2573,6 +2621,7 @@ fix = {
files = Xm/BaseClassI.h; files = Xm/BaseClassI.h;
bypass = "__cplusplus"; bypass = "__cplusplus";
sed = "s/ class[)]/ c_class)/g"; sed = "s/ class[)]/ c_class)/g";
test_text = "extern mumble (int class);\n";
}; };
...@@ -2593,6 +2642,10 @@ fix = { ...@@ -2593,6 +2642,10 @@ fix = {
"#endif\n"; "#endif\n";
sed = "s/Widget new,/Widget c_new,/g"; 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 = { ...@@ -2608,6 +2661,7 @@ fix = {
sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n" sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
"extern char *\tsprintf();\\\n" "extern char *\tsprintf();\\\n"
"#endif /* !defined __STDC__ */,"; "#endif /* !defined __STDC__ */,";
test_text = "extern char *\tsprintf();";
}; };
/*EOF*/ /*EOF*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment