📄 inclhack.def
字号:
};/* * 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; bypass = '"C"|__BEGIN_DECLS'; sed = "1i\\\n" "#ifdef __cplusplus\\\n" "extern \"C\" {\\\n" "#endif\\\n\n"; sed = "$a\\\n" "#ifdef __cplusplus\\\n" "}\\\n" "#endif\n";};/* * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h */fix = { hackname = hpux_maxint; files = sys/param.h; sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n" "#ifndef MAXINT\n"; sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n" "#endif\n";};/* * 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;/";};/* * Determine if we're on Interactive Unix 2.2 or later, in which case we * need to fix some additional files. This is the same test for ISC that * Autoconf uses. On Interactive 2.2, certain traditional Unix * definitions (notably getc and putc in stdio.h) are omitted if __STDC__ * is defined, not just if _POSIX_SOURCE is defined. This makes it * impossible to compile any nontrivial program except with -posix. */fix = { hackname = interactv_add1; test = " -d /etc/conf/kconfig.d"; test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"'; files = "stdio.h"; files = "math.h"; files = "ctype.h"; files = "sys/limits.h"; files = "sys/fcntl.h"; files = "sys/dirent.h"; sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/" "!defined(_POSIX_SOURCE)/";};fix = { hackname = interactv_add2; test = " -d /etc/conf/kconfig.d"; test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"'; files = math.h; sed = "s/fmod(double)/fmod(double, double)/";};fix = { hackname = interactv_add3; test = " -d /etc/conf/kconfig.d"; test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"'; files = sys/limits.h; sed = "/CHILD_MAX/s,/\\* Max, Max,"; sed = "/OPEN_MAX/s,/\\* Max, Max,";};/* * Fix various _IO* defines, but do *not* quote the characters cgxtf. */fix = { hackname = io_def_quotes; select = "[ \t]*[ \t](_|DES)IO[A-Z]*[ \t]*\\( *[^,']"; sed = "s/\\([ \t]*[ \t]_IO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/"; sed = "s/\\([ \t]*[ \t]DESIO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/"; sed = "/#[ \t]*define[ \t]*[ \t]_IO/" "s/'\\([cgxtf]\\)'/\\1/g"; sed = "/#[ \t]*define[ \t]*[ \t]DESIOC/" 's/\'\([cdgx]\)\'/\1/g';};/* * Fix CTRL macros * * Basically, what is supposed to be happening is that every * _invocation_ of the "_CTRL()" or "CTRL()" macros is supposed to have * its argument inserted into single quotes. We _must_ do this because * ANSI macro substitution rules prohibit looking inside quoted strings * for the substitution names. A side effect is that the quotes are * inserted in the definitions of those macros as well. So, the last * three sed expressions are supposed to clean up the definitions, as * long as those definitions are using "c", "g" or "x" as the macro * argument :). Yuck. */fix = { hackname = ioctl_fix_ctrl; select = "CTRL[ \t]*\\("; sed = "/[^A-Z0-9_]CTRL[ \t]*(/" "s/\\([^']\\))/'\\1')/"; sed = "/[^A-Z0-9]_CTRL[ \t]*(/" "s/\\([^']\\))/'\\1')/"; sed = "/#[ \t]*define[ \t]*[ \t]CTRL/" "s/'\\([cgx]\\)'/\\1/g"; sed = "/#[ \t]*define[ \t]*[ \t]_CTRL/" "s/'\\([cgx]\\)'/\\1/g"; sed = "/#[ \t]*define[ \t]*[ \t]BSD43_CTRL/" "s/'\\([cgx]\\)'/\\1/g"; sed = "/#[ \t]*define[ \t]*[ \t]_*ISCTRL/" "s/'\\([cgx]\\)'/\\1/g";};/* * Check for missing ';' in struct */fix = { hackname = ip_missing_semi; files = netinet/ip.h; sed = "/^struct/,/^};/s/}$/};/";};/* * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr * in prototype without previous definition. */fix = { hackname = irix_multiline_cmnt; files = sys/types.h; sed = "s@type of the result@type of the result */@"; sed = "s@of the sizeof@/* of the sizeof@";};/* * Some IRIX header files contain the string "//" */fix = { hackname = irix_sockaddr; files = rpc/auth.h; select = "authdes_create.*struct sockaddr"; 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";};/* * Fixing ISC fmod declaration */fix = { hackname = isc_fmod; files = math.h; select = 'fmod\(double\)'; sed = "s/fmod(double)/fmod(double, 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,";};/* * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3 * use / * * / to concatenate tokens. */fix = { hackname = kandr_concat; files = "sparc/asm_linkage.h"; files = "sun3/asm_linkage.h"; files = "sun3x/asm_linkage.h"; files = "sun4/asm_linkage.h"; files = "sun4c/asm_linkage.h"; files = "sun4m/asm_linkage.h"; files = "sun4c/debug/asm_linkage.h"; files = "sun4m/debug/asm_linkage.h"; files = "arm/as_support.h"; files = "arm/mc_type.h"; files = "arm/xcb.h"; files = "dev/chardefmac.h"; files = "dev/ps_irq.h"; files = "dev/screen.h"; files = "dev/scsi.h"; files = "sys/tty.h"; files = "Xm.acorn/XmP.h"; files = bsd43/bsd43_.h; select = '/\*\*/'; sed = 's|/\*\*/|##|g';};/* * In limits.h, put #ifndefs around things that are supposed to be defined * in float.h to avoid redefinition errors if float.h is included first. * On HP/UX this patch does not work, because on HP/UX limits.h uses * multi line comments and the inserted #endif winds up inside the * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if * we find a #ifndef FLT_MIN we assume that all the required #ifndefs * 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 = { hackname = limits_ifndefs; files = "limits.h"; files = "sys/limits.h"; bypass = "ifndef[ \t]+FLT_MIN"; sed = "/[ \t]FLT_MIN[ \t]/i\\\n#ifndef FLT_MIN\n"; sed = "/[ \t]FLT_MIN[ \t]/a\\\n#endif\n"; sed = "/[ \t]FLT_MAX[ \t]/i\\\n#ifndef FLT_MAX\n"; sed = "/[ \t]FLT_MAX[ \t]/a\\\n#endif\n"; sed = "/[ \t]FLT_DIG[ \t]/i\\\n#ifndef FLT_DIG\n"; sed = "/[ \t]FLT_DIG[ \t]/a\\\n#endif\n"; 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/";};/* * Delete the '#define void int' line from curses.h on Lynx */fix = { hackname = lynx_void_int; files = curses.h; select = "#[ \t]*define[ \t]+void[ \t]+int"; sed = "/#[ \t]*define[ \t][ \t]*void[ \t]int/d";};/* * Fix fcntl prototype in fcntl.h on LynxOS. */fix = { hackname = lynxos_fcntl_proto; files = fcntl.h; select = 'fcntl.*\(int, int, int\)'; sed = 's/\(fcntl.*(int, int, \)int)/\1...)/';};/* * libm.a on m88k-motorola-sysv3 contains a stupid optimization for * function hypot(), which returns the second argument without even * looking at its value, if the other is 0.0. Another drawback is * that fix-header doesn't fix fabs' prototype, and I have no idea why. */fix = { hackname = m88k_bad_hypot_opt; mach = "m88k-motorola-sysv3*"; files = "math.h"; sed = "s/extern double floor(), ceil(), fmod(), fabs();/" "extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/"; sed = "/^extern double hypot();$/a\\\n" "\\/* Workaround a stupid Motorola optimization if one\\\n" " of x or y is 0.0 and the other is negative! *\\/\\\n" "#ifdef __STDC__\\\n" "static __inline__ double fake_hypot (double x, double y)\\\n" "#else\\\n" "static __inline__ double fake_hypot (x, y)\\\n" "\tdouble x, y;\\\n" "#endif\\\n" "{\\\n" "\treturn fabs (hypot (x, y));\\\n" "}\\\n" "#define hypot\tfake_hypot\n";};/* * Fix incorrect S_IF* definitions on m88k-sysv3. */fix = { hackname = m88k_bad_s_if; mach = "m88k-*-sysv3*"; files = sys/stat.h; select = "#define[ \t]+S_IS[A-Z]*(m)[ \t]"; sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*" "(m[ \t]*&[ \t]*\\(S_IF[A-Z][A-Z][A-Z][A-Z]*\\)[ \t]*)/" "\\1 (((m)\\&S_IFMT)==\\2)/"; sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*" "(m[ \t]*&[ \t]*\\(0[0-9]*\\)[ \t]*)/" "\\1 (((m)\\&S_IFMT)==\\2)/";};/* * Put cpp wrappers around these include files to avoid redeclaration * errors during multiple inclusion on m88k-tektronix-sysv3. */fix = { hackname = m88k_multi_incl; mach = "m88k-tektronix-sysv3*"; files = "time.h"; bypass = "#ifndef"; shell = "echo Fixing $file, to protect against multiple inclusion. >&2 cpp_wrapper=`echo $file | sed -e 's,\\.,_,g' -e 's,/,_,g'` echo \"#ifndef __GCC_GOT_${cpp_wrapper}_\" echo \"#define __GCC_GOT_${cpp_wrapper}_\" cat echo \"#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\"";};/* * Fix non-ansi machine name defines * File selection is split into two parts: the shell version as * a single patch, and the program version with each patch separate. * Each is substantially faster for the particular environment. * You have a dual maintenance problem here. */fix = { hackname = machine_name; /* * Select '#if.*' and '#elif" with possible non-ansi symbols * The only non-ansi symbols we know about start with one of: * MRS_bhimnprstuv * If any are added to the substitution list, then add it to * the selection list as well. Hopefully we can avoid names * starting with "d" and "l", because this pattern would then * match "defined" and "lint" as well. I suppose we could add * a "bypass = lint" if we had to though. * * The fixinc_eol stuff is to work around a bug in the sed */ select = "^#[ \t]*(if|elif).*" "[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]"; exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]" "(" "M32" "|_*MIPSE[LB]" "|_*SYSTYPE_[A-Z0-9]" "|_*[Rr][34]000" "|_*host_mips" "|_*i386" "|_*mips" "|bsd4" "|is68k" "|m[68]8k" "|mc680" "|news" "|ns32000" "|pdp11" "|pyr" "|sel" "|sony_news" "|sparc" "|sun" "|tahoe" "|tower" "|u370" "|u3b" "|unix" "|vax" ")"; sed = ":loop\n" '/\\\\$/' "N\n" 's/\\\\$/\\\\+++fixinc_eol+++/' "\n" '/\\\\$/' "b loop\n" 's/\\\\+++fixinc_eol+++/\\\\/g' "\n" "/#[\t ]*[el]*if/ {\n" "\ts/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g\n" "\ts/ M32 / __M32__ /g\n" "\ts/ _*MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n" "\ts/ _*SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n" "\ts/ _*\\([Rr][34]\\)000 / __\\1000__ /g\n" "\ts/ _*host_mips / __host_mips__ /g\n" "\ts/ _*i386 / __i386__ /g\n" "\ts/ _*mips / __mips__ /g\n" "\ts/ bsd4\\([0-9]\\) / __bsd4\\1__ /g\n" "\ts/ is68k / __is68k__ /g\n" "\ts/ m68k / __m68k__ /g\n" "\ts/ m88k / __m88k__ /g\n" "\ts/ mc680\\([0-9]\\)0 / __mc680\\10__ /g\n" "\ts/ news\\([0-9]*\\) / __news\\1__ /g\n" "\ts/ ns32000 / __ns32000__ /g\n" "\ts/ pdp11 / __pdp11__ /g\n" "\ts/ pyr / __pyr__ /g\n" "\ts/ sel / __sel__ /g\n" "\ts/ sony_news / __sony_news__ /g\n"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -