Commit cd64831f by Bruce Korb Committed by Bruce Korb

more applications of c_fix=format + tests

From-SVN: r34053
parent 019b761f
2000-05-20 Bruce Korb <bkorb@gnu.org>
* fixinc/inclhack.def: more applications of c_fix=format + tests
* fixinc/check.diff: regenerated
Sat May 20 09:30:55 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Sat May 20 09:30:55 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* alias.c: Clarify some comments. * alias.c: Clarify some comments.
......
...@@ -128,13 +128,18 @@ ...@@ -128,13 +128,18 @@
*** inc/curses.h *** inc/curses.h
--- res/curses.h --- res/curses.h
*************** ***************
*** 1,16 **** *** 1,21 ****
#if defined( AVOID_BOOL_CHECK ) #if defined( AVOID_BOOL_DEFINE_CHECK )
# define bool char # define bool char
#endif /* AVOID_BOOL_DEFINE_CHECK */
#if defined( AVOID_BOOL_TYPE_CHECK )
typedef unsigned int bool ; /* bool type */ typedef unsigned int bool ; /* bool type */
#endif /* AVOID_BOOL_CHECK */ #endif /* AVOID_BOOL_TYPE_CHECK */
#if defined( BAD_STRUCT_TERM_CHECK ) #if defined( BAD_STRUCT_TERM_CHECK )
...@@ -145,17 +150,22 @@ ...@@ -145,17 +150,22 @@
#if defined( LYNX_VOID_INT_CHECK ) #if defined( LYNX_VOID_INT_CHECK )
! # define void int /* curses foiled again */ ! # define void int /* curses foiled again */
#endif /* LYNX_VOID_INT_CHECK */ #endif /* LYNX_VOID_INT_CHECK */
--- 1,20 ---- --- 1,25 ----
#if defined( AVOID_BOOL_CHECK ) #if defined( AVOID_BOOL_DEFINE_CHECK )
+ #ifndef __cplusplus + #ifndef __cplusplus
# define bool char # define bool char
+ #endif + #endif
#endif /* AVOID_BOOL_DEFINE_CHECK */
#if defined( AVOID_BOOL_TYPE_CHECK )
+ #ifndef __cplusplus + #ifndef __cplusplus
typedef unsigned int bool ; /* bool type */ typedef unsigned int bool ; /* bool type */
+ #endif + #endif
#endif /* AVOID_BOOL_CHECK */ #endif /* AVOID_BOOL_TYPE_CHECK */
#if defined( BAD_STRUCT_TERM_CHECK ) #if defined( BAD_STRUCT_TERM_CHECK )
...@@ -499,7 +509,7 @@ ...@@ -499,7 +509,7 @@
#if defined( ECD_CURSOR_CHECK ) #if defined( ECD_CURSOR_CHECK )
! #ifdef ecd.cursor ! #ifdef ecd.cursor
#error bogus #error bogus
! #endif /* ecd+cursor */ #endif /* ecd+cursor */
#endif /* ECD_CURSOR_CHECK */ #endif /* ECD_CURSOR_CHECK */
--- 1,7 ---- --- 1,7 ----
...@@ -507,7 +517,7 @@ ...@@ -507,7 +517,7 @@
#if defined( ECD_CURSOR_CHECK ) #if defined( ECD_CURSOR_CHECK )
! #ifdef ecd_cursor ! #ifdef ecd_cursor
#error bogus #error bogus
! #endif /* ecd_cursor */ #endif /* ecd+cursor */
#endif /* ECD_CURSOR_CHECK */ #endif /* ECD_CURSOR_CHECK */
*** inc/sym.h *** inc/sym.h
--- res/sym.h --- res/sym.h
...@@ -645,21 +655,17 @@ ...@@ -645,21 +655,17 @@
*** inc/sys/spinlock.h *** inc/sys/spinlock.h
--- res/sys/spinlock.h --- res/sys/spinlock.h
*************** ***************
*** 1,7 **** *** 1,5 ****
#if defined( HP_INLINE_CHECK ) #if defined( HP_INLINE_CHECK )
! # include "../machine/inline.h" ! # include "../machine/mumble.h"
# include "../machine/dontfix.h"
! # include "../machine/psl.h"
#endif /* HP_INLINE_CHECK */ #endif /* HP_INLINE_CHECK */
--- 1,7 ---- --- 1,5 ----
#if defined( HP_INLINE_CHECK ) #if defined( HP_INLINE_CHECK )
! # include <machine/inline.h> ! # include <machine/mumble.h>
# include "../machine/dontfix.h"
! # include <machine/psl.h>
#endif /* HP_INLINE_CHECK */ #endif /* HP_INLINE_CHECK */
*** inc/sys/stat.h *** inc/sys/stat.h
--- res/sys/stat.h --- res/sys/stat.h
...@@ -723,7 +729,7 @@ ...@@ -723,7 +729,7 @@
*** inc/testing.h *** inc/testing.h
--- res/testing.h --- res/testing.h
*************** ***************
*** 1,33 **** *** 1,35 ****
#if defined( CTRL_QUOTES_DEF_CHECK ) #if defined( CTRL_QUOTES_DEF_CHECK )
...@@ -738,6 +744,8 @@ ...@@ -738,6 +744,8 @@
#if defined( IO_QUOTES_DEF_CHECK ) #if defined( IO_QUOTES_DEF_CHECK )
! #define BSD43__IOWR(n, x) (('n'<<8)+x) ! #define BSD43__IOWR(n, x) (('n'<<8)+x)
! #define _IOWN(x,y,t) (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
! #define _IO(x,y) ('x'<<8|y)
#endif /* IO_QUOTES_DEF_CHECK */ #endif /* IO_QUOTES_DEF_CHECK */
...@@ -755,7 +763,7 @@ ...@@ -755,7 +763,7 @@
#define NULL ((void*)0) #define NULL ((void*)0)
#endif /* UNDEFINE_NULL_CHECK */ #endif /* UNDEFINE_NULL_CHECK */
--- 1,37 ---- --- 1,39 ----
#if defined( CTRL_QUOTES_DEF_CHECK ) #if defined( CTRL_QUOTES_DEF_CHECK )
...@@ -770,6 +778,8 @@ ...@@ -770,6 +778,8 @@
#if defined( IO_QUOTES_DEF_CHECK ) #if defined( IO_QUOTES_DEF_CHECK )
! #define BSD43__IOWR(n, x) ((n<<8)+x) ! #define BSD43__IOWR(n, x) ((n<<8)+x)
! #define _IOWN(x,y,t) (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
! #define _IO(x,y) (x<<8|y)
#endif /* IO_QUOTES_DEF_CHECK */ #endif /* IO_QUOTES_DEF_CHECK */
......
...@@ -597,7 +597,8 @@ fix = { ...@@ -597,7 +597,8 @@ 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/"; c_fix = format;
c_fix_arg = "p_type";
test_text = "___type p_type mumble;"; test_text = "___type p_type mumble;";
}; };
...@@ -627,8 +628,10 @@ fix = { ...@@ -627,8 +628,10 @@ fix = {
hackname = aux_asm; hackname = aux_asm;
files = sys/param.h; files = sys/param.h;
select = "#ifndef NOINLINE"; select = "#ifndef NOINLINE";
sed = "s|#ifndef NOINLINE"
"|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|"; c_fix = format;
c_fix_arg = "#if !defined(NOINLINE) && !defined(__GNUC__)";
test_text = test_text =
"#ifndef NOINLINE /* ain't got no inline, so we got it */\n" "#ifndef NOINLINE /* ain't got no inline, so we got it */\n"
"#endif /* NOINLINE */"; "#endif /* NOINLINE */";
...@@ -641,46 +644,35 @@ fix = { ...@@ -641,46 +644,35 @@ fix = {
* HP/UX 10.20 also has it in curses_colr/curses.h. * HP/UX 10.20 also has it in curses_colr/curses.h.
*/ */
fix = { fix = {
hackname = avoid_bool; hackname = avoid_bool_define;
files = curses.h; files = curses.h;
files = curses_colr/curses.h; files = curses_colr/curses.h;
files = term.h; files = term.h;
files = tinfo.h; files = tinfo.h;
select = "char[ \t]+bool|bool[ \t]+char";
bypass = "we must use the C\\+\\+ compiler's type";
sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
"#ifndef __cplusplus\n";
sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/a\\\n"
"#endif\n";
sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/i\\\n"
"#ifndef __cplusplus\n";
sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/a\\\n" select = "#[ \t]*define[ \t]+bool[ \t]";
"#endif\n";
sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/i\\\n" c_fix = format;
"#ifndef __cplusplus\n"; c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/a\\\n" test_text = "# define bool\t char \n";
"#endif\n"; };
sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/i\\\n" fix = {
"#ifndef __cplusplus\n"; hackname = avoid_bool_type;
files = curses.h;
files = curses_colr/curses.h;
files = term.h;
files = tinfo.h;
sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/a\\\n" select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
"#endif\n";
sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/i\\\n" c_fix = format;
"#ifndef __cplusplus\n"; c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
c_fix_arg = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;.*";
sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n" test_text = "typedef unsigned int\tbool \t; /* bool type */";
"#endif\n";
test_text = "# define bool\t char \n"
"typedef unsigned int\tbool \t; /* bool type */";
}; };
...@@ -727,11 +719,12 @@ fix = { ...@@ -727,11 +719,12 @@ fix = {
* Fix `typedef struct term;' on hppa1.1-hp-hpux9. * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
*/ */
fix = { fix = {
hackname = bad_struct_term; hackname = bad_struct_term;
files = curses.h; files = curses.h;
select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;"; select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
sed = "s/^[ \t]*typedef[ \t][ \t]*" c_fix = format;
"\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/"; c_fix_arg = "struct term;";
test_text = 'typedef struct term;'; test_text = 'typedef struct term;';
}; };
...@@ -741,9 +734,12 @@ fix = { ...@@ -741,9 +734,12 @@ fix = {
* a mismatched quote not inside a C comment. * a mismatched quote not inside a C comment.
*/ */
fix = { fix = {
hackname = badquote; hackname = badquote;
files = sundev/vuid_event.h; files = sundev/vuid_event.h;
sed = "s/doesn't/does not/"; select = "doesn't";
c_fix = format;
c_fix_arg = "does not";
test_text = "/* doesn't have matched single quotes */"; test_text = "/* doesn't have matched single quotes */";
}; };
...@@ -788,8 +784,11 @@ fix = { ...@@ -788,8 +784,11 @@ fix = {
hackname = broken_cabs; hackname = broken_cabs;
files = "math.h"; files = "math.h";
select = '^extern double cabs'; select = '^extern double cabs';
sed = 's/^extern double cabs();//';
sed = 's/^extern double cabs(struct dbl_hypot);//'; c_fix = format;
c_fix_arg = "";
c_fix_arg = "^extern double cabs\\((struct dbl_hypot|)\\);";
test_text = "#ifdef __STDC__\n" test_text = "#ifdef __STDC__\n"
"extern double cabs(struct dbl_hypot);\n" "extern double cabs(struct dbl_hypot);\n"
"#else\n" "#else\n"
...@@ -819,7 +818,7 @@ fix = { ...@@ -819,7 +818,7 @@ fix = {
*/ */
fix = { 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],";
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)"; test_text = "#define BSD43_CTRL(n, x) (('n'<<8)+x)";
...@@ -838,8 +837,10 @@ fix = { ...@@ -838,8 +837,10 @@ fix = {
* sys/mman.h on HP/UX is not C++ ready, * sys/mman.h on HP/UX is not C++ ready,
* even though NO_IMPLICIT_EXTERN_C is defined on HP/UX. * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
* *
* rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C * rpc/types.h on OSF1/2.0 is not C++ ready,
* is defined for the alpha. The problem is the declaration of malloc. * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
*
* The problem is the declaration of malloc.
*/ */
fix = { fix = {
hackname = cxx_unready; hackname = cxx_unready;
...@@ -882,10 +883,13 @@ fix = { ...@@ -882,10 +883,13 @@ fix = {
* Fix these Sun OS files to avoid an invalid identifier in an #ifdef. * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
*/ */
fix = { fix = {
hackname = ecd_cursor; hackname = ecd_cursor;
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/"; select = 'ecd\.cursor';
c_fix = format;
c_fix_arg = 'ecd_cursor';
test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */"; test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
}; };
...@@ -911,14 +915,18 @@ fix = { ...@@ -911,14 +915,18 @@ fix = {
* /usr/include/machine/inline.h * /usr/include/machine/inline.h
*/ */
fix = { fix = {
hackname = hp_inline; hackname = hp_inline;
files = sys/spinlock.h; files = sys/spinlock.h;
select = 'include.*"\.\./machine/'; files = machine/machparam.h;
sed = "s,\"../machine/inline.h\",<machine/inline.h>,"; select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
test_text = '# include "../machine/inline.h"' "\n" c_fix = format;
'# include "../machine/dontfix.h"' "\n" c_fix_arg = "%1<machine/%2.h>";
'# include "../machine/psl.h"';
c_fix_arg = "([ \t]*#[ \t]*include[ \t]+)" '"\.\./machine/'
'([a-z]+)\.h"';
test_text = ' # include "../machine/mumble.h"';
}; };
...@@ -929,7 +937,11 @@ fix = { ...@@ -929,7 +937,11 @@ 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 *, ...)/';
c_fix = format;
c_fix_arg = "(struct file *, ...)";
c_fix_arg = '\(\.\.\.\)';
test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */"; test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
}; };
...@@ -955,23 +967,6 @@ fix = { ...@@ -955,23 +967,6 @@ fix = {
/* /*
* get rid of bogus inline definitions in HP-UX 8.0
*/
fix = {
hackname = hpux8_bogus_inlines;
files = math.h;
select = inline;
sed = "s@inline int abs(int [a-z][a-z]*) {.*}"
"@extern \"C\" int abs(int);@";
sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
test_text = "inline int abs(int v) { return (v>=0)?v:-v; }\n"
"inline double sqr(double v) { return v**0.5; }";
};
/*
* In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
* of UINT32_C has undefined behavior according to ISO/ANSI: * of UINT32_C has undefined behavior according to ISO/ANSI:
* the arguments to __CONCAT__ are not macro expanded before the * the arguments to __CONCAT__ are not macro expanded before the
...@@ -998,6 +993,24 @@ fix = { ...@@ -998,6 +993,24 @@ fix = {
"#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)"; "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
}; };
/*
* get rid of bogus inline definitions in HP-UX 8.0
*/
fix = {
hackname = hpux8_bogus_inlines;
files = math.h;
select = inline;
sed = "s@inline int abs(int [a-z][a-z]*) {.*}"
"@extern \"C\" int abs(int);@";
sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
test_text = "inline int abs(int v) { return (v>=0)?v:-v; }\n"
"inline double sqr(double v) { return v**0.5; }";
};
/* /*
* On Interactive Unix 2.2, certain traditional Unix definitions * On Interactive Unix 2.2, certain traditional Unix definitions
* (notably getc and putc in stdio.h) are omitted if __STDC__ is * (notably getc and putc in stdio.h) are omitted if __STDC__ is
...@@ -1021,6 +1034,7 @@ fix = { ...@@ -1021,6 +1034,7 @@ fix = {
"\nint foo;\n#endif"; "\nint foo;\n#endif";
}; };
/* /*
* Fix various macros used to define ioctl numbers. * Fix various macros used to define ioctl numbers.
* The traditional syntax was: * The traditional syntax was:
...@@ -1040,10 +1054,13 @@ fix = { ...@@ -1040,10 +1054,13 @@ fix = {
*/ */
fix = { fix = {
hackname = io_quotes_def; hackname = io_quotes_def;
select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\1'"; select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\([a-zA-Z],";
c_fix = char_macro_def; c_fix = char_macro_def;
c_fix_arg = "IO"; c_fix_arg = "IO";
test_text = "#define BSD43__IOWR(n, x) (('n'<<8)+x)"; test_text =
"#define BSD43__IOWR(n, x) (('n'<<8)+x)\n"
"#define _IOWN(x,y,t) (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)\n"
"#define _IO(x,y) ('x'<<8|y)";
}; };
fix = { fix = {
...@@ -1063,11 +1080,11 @@ fix = { ...@@ -1063,11 +1080,11 @@ fix = {
hackname = hpux_maxint; hackname = hpux_maxint;
files = sys/param.h; files = sys/param.h;
select = "^#[ \t]*define[ \t]*MAXINT[ \t]"; 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" c_fix = format;
"#endif\n"; c_fix_arg = "#ifndef MAXINT\n%0\n#endif";
c_fix_arg = "^#[ \t]*define[ \t]*MAXINT[ \t].*";
test_text = '#define MAXINT 0x7FFFFFFF'; test_text = '#define MAXINT 0x7FFFFFFF';
}; };
......
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