Commit 99d05d99 by Bruce Korb Committed by Bruce Korb

Add several tests and use the ``c_fix = format'' fixer more

From-SVN: r33895
parent 5ba02ca6
...@@ -14,8 +14,11 @@ ...@@ -14,8 +14,11 @@
* fixinc/fixlib.h(must_malloc): + reformatting * fixinc/fixlib.h(must_malloc): + reformatting
* fixinc/inclhack.def: replace the "1i" and "$a" sed commands * fixinc/inclhack.def: replace the "1i" and "$a" sed commands
with usages of ``c_fix = wrap;'' with usages of ``c_fix = wrap;''
Add several tests and use the ``c_fix = format'' fixer more.
* fixinc/fixincl.x: regen * fixinc/fixincl.x: regen
* fixinc/check.diff: regen * fixinc/check.diff: regen
* fixinc/check.tpl: emit the associated header with the missing
test message
Sun May 14 17:58:59 2000 Hans-Peter Nilsson <hp@axis.com> Sun May 14 17:58:59 2000 Hans-Peter Nilsson <hp@axis.com>
......
...@@ -444,14 +444,90 @@ ...@@ -444,14 +444,90 @@
*** inc/sys/wait.h *** inc/sys/wait.h
--- res/sys/wait.h --- res/sys/wait.h
*************** ***************
*** 2,6 **** *** 2,7 ****
--- 2,7 ---- --- 2,8 ----
#ifndef AIX_SYSWAIT_CHECK #ifndef AIX_SYSWAIT_CHECK
/* bos325, */ /* bos325, */
+ struct rusage; + struct rusage;
extern pid_t wait3(); extern pid_t wait3();
/* pid_t wait3(int *, int, struct rusage *); */
#endif /* AIX_SYSWAIT_CHECK */ #endif /* AIX_SYSWAIT_CHECK */
*** inc/testing.h
--- res/testing.h
***************
*** 1,33 ****
#ifndef IO_QUOTES_DEF_CHECK
! #define BSD43__IOWR(n, x) (('n'<<8)+x)
#endif /* IO_QUOTES_DEF_CHECK */
#ifndef IO_QUOTES_USE_CHECK
! #define TIOCFOO BSD43__IOWR(T, 1)
#endif /* IO_QUOTES_USE_CHECK */
#ifndef CTRL_QUOTES_DEF_CHECK
! #define BSD43_CTRL(n, x) (('n'<<8)+x)
#endif /* CTRL_QUOTES_DEF_CHECK */
#ifndef CTRL_QUOTES_USE_CHECK
! #define TIOCFOO BSD43_CTRL(T, 1)
#endif /* CTRL_QUOTES_USE_CHECK */
#ifndef MACHINE_NAME_CHECK
! #ifdef i386 /* no uniform machine_name test, so
this only works on i?86 machines */
#endif /* MACHINE_NAME_CHECK */
#ifndef UNDEFINE_NULL_CHECK
#define NULL 0UL
#define NULL ((void*)0)
#endif /* UNDEFINE_NULL_CHECK */
--- 1,37 ----
#ifndef IO_QUOTES_DEF_CHECK
! #define BSD43__IOWR(n, x) ((n<<8)+x)
#endif /* IO_QUOTES_DEF_CHECK */
#ifndef IO_QUOTES_USE_CHECK
! #define TIOCFOO BSD43__IOWR('T', 1)
#endif /* IO_QUOTES_USE_CHECK */
#ifndef CTRL_QUOTES_DEF_CHECK
! #define BSD43_CTRL(n, x) ((n<<8)+x)
#endif /* CTRL_QUOTES_DEF_CHECK */
#ifndef CTRL_QUOTES_USE_CHECK
! #define TIOCFOO BSD43_CTRL('T', 1)
#endif /* CTRL_QUOTES_USE_CHECK */
#ifndef MACHINE_NAME_CHECK
! #ifdef __i386__ /* no uniform machine_name test, so
this only works on i?86 machines */
#endif /* MACHINE_NAME_CHECK */
#ifndef UNDEFINE_NULL_CHECK
+ #ifndef NULL
#define NULL 0UL
+ #endif
+ #ifndef NULL
#define NULL ((void*)0)
+ #endif
#endif /* UNDEFINE_NULL_CHECK */
*** inc/time.h *** inc/time.h
--- res/time.h --- res/time.h
*************** ***************
...@@ -480,5 +556,5 @@ ...@@ -480,5 +556,5 @@
#ifndef ALPHA_SBRK_CHECK #ifndef ALPHA_SBRK_CHECK
! extern void* sbrk(ptrdiff_t increment); ! extern void *sbrk(ptrdiff_t increment);
#endif /* ALPHA_SBRK_CHECK */ #endif /* ALPHA_SBRK_CHECK */
...@@ -29,7 +29,11 @@ _FOR fix =][= ...@@ -29,7 +29,11 @@ _FOR fix =][=
_IF test_text _exist ! =][= _IF test_text _exist ! =][=
_IF replace _exist ! =] _IF replace _exist ! =]
echo No test for [=hackname=][= echo No test for [=hackname=] in inc/[=
_IF files _exist =][=
files[0] =][=
_ELSE =]testing.h[=
_ENDIF =][=
_ENDIF =][= _ENDIF =][=
_ELSE =] _ELSE =]
cat >> inc/[= cat >> inc/[=
......
...@@ -803,8 +803,9 @@ tTestDesc aAix_VolatileTests[] = { ...@@ -803,8 +803,9 @@ tTestDesc aAix_VolatileTests[] = {
/* /*
* Fix Command Arguments for Aix_Volatile * Fix Command Arguments for Aix_Volatile
*/ */
const char* apzAix_VolatilePatch[] = { "sed", const char* apzAix_VolatilePatch[] = {
"-e", "s/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/", "format",
"typedef int sig_atomic_t",
(char*)NULL }; (char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
...@@ -838,8 +839,9 @@ tTestDesc aAlpha_GetoptTests[] = { ...@@ -838,8 +839,9 @@ tTestDesc aAlpha_GetoptTests[] = {
/* /*
* Fix Command Arguments for Alpha_Getopt * Fix Command Arguments for Alpha_Getopt
*/ */
const char* apzAlpha_GetoptPatch[] = { "sed", const char* apzAlpha_GetoptPatch[] = {
"-e", "s/getopt(int, char \\*\\[\\],[ ]*char \\*)/getopt(int, char *const[], const char *)/", "format",
"getopt(int, char *const[], const char *)",
(char*)NULL }; (char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
...@@ -873,8 +875,9 @@ tTestDesc aAlpha_ParensTests[] = { ...@@ -873,8 +875,9 @@ tTestDesc aAlpha_ParensTests[] = {
/* /*
* Fix Command Arguments for Alpha_Parens * Fix Command Arguments for Alpha_Parens
*/ */
const char* apzAlpha_ParensPatch[] = { "sed", const char* apzAlpha_ParensPatch[] = {
"-e", "s/#ifndef(__mips64)/#ifndef __mips64/", "format",
"#ifndef __mips64",
(char*)NULL }; (char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
...@@ -908,8 +911,9 @@ tTestDesc aAlpha_SbrkTests[] = { ...@@ -908,8 +911,9 @@ tTestDesc aAlpha_SbrkTests[] = {
/* /*
* Fix Command Arguments for Alpha_Sbrk * Fix Command Arguments for Alpha_Sbrk
*/ */
const char* apzAlpha_SbrkPatch[] = { "sed", const char* apzAlpha_SbrkPatch[] = {
"-e", "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/", "format",
"void *sbrk(",
(char*)NULL }; (char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
...@@ -1659,44 +1663,9 @@ const char* apzIsc_Omits_With_StdcPatch[] = { "sed", ...@@ -1659,44 +1663,9 @@ const char* apzIsc_Omits_With_StdcPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description of Io_Quotes_Use fix
*/
#define IO_QUOTES_USE_FIXIDX 38
tSCC zIo_Quotes_UseName[] =
"io_quotes_use";
/*
* File name selection pattern
*/
#define zIo_Quotes_UseList (char*)NULL
/*
* Machine/OS name selection pattern
*/
#define apzIo_Quotes_UseMachs (const char**)NULL
/*
* content selection pattern - do fix if pattern found
*/
tSCC zIo_Quotes_UseSelect0[] =
"define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*\\( *[^,']";
#define IO_QUOTES_USE_TEST_CT 1
tTestDesc aIo_Quotes_UseTests[] = {
{ TT_EGREP, zIo_Quotes_UseSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Io_Quotes_Use
*/
const char* apzIo_Quotes_UsePatch[] = {
"char_macro_use",
"IO",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Io_Quotes_Def fix * Description of Io_Quotes_Def fix
*/ */
#define IO_QUOTES_DEF_FIXIDX 39 #define IO_QUOTES_DEF_FIXIDX 38
tSCC zIo_Quotes_DefName[] = tSCC zIo_Quotes_DefName[] =
"io_quotes_def"; "io_quotes_def";
...@@ -1729,44 +1698,44 @@ const char* apzIo_Quotes_DefPatch[] = { ...@@ -1729,44 +1698,44 @@ const char* apzIo_Quotes_DefPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description of Ctrl_Quotes_Use fix * Description of Io_Quotes_Use fix
*/ */
#define CTRL_QUOTES_USE_FIXIDX 40 #define IO_QUOTES_USE_FIXIDX 39
tSCC zCtrl_Quotes_UseName[] = tSCC zIo_Quotes_UseName[] =
"ctrl_quotes_use"; "io_quotes_use";
/* /*
* File name selection pattern * File name selection pattern
*/ */
#define zCtrl_Quotes_UseList (char*)NULL #define zIo_Quotes_UseList (char*)NULL
/* /*
* Machine/OS name selection pattern * Machine/OS name selection pattern
*/ */
#define apzCtrl_Quotes_UseMachs (const char**)NULL #define apzIo_Quotes_UseMachs (const char**)NULL
/* /*
* content selection pattern - do fix if pattern found * content selection pattern - do fix if pattern found
*/ */
tSCC zCtrl_Quotes_UseSelect0[] = tSCC zIo_Quotes_UseSelect0[] =
"define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']"; "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*\\( *[^,']";
#define CTRL_QUOTES_USE_TEST_CT 1 #define IO_QUOTES_USE_TEST_CT 1
tTestDesc aCtrl_Quotes_UseTests[] = { tTestDesc aIo_Quotes_UseTests[] = {
{ TT_EGREP, zCtrl_Quotes_UseSelect0, (regex_t*)NULL }, }; { TT_EGREP, zIo_Quotes_UseSelect0, (regex_t*)NULL }, };
/* /*
* Fix Command Arguments for Ctrl_Quotes_Use * Fix Command Arguments for Io_Quotes_Use
*/ */
const char* apzCtrl_Quotes_UsePatch[] = { const char* apzIo_Quotes_UsePatch[] = {
"char_macro_use", "char_macro_use",
"CTRL", "IO",
(char*)NULL }; (char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description of Ctrl_Quotes_Def fix * Description of Ctrl_Quotes_Def fix
*/ */
#define CTRL_QUOTES_DEF_FIXIDX 41 #define CTRL_QUOTES_DEF_FIXIDX 40
tSCC zCtrl_Quotes_DefName[] = tSCC zCtrl_Quotes_DefName[] =
"ctrl_quotes_def"; "ctrl_quotes_def";
...@@ -1799,6 +1768,41 @@ const char* apzCtrl_Quotes_DefPatch[] = { ...@@ -1799,6 +1768,41 @@ const char* apzCtrl_Quotes_DefPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description of Ctrl_Quotes_Use fix
*/
#define CTRL_QUOTES_USE_FIXIDX 41
tSCC zCtrl_Quotes_UseName[] =
"ctrl_quotes_use";
/*
* File name selection pattern
*/
#define zCtrl_Quotes_UseList (char*)NULL
/*
* Machine/OS name selection pattern
*/
#define apzCtrl_Quotes_UseMachs (const char**)NULL
/*
* content selection pattern - do fix if pattern found
*/
tSCC zCtrl_Quotes_UseSelect0[] =
"define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
#define CTRL_QUOTES_USE_TEST_CT 1
tTestDesc aCtrl_Quotes_UseTests[] = {
{ TT_EGREP, zCtrl_Quotes_UseSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Ctrl_Quotes_Use
*/
const char* apzCtrl_Quotes_UsePatch[] = {
"char_macro_use",
"CTRL",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Ip_Missing_Semi fix * Description of Ip_Missing_Semi fix
*/ */
#define IP_MISSING_SEMI_FIXIDX 42 #define IP_MISSING_SEMI_FIXIDX 42
...@@ -4206,13 +4210,13 @@ tSCC zUndefine_NullName[] = ...@@ -4206,13 +4210,13 @@ tSCC zUndefine_NullName[] =
* content selection pattern - do fix if pattern found * content selection pattern - do fix if pattern found
*/ */
tSCC zUndefine_NullSelect0[] = tSCC zUndefine_NullSelect0[] =
"^#[ \t]*define[ \t]*[ \t]NULL[ \t\r]"; "^#[ \t]*define[ \t]+NULL[ \t]";
/* /*
* content bypass pattern - skip fix if pattern found * content bypass pattern - skip fix if pattern found
*/ */
tSCC zUndefine_NullBypass0[] = tSCC zUndefine_NullBypass0[] =
"#[ \t]*(ifn|un)def[ \t]*[ \t]NULL($|[ \t\r])"; "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
#define UNDEFINE_NULL_TEST_CT 2 #define UNDEFINE_NULL_TEST_CT 2
tTestDesc aUndefine_NullTests[] = { tTestDesc aUndefine_NullTests[] = {
...@@ -4222,9 +4226,13 @@ tTestDesc aUndefine_NullTests[] = { ...@@ -4222,9 +4226,13 @@ tTestDesc aUndefine_NullTests[] = {
/* /*
* Fix Command Arguments for Undefine_Null * Fix Command Arguments for Undefine_Null
*/ */
const char* apzUndefine_NullPatch[] = { "sed", const char* apzUndefine_NullPatch[] = {
"-e", "/^#[ \t]*define[ \t][ \t]*NULL[ \t\r]/i\\\n\ "format",
#undef NULL\n", "#ifndef NULL%2\n\
#define NULL%1%2\n\
#endif%2\n",
"^#[ \t]*define[ \t]*[ \t]NULL([^\r\n\
]+)([\r]*)\n",
(char*)NULL }; (char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
...@@ -4763,22 +4771,22 @@ tFixDesc fixDescList[ FIX_COUNT ] = { ...@@ -4763,22 +4771,22 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zAix_VolatileName, zAix_VolatileList, { zAix_VolatileName, zAix_VolatileList,
apzAix_VolatileMachs, apzAix_VolatileMachs,
AIX_VOLATILE_TEST_CT, FD_MACH_ONLY, AIX_VOLATILE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aAix_VolatileTests, apzAix_VolatilePatch }, aAix_VolatileTests, apzAix_VolatilePatch },
{ zAlpha_GetoptName, zAlpha_GetoptList, { zAlpha_GetoptName, zAlpha_GetoptList,
apzAlpha_GetoptMachs, apzAlpha_GetoptMachs,
ALPHA_GETOPT_TEST_CT, FD_MACH_ONLY, ALPHA_GETOPT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aAlpha_GetoptTests, apzAlpha_GetoptPatch }, aAlpha_GetoptTests, apzAlpha_GetoptPatch },
{ zAlpha_ParensName, zAlpha_ParensList, { zAlpha_ParensName, zAlpha_ParensList,
apzAlpha_ParensMachs, apzAlpha_ParensMachs,
ALPHA_PARENS_TEST_CT, FD_MACH_ONLY, ALPHA_PARENS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aAlpha_ParensTests, apzAlpha_ParensPatch }, aAlpha_ParensTests, apzAlpha_ParensPatch },
{ zAlpha_SbrkName, zAlpha_SbrkList, { zAlpha_SbrkName, zAlpha_SbrkList,
apzAlpha_SbrkMachs, apzAlpha_SbrkMachs,
ALPHA_SBRK_TEST_CT, FD_MACH_ONLY, ALPHA_SBRK_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aAlpha_SbrkTests, apzAlpha_SbrkPatch }, aAlpha_SbrkTests, apzAlpha_SbrkPatch },
{ zArm_Norcroft_HintName, zArm_Norcroft_HintList, { zArm_Norcroft_HintName, zArm_Norcroft_HintList,
...@@ -4881,26 +4889,26 @@ tFixDesc fixDescList[ FIX_COUNT ] = { ...@@ -4881,26 +4889,26 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
ISC_OMITS_WITH_STDC_TEST_CT, FD_MACH_ONLY, ISC_OMITS_WITH_STDC_TEST_CT, FD_MACH_ONLY,
aIsc_Omits_With_StdcTests, apzIsc_Omits_With_StdcPatch }, aIsc_Omits_With_StdcTests, apzIsc_Omits_With_StdcPatch },
{ zIo_Quotes_UseName, zIo_Quotes_UseList,
apzIo_Quotes_UseMachs,
IO_QUOTES_USE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aIo_Quotes_UseTests, apzIo_Quotes_UsePatch },
{ zIo_Quotes_DefName, zIo_Quotes_DefList, { zIo_Quotes_DefName, zIo_Quotes_DefList,
apzIo_Quotes_DefMachs, apzIo_Quotes_DefMachs,
IO_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, IO_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aIo_Quotes_DefTests, apzIo_Quotes_DefPatch }, aIo_Quotes_DefTests, apzIo_Quotes_DefPatch },
{ zCtrl_Quotes_UseName, zCtrl_Quotes_UseList, { zIo_Quotes_UseName, zIo_Quotes_UseList,
apzCtrl_Quotes_UseMachs, apzIo_Quotes_UseMachs,
CTRL_QUOTES_USE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, IO_QUOTES_USE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aCtrl_Quotes_UseTests, apzCtrl_Quotes_UsePatch }, aIo_Quotes_UseTests, apzIo_Quotes_UsePatch },
{ zCtrl_Quotes_DefName, zCtrl_Quotes_DefList, { zCtrl_Quotes_DefName, zCtrl_Quotes_DefList,
apzCtrl_Quotes_DefMachs, apzCtrl_Quotes_DefMachs,
CTRL_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, CTRL_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aCtrl_Quotes_DefTests, apzCtrl_Quotes_DefPatch }, aCtrl_Quotes_DefTests, apzCtrl_Quotes_DefPatch },
{ zCtrl_Quotes_UseName, zCtrl_Quotes_UseList,
apzCtrl_Quotes_UseMachs,
CTRL_QUOTES_USE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aCtrl_Quotes_UseTests, apzCtrl_Quotes_UsePatch },
{ zIp_Missing_SemiName, zIp_Missing_SemiList, { zIp_Missing_SemiName, zIp_Missing_SemiList,
apzIp_Missing_SemiMachs, apzIp_Missing_SemiMachs,
IP_MISSING_SEMI_TEST_CT, FD_MACH_ONLY, IP_MISSING_SEMI_TEST_CT, FD_MACH_ONLY,
...@@ -5223,7 +5231,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = { ...@@ -5223,7 +5231,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zUndefine_NullName, zUndefine_NullList, { zUndefine_NullName, zUndefine_NullList,
apzUndefine_NullMachs, apzUndefine_NullMachs,
UNDEFINE_NULL_TEST_CT, FD_MACH_ONLY, UNDEFINE_NULL_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aUndefine_NullTests, apzUndefine_NullPatch }, aUndefine_NullTests, apzUndefine_NullPatch },
{ zUnixware7_Byteorder_FixName, zUnixware7_Byteorder_FixList, { zUnixware7_Byteorder_FixName, zUnixware7_Byteorder_FixList,
......
...@@ -517,8 +517,8 @@ fix = { ...@@ -517,8 +517,8 @@ fix = {
/* /*
* sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the
* of struct rusage, so the prototype (added by fixproto) causes havoc. * definition of struct rusage, so the prototype added by fixproto fails.
*/ */
fix = { fix = {
hackname = aix_syswait; hackname = aix_syswait;
...@@ -527,7 +527,9 @@ fix = { ...@@ -527,7 +527,9 @@ fix = {
select = "bos325,"; select = "bos325,";
c_fix = format; c_fix = format;
c_fix_arg = "struct rusage;\n%0"; c_fix_arg = "struct rusage;\n%0";
test_text = "/* bos325, */\nextern pid_t wait3();"; test_text = "/* bos325, */\n"
"extern pid_t wait3();\n"
"\t/* pid_t wait3(int *, int, struct rusage *); */";
}; };
...@@ -541,8 +543,8 @@ fix = { ...@@ -541,8 +543,8 @@ 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" c_fix = format;
"/typedef int sig_atomic_t/"; c_fix_arg = "typedef int sig_atomic_t";
test_text = "typedef volatile int sig_atomic_t;"; test_text = "typedef volatile int sig_atomic_t;";
}; };
...@@ -555,8 +557,8 @@ fix = { ...@@ -555,8 +557,8 @@ fix = {
files = "stdio.h"; files = "stdio.h";
files = "stdlib.h"; files = "stdlib.h";
select = 'getopt\(int, char \*\[\], *char \*\)'; select = 'getopt\(int, char \*\[\], *char \*\)';
sed = 's/getopt(int, char \*\[\],[ ]*char \*)/' c_fix = format;
'getopt(int, char *const[], const char *)/'; c_fix_arg = "getopt(int, char *const[], const char *)";
test_text = 'extern int getopt(int, char *[], char *);'; test_text = 'extern int getopt(int, char *[], char *);';
}; };
...@@ -568,7 +570,8 @@ fix = { ...@@ -568,7 +570,8 @@ 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/"; c_fix = format;
c_fix_arg = "#ifndef __mips64";
test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif"; test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
}; };
...@@ -580,7 +583,8 @@ fix = { ...@@ -580,7 +583,8 @@ fix = {
hackname = alpha_sbrk; hackname = alpha_sbrk;
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/"; c_fix = format;
c_fix_arg = "void *sbrk(";
test_text = "extern char* sbrk(ptrdiff_t increment);"; test_text = "extern char* sbrk(ptrdiff_t increment);";
}; };
...@@ -968,59 +972,71 @@ fix = { ...@@ -968,59 +972,71 @@ fix = {
}; };
/* /*
* Fix various macros used to define ioctl numbers. The traditional * Fix various macros used to define ioctl numbers.
* syntax was * The traditional syntax was:
* #define _IO(n, x) (('n'<<8)+x) *
* #define TIOCFOO _IO(T, 1) * #define _IO(n, x) (('n'<<8)+x)
* #define TIOCFOO _IO(T, 1)
*
* but this does not work with the C standard, which disallows macro * but this does not work with the C standard, which disallows macro
* expansion inside strings. We have to rewrite it thus: * expansion inside strings. We have to rewrite it thus:
* #define _IO(n, x) ((n<<8)+x) *
* #define TIOCFOO _IO('T', 1) * #define _IO(n, x) ((n<<8)+x)
* #define TIOCFOO _IO('T', 1)
*
* The select expressions match too much, but the c_fix code is cautious. * The select expressions match too much, but the c_fix code is cautious.
* *
* _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes. * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
*/ */
fix = { fix = {
hackname = io_quotes_use; hackname = io_quotes_def;
select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*" select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\1'";
"\\( *[^,']"; c_fix = char_macro_def;
c_fix = char_macro_use;
c_fix_arg = "IO"; c_fix_arg = "IO";
test_text = "#define BSD43__IOWR(n, x) (('n'<<8)+x)";
}; };
fix = { fix = {
hackname = io_quotes_def; hackname = io_quotes_use;
select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\1'"; select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*"
c_fix = char_macro_def; "\\( *[^,']";
c_fix = char_macro_use;
c_fix_arg = "IO"; c_fix_arg = "IO";
test_text = "#define TIOCFOO BSD43__IOWR(T, 1)";
}; };
/* /*
* Fix various macros used to define ioctl numbers. The traditional * Fix various macros used to define ioctl numbers.
* syntax was * The traditional syntax was:
* #define _CTRL(n, x) (('n'<<8)+x) *
* #define TIOCFOO _CTRL(T, 1) * #define _CTRL(n, x) (('n'<<8)+x)
* #define TCTRLCFOO _CTRL(T, 1)
*
* but this does not work with the C standard, which disallows macro * but this does not work with the C standard, which disallows macro
* expansion inside strings. We have to rewrite it thus: * expansion inside strings. We have to rewrite it thus:
* #define _CTRL(n, x) ((n<<8)+x) *
* #define TIOCFOO _CTRL('T', 1) * #define _CTRL(n, x) ((n<<8)+x)
* #define TCTRLCFOO _CTRL('T', 1)
*
* The select expressions match too much, but the c_fix code is cautious. * The select expressions match too much, but the c_fix code is cautious.
* *
* CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ... * CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
*/ */
fix = { fix = {
hackname = ctrl_quotes_use;
select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
c_fix = char_macro_use;
c_fix_arg = "CTRL";
};
fix = {
hackname = ctrl_quotes_def; hackname = ctrl_quotes_def;
select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'"; select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'";
c_fix = char_macro_def; c_fix = char_macro_def;
c_fix_arg = "CTRL"; c_fix_arg = "CTRL";
test_text = "#define BSD43_CTRL(n, x) (('n'<<8)+x)";
};
fix = {
hackname = ctrl_quotes_use;
select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
c_fix = char_macro_use;
c_fix_arg = "CTRL";
test_text = "#define TIOCFOO BSD43_CTRL(T, 1)";
}; };
...@@ -1293,9 +1309,11 @@ fix = { ...@@ -1293,9 +1309,11 @@ fix = {
* Fix non-ansi machine name defines * Fix non-ansi machine name defines
*/ */
fix = { fix = {
hackname = machine_name; hackname = machine_name;
c_test = machine_name; c_test = machine_name;
c_fix = machine_name; c_fix = machine_name;
test_text = "#ifdef i386 /* no uniform machine_name test, so\n"
" this only works on i?86 machines */";
}; };
...@@ -2459,14 +2477,19 @@ fix = { ...@@ -2459,14 +2477,19 @@ fix = {
/* /*
* Fix multiple defines for NULL * Fix multiple defines for NULL. Sometimes, we stumble into \r\n
* terminated lines, so accommodate these. Test both ways.
*/ */
fix = { fix = {
hackname = undefine_null; hackname = undefine_null;
select = "^#[ \t]*define[ \t]*[ \t]NULL[ \t\r]"; select = "^#[ \t]*define[ \t]+NULL[ \t]";
bypass = "#[ \t]*(ifn|un)def[ \t]*[ \t]NULL($|[ \t\r])"; bypass = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
sed = "/^#[ \t]*define[ \t][ \t]*NULL[ \t\r]/i\\\n"
"#undef NULL\n"; c_fix = format;
c_fix_arg = "#ifndef NULL%2\n#define NULL%1%2\n#endif%2\n";
c_fix_arg = "^#[ \t]*define[ \t]*[ \t]NULL([^\r\n]+)([\r]*)\n";
test_text = "#define NULL 0UL\r\n#define NULL\t((void*)0)\n";
}; };
......
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