📄 inclhack.def
字号:
"\ts/ sparc / __sparc__ /g\n" "\ts/ sun\\([a-z0-9]*\\) / __sun\\1__ /g\n" "\ts/ tahoe / __tahoe__ /g\n" "\ts/ tower\\([_0-9]*\\) / __tower\\1__ /g\n" "\ts/ u370 / __u370__ /g\n" "\ts/ u3b\\([0-9]*\\) / __u3b\\1__ /g\n" "\ts/ unix / __unix__ /g\n" "\ts/ vax / __vax__ /g\n" "\ts/ \\([a-zA-Z0-9_][a-zA-Z0-9_]*\\) /\\1/g\n\t}";};/* * Some math.h files define struct exception, which conflicts with * the class exception defined in the C++ file std/stdexcept.h. We * redefine it to __math_exception. This is not a great fix, but I * haven't been able to think of anything better. */fix = { hackname = math_exception; files = math.h; select = "struct exception"; sed = "/struct exception/i\\\n" "#ifdef __cplusplus\\\n" "#define exception __math_exception\\\n" "#endif\n"; sed = "/struct exception/a\\\n" "#ifdef __cplusplus\\\n" "#undef exception\\\n" "#endif\n"; sed = "/matherr/i\\\n" "#ifdef __cplusplus\\\n" "#define exception __math_exception\\\n" "#endif\n"; sed = "/matherr/a\\\n" "#ifdef __cplusplus\\\n" "#undef exception\\\n" "#endif\n";#ifdef MATH_EXCEPTION_FIXEDI think this patch needs some more thinking.This is from SVR4.2 (With '#' replaced with '@').Perhaps we could do without the "/matherr/a" entries?Can we bypass the entire fix if someone was astuteenough to have '#ifdef __cplusplus' anywhere in the file?*** /usr/include/math.h Fri Apr 3 18:54:59 1998--- math.h Sun May 9 07:28:58 1999****************** 25,31 ****--- 25,37 ---- @ifndef __cplusplus + @ifdef __cplusplus+ @define exception __math_exception+ @endif struct exception+ @ifdef __cplusplus+ @undef exception+ @endif { int type; char *name;****************** 34,40 ****--- 40,58 ---- double retval; }; + @ifdef __cplusplus+ @define exception __math_exception+ @endif+ @ifdef __cplusplus+ @define exception __math_exception+ @endif extern int matherr(struct exception *);+ @ifdef __cplusplus+ @undef exception+ @endif+ @ifdef __cplusplus+ @undef exception+ @endif @endif /*__cplusplus*/#endif};/* * In math.h, put #ifndefs around things that might be defined * in a gcc specific math-*.h file. */fix = { hackname = math_gcc_ifndefs; files = math.h; shell = /* * First see if we have a definition for DBL_MAX in float.h * If we do, we will replace the one in math.h with that one. */ /* * IF we have such a define *and* HUGE_VAL is defined to be DBL_MAX * *and* DBL_MAX is _not_ defined in the current file (math.h), * THEN replace the defined value of HUGE_VAL * ELSE just copy stdin to stdout so the main filter can process it */ /* * Put conditional guards around the HUGE_VAL definition. */ "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h " "2>/dev/null`\n\n" "\tif ( test -n \"${dbl_max_def}\" \\\n" "\t\t-a -n \"`egrep '#define[ \t]*HUGE_VAL[ \t]+DBL_MAX' $file`\" \\\n" "\t\t-a -z \"`egrep '#define[ \t]+DBL_MAX[ \t]+' $file`\"\n" "\t ) > /dev/null 2>&1\n" "\tthen sed -e '/define[ \t]HUGE_VAL[ \t]DBL_MAX/s/DBL_MAX/$dbl_max_def/'" "\n\telse cat ; fi |\n" "\tsed -e '/define[ \t]HUGE_VAL[ \t]/i\\\n#ifndef HUGE_VAL\n' " "-e '/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n'";};/* * nested comment */fix = { hackname = nested_comment; files = rpc/rpc.h; sed = 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@';};/* * fix bogus recursive stdlib.h in NEWS-OS 4.0C */fix = { hackname = news_os_recursion; files = stdlib.h; select = "#include <stdlib.h>"; sed = "/^#include <stdlib.h>/i\\\n" "#ifdef BOGUS_RECURSION\n"; sed = "/^#include <stdlib.h>/a\\\n" "#endif\n";};/* * NeXT 3.2 adds const prefix to some math functions. * These conflict with the built-in functions. */fix = { hackname = next_math_prefix; files = ansi/math.h; select = "^extern.*double.*__const__.*"; sed = "/^extern.*double.*__const__.*sqrt(/s/__const__//"; sed = "/^extern.*double.*__const__.*fabs(/s/__const__//"; sed = "/^extern.*double.*__const__.*cos(/s/__const__//"; sed = "/^extern.*double.*__const__.*hypot(/s/__const__//"; sed = "/^extern.*double.*__const__.*sin(/s/__const__//";};/* * NeXT 3.2 uses the word "template" as a parameter for some * functions. GCC reports an invalid use of a reserved key word * with the built-in functions. NeXT 3.2 includes the keyword * volatile in the prototype for abort(). This conflicts with * the built-in definition. */fix = { hackname = next_template; files = bsd/libc.h; select = template; sed = '/\(.*template\)/s/template//'; sed = "/extern.*volatile.*void.*abort/s/volatile//";};/* * NeXT 3.2 includes the keyword volatile in the abort() and exit() * function prototypes. That conflicts with the built-in functions. */fix = { hackname = next_volitile; files = ansi/stdlib.h; select = volatile; sed = "/extern.*volatile.*void.*exit/s/volatile//"; sed = "/extern.*volatile.*void.*abort/s/volatile//";};/* * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1. * Note that version 3 of the NeXT system has wait.h in a different directory, * so that this code won't do anything. But wait.h in version 3 has a * conditional, so it doesn't need this fix. So everything is okay. */fix = { hackname = next_wait_union; files = sys/wait.h; select = 'wait\(union wait'; sed = "s@wait(union wait@wait(void@";};/* * a missing semi-colon at the end of the nodeent structure definition. */fix = { hackname = nodeent_syntax; files = netdnet/dnetdb.h; sed = "s/char.*na_addr *$/char *na_addr;/";};/* * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by * defining regex.h related types. This causes libg++ build and usage * failures. Fixing this correctly requires checking and modifying 3 files. */fix = { hackname = osf_namespace_a; files = reg_types.h; files = sys/lc_core.h; test = " -r reg_types.h"; test = " -r sys/lc_core.h"; test = " -n \"`grep '} regex_t;' reg_types.h`\""; test = " -z \"`grep __regex_t regex.h`\""; sed = "s/regex_t/__regex_t/g"; sed = "s/regoff_t/__regoff_t/g"; sed = "s/regmatch_t/__regmatch_t/g";};fix = { hackname = osf_namespace_b; files = regex.h; test = " -r reg_types.h"; test = " -r sys/lc_core.h"; test = " -n \"`grep '} regex_t;' reg_types.h`\""; test = " -z \"`grep __regex_t regex.h`\""; sed = "/#include <reg_types.h>/a\\\n" "typedef __regex_t\tregex_t;\\\n" "typedef __regoff_t\tregoff_t;\\\n" "typedef __regmatch_t\tregmatch_t;\n";};/* * Fix __page_size* declarations in pthread.h AIX 4.1.[34]. * The original ones fail if uninitialized externs are not common. * This is the default for all ANSI standard C++ compilers. */fix = { hackname = pthread_page_size; files = pthread.h; select = "^int __page_size"; sed = "s/^int __page_size/extern int __page_size/";};/* * Fix return type of fread and fwrite on sysV68 */#ifdef LATERfix = { hackname = read_ret_type; files = stdio.h; sed = "s/^\\(extern int\tfclose(), fflush()\\), " "\\(fread(), fwrite()\\)\\(.*\\)$" "/extern unsigned int\t\\2;\\\n\\1\\3/";};#endif/* * function class(double x) conflicts with C++ keyword on rs/6000 */fix = { hackname = rs6000_double; files = math.h; select = '[^a-zA-Z_]class\('; sed = "/class[(]/i\\\n#ifndef __cplusplus\n"; sed = "/class[(]/a\\\n#endif\n";};/* * Wrong fchmod prototype on RS/6000. */fix = { hackname = rs6000_fchmod; files = sys/stat.h; select = 'fchmod\(char'; sed = 's/fchmod(char \*/fchmod(int/';};/* * parameters conflict with C++ new on rs/6000 */fix = { hackname = rs6000_param; files = "stdio.h"; files = "unistd.h"; sed = 's@rename(const char \*old, const char \*new)@' 'rename(const char *_old, const char *_new)@';};/* * Sony NEWSOS 5.0 does not support the complete ANSI C standard. */#ifdef SONYfix = { hackname = sony_ctype; files = ctype.h; test = " -x /bin/sony"; test = " ! -z \"`if /bin/sony ; then echo true ; fi`\""; sed = "s/__ctype/_ctype/g";};#endif/* * Incorrect #include in Sony News-OS 3.2. */fix = { hackname = sony_include; files = machine/machparam.h; select = '"\.\./machine/endian.h"'; sed = 's@"../machine/endian.h"@<machine/endian.h>@';};/* * Sony NEWSOS 5.0 does not support the complete ANSI C standard. */#ifdef SONYfix = { hackname = sony_stdio; files = stdio.h; test = " -x /bin/sony"; test = " ! -z \"`if /bin/sony ; then echo true ; fi`\""; sed = "s/__filbuf/_filbuf/g\n" "s/__flsbuf/_flsbuf/g\n" "s/__iob/_iob/g";};#endif/* * Add a `static' declaration of `getrnge' into <regexp.h>. * * Don't do this if there is already a `static void getrnge' declaration * present, since this would cause a redeclaration error. Solaris 2.x has * such a declaration. */#ifdef SVR4fix = { hackname = static_getrnge; files = regexp.h; bypass = "static void getrnge"; sed = "/^static int[ \t]*size;/c\\\n" "static int size ;\\\n\\\n" "static int getrnge ();";};#endif/* * a missing semi-colon at the end of the statsswtch structure definition. */fix = { hackname = statsswtch; files = rpcsvc/rstat.h; select = "boottime$"; sed = "s/boottime$/boottime;/";};/* * Don't use or define the name va_list in stdio.h. * This is for ANSI and also to interoperate properly with gcc's varargs.h. * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list */fix = { hackname = stdio_va_list; files = stdio.h; /* * Use __gnuc_va_list in arg types in place of va_list. * On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the * trailing parentheses and semicolon save all other systems from this. * Define __va_list__ (something harmless and unused) instead of va_list. * Don't claim to have defined va_list. */ shell = "if ( egrep \"__need___va_list\" $file ) > /dev/null 2>&1 ; then : else echo \"#define __need___va_list\" echo \"#include <stdarg.h>\" fi sed -e 's@ va_list @ __gnuc_va_list @' \\ -e 's@ va_list)@ __gnuc_va_list)@' \\ -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \\ -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \\ -e 's@ va_list@ __va_list__@' \\ -e 's@\\*va_list@*__va_list__@' \\ -e 's@ __va_list)@ __gnuc_va_list)@' \\ -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \\ -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \\ -e 's@VA_LIST@DUMMY_VA_LIST@' \\ -e 's@_Va_LIST@_VA_LIST@'";};/* * Check for strict ansi compliance */#ifdef STRICT_ANSIfix = { hackname = strict_ansi; select = "__STDC__[ \t]*[=!]=[ \t]*[01]"; sed = "s/__STDC__[ \t]*==[ \t]*0/!defined (__STRICT_ANSI__)/g"; sed = "s/__STDC__[ \t]*!=[ \t]*0/defined (__STRICT_ANSI__)/g"; sed = "s/__STDC__[ \t]*==[ \t]*1/defined (__STRICT_ANSI__)/g"; sed = "s/__STDC__[ \t]*!=[ \t]*1/!defined (__STRICT_ANSI__)/g";};#endif/* * Fix bogus #ifdef on SunOS 4.1. */fix = { hackname = sun_bogus_ifdef; files = "hsfs/hsfs_spec.h"; files = "hsfs/iso_spec.h"; select = '#ifdef __i386__ || __vax__'; sed = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";};/* * Fix bogus #ifdef on SunOS 4.1. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -