📄 inclhack.def
字号:
fix = { hackname = sun_bogus_ifdef_sun4c; files = "hsfs/hsnode.h"; select = '#ifdef __i386__ || __sun4c__'; sed = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";};/* * Fix the CAT macro in SunOS memvar.h. */fix = { hackname = sun_catmacro; files = pixrect/memvar.h; select = "^#define[ \t]+CAT\\(a,b\\)"; sed = "/^#define[ \t]CAT(a,b)/ i\\\n" "#ifdef __STDC__ \\\n" "#define CAT(a,b) a##b\\\n" "#else\n"; sed = "/^#define[ \t]CAT(a,b)/ a\\\n" "#endif\n";};/* * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1. * Also fix return type of {m,re}alloc in <malloc.h> on sysV68 */fix = { hackname = sun_malloc; files = malloc.h; sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g"; sed = "s/int[ \t][ \t]*free/void\tfree/g"; sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g"; sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";};/* * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because * many other systems have similar text but correct versions of the file. * To ensure only Sun's is fixed, we grep for a likely unique string. * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t ) */fix = { hackname = sun_memcpy; files = memory.h; select = "/\\*\t@\\(#\\)" "(head/memory.h\t50.1\t " "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/"; sed = "1i\\\n/* This file was generated by fixincludes */\\\n" "#ifndef __memory_h__\\\n" "#define __memory_h__\\\n\\\n" "#ifdef __STDC__\\\n" "extern void *memccpy();\\\n" "extern void *memchr();\\\n" "extern void *memcpy();\\\n" "extern void *memset();\\\n" "#else\\\n" "extern char *memccpy();\\\n" "extern char *memchr();\\\n" "extern char *memcpy();\\\n" "extern char *memset();\\\n" "#endif /* __STDC__ */\\\n\\\n" "extern int memcmp();\\\n\\\n" "#endif /* __memory_h__ */\n"; sed = "1,$d";};/* * Check for yet more missing ';' in struct (in SunOS 4.0.x) */fix = { hackname = sun_rusers_semi; files = rpcsvc/rusers.h; select = "_cnt$"; sed = "/^struct/,/^};/s/_cnt$/_cnt;/";};/* * signal.h on SunOS defines signal using (), * which causes trouble when compiling with g++ -pedantic. */fix = { hackname = sun_signal; files = sys/signal.h; files = signal.h; select = "^void\t" '\(\*signal\(\)\)\(\);'; sed = "/^void\t" '(\*signal())();$/i' "\\\n" "#ifdef __cplusplus" "\\\n" "void\t(*signal(...))(...);" "\\\n" "#else" "\n"; sed = "/^void\t" '(\*signal())();$/a' "\\\n" '#endif' "\n";};/* * Apply fix this to all OSs since this problem seems to effect * more than just SunOS. In general, fixes which are triggered * by a specific target are bad. */fix = { hackname = sun_auth_proto; files = rpc/auth.h; files = rpc/clnt.h; files = rpc/svc.h; files = rpc/xdr.h; /* * Select those files containing '(*name)()'. */ select = '\(\*[a-z][a-z_]*\)\(\)'; sed = 's' '/^\(.*(\*[a-z][a-z_]*)(\)' '\();.*\)' "/\\\n" "#ifdef __cplusplus\\\n" '\1...\2' "\\\n" "#else\\\n" '\1\2' "\\\n" "#endif" "/";};/* * math.h on SunOS 4 puts the declaration of matherr before the definition * of struct exception, so the prototype (added by fixproto) causes havoc. */fix = { hackname = sunos_matherr_decl; files = math.h; /* * Once a declaration for 'struct exception' is found, * stop trying to insert a forward reference for it. */ sed = "/^struct exception/,$b"; sed = "/matherr/i\\\nstruct exception;\n";};/* * Correct the return type for strlen in strings.h in SunOS 4. */fix = { hackname = sunos_strlen; files = strings.h; sed = "s/int[ \t]*strlen();/__SIZE_TYPE__ strlen();/";};/* * Solaris math.h and floatingpoint.h define __P without protection, * which conflicts with the fixproto definition. The fixproto * definition and the Solaris definition are used the same way. */#ifdef SVR4fix = { hackname = svr4__p; files = math.h; files = floatingpoint.h; select = "^#define[ \t]*__P"; sed = "/^#define[ \t]*__P/i\\\n#ifndef __P\n"; sed = "/^#define[ \t]*__P/a\\\n#endif\n";};#endif/* * Disable apparent native compiler optimization cruft in SVR4.2 <string.h> * that is visible to any ANSI compiler using this include. Simply * delete the lines that #define some string functions to internal forms. */#ifdef SVR4fix = { hackname = svr4_disable_opt; files = string.h; select = '#define.*__std_hdr_'; sed = '/#define.*__std_hdr_/d';};#endif/* * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__. */#ifdef SVR4fix = { hackname = svr4_endian; files = sys/endian.h; bypass = '__GNUC__'; sed = "/#\tifdef\t__STDC__/i\\\n" "# if !defined (__GNUC__) && !defined (__GNUG__)\n"; sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /"; sed = "/# include\t<sys\\/byteorder.h>/i\\\n" "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";};#endif/* * Remove useless extern keyword from struct forward declarations * in <sys/stream.h> and <sys/strsubr.h> */#ifdef SVR4fix = { hackname = svr4_extern_struct; files = sys/stream.h; files = sys/strsubr.h; select = 'extern struct [a-z_]*;'; sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';};#endif/* * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4 * systems the file <ftw.h> contains extern declarations of these * functions followed by explicitly `static' definitions of these * functions... and that's not allowed according to ANSI C. (Note * however that on Solaris, this header file glitch has been pre-fixed by * Sun. In the Solaris version of <ftw.h> there are no static * definitions of any function so we don't need to do any of this stuff * when on Solaris. */#ifdef SVR4#ifndef SOLARISfix = { hackname = svr4_ftw; files = ftw.h; select = '^extern int ftw\(const'; sed = '/^extern int ftw(const/i' "\\\n" "#if !defined(_STYPES)\\\n" "static\\\n" "#else\\\n" "extern\\\n" "#endif"; sed = 's/extern \(int ftw(const.*\)$/\1/'; sed = "/^extern int nftw/i\\\n" "#if defined(_STYPES)\\\n" "static\\\n" "#else\\\n" "extern\\\n" "#endif"; sed = 's/extern \(int nftw.*\)$/\1/'; sed = "/^extern int ftw(),/c\\\n" "#if !defined(_STYPES)\\\n" "static\\\n" "#else\\\n" "extern\\\n" "#endif\\\n" " int ftw();\\\n" "#if defined(_STYPES)\\\n" "static\\\n" "#else\\\n" "extern\\\n" "#endif\\\n" " int nftw();";};#endif#endif/* * Fix broken decl of getcwd present on some svr4 systems. */#ifdef SVR4fix = { hackname = svr4_getcwd; files = stdlib.h; files = unistd.h; select = 'getcwd\(char \*, int\)'; sed = 's/getcwd(char \*, int)/getcwd(char *, size_t)/';};#endif/* * set ifdef _KERNEL */#ifdef SVR4fix = { hackname = svr4_kernel; files = fs/rfs/rf_cache.h; files = sys/erec.h; files = sys/err.h; files = sys/char.h; files = sys/getpages.h; files = sys/map.h; files = sys/cmn_err.h; files = sys/kdebugger.h; bypass = '_KERNEL'; sed = "1i\\\n#ifdef _KERNEL"; sed = "$a\\\n#endif /* _KERNEL */";};#endif/* * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They * tend to conflict with the compiler's own definition of this symbol. (We * will use the compiler's definition.) * Likewise __sparc, for Solaris, and __i860, and a few others * (guessing it is necessary for all of them). */#ifdef SVR4fix = { hackname = svr4_mach_defines; files = ieeefp.h; select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]"; sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";};#endif/* * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>. */#ifdef SVR4fix = { hackname = svr4_mkdev; files = sys/mkdev.h; sed = "/^dev_t makedev(const/c\\\n" "static dev_t makedev(const major_t, const minor_t);"; sed = "/^dev_t makedev()/c\\\n" "static dev_t makedev();"; sed = "/^major_t major(const/c\\\n" "static major_t major(const dev_t);"; sed = "/^major_t major()/c\\\n" "static major_t major();"; sed = "/^minor_t minor(const/c\\\n" "static minor_t minor(const dev_t);"; sed = "/^minor_t minor()/c\\\n" "static minor_t minor();";};#endif/* * Fix reference to NC_NPI_RAW in <sys/netcspace.h>. * Also fix types of array initializers. */#ifdef SVR4fix = { hackname = svr4_netcspace; files = sys/netcspace.h; select = 'NC_NPI_RAW'; sed = 's/NC_NPI_RAW/NC_TPI_RAW/g'; sed = 's/NC_/(unsigned long) NC_/';};#endif/* * Fix reference to NMSZ in <sys/adv.h>. */#ifdef SVR4fix = { hackname = svr4_nmsz; files = sys/adv.h; select = '\[NMSZ\]'; sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';};#endif/* * Completely replace <sys/varargs.h> with a file that includes gcc's * stdarg.h or varargs.h files as appropriate. */#ifdef SVR4fix = { hackname = svr4_no_varargs; files = sys/varargs.h; shell = "cat > /dev/null\n" "cat << _EOF_\n" "/* This file was generated by fixincludes. */\n" "#ifndef _SYS_VARARGS_H\n" "#define _SYS_VARARGS_H\n\n" "#ifdef __STDC__\n" "#include <stdarg.h>\n" "#else\n" "#include <varargs.h>\n" "#endif\n\n" "#endif /* _SYS_VARARGS_H */\n" "_EOF_";};#endif/* * Fix broken decl of profil present on some svr4 systems. */#ifdef SVR4fix = { hackname = svr4_profil; files = stdlib.h; files = unistd.h; sed = 's/profil(unsigned short \*, unsigned int, ' 'unsigned int, unsigned int)' '/profil(unsigned short *, size_t, int, unsigned)/';};#endif/* * Convert functions to prototype form, and fix arg names in <sys/stat.h>. */#ifdef SVR4fix = { hackname = svr4_proto_form; files = sys/stat.h; select = 'const extern'; sed = "/^stat([ \t]*[^c]/ {\nN\nN\n" "s/(.*)\\n/( /\n" "s/;\\n/, /\n" "s/;$/)/\n" "}"; sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n" "s/(.*)\\n/( /\n" "s/;\\n/, /\n" "s/;$/)/\n" "}"; sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n" "s/(.*)\\n/( /\n" "s/;\\n/, /\n" "s/;$/)/\n" "}"; sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n" "s/(.*)\\n/( /\n" "s/;\\n/, /g\n" "s/;$/)/\n" "}"; sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g"; sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g"; sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g"; sed = "1,$s/ret\\([^u]\\)/__ret\\1/g"; sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g"; sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";};#endif/* * Add a prototyped declaration of mmap to <sys/mman.h>. */#ifdef SVR4fix = { hackname = svr4_proto_mmap; files = sys/mman.h; select = '^extern caddr_t mmap();$'; sed = '/^extern caddr_t mmap();$/c' "\\\n" "#ifdef __STDC__\\\n" "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n" "#else /* !defined(__STDC__) */\\\n"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -