added several "test_text" attributes; changed several fixes to use `c_fix = format'

and  re-alphabetized the fixes

From-SVN: r33930
This commit is contained in:
Bruce Korb 2000-05-16 14:01:34 +00:00
parent 789f3ce3dd
commit 79589c4d8b
4 changed files with 1298 additions and 955 deletions

View File

@ -128,7 +128,7 @@
*** inc/curses.h *** inc/curses.h
--- res/curses.h --- res/curses.h
*************** ***************
*** 1,11 **** *** 1,16 ****
#ifndef AVOID_BOOL_CHECK #ifndef AVOID_BOOL_CHECK
@ -140,7 +140,12 @@
#ifndef BAD_STRUCT_TERM_CHECK #ifndef BAD_STRUCT_TERM_CHECK
! typedef struct term; ! typedef struct term;
#endif /* BAD_STRUCT_TERM_CHECK */ #endif /* BAD_STRUCT_TERM_CHECK */
--- 1,15 ----
#ifndef LYNX_VOID_INT_CHECK
! # define void int /* curses foiled again */
#endif /* LYNX_VOID_INT_CHECK */
--- 1,20 ----
#ifndef AVOID_BOOL_CHECK #ifndef AVOID_BOOL_CHECK
@ -156,6 +161,41 @@
#ifndef BAD_STRUCT_TERM_CHECK #ifndef BAD_STRUCT_TERM_CHECK
! struct term; ! struct term;
#endif /* BAD_STRUCT_TERM_CHECK */ #endif /* BAD_STRUCT_TERM_CHECK */
#ifndef LYNX_VOID_INT_CHECK
! /* curses foiled again */
#endif /* LYNX_VOID_INT_CHECK */
*** inc/fcntl.h
--- res/fcntl.h
***************
*** 1,5 ****
#ifndef LYNXOS_FCNTL_PROTO_CHECK
! extern int fcntl(int, int, int);
#endif /* LYNXOS_FCNTL_PROTO_CHECK */
--- 1,5 ----
#ifndef LYNXOS_FCNTL_PROTO_CHECK
! extern int fcntl(int, int, ...);
#endif /* LYNXOS_FCNTL_PROTO_CHECK */
*** inc/inttypes.h
--- res/inttypes.h
***************
*** 2,6 ****
#ifndef HPUX11_UINT32_C_CHECK
#define CONCAT_U__(__c) __CONCAT__(__c,u)
! #define UINT32_C(__c) __CONCAT__(__CONCAT_U__(__c),l)
#endif /* HPUX11_UINT32_C_CHECK */
--- 2,6 ----
#ifndef HPUX11_UINT32_C_CHECK
#define CONCAT_U__(__c) __CONCAT__(__c,u)
! #define UINT32_C(__c) __CONCAT__(__c,ul)
#endif /* HPUX11_UINT32_C_CHECK */
*** inc/libgen.h *** inc/libgen.h
--- res/libgen.h --- res/libgen.h
*************** ***************
@ -173,10 +213,22 @@
! #define something _FOOsomething ! #define something _FOOsomething
#define mumble _FOOmumble #define mumble _FOOmumble
#endif /* BAD_LVAL_CHECK */ #endif /* BAD_LVAL_CHECK */
*** inc/limits.h
--- res/limits.h
***************
*** 1,5 ****
--- 1,7 ----
#ifndef LIMITS_IFNDEFS_CHECK
+ #ifndef DBL_DIG
# define DBL_DIG 0 /* somthin' */
+ #endif
#endif /* LIMITS_IFNDEFS_CHECK */
*** inc/math.h *** inc/math.h
--- res/math.h --- res/math.h
*************** ***************
*** 1,10 **** *** 1,35 ****
#ifndef BROKEN_CABS_CHECK #ifndef BROKEN_CABS_CHECK
@ -187,7 +239,32 @@
#endif #endif
#endif /* BROKEN_CABS_CHECK */ #endif /* BROKEN_CABS_CHECK */
--- 1,14 ----
#ifndef FIX_HEADER_BREAKAGE_CHECK
! extern double floor(), ceil(), fmod(), fabs();
#endif /* FIX_HEADER_BREAKAGE_CHECK */
#ifndef HPUX8_BOGUS_INLINES_CHECK
! inline int abs(int v) { return (v>=0)?v:-v; }
! inline double sqr(double v) { return v**0.5; }
#endif /* HPUX8_BOGUS_INLINES_CHECK */
#ifndef ISC_FMOD_CHECK
! extern double fmod(double);
#endif /* ISC_FMOD_CHECK */
#ifndef M88K_BAD_HYPOT_OPT_CHECK
extern double hypot();
#endif /* M88K_BAD_HYPOT_OPT_CHECK */
#ifndef MATH_EXCEPTION_CHECK
typedef struct exception t_math_exception;
#endif /* MATH_EXCEPTION_CHECK */
--- 1,56 ----
+ #ifndef FIXINC_MATH_EXCEPTION_CHECK + #ifndef FIXINC_MATH_EXCEPTION_CHECK
+ #define FIXINC_MATH_EXCEPTION_CHECK 1 + #define FIXINC_MATH_EXCEPTION_CHECK 1
+ +
@ -202,9 +279,40 @@
#endif #endif
#endif /* BROKEN_CABS_CHECK */ #endif /* BROKEN_CABS_CHECK */
***************
*** 12,14 **** #ifndef FIX_HEADER_BREAKAGE_CHECK
--- 16,23 ---- ! extern double floor(), ceil(), fmod(), fabs _PARAMS((double));
#endif /* FIX_HEADER_BREAKAGE_CHECK */
#ifndef HPUX8_BOGUS_INLINES_CHECK
! extern "C" int abs(int);
!
#endif /* HPUX8_BOGUS_INLINES_CHECK */
#ifndef ISC_FMOD_CHECK
! extern double fmod(double, double);
#endif /* ISC_FMOD_CHECK */
#ifndef M88K_BAD_HYPOT_OPT_CHECK
extern double hypot();
+ /* Workaround a stupid Motorola optimization if one
+ of x or y is 0.0 and the other is negative! */
+ #ifdef __STDC__
+ static __inline__ double fake_hypot (double x, double y)
+ #else
+ static __inline__ double fake_hypot (x, y)
+ double x, y;
+ #endif
+ {
+ return fabs (hypot (x, y));
+ }
+ #define hypot fake_hypot
#endif /* M88K_BAD_HYPOT_OPT_CHECK */
#ifndef MATH_EXCEPTION_CHECK #ifndef MATH_EXCEPTION_CHECK
typedef struct exception t_math_exception; typedef struct exception t_math_exception;
#endif /* MATH_EXCEPTION_CHECK */ #endif /* MATH_EXCEPTION_CHECK */
@ -213,6 +321,77 @@
+ #endif + #endif
+ +
+ #endif /* FIXINC_MATH_EXCEPTION_CHECK */ + #endif /* FIXINC_MATH_EXCEPTION_CHECK */
*** inc/netinet/ip.h
--- res/netinet/ip.h
***************
*** 4,10 ****
struct mumble {
union {
int x;
! }
}; /* mumbled struct */
#endif /* IP_MISSING_SEMI_CHECK */
--- 4,10 ----
struct mumble {
union {
int x;
! };
}; /* mumbled struct */
#endif /* IP_MISSING_SEMI_CHECK */
*** inc/rpc/auth.h
--- res/rpc/auth.h
***************
*** 1,5 ****
--- 1,6 ----
#ifndef STRUCT_SOCKADDR_CHECK
+ struct sockaddr;
extern AUTH* authdes_create( struct sockaddr* );
#endif /* STRUCT_SOCKADDR_CHECK */
*** inc/rpc/rpc.h
--- res/rpc/rpc.h
***************
*** 1,5 ****
#ifndef NESTED_AUTH_DES_CHECK
! /*#include <rpc/auth_des.h> /* skip this */
#endif /* NESTED_AUTH_DES_CHECK */
--- 1,5 ----
#ifndef NESTED_AUTH_DES_CHECK
! /*#include <rpc/auth_des.h> */ /* skip this */
#endif /* NESTED_AUTH_DES_CHECK */
*** inc/rpc/xdr.h
--- res/rpc/xdr.h
***************
*** 1,5 ****
--- 1,6 ----
#ifndef STRUCT_FILE_CHECK
+ struct __file_s;
extern void xdrstdio_create( struct __file_s* );
#endif /* STRUCT_FILE_CHECK */
*** inc/sparc/asm_linkage.h
--- res/sparc/asm_linkage.h
***************
*** 1,5 ****
#ifndef KANDR_CONCAT_CHECK
! #define __CONCAT__(a,b) a/**/b
#endif /* KANDR_CONCAT_CHECK */
--- 1,5 ----
#ifndef KANDR_CONCAT_CHECK
! #define __CONCAT__(a,b) a##b
#endif /* KANDR_CONCAT_CHECK */
*** inc/stdio.h *** inc/stdio.h
--- res/stdio.h --- res/stdio.h
*************** ***************
@ -327,6 +506,21 @@
extern int foo; extern int foo;
#endif #endif
#endif /* ALPHA_PARENS_CHECK */ #endif /* ALPHA_PARENS_CHECK */
*** inc/sys/asm.h
--- res/sys/asm.h
***************
*** 1,5 ****
#ifndef IRIX_ASM_APOSTROPHE_CHECK
! # and we're on vacation
#endif /* IRIX_ASM_APOSTROPHE_CHECK */
--- 1,5 ----
#ifndef IRIX_ASM_APOSTROPHE_CHECK
! # and we are on vacation
#endif /* IRIX_ASM_APOSTROPHE_CHECK */
*** inc/sys/file.h *** inc/sys/file.h
--- res/sys/file.h --- res/sys/file.h
*************** ***************
@ -342,6 +536,25 @@
#ifndef HP_SYSFILE_CHECK #ifndef HP_SYSFILE_CHECK
! extern void foo(struct file *, ...); /* HPUX_SOURCE - bad varargs */ ! extern void foo(struct file *, ...); /* HPUX_SOURCE - bad varargs */
#endif /* HP_SYSFILE_CHECK */ #endif /* HP_SYSFILE_CHECK */
*** inc/sys/limits.h
--- res/sys/limits.h
***************
*** 2,8 ****
#ifndef NESTED_SYS_LIMITS_CHECK
/*
! #define CHILD_MAX 20 /* Max, Max, ... */ /*
! #define OPEN_MAX 20 /* Max, Max, ... */
#endif /* NESTED_SYS_LIMITS_CHECK */
--- 2,8 ----
#ifndef NESTED_SYS_LIMITS_CHECK
/*
! #define CHILD_MAX 20 Max, Max, ... */ /*
! #define OPEN_MAX 20 Max, Max, ... */
#endif /* NESTED_SYS_LIMITS_CHECK */
*** inc/sys/mman.h *** inc/sys/mman.h
--- res/sys/mman.h --- res/sys/mman.h
*************** ***************
@ -426,6 +639,21 @@
# include "../machine/dontfix.h" # include "../machine/dontfix.h"
! # include <machine/psl.h> ! # include <machine/psl.h>
#endif /* HP_INLINE_CHECK */ #endif /* HP_INLINE_CHECK */
*** inc/sys/stat.h
--- res/sys/stat.h
***************
*** 1,5 ****
#ifndef M88K_BAD_S_IF_CHECK
! #define S_ISREG(m) (m & S_IFREG) /* is regular? */
#endif /* M88K_BAD_S_IF_CHECK */
--- 1,5 ----
#ifndef M88K_BAD_S_IF_CHECK
! #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* is regular? */
#endif /* M88K_BAD_S_IF_CHECK */
*** inc/sys/time.h *** inc/sys/time.h
--- res/sys/time.h --- res/sys/time.h
*************** ***************
@ -441,6 +669,23 @@
#ifndef HPUX_SYSTIME_CHECK #ifndef HPUX_SYSTIME_CHECK
! struct sigevent; ! struct sigevent;
#endif /* HPUX_SYSTIME_CHECK */ #endif /* HPUX_SYSTIME_CHECK */
*** inc/sys/types.h
--- res/sys/types.h
***************
*** 1,6 ****
#ifndef IRIX_MULTILINE_CMNT_CHECK
! /* we check the type of the result
! // of the sizeof something. This is a bad test :-( */
#endif /* IRIX_MULTILINE_CMNT_CHECK */
--- 1,6 ----
#ifndef IRIX_MULTILINE_CMNT_CHECK
! /* we check the type of the result */
! // /* of the sizeof something. This is a bad test :-( */
#endif /* IRIX_MULTILINE_CMNT_CHECK */
*** inc/sys/wait.h *** inc/sys/wait.h
--- res/sys/wait.h --- res/sys/wait.h
*************** ***************

View File

@ -21,7 +21,7 @@ export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE
mkdir ${DESTDIR} ${SRCDIR} mkdir ${DESTDIR} ${SRCDIR}
( cd ${SRCDIR} ( cd ${SRCDIR}
mkdir sys X11 Xm sundev sunwindow ) mkdir netinet rpc sparc sundev sunwindow sys X11 Xm )
[= [=

File diff suppressed because it is too large Load Diff

View File

@ -684,31 +684,6 @@ fix = {
}; };
/*
* Fix `typedef struct term;' on hppa1.1-hp-hpux9.
*/
fix = {
hackname = bad_struct_term;
files = curses.h;
select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
sed = "s/^[ \t]*typedef[ \t][ \t]*"
"\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
test_text = 'typedef struct term;';
};
/*
* Fix one other error in this file:
* a mismatched quote not inside a C comment.
*/
fix = {
hackname = badquote;
files = sundev/vuid_event.h;
sed = "s/doesn't/does not/";
test_text = "/* doesn't have matched single quotes */";
};
/* /*
* Fix #defines under Alpha OSF/1: * Fix #defines under Alpha OSF/1:
* The following files contain '#pragma extern_prefix "_FOO"' followed by * The following files contain '#pragma extern_prefix "_FOO"' followed by
@ -748,6 +723,31 @@ fix = {
}; };
/*
* Fix `typedef struct term;' on hppa1.1-hp-hpux9.
*/
fix = {
hackname = bad_struct_term;
files = curses.h;
select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
sed = "s/^[ \t]*typedef[ \t][ \t]*"
"\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
test_text = 'typedef struct term;';
};
/*
* Fix one other error in this file:
* a mismatched quote not inside a C comment.
*/
fix = {
hackname = badquote;
files = sundev/vuid_event.h;
sed = "s/doesn't/does not/";
test_text = "/* doesn't have matched single quotes */";
};
/* /*
* check for broken assert.h that needs stdio.h * check for broken assert.h that needs stdio.h
*/ */
@ -796,6 +796,66 @@ fix = {
}; };
/*
* Fix various macros used to define ioctl numbers.
* The traditional syntax was:
*
* #define _CTRL(n, x) (('n'<<8)+x)
* #define TCTRLCFOO _CTRL(T, 1)
*
* but this does not work with the C standard, which disallows macro
* expansion inside strings. We have to rewrite it thus:
*
* #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.
*
* CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
*/
fix = {
hackname = ctrl_quotes_def;
select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'";
c_fix = char_macro_def;
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)";
};
/*
* sys/mman.h on HP/UX is not C++ ready,
* 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
* is defined for the alpha. The problem is the declaration of malloc.
*/
fix = {
hackname = cxx_unready;
files = sys/mman.h;
files = rpc/types.h;
select = '[^#]+malloc.*;'; /* Catch any form of declaration
not within a macro. */
bypass = '"C"|__BEGIN_DECLS';
c_fix = wrap;
c_fix_arg = "#ifdef __cplusplus\n"
"extern \"C\" {\n"
"#endif\n";
c_fix_arg = "#ifdef __cplusplus\n"
"}\n"
"#endif\n";
test_text = "extern void* malloc( size_t );";
};
/* /*
* Fix <c_asm.h> on Digital UNIX V4.0: * Fix <c_asm.h> on Digital UNIX V4.0:
* It contains a prototype for a DEC C internal asm() function, * It contains a prototype for a DEC C internal asm() function,
@ -826,6 +886,22 @@ fix = {
}; };
/*
* fix-header doesn't fix fabs' prototype, and I have no idea why.
*/
fix = {
hackname = fix_header_breakage;
mach = "m88k-motorola-sysv3*";
files = "math.h";
select = 'extern double floor\(\), ceil\(\), fmod\(\), fabs\(\);';
c_fix = format;
c_fix_arg =
'extern double floor(), ceil(), fmod(), fabs _PARAMS((double));';
test_text = 'extern double floor(), ceil(), fmod(), fabs();';
};
/* /*
* Fix HP's use of ../machine/inline.h to refer to * Fix HP's use of ../machine/inline.h to refer to
* /usr/include/machine/inline.h * /usr/include/machine/inline.h
@ -854,60 +930,6 @@ fix = {
}; };
/*
* sys/mman.h on HP/UX is not C++ ready,
* 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
* is defined for the alpha. The problem is the declaration of malloc.
*/
fix = {
hackname = cxx_unready;
files = sys/mman.h;
files = rpc/types.h;
select = '[^#]+malloc.*;'; /* Catch any form of declaration
not within a macro. */
bypass = '"C"|__BEGIN_DECLS';
c_fix = wrap;
c_fix_arg = "#ifdef __cplusplus\n"
"extern \"C\" {\n"
"#endif\n";
c_fix_arg = "#ifdef __cplusplus\n"
"}\n"
"#endif\n";
test_text = "extern void* malloc( size_t );";
};
/*
* HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
*/
fix = {
hackname = hpux_maxint;
files = sys/param.h;
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"
"#endif\n";
test_text = '#define MAXINT 0x7FFFFFFF';
};
/*
* Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
*/
fix = {
hackname = hpux_systime;
files = sys/time.h;
select = "^extern struct sigevent;";
sed = "s/^extern struct sigevent;/struct sigevent;/";
test_text = 'extern struct sigevent;';
};
/* /*
* get rid of bogus inline definitions in HP-UX 8.0 * get rid of bogus inline definitions in HP-UX 8.0
*/ */
@ -915,10 +937,13 @@ fix = {
hackname = hpux8_bogus_inlines; hackname = hpux8_bogus_inlines;
files = math.h; files = math.h;
select = inline; select = inline;
sed = "s@inline int abs(int [a-z][a-z]*) {.*}@extern \"C\" int abs(int);@"; 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 double abs(double [a-z][a-z]*) {.*}@@";
sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@"; sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
sed = "s@inline double sqr(double [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; }";
}; };
@ -937,14 +962,16 @@ fix = {
* A more specific solution, the one used here, is to change the UINT32_C * A more specific solution, the one used here, is to change the UINT32_C
* macro to not used macros in the arguments to __CONCAT__. * macro to not used macros in the arguments to __CONCAT__.
*/ */
fix = { fix = {
hackname = hpux11_uint32_c; hackname = hpux11_uint32_c;
files = inttypes.h; files = inttypes.h;
select = "^#define UINT32_C\\(__c\\)[ \t]*" select = "^#define UINT32_C\\(__c\\)[ \t]*"
"__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)"; "__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)/"; c_fix = format;
c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)'; c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
test_text =
"#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
"#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
}; };
/* /*
@ -956,17 +983,16 @@ fix = {
fix = { fix = {
hackname = isc_omits_with_stdc; hackname = isc_omits_with_stdc;
files = "stdio.h"; files = "stdio.h";
files = "math.h"; files = "math.h";
files = "ctype.h"; files = "ctype.h";
files = "sys/limits.h"; files = "sys/limits.h";
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\)';
c_fix = format;
sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/" c_fix_arg = '!defined(_POSIX_SOURCE)';
"!defined(_POSIX_SOURCE)/";
test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */" test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
"\nint foo;\n#endif"; "\nint foo;\n#endif";
}; };
@ -1004,39 +1030,33 @@ fix = {
c_fix_arg = "IO"; c_fix_arg = "IO";
test_text = "#define TIOCFOO BSD43__IOWR(T, 1)"; test_text = "#define TIOCFOO BSD43__IOWR(T, 1)";
}; };
/* /*
* Fix various macros used to define ioctl numbers. * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
* The traditional syntax was:
*
* #define _CTRL(n, x) (('n'<<8)+x)
* #define TCTRLCFOO _CTRL(T, 1)
*
* but this does not work with the C standard, which disallows macro
* expansion inside strings. We have to rewrite it thus:
*
* #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.
*
* CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
*/ */
fix = { fix = {
hackname = ctrl_quotes_def; hackname = hpux_maxint;
select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'"; files = sys/param.h;
c_fix = char_macro_def; select = "^#[ \t]*define[ \t]*MAXINT[ \t]";
c_fix_arg = "CTRL"; sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
test_text = "#define BSD43_CTRL(n, x) (('n'<<8)+x)"; "#ifndef MAXINT\n";
sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
"#endif\n";
test_text = '#define MAXINT 0x7FFFFFFF';
}; };
/*
* Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
*/
fix = { fix = {
hackname = ctrl_quotes_use; hackname = hpux_systime;
select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']"; files = sys/time.h;
c_fix = char_macro_use; select = "^extern struct sigevent;";
c_fix_arg = "CTRL"; sed = "s/^extern struct sigevent;/struct sigevent;/";
test_text = "#define TIOCFOO BSD43_CTRL(T, 1)"; test_text = 'extern struct sigevent;';
}; };
@ -1048,6 +1068,29 @@ fix = {
files = netinet/ip.h; files = netinet/ip.h;
select = "}$"; select = "}$";
sed = "/^struct/,/^};/s/}$/};/"; sed = "/^struct/,/^};/s/}$/};/";
test_text=
"struct mumble {\n"
" union {\n"
" int x;\n"
" }\n"
"}; /* mumbled struct */\n";
};
/*
* IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
* that causes the assembly preprocessor to complain about an
* unterminated character constant.
*/
fix = {
hackname = irix_asm_apostrophe;
files = sys/asm.h;
select = "^[ \t]*#.*[Ww]e're";
c_fix = format;
c_fix_arg = "%1 are";
c_fix_arg = "^([ \t]*#.*[Ww]e)'re";
test_text = "\t# and we're on vacation";
}; };
@ -1060,46 +1103,9 @@ fix = {
sed = "s@type of the result@type of the result */@"; sed = "s@type of the result@type of the result */@";
sed = "s@of the sizeof@/* of the sizeof@"; sed = "s@of the sizeof@/* of the sizeof@";
}; test_text =
"/* we check the type of the result\n"
"// of the sizeof something. This is a bad test :-( */";
/*
* IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
* in prototype without previous definition.
*/
fix = {
hackname = irix_sockaddr;
files = rpc/auth.h;
select = "authdes_create.*struct sockaddr";
bypass = "<sys/socket\.h>";
sed = "/authdes_create.*struct sockaddr/i\\\n"
"struct sockaddr;\n";
};
/*
* IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
* in prototype without previous definition.
*/
fix = {
hackname = irix_struct__file;
files = rpc/xdr.h;
sed = "/xdrstdio_create.*struct __file_s/i\\\n"
"struct __file_s;\n";
};
/*
* IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
* that causes the assembly preprocessor to complain about an
* unterminated character constant.
*/
fix = {
hackname = irix_asm_apostrophe;
files = sys/asm.h;
select = "^[ \t]*#.*[Ww]e're";
sed = "/^[ \t]*#/s/\\([Ww]e\\)'re/\\1 are/";
}; };
@ -1107,37 +1113,12 @@ fix = {
* Fixing ISC fmod declaration * Fixing ISC fmod declaration
*/ */
fix = { fix = {
hackname = isc_fmod; hackname = isc_fmod;
files = math.h; files = math.h;
select = 'fmod\(double\)'; select = 'fmod\(double\)';
sed = "s/fmod(double)/fmod(double, double)/"; c_fix = format;
}; c_fix_arg = "fmod(double, double)";
test_text = "extern double fmod(double);";
/*
* Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
*/
fix = {
hackname = motorola_nested;
mach = "m68k-motorola-sysv*";
files = limits.h;
files = sys/limits.h;
sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
"/\\* max # bytes atomic in write to a\\)$@\\1 */@";
sed = "s@\\(/\\*#define\tHUGE_VAL\t3.40282346638528860e+38 \\)"
"\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
};
/*
* Fixing nested comments in ISC <sys/limits.h>
*/
fix = {
hackname = isc_sys_limits;
files = sys/limits.h;
select = CHILD_MAX;
sed = "/CHILD_MAX/s,/\\* Max, Max,";
sed = "/OPEN_MAX/s,/\\* Max, Max,";
}; };
@ -1166,7 +1147,9 @@ fix = {
files = "Xm.acorn/XmP.h"; files = "Xm.acorn/XmP.h";
files = bsd43/bsd43_.h; files = bsd43/bsd43_.h;
select = '/\*\*/'; select = '/\*\*/';
sed = 's|/\*\*/|##|g'; c_fix = format;
c_fix_arg = '##';
test_text = "#define __CONCAT__(a,b) a/**/b";
}; };
@ -1178,7 +1161,6 @@ fix = {
* comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
* we find a #ifndef FLT_MIN we assume that all the required #ifndefs * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
* are there, and we do not add them ourselves. * are there, and we do not add them ourselves.
* Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1
*/ */
fix = { fix = {
hackname = limits_ifndefs; hackname = limits_ifndefs;
@ -1186,19 +1168,12 @@ fix = {
files = "sys/limits.h"; files = "sys/limits.h";
bypass = "ifndef[ \t]+FLT_MIN"; bypass = "ifndef[ \t]+FLT_MIN";
sed = "/[ \t]FLT_MIN[ \t]/i\\\n#ifndef FLT_MIN\n"; c_fix = format;
sed = "/[ \t]FLT_MIN[ \t]/a\\\n#endif\n"; c_fix_arg = "#ifndef %1\n%0#endif\n";
sed = "/[ \t]FLT_MAX[ \t]/i\\\n#ifndef FLT_MAX\n"; c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+"
sed = "/[ \t]FLT_MAX[ \t]/a\\\n#endif\n"; "((FLT|DBL)_(MIN|MAX|DIG))"
sed = "/[ \t]FLT_DIG[ \t]/i\\\n#ifndef FLT_DIG\n"; "[ \t][^\n]*\n";
sed = "/[ \t]FLT_DIG[ \t]/a\\\n#endif\n"; test_text = " #\tdefine\tDBL_DIG \t 0 /* somthin' */";
sed = "/[ \t]DBL_MIN[ \t]/i\\\n#ifndef DBL_MIN\n";
sed = "/[ \t]DBL_MIN[ \t]/a\\\n#endif\n";
sed = "/[ \t]DBL_MAX[ \t]/i\\\n#ifndef DBL_MAX\n";
sed = "/[ \t]DBL_MAX[ \t]/a\\\n#endif\n";
sed = "/[ \t]DBL_DIG[ \t]/i\\\n#ifndef DBL_DIG\n";
sed = "/[ \t]DBL_DIG[ \t]/a\\\n#endif\n";
sed = "/^\\(\\/\\*#define\tHUGE_VAL\t3\\.[0-9e+]* *\\)\\/\\*/s//\\1/";
}; };
@ -1206,10 +1181,12 @@ fix = {
* Delete the '#define void int' line from curses.h on Lynx * Delete the '#define void int' line from curses.h on Lynx
*/ */
fix = { fix = {
hackname = lynx_void_int; hackname = lynx_void_int;
files = curses.h; files = curses.h;
select = "#[ \t]*define[ \t]+void[ \t]+int"; select = "#[ \t]*define[ \t]+void[ \t]+int[ \t]*";
sed = "/#[ \t]*define[ \t][ \t]*void[ \t]int/d"; c_fix = format;
c_fix_arg = "";
test_text = "# define\tvoid\tint \t/* curses foiled again */";
}; };
@ -1217,40 +1194,41 @@ fix = {
* Fix fcntl prototype in fcntl.h on LynxOS. * Fix fcntl prototype in fcntl.h on LynxOS.
*/ */
fix = { fix = {
hackname = lynxos_fcntl_proto; hackname = lynxos_fcntl_proto;
files = fcntl.h; files = fcntl.h;
select = 'fcntl.*\(int, int, int\)'; select = "fcntl[ \t]*" '\(int, int, int\)';
sed = 's/\(fcntl.*(int, int, \)int)/\1...)/'; c_fix = format;
c_fix_arg = '%1...)';
c_fix_arg = "(fcntl[ \t]*" '\(int, int, )int\)';
test_text = "extern int fcntl(int, int, int);";
}; };
/* /*
* libm.a on m88k-motorola-sysv3 contains a stupid optimization for * libm.a on m88k-motorola-sysv3 contains a stupid optimization for
* function hypot(), which returns the second argument without even * function hypot(), which returns the second argument without even
* looking at its value, if the other is 0.0. Another drawback is * looking at its value, if the other is 0.0.
* that fix-header doesn't fix fabs' prototype, and I have no idea why.
*/ */
fix = { fix = {
hackname = m88k_bad_hypot_opt; hackname = m88k_bad_hypot_opt;
mach = "m88k-motorola-sysv3*"; mach = "m88k-motorola-sysv3*";
files = "math.h"; files = "math.h";
select = "^extern double hypot\\(\\);\n";
sed = "s/extern double floor(), ceil(), fmod(), fabs();/" c_fix = format;
"extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/"; c_fix_arg = "%0"
"/* Workaround a stupid Motorola optimization if one\n"
sed = "/^extern double hypot();$/a\\\n" " of x or y is 0.0 and the other is negative! */\n"
"\\/* Workaround a stupid Motorola optimization if one\\\n" "#ifdef __STDC__\n"
" of x or y is 0.0 and the other is negative! *\\/\\\n" "static __inline__ double fake_hypot (double x, double y)\n"
"#ifdef __STDC__\\\n" "#else\n"
"static __inline__ double fake_hypot (double x, double y)\\\n" "static __inline__ double fake_hypot (x, y)\n"
"#else\\\n" "\tdouble x, y;\n"
"static __inline__ double fake_hypot (x, y)\\\n" "#endif\n"
"\tdouble x, y;\\\n" "{\n"
"#endif\\\n" "\treturn fabs (hypot (x, y));\n"
"{\\\n" "}\n"
"\treturn fabs (hypot (x, y));\\\n"
"}\\\n"
"#define hypot\tfake_hypot\n"; "#define hypot\tfake_hypot\n";
test_text = "extern double hypot();";
}; };
@ -1261,15 +1239,15 @@ fix = {
hackname = m88k_bad_s_if; hackname = m88k_bad_s_if;
mach = "m88k-*-sysv3*"; mach = "m88k-*-sysv3*";
files = sys/stat.h; files = sys/stat.h;
select = "#define[ \t]+S_IS[A-Z]*(m)[ \t]"; select = "#define[ \t]+S_IS[A-Z]+\\(m\\)[ \t]+\\(m[ \t]*&";
sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*" c_fix = format;
"(m[ \t]*&[ \t]*\\(S_IF[A-Z][A-Z][A-Z][A-Z]*\\)[ \t]*)/" c_fix_arg = '#define %1(m) (((m) & S_IFMT) == %2)';
"\\1 (((m)\\&S_IFMT)==\\2)/"; c_fix_arg = "#define[ \t]+(S_IS[A-Z]+)\\(m\\)[ \t]+"
"\\(m[ \t]*&[ \t]*"
sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*" "(S_IF[A-Z][A-Z][A-Z]+|0[0-9]+)"
"(m[ \t]*&[ \t]*\\(0[0-9]*\\)[ \t]*)/" "[ \t]*\\)";
"\\1 (((m)\\&S_IFMT)==\\2)/"; test_text = '#define S_ISREG(m) (m & S_IFREG) /* is regular? */';
}; };
@ -1382,13 +1360,55 @@ fix = {
sed = "/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n"; sed = "/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n";
}; };
/*
* Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
*/
fix = {
hackname = nested_motorola;
mach = "m68k-motorola-sysv*";
files = limits.h;
files = sys/limits.h;
sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
"/\\* max # bytes atomic in write to a\\)$@\\1 */@";
sed = "s@\\(/\\*#define\tHUGE_VAL\t3.[0-9e+]* \\)"
"\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
};
/*
* Fixing nested comments in ISC <sys/limits.h>
*/
fix = {
hackname = nested_sys_limits;
files = sys/limits.h;
select = CHILD_MAX;
sed = "/CHILD_MAX/s,/\\* Max, Max,";
sed = "/OPEN_MAX/s,/\\* Max, Max,";
test_text = "/*\n#define CHILD_MAX 20 /* Max, Max, ... */ /*\n"
"#define OPEN_MAX 20 /* Max, Max, ... */\n";
};
/* /*
* nested comment * nested comment
*/ */
fix = { fix = {
hackname = nested_comment; hackname = nested_auth_des;
files = rpc/rpc.h; files = rpc/rpc.h;
sed = 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@'; select = '(/\*.*rpc/auth_des\.h>.*)/\*';
c_fix = format;
c_fix_arg = "%1*/ /*";
test_text = "/*#include <rpc/auth_des.h> /* skip this */";
};
/*
* Avoid nested comments on Ultrix 4.3.
*/
fix = {
hackname = nested_ultrix;
files = rpc/svc.h;
sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
}; };
@ -1578,17 +1598,6 @@ fix = {
}; };
/*
* "!__STDC__" is "!defined( __STRICT_ANSI__ )"
*/
fix = {
hackname = sco_strict_ansi;
mach = "i?86-*-sco3.2*";
select = "^[ \t]*#[ \t]*if.*!__STDC__";
sed = 's/!__STDC__/!defined(__STRICT_ANSI__)/g';
};
/* /*
* The static functions lstat() and fchmod() in <sys/stat.h> * The static functions lstat() and fchmod() in <sys/stat.h>
* cause G++ grief since they're not wrapped in "if __cplusplus". * cause G++ grief since they're not wrapped in "if __cplusplus".
@ -1614,6 +1623,17 @@ fix = {
}; };
/*
* "!__STDC__" is "!defined( __STRICT_ANSI__ )"
*/
fix = {
hackname = sco_strict_ansi;
mach = "i?86-*-sco3.2*";
select = "^[ \t]*#[ \t]*if.*!__STDC__";
sed = 's/!__STDC__/!defined(__STRICT_ANSI__)/g';
};
/* /*
* Fix prototype declaration of utime in sys/times.h. * Fix prototype declaration of utime in sys/times.h.
* In 3.2v4.0 the const is missing. * In 3.2v4.0 the const is missing.
@ -1763,6 +1783,35 @@ fix = {
#endif #endif
/*
* IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
* in prototype without previous definition.
*/
fix = {
hackname = struct_file;
files = rpc/xdr.h;
select = '^.*xdrstdio_create.*struct __file_s';
c_fix = format;
c_fix_arg = "struct __file_s;\n%0";
test_text = "extern void xdrstdio_create( struct __file_s* );";
};
/*
* IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
* in prototype without previous definition.
*/
fix = {
hackname = struct_sockaddr;
files = rpc/auth.h;
select = "^.*authdes_create.*struct sockaddr";
bypass = "<sys/socket\.h>";
c_fix = format;
c_fix_arg = "struct sockaddr;\n%0";
test_text = "extern AUTH* authdes_create( struct sockaddr* );";
};
/* /*
* Apply fix this to all OSs since this problem seems to effect * Apply fix this to all OSs since this problem seems to effect
* more than just SunOS. * more than just SunOS.
@ -2394,19 +2443,6 @@ fix = {
}; };
/*
* Ultrix V4.[35] puts the declaration of uname before the definition
* of struct utsname, so the prototype (added by fixproto) causes havoc.
*/
fix = {
hackname = ultrix_fix_fixproto;
files = sys/utsname.h;
select = ULTRIX;
sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
"struct utsname;\n";
};
/* /*
* parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R. * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
*/ */
@ -2441,6 +2477,19 @@ fix = {
}; };
/*
* Ultrix V4.[35] puts the declaration of uname before the definition
* of struct utsname, so the prototype (added by fixproto) causes havoc.
*/
fix = {
hackname = ultrix_fix_fixproto;
files = sys/utsname.h;
select = ULTRIX;
sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
"struct utsname;\n";
};
/* /*
* Check for bad #ifdef line (in Ultrix 4.1) * Check for bad #ifdef line (in Ultrix 4.1)
*/ */
@ -2452,16 +2501,6 @@ fix = {
}; };
/*
* Avoid nested comments on Ultrix 4.3.
*/
fix = {
hackname = ultrix_nested_cmnt;
files = rpc/svc.h;
sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
};
/* /*
* Check for superfluous `static' (in Ultrix 4.2) * Check for superfluous `static' (in Ultrix 4.2)
* On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken. * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.