Commit 5d7d28c2 by Bruce Korb Committed by Bruce Korb

rework "make check" for fixinc

From-SVN: r34298
parent 231a2828
2000-05-31 Bruce Korb <bkorb@gnu.org>
* check.tpl: rework to use test result tree
* fixincl.x: regenerate
* inclhack.def: add new tests
* tests/base/arch/i960/archI960.h: New test result
* tests/base/curses.h: modified test result
Wed May 31 13:17:20 2000 Philippe De Muyter <phdm@macqel.be> Wed May 31 13:17:20 2000 Philippe De Muyter <phdm@macqel.be>
* except.c (clear_function_eh_region): Do not free NULL. * except.c (clear_function_eh_region): Do not free NULL.
......
...@@ -6,9 +6,12 @@ ...@@ -6,9 +6,12 @@
=]#!/bin/sh =]#!/bin/sh
set -e set -e
[ -d testdir ] && rm -rf testdir TESTDIR=tests
mkdir testdir TESTBASE=`cd $1;pwd`
cd testdir
[ -d ${TESTDIR} ] || mkdir ${TESTDIR}
cd ${TESTDIR}
TESTDIR=`pwd`
TARGET_MACHINE='*' TARGET_MACHINE='*'
DESTDIR=`pwd`/res DESTDIR=`pwd`/res
...@@ -18,6 +21,7 @@ VERBOSE=1 ...@@ -18,6 +21,7 @@ VERBOSE=1
export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE
rm -rf ${DESTDIR} ${SRCDIR}
mkdir ${DESTDIR} ${SRCDIR} mkdir ${DESTDIR} ${SRCDIR}
( cd ${SRCDIR} ( cd ${SRCDIR}
...@@ -37,10 +41,41 @@ mkdir ${DESTDIR} ${SRCDIR} ...@@ -37,10 +41,41 @@ mkdir ${DESTDIR} ${SRCDIR}
mkdir $f || mkdir -p $f mkdir $f || mkdir -p $f
done ) > /dev/null 2>&1 done ) > /dev/null 2>&1
cd inc
[= [=
_FOR fix =][= _FOR fix =][=
_IF test_text _count 1 > =]
#
# [=hackname=] has [=_EVAL test_text _count=] tests
#
sfile=[=
_IF files _exist =][=
files[0] =][=
_ELSE =]testing.h[=
_ENDIF =]
dfile=`dirname $sfile`/[=hackname "_A-Z" "-a-z" _tr=]-[=_EVAL _index=].h
fixnum=[=_EVAL _index=][=
_FOR test_text FROM 1 =]
cat >> $sfile <<_HACK_EOF_
#if defined( [=hackname _up=]_CHECK_[=_EVAL _index=] )
[=test_text=]
#endif /* [=hackname _up=]_CHECK_[=_EVAL _index=] */
_HACK_EOF_
echo $sfile | ../../fixincl
[ -f ${DESTDIR}/$sfile ] && mv ${DESTDIR}/$sfile ${DESTDIR}/$dfile[=
/test_text =][=
_ENDIF =][=
/fix
=][=
_FOR fix =][=
_IF test_text _exist ! =][= _IF test_text _exist ! =][=
_IF replace _exist ! =] _IF replace _exist ! =]
echo No test for [=hackname=] in inc/[= echo No test for [=hackname=] in inc/[=
...@@ -50,16 +85,16 @@ echo No test for [=hackname=] in inc/[= ...@@ -50,16 +85,16 @@ echo No test for [=hackname=] in inc/[=
_ENDIF =][= _ENDIF =][=
_ENDIF =][= _ENDIF =][=
_ELSE =] _ELSE =]
cat >> inc/[= cat >> [=
_IF files _exist =][= _IF files _exist =][=
files[0] =][= files[0] =][=
_ELSE =]testing.h[= _ELSE =]testing.h[=
_ENDIF =] <<- _HACK_EOF_ _ENDIF =] <<_HACK_EOF_
#if defined( [=hackname _up=]_CHECK ) #if defined( [=hackname _up=]_CHECK )
[=test_text "\t" _prefix=] [=test_text=]
#endif /* [=hackname _up=]_CHECK */ #endif /* [=hackname _up=]_CHECK */
_HACK_EOF_ _HACK_EOF_
[=_ENDIF =][= [=_ENDIF =][=
...@@ -67,40 +102,63 @@ _HACK_EOF_ ...@@ -67,40 +102,63 @@ _HACK_EOF_
=] =]
cd inc find . -type f | sed 's;\./;;' | sort | ../../fixincl
find . -type f | sed 's;\./;;' | sort > ../LIST cd ${DESTDIR}
../../fixincl < ../LIST
cd .. exitok=true
find * -type f -print > ${TESTDIR}/LIST
exitok=`
exec < ${TESTDIR}/LIST
while read f while read f
do do
if [ ! -f res/$f ] if [ ! -f ${TESTBASE}/$f ]
then
echo "Newly fixed header: $f" >&2
exitok=false
elif cmp $f ${TESTBASE}/$f >&2
then then
echo "Only in inc: inc/$f" :
else else
diff -c inc/$f res/$f | \ diff -c $f ${TESTBASE}/$f >&2
sed -e '1,2s; .*;;' -e '/MACH_DIFF:/,/no uniform test,/d' exitok=false
fi fi
done > NEWDIFF < LIST done
echo $exitok`
echo cd $TESTBASE
echo Test output check:
[=
_FOR fix =][= find * -type f -print | \
fgrep -v 'CVS/' > ${TESTDIR}/LIST
_IF test_text _exist =] exitok=`
fgrep [=hackname _up=]_CHECK NEWDIFF > /dev/null 2>&1 || \ exec < ${TESTDIR}/LIST
echo "[=_eval hackname _get "#%32s test failed. See testdir/inc/" while read f
_printf =][= do
_IF files _exist =][= if [ -s $f ] && [ ! -f ${DESTDIR}/$f ]
files[0] =][= then
_ELSE =]testing.h[= echo "Missing header fix: $f" >&2
_ENDIF =]"[= exitok=false
_ENDIF =][= fi
done
echo $exitok`
/fix echo
if $exitok
then
cd ${TESTDIR}
rm -rf inc res LIST
cd ..
rmdir ${TESTDIR} > /dev/null 2>&1 || :
echo All fixinclude tests pass >&2
else
echo There were fixinclude test FAILURES >&2
fi
$exitok[=
=][=
_eval _outfile "chmod +x %s" _printf _shell _eval _outfile "chmod +x %s" _printf _shell
=] =]
...@@ -1612,7 +1612,7 @@ fix = { ...@@ -1612,7 +1612,7 @@ fix = {
c_fix_arg = "__%0"; c_fix_arg = "__%0";
c_fix_arg = "reg(ex|off|match)_t[^;]"; c_fix_arg = "reg(ex|off|match)_t[^;]";
test_text = "`touch inc/sys/lc_core.h`" test_text = "`touch sys/lc_core.h`"
"typedef struct {\n int stuff, mo_suff;\n} regex_t;\n" "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
"extern regex_t re;\n" "extern regex_t re;\n"
"extern regoff_t ro;\n" "extern regoff_t ro;\n"
...@@ -2601,7 +2601,10 @@ fix = { ...@@ -2601,7 +2601,10 @@ fix = {
hackname = tinfo_cplusplus; hackname = tinfo_cplusplus;
files = tinfo.h; files = tinfo.h;
select = "[ \t]_cplusplus"; select = "[ \t]_cplusplus";
sed = "s/[ \t]_cplusplus/ __cplusplus/";
c_fix = format;
c_fix_arg = " __cplusplus";
test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
}; };
...@@ -2621,21 +2624,43 @@ fix = { ...@@ -2621,21 +2624,43 @@ fix = {
* parameters not const on DECstation Ultrix V4.0 and OSF/1. * parameters not const on DECstation Ultrix V4.0 and OSF/1.
*/ */
fix = { fix = {
hackname = ultrix_const; hackname = ultrix_const;
files = stdio.h; files = stdio.h;
select = 'perror\( char \*';
c_fix = format;
c_fix_arg = "%1 const %3 *__";
c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
"[ \t]+(char|void) \\*__";
test_text =
"extern void perror( char *__s );\n"
"extern int fputs( char *__s, FILE *);\n"
"extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
"extern int fscanf( FILE *__stream, char *__format, ...);\n"
"extern int scanf( char *__format, ...);\n";
};
/*
* parameters not const on DECstation Ultrix V4.0 and OSF/1.
*/
fix = {
hackname = ultrix_const2;
files = stdio.h;
select = '\*fopen\( char \*';
c_fix = format;
c_fix_arg = "%1( const char *%3, const char *";
c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
"[ \t]*char[ \t]*\\*([^,]*),"
"[ \t]*char[ \t]*\\*[ \t]*";
sed = 's@perror( char \*__s );@perror( const char *__s );@'; test_text =
sed = 's@fputs( char \*__s,@fputs( const char *__s,@'; "extern FILE *fopen( char *__filename, char *__type );\n"
sed = 's@fopen( char \*__filename, char \*__type );@' "extern int sscanf( char *__s, char *__format, ...);\n"
'fopen( const char *__filename, const char *__type );@'; "extern FILE *popen(char *, char *);\n"
sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@'; "extern char *tempnam(char*,char*);\n";
sed = 's@fscanf( FILE \*__stream, char \*__format,@'
'fscanf( FILE *__stream, const char *__format,@';
sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
sed = 's@sscanf( char \*__s, char \*__format,@'
'sscanf( const char *__s, const char *__format,@';
sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
}; };
...@@ -2649,6 +2674,9 @@ fix = { ...@@ -2649,6 +2674,9 @@ fix = {
select = ULTRIX; select = ULTRIX;
sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n" sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
"struct utsname;\n"; "struct utsname;\n";
test_text =
"/* ULTRIX's uname */\nextern\tint\tuname();";
}; };
...@@ -2657,9 +2685,12 @@ fix = { ...@@ -2657,9 +2685,12 @@ fix = {
*/ */
fix = { fix = {
hackname = ultrix_ifdef; hackname = ultrix_ifdef;
select = "#ifdef KERNEL[ \t]*[^ \t]"; select = "#ifdef KERNEL[ \t]+[^ \t]";
files = sys/file.h; files = sys/file.h;
sed = "s/#ifdef KERNEL/#if defined(KERNEL)/"; sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
test_text =
"#ifdef KERNEL\t&& defined( mumbojumbo )\nint oops;\n#endif";
}; };
...@@ -2721,13 +2752,18 @@ fix = { ...@@ -2721,13 +2752,18 @@ fix = {
* Fix definitions of macros used by va-i960.h in VxWorks header file. * Fix definitions of macros used by va-i960.h in VxWorks header file.
*/ */
fix = { fix = {
hackname = va_i960_macro; hackname = va_i960_macro;
files = arch/i960/archI960.h; files = arch/i960/archI960.h;
select = "__(vsiz|vali|vpad|alignof__)"; select = "__(vsiz|vali|vpad|alignof__)";
sed = "s/__vsiz/__vxvsiz/";
sed = "s/__vali/__vxvali/"; c_fix = format;
sed = "s/__vpad/__vxvpad/"; c_fix_arg = "__vx%1";
sed = "s/__alignof__/__vxalignof__/";
test_text =
"extern int __vsiz vsiz;\n"
"extern int __vali vali;\n"
"extern int __vpad vpad;\n"
"#define __alignof__(x) ...";
}; };
...@@ -2736,21 +2772,22 @@ fix = { ...@@ -2736,21 +2772,22 @@ fix = {
* which is illegal in ANSI C++. * which is illegal in ANSI C++.
*/ */
fix = { fix = {
hackname = void_null; hackname = void_null;
files = curses.h; files = curses.h;
files = dbm.h; files = dbm.h;
files = locale.h; files = locale.h;
files = stdio.h; files = stdio.h;
files = stdlib.h; files = stdlib.h;
files = string.h; files = string.h;
files = time.h; files = time.h;
files = unistd.h; files = unistd.h;
files = sys/dir.h; files = sys/dir.h;
files = sys/param.h; files = sys/param.h;
files = sys/types.h; files = sys/types.h;
select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void"; select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)" c_fix = format;
"/#define NULL 0/"; c_fix_arg = "#define NULL 0";
test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
}; };
...@@ -2785,6 +2822,13 @@ fix = { ...@@ -2785,6 +2822,13 @@ fix = {
sed = "/[ \t]wchar_t/a\\\n" sed = "/[ \t]wchar_t/a\\\n"
"#endif\n"; "#endif\n";
test_text =
"#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
"typedef unsigned int size_t;\n"
"typedef long ptrdiff_t;\n"
"typedef unsigned short wchar_t;\n"
"#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
}; };
...@@ -2792,10 +2836,11 @@ fix = { ...@@ -2792,10 +2836,11 @@ fix = {
* Fix VxWorks <time.h> to not require including <vxTypes.h>. * Fix VxWorks <time.h> to not require including <vxTypes.h>.
*/ */
fix = { fix = {
hackname = vxworks_needs_vxtypes; hackname = vxworks_needs_vxtypes;
files = time.h; files = time.h;
select = "uint_t[ \t][ \t]*_clocks_per_sec"; select = "uint_t([ \t]+_clocks_per_sec)";
sed = "s/uint_t/unsigned int/"; c_fix = format;
c_fix_arg = "unsigned int%1";
test_text = "uint_t\t_clocks_per_sec;"; test_text = "uint_t\t_clocks_per_sec;";
}; };
...@@ -2809,10 +2854,14 @@ fix = { ...@@ -2809,10 +2854,14 @@ fix = {
test = " -r types/vxTypesOld.h"; test = " -r types/vxTypesOld.h";
test = " -n \"`egrep '#include' $file`\""; test = " -n \"`egrep '#include' $file`\"";
test = " -n \"`egrep ULONG $file`\""; test = " -n \"`egrep ULONG $file`\"";
select = "#[ \t]define[ \t][ \t]*__INCstath"; select = "#[ \t]define[ \t]+__INCstath";
sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n" sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
"#include <types/vxTypesOld.h>\n"; "#include <types/vxTypesOld.h>\n";
test_text = "`touch types/vxTypesOld.h`"
"#include </dev/null> /* ULONG */\n"
"# define\t__INCstath <sys/stat.h>";
}; };
...@@ -2822,19 +2871,24 @@ fix = { ...@@ -2822,19 +2871,24 @@ fix = {
fix = { fix = {
hackname = vxworks_time; hackname = vxworks_time;
files = time.h; files = time.h;
select = "VOIDFUNCPTR";
test = " -r vxWorks.h"; test = " -r vxWorks.h";
sed = "/VOIDFUNCPTR/i\\\n"
"#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
"#ifdef __cplusplus\\\n"
"typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
"#else\\\n"
"typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
"#endif\\\n"
"#define __gcc_VOIDFUNCPTR_defined\\\n"
"#endif\n";
sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g"; select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
c_fix = format;
c_fix_arg =
"#ifndef __gcc_VOIDFUNCPTR_defined\n"
"#ifdef __cplusplus\n"
"typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
"#else\n"
"typedef void (*__gcc_VOIDFUNCPTR) ();\n"
"#endif\n"
"#define __gcc_VOIDFUNCPTR_defined\n"
"#endif\n"
"#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
test_text = "`touch vxWorks.h`"
"#define VOIDFUNCPTR (void(*)())";
}; };
...@@ -2867,7 +2921,11 @@ fix = { ...@@ -2867,7 +2921,11 @@ fix = {
hackname = x11_class_usage; hackname = x11_class_usage;
files = Xm/BaseClassI.h; files = Xm/BaseClassI.h;
bypass = "__cplusplus"; bypass = "__cplusplus";
sed = "s/ class[)]/ c_class)/g";
select = " class\\)";
c_fix = format;
c_fix_arg = " c_class)";
test_text = "extern mumble (int class);\n"; test_text = "extern mumble (int class);\n";
}; };
...@@ -2903,11 +2961,11 @@ fix = { ...@@ -2903,11 +2961,11 @@ fix = {
hackname = x11_sprintf; hackname = x11_sprintf;
files = X11/Xmu.h; files = X11/Xmu.h;
files = X11/Xmu/Xmu.h; files = X11/Xmu/Xmu.h;
select = 'sprintf\(\)'; select = "^extern char \\*\tsprintf\\(\\);$";
c_fix = format;
c_fix_arg = "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
"extern char *\tsprintf();\\\n"
"#endif /* !defined __STDC__ */,";
test_text = "extern char *\tsprintf();"; test_text = "extern char *\tsprintf();";
}; };
......
#if defined( VA_I960_MACRO_CHECK )
extern int __vxvsiz vsiz;
extern int __vxvali vali;
extern int __vxvpad vpad;
#define __vxalignof__(x) ...
#endif /* VA_I960_MACRO_CHECK */
...@@ -23,3 +23,10 @@ struct term; ...@@ -23,3 +23,10 @@ struct term;
#if defined( LYNX_VOID_INT_CHECK ) #if defined( LYNX_VOID_INT_CHECK )
/* curses foiled again */ /* curses foiled again */
#endif /* LYNX_VOID_INT_CHECK */ #endif /* LYNX_VOID_INT_CHECK */
#if defined( VOID_NULL_CHECK )
#ifndef NULL
#define NULL 0 /* typed NULL */
#endif
#endif /* VOID_NULL_CHECK */
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