diff options
author | korbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-31 14:26:57 +0000 |
---|---|---|
committer | korbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-31 14:26:57 +0000 |
commit | f74d6549b4797914ce976195738835e319f77840 (patch) | |
tree | 81a8d3f3c8ce89d52bcc2882645c3fbb740b30f9 /gcc/fixinc | |
parent | 7d5d604a9861204c4c9277b0c212b4955d57adb5 (diff) | |
download | gcc-f74d6549b4797914ce976195738835e319f77840.tar.gz |
rework "make check" for fixinc
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34298 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixinc')
-rw-r--r-- | gcc/fixinc/check.tpl | 122 | ||||
-rw-r--r-- | gcc/fixinc/fixincl.x | 202 | ||||
-rw-r--r-- | gcc/fixinc/inclhack.def | 178 | ||||
-rw-r--r-- | gcc/fixinc/tests/base/arch/i960/archI960.h | 8 | ||||
-rw-r--r-- | gcc/fixinc/tests/base/curses.h | 7 |
5 files changed, 351 insertions, 166 deletions
diff --git a/gcc/fixinc/check.tpl b/gcc/fixinc/check.tpl index 10773a592fa..a4be5ed0711 100644 --- a/gcc/fixinc/check.tpl +++ b/gcc/fixinc/check.tpl @@ -6,9 +6,12 @@ =]#!/bin/sh set -e -[ -d testdir ] && rm -rf testdir -mkdir testdir -cd testdir +TESTDIR=tests +TESTBASE=`cd $1;pwd` + +[ -d ${TESTDIR} ] || mkdir ${TESTDIR} +cd ${TESTDIR} +TESTDIR=`pwd` TARGET_MACHINE='*' DESTDIR=`pwd`/res @@ -18,6 +21,7 @@ VERBOSE=1 export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE +rm -rf ${DESTDIR} ${SRCDIR} mkdir ${DESTDIR} ${SRCDIR} ( cd ${SRCDIR} @@ -37,10 +41,41 @@ mkdir ${DESTDIR} ${SRCDIR} mkdir $f || mkdir -p $f done ) > /dev/null 2>&1 +cd inc [= _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 replace _exist ! =] echo No test for [=hackname=] in inc/[= @@ -50,16 +85,16 @@ echo No test for [=hackname=] in inc/[= _ENDIF =][= _ENDIF =][= _ELSE =] -cat >> inc/[= +cat >> [= _IF files _exist =][= files[0] =][= _ELSE =]testing.h[= - _ENDIF =] <<- _HACK_EOF_ + _ENDIF =] <<_HACK_EOF_ - #if defined( [=hackname _up=]_CHECK ) -[=test_text "\t" _prefix=] - #endif /* [=hackname _up=]_CHECK */ +#if defined( [=hackname _up=]_CHECK ) +[=test_text=] +#endif /* [=hackname _up=]_CHECK */ _HACK_EOF_ [=_ENDIF =][= @@ -67,40 +102,63 @@ _HACK_EOF_ =] -cd inc -find . -type f | sed 's;\./;;' | sort > ../LIST -../../fixincl < ../LIST -cd .. +find . -type f | sed 's;\./;;' | sort | ../../fixincl +cd ${DESTDIR} + +exitok=true +find * -type f -print > ${TESTDIR}/LIST + +exitok=` +exec < ${TESTDIR}/LIST while read f 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 - echo "Only in inc: inc/$f" + : + else - diff -c inc/$f res/$f | \ - sed -e '1,2s; .*;;' -e '/MACH_DIFF:/,/no uniform test,/d' + diff -c $f ${TESTBASE}/$f >&2 + exitok=false fi -done > NEWDIFF < LIST +done +echo $exitok` -echo -echo Test output check: -[= +cd $TESTBASE -_FOR fix =][= +find * -type f -print | \ +fgrep -v 'CVS/' > ${TESTDIR}/LIST - _IF test_text _exist =] -fgrep [=hackname _up=]_CHECK NEWDIFF > /dev/null 2>&1 || \ - echo "[=_eval hackname _get "#%32s test failed. See testdir/inc/" - _printf =][= - _IF files _exist =][= - files[0] =][= - _ELSE =]testing.h[= - _ENDIF =]"[= - _ENDIF =][= +exitok=` +exec < ${TESTDIR}/LIST +while read f +do + if [ -s $f ] && [ ! -f ${DESTDIR}/$f ] + then + echo "Missing header fix: $f" >&2 + exitok=false + 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 + =] diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x index 9b7957868cc..de240964e7f 100644 --- a/gcc/fixinc/fixincl.x +++ b/gcc/fixinc/fixincl.x @@ -5,7 +5,7 @@ * files which are fixed to work correctly with ANSI C and placed in a * directory that GNU C will search. * - * This file contains 122 fixup descriptions. + * This file contains 123 fixup descriptions. * * See README-fixinc for more information. * @@ -4253,8 +4253,9 @@ tTestDesc aTinfo_CplusplusTests[] = { /* * Fix Command Arguments for Tinfo_Cplusplus */ -const char* apzTinfo_CplusplusPatch[] = { "sed", - "-e", "s/[ \t]_cplusplus/ __cplusplus/", +const char* apzTinfo_CplusplusPatch[] = { + "format", + " __cplusplus", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -4309,29 +4310,68 @@ tSCC zUltrix_ConstList[] = * Machine/OS name selection pattern */ #define apzUltrix_ConstMachs (const char**)NULL -#define ULTRIX_CONST_TEST_CT 0 -#define aUltrix_ConstTests (tTestDesc*)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zUltrix_ConstSelect0[] = + "perror\\( char \\*"; + +#define ULTRIX_CONST_TEST_CT 1 +tTestDesc aUltrix_ConstTests[] = { + { TT_EGREP, zUltrix_ConstSelect0, (regex_t*)NULL }, }; /* * Fix Command Arguments for Ultrix_Const */ -const char* apzUltrix_ConstPatch[] = { "sed", - "-e", "s@perror( char \\*__s );@perror( const char *__s );@", - "-e", "s@fputs( char \\*__s,@fputs( const char *__s,@", - "-e", "s@fopen( char \\*__filename, char \\*__type );@fopen( const char *__filename, const char *__type );@", - "-e", "s@fwrite( void \\*__ptr,@fwrite( const void *__ptr,@", - "-e", "s@fscanf( FILE \\*__stream, char \\*__format,@fscanf( FILE *__stream, const char *__format,@", - "-e", "s@scanf( char \\*__format,@scanf( const char *__format,@", - "-e", "s@sscanf( char \\*__s, char \\*__format,@sscanf( const char *__s, const char *__format,@", - "-e", "s@popen(char \\*, char \\*);@popen(const char *, const char *);@", - "-e", "s@tempnam(char\\*,char\\*);@tempnam(const char*,const char*);@", +const char* apzUltrix_ConstPatch[] = { + "format", + "%1 const %3 *__", + "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)[ \t]+(char|void) \\*__", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Ultrix_Const2 fix + */ +#define ULTRIX_CONST2_FIXIDX 107 +tSCC zUltrix_Const2Name[] = + "ultrix_const2"; + +/* + * File name selection pattern + */ +tSCC zUltrix_Const2List[] = + "|stdio.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzUltrix_Const2Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zUltrix_Const2Select0[] = + "\\*fopen\\( char \\*"; + +#define ULTRIX_CONST2_TEST_CT 1 +tTestDesc aUltrix_Const2Tests[] = { + { TT_EGREP, zUltrix_Const2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Ultrix_Const2 + */ +const char* apzUltrix_Const2Patch[] = { + "format", + "%1( const char *%3, const char *", + "([ \t*](fopen|sscanf|popen|tempnam))\\([ \t]*char[ \t]*\\*([^,]*),[ \t]*char[ \t]*\\*[ \t]*", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Ultrix_Fix_Fixproto fix */ -#define ULTRIX_FIX_FIXPROTO_FIXIDX 107 +#define ULTRIX_FIX_FIXPROTO_FIXIDX 108 tSCC zUltrix_Fix_FixprotoName[] = "ultrix_fix_fixproto"; @@ -4367,7 +4407,7 @@ struct utsname;\n", * * Description of Ultrix_Ifdef fix */ -#define ULTRIX_IFDEF_FIXIDX 108 +#define ULTRIX_IFDEF_FIXIDX 109 tSCC zUltrix_IfdefName[] = "ultrix_ifdef"; @@ -4385,7 +4425,7 @@ tSCC zUltrix_IfdefList[] = * content selection pattern - do fix if pattern found */ tSCC zUltrix_IfdefSelect0[] = - "#ifdef KERNEL[ \t]*[^ \t]"; + "#ifdef KERNEL[ \t]+[^ \t]"; #define ULTRIX_IFDEF_TEST_CT 1 tTestDesc aUltrix_IfdefTests[] = { @@ -4402,7 +4442,7 @@ const char* apzUltrix_IfdefPatch[] = { "sed", * * Description of Ultrix_Static fix */ -#define ULTRIX_STATIC_FIXIDX 109 +#define ULTRIX_STATIC_FIXIDX 110 tSCC zUltrix_StaticName[] = "ultrix_static"; @@ -4439,7 +4479,7 @@ const char* apzUltrix_StaticPatch[] = { "sed", * * Description of Undefine_Null fix */ -#define UNDEFINE_NULL_FIXIDX 110 +#define UNDEFINE_NULL_FIXIDX 111 tSCC zUndefine_NullName[] = "undefine_null"; @@ -4485,7 +4525,7 @@ const char* apzUndefine_NullPatch[] = { * * Description of Unixware7_Byteorder_Fix fix */ -#define UNIXWARE7_BYTEORDER_FIX_FIXIDX 111 +#define UNIXWARE7_BYTEORDER_FIX_FIXIDX 112 tSCC zUnixware7_Byteorder_FixName[] = "unixware7_byteorder_fix"; @@ -4528,7 +4568,7 @@ const char* apzUnixware7_Byteorder_FixPatch[] = { "sed", * * Description of Va_I960_Macro fix */ -#define VA_I960_MACRO_FIXIDX 112 +#define VA_I960_MACRO_FIXIDX 113 tSCC zVa_I960_MacroName[] = "va_i960_macro"; @@ -4555,18 +4595,16 @@ tTestDesc aVa_I960_MacroTests[] = { /* * Fix Command Arguments for Va_I960_Macro */ -const char* apzVa_I960_MacroPatch[] = { "sed", - "-e", "s/__vsiz/__vxvsiz/", - "-e", "s/__vali/__vxvali/", - "-e", "s/__vpad/__vxvpad/", - "-e", "s/__alignof__/__vxalignof__/", +const char* apzVa_I960_MacroPatch[] = { + "format", + "__vx%1", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Void_Null fix */ -#define VOID_NULL_FIXIDX 113 +#define VOID_NULL_FIXIDX 114 tSCC zVoid_NullName[] = "void_null"; @@ -4584,7 +4622,7 @@ tSCC zVoid_NullList[] = * content selection pattern - do fix if pattern found */ tSCC zVoid_NullSelect0[] = - "#[ \t]*define[ \t][ \t]*NULL[ \t].*void"; + "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)"; #define VOID_NULL_TEST_CT 1 tTestDesc aVoid_NullTests[] = { @@ -4593,15 +4631,16 @@ tTestDesc aVoid_NullTests[] = { /* * Fix Command Arguments for Void_Null */ -const char* apzVoid_NullPatch[] = { "sed", - "-e", "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)/#define NULL 0/", +const char* apzVoid_NullPatch[] = { + "format", + "#define NULL 0", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Vxworks_Gcc_Problem fix */ -#define VXWORKS_GCC_PROBLEM_FIXIDX 114 +#define VXWORKS_GCC_PROBLEM_FIXIDX 115 tSCC zVxworks_Gcc_ProblemName[] = "vxworks_gcc_problem"; @@ -4651,7 +4690,7 @@ const char* apzVxworks_Gcc_ProblemPatch[] = { "sed", * * Description of Vxworks_Needs_Vxtypes fix */ -#define VXWORKS_NEEDS_VXTYPES_FIXIDX 115 +#define VXWORKS_NEEDS_VXTYPES_FIXIDX 116 tSCC zVxworks_Needs_VxtypesName[] = "vxworks_needs_vxtypes"; @@ -4669,7 +4708,7 @@ tSCC zVxworks_Needs_VxtypesList[] = * content selection pattern - do fix if pattern found */ tSCC zVxworks_Needs_VxtypesSelect0[] = - "uint_t[ \t][ \t]*_clocks_per_sec"; + "uint_t([ \t]+_clocks_per_sec)"; #define VXWORKS_NEEDS_VXTYPES_TEST_CT 1 tTestDesc aVxworks_Needs_VxtypesTests[] = { @@ -4678,15 +4717,16 @@ tTestDesc aVxworks_Needs_VxtypesTests[] = { /* * Fix Command Arguments for Vxworks_Needs_Vxtypes */ -const char* apzVxworks_Needs_VxtypesPatch[] = { "sed", - "-e", "s/uint_t/unsigned int/", +const char* apzVxworks_Needs_VxtypesPatch[] = { + "format", + "unsigned int%1", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Vxworks_Needs_Vxworks fix */ -#define VXWORKS_NEEDS_VXWORKS_FIXIDX 116 +#define VXWORKS_NEEDS_VXWORKS_FIXIDX 117 tSCC zVxworks_Needs_VxworksName[] = "vxworks_needs_vxworks"; @@ -4704,7 +4744,7 @@ tSCC zVxworks_Needs_VxworksList[] = * content selection pattern - do fix if pattern found */ tSCC zVxworks_Needs_VxworksSelect0[] = - "#[ \t]define[ \t][ \t]*__INCstath"; + "#[ \t]define[ \t]+__INCstath"; /* * perform the 'test' shell command - do fix on success @@ -4735,7 +4775,7 @@ const char* apzVxworks_Needs_VxworksPatch[] = { "sed", * * Description of Vxworks_Time fix */ -#define VXWORKS_TIME_FIXIDX 117 +#define VXWORKS_TIME_FIXIDX 118 tSCC zVxworks_TimeName[] = "vxworks_time"; @@ -4753,7 +4793,7 @@ tSCC zVxworks_TimeList[] = * content selection pattern - do fix if pattern found */ tSCC zVxworks_TimeSelect0[] = - "VOIDFUNCPTR"; + "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*"; /* * perform the 'test' shell command - do fix on success @@ -4769,24 +4809,24 @@ tTestDesc aVxworks_TimeTests[] = { /* * Fix Command Arguments for Vxworks_Time */ -const char* apzVxworks_TimePatch[] = { "sed", - "-e", "/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", - "-e", "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g", +const char* apzVxworks_TimePatch[] = { + "format", + "#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", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of X11_Class fix */ -#define X11_CLASS_FIXIDX 118 +#define X11_CLASS_FIXIDX 119 tSCC zX11_ClassName[] = "x11_class"; @@ -4826,7 +4866,7 @@ const char* apzX11_ClassPatch[] = { "sed", * * Description of X11_Class_Usage fix */ -#define X11_CLASS_USAGE_FIXIDX 119 +#define X11_CLASS_USAGE_FIXIDX 120 tSCC zX11_Class_UsageName[] = "x11_class_usage"; @@ -4841,27 +4881,35 @@ tSCC zX11_Class_UsageList[] = #define apzX11_Class_UsageMachs (const char**)NULL /* + * content selection pattern - do fix if pattern found + */ +tSCC zX11_Class_UsageSelect0[] = + " class\\)"; + +/* * content bypass pattern - skip fix if pattern found */ tSCC zX11_Class_UsageBypass0[] = "__cplusplus"; -#define X11_CLASS_USAGE_TEST_CT 1 +#define X11_CLASS_USAGE_TEST_CT 2 tTestDesc aX11_Class_UsageTests[] = { - { TT_NEGREP, zX11_Class_UsageBypass0, (regex_t*)NULL }, }; + { TT_NEGREP, zX11_Class_UsageBypass0, (regex_t*)NULL }, + { TT_EGREP, zX11_Class_UsageSelect0, (regex_t*)NULL }, }; /* * Fix Command Arguments for X11_Class_Usage */ -const char* apzX11_Class_UsagePatch[] = { "sed", - "-e", "s/ class[)]/ c_class)/g", +const char* apzX11_Class_UsagePatch[] = { + "format", + " c_class)", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of X11_New fix */ -#define X11_NEW_FIXIDX 120 +#define X11_NEW_FIXIDX 121 tSCC zX11_NewName[] = "x11_new"; @@ -4902,7 +4950,7 @@ const char* apzX11_NewPatch[] = { "sed", * * Description of X11_Sprintf fix */ -#define X11_SPRINTF_FIXIDX 121 +#define X11_SPRINTF_FIXIDX 122 tSCC zX11_SprintfName[] = "x11_sprintf"; @@ -4920,7 +4968,7 @@ tSCC zX11_SprintfList[] = * content selection pattern - do fix if pattern found */ tSCC zX11_SprintfSelect0[] = - "sprintf\\(\\)"; + "^extern char \\*\tsprintf\\(\\);$"; #define X11_SPRINTF_TEST_CT 1 tTestDesc aX11_SprintfTests[] = { @@ -4929,10 +4977,11 @@ tTestDesc aX11_SprintfTests[] = { /* * Fix Command Arguments for X11_Sprintf */ -const char* apzX11_SprintfPatch[] = { "sed", - "-e", "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n\ -extern char *\tsprintf();\\\n\ -#endif /* !defined __STDC__ */,", +const char* apzX11_SprintfPatch[] = { + "format", + "#ifndef __STDC__\n\ +%0\n\ +#endif /* !defined __STDC__ */", (char*)NULL }; @@ -4940,9 +4989,9 @@ extern char *\tsprintf();\\\n\ * * List of all fixes */ -#define REGEX_COUNT 121 +#define REGEX_COUNT 124 #define MACH_LIST_SIZE_LIMIT 279 -#define FIX_COUNT 122 +#define FIX_COUNT 123 tFixDesc fixDescList[ FIX_COUNT ] = { { zAaa_Ki_IfaceName, zAaa_Ki_IfaceList, @@ -5467,7 +5516,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zTinfo_CplusplusName, zTinfo_CplusplusList, apzTinfo_CplusplusMachs, - TINFO_CPLUSPLUS_TEST_CT, FD_MACH_ONLY, + TINFO_CPLUSPLUS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aTinfo_CplusplusTests, apzTinfo_CplusplusPatch }, { zUltrix_Atof_ParamName, zUltrix_Atof_ParamList, @@ -5477,9 +5526,14 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zUltrix_ConstName, zUltrix_ConstList, apzUltrix_ConstMachs, - ULTRIX_CONST_TEST_CT, FD_MACH_ONLY, + ULTRIX_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aUltrix_ConstTests, apzUltrix_ConstPatch }, + { zUltrix_Const2Name, zUltrix_Const2List, + apzUltrix_Const2Machs, + ULTRIX_CONST2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aUltrix_Const2Tests, apzUltrix_Const2Patch }, + { zUltrix_Fix_FixprotoName, zUltrix_Fix_FixprotoList, apzUltrix_Fix_FixprotoMachs, ULTRIX_FIX_FIXPROTO_TEST_CT, FD_MACH_ONLY, @@ -5507,12 +5561,12 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zVa_I960_MacroName, zVa_I960_MacroList, apzVa_I960_MacroMachs, - VA_I960_MACRO_TEST_CT, FD_MACH_ONLY, + VA_I960_MACRO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aVa_I960_MacroTests, apzVa_I960_MacroPatch }, { zVoid_NullName, zVoid_NullList, apzVoid_NullMachs, - VOID_NULL_TEST_CT, FD_MACH_ONLY, + VOID_NULL_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aVoid_NullTests, apzVoid_NullPatch }, { zVxworks_Gcc_ProblemName, zVxworks_Gcc_ProblemList, @@ -5522,7 +5576,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zVxworks_Needs_VxtypesName, zVxworks_Needs_VxtypesList, apzVxworks_Needs_VxtypesMachs, - VXWORKS_NEEDS_VXTYPES_TEST_CT, FD_MACH_ONLY, + VXWORKS_NEEDS_VXTYPES_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aVxworks_Needs_VxtypesTests, apzVxworks_Needs_VxtypesPatch }, { zVxworks_Needs_VxworksName, zVxworks_Needs_VxworksList, @@ -5532,7 +5586,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zVxworks_TimeName, zVxworks_TimeList, apzVxworks_TimeMachs, - VXWORKS_TIME_TEST_CT, FD_MACH_ONLY, + VXWORKS_TIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aVxworks_TimeTests, apzVxworks_TimePatch }, { zX11_ClassName, zX11_ClassList, @@ -5542,7 +5596,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zX11_Class_UsageName, zX11_Class_UsageList, apzX11_Class_UsageMachs, - X11_CLASS_USAGE_TEST_CT, FD_MACH_ONLY, + X11_CLASS_USAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aX11_Class_UsageTests, apzX11_Class_UsagePatch }, { zX11_NewName, zX11_NewList, @@ -5552,6 +5606,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zX11_SprintfName, zX11_SprintfList, apzX11_SprintfMachs, - X11_SPRINTF_TEST_CT, FD_MACH_ONLY, + X11_SPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aX11_SprintfTests, apzX11_SprintfPatch } }; diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def index 93698b3e875..6fea1f73849 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -1612,7 +1612,7 @@ fix = { c_fix_arg = "__%0"; 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" "extern regex_t re;\n" "extern regoff_t ro;\n" @@ -2601,7 +2601,10 @@ fix = { hackname = tinfo_cplusplus; files = tinfo.h; 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 = { * parameters not const on DECstation Ultrix V4.0 and OSF/1. */ fix = { - hackname = ultrix_const; - files = stdio.h; + hackname = ultrix_const; + 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 );@'; - sed = 's@fputs( char \*__s,@fputs( const char *__s,@'; - sed = 's@fopen( char \*__filename, char \*__type );@' - 'fopen( const char *__filename, const char *__type );@'; - sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@'; - 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*);@'; + test_text = + "extern FILE *fopen( char *__filename, char *__type );\n" + "extern int sscanf( char *__s, char *__format, ...);\n" + "extern FILE *popen(char *, char *);\n" + "extern char *tempnam(char*,char*);\n"; }; @@ -2649,6 +2674,9 @@ fix = { select = ULTRIX; sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n" "struct utsname;\n"; + + test_text = + "/* ULTRIX's uname */\nextern\tint\tuname();"; }; @@ -2657,9 +2685,12 @@ fix = { */ fix = { hackname = ultrix_ifdef; - select = "#ifdef KERNEL[ \t]*[^ \t]"; + select = "#ifdef KERNEL[ \t]+[^ \t]"; files = sys/file.h; sed = "s/#ifdef KERNEL/#if defined(KERNEL)/"; + + test_text = + "#ifdef KERNEL\t&& defined( mumbojumbo )\nint oops;\n#endif"; }; @@ -2721,13 +2752,18 @@ fix = { * Fix definitions of macros used by va-i960.h in VxWorks header file. */ fix = { - hackname = va_i960_macro; - files = arch/i960/archI960.h; - select = "__(vsiz|vali|vpad|alignof__)"; - sed = "s/__vsiz/__vxvsiz/"; - sed = "s/__vali/__vxvali/"; - sed = "s/__vpad/__vxvpad/"; - sed = "s/__alignof__/__vxalignof__/"; + hackname = va_i960_macro; + files = arch/i960/archI960.h; + select = "__(vsiz|vali|vpad|alignof__)"; + + c_fix = format; + c_fix_arg = "__vx%1"; + + 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 = { * which is illegal in ANSI C++. */ fix = { - hackname = void_null; - files = curses.h; - files = dbm.h; - files = locale.h; - files = stdio.h; - files = stdlib.h; - files = string.h; - files = time.h; - files = unistd.h; - files = sys/dir.h; - files = sys/param.h; - files = sys/types.h; - select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void"; - sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)" - "/#define NULL 0/"; + hackname = void_null; + files = curses.h; + files = dbm.h; + files = locale.h; + files = stdio.h; + files = stdlib.h; + files = string.h; + files = time.h; + files = unistd.h; + files = sys/dir.h; + files = sys/param.h; + files = sys/types.h; + select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)"; + c_fix = format; + c_fix_arg = "#define NULL 0"; + test_text = "# define\tNULL \t((void *)0) /* typed NULL */"; }; @@ -2785,6 +2822,13 @@ fix = { sed = "/[ \t]wchar_t/a\\\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 = { * Fix VxWorks <time.h> to not require including <vxTypes.h>. */ fix = { - hackname = vxworks_needs_vxtypes; - files = time.h; - select = "uint_t[ \t][ \t]*_clocks_per_sec"; - sed = "s/uint_t/unsigned int/"; + hackname = vxworks_needs_vxtypes; + files = time.h; + select = "uint_t([ \t]+_clocks_per_sec)"; + c_fix = format; + c_fix_arg = "unsigned int%1"; test_text = "uint_t\t_clocks_per_sec;"; }; @@ -2809,10 +2854,14 @@ fix = { test = " -r types/vxTypesOld.h"; test = " -n \"`egrep '#include' $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" "#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 = { fix = { hackname = vxworks_time; files = time.h; - select = "VOIDFUNCPTR"; 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 = { hackname = x11_class_usage; files = Xm/BaseClassI.h; 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"; }; @@ -2903,11 +2961,11 @@ fix = { hackname = x11_sprintf; files = X11/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();"; }; diff --git a/gcc/fixinc/tests/base/arch/i960/archI960.h b/gcc/fixinc/tests/base/arch/i960/archI960.h new file mode 100644 index 00000000000..fb436a7443a --- /dev/null +++ b/gcc/fixinc/tests/base/arch/i960/archI960.h @@ -0,0 +1,8 @@ + + +#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 */ diff --git a/gcc/fixinc/tests/base/curses.h b/gcc/fixinc/tests/base/curses.h index 02a6af0ba21..5b3367c7688 100644 --- a/gcc/fixinc/tests/base/curses.h +++ b/gcc/fixinc/tests/base/curses.h @@ -23,3 +23,10 @@ struct term; #if defined( LYNX_VOID_INT_CHECK ) /* curses foiled again */ #endif /* LYNX_VOID_INT_CHECK */ + + +#if defined( VOID_NULL_CHECK ) +#ifndef NULL +#define NULL 0 /* typed NULL */ +#endif +#endif /* VOID_NULL_CHECK */ |