📄 inclhack.def
字号:
/* -*- Mode: C -*- */autogen definitions inclhack;/* * Define all the fixes we know about for repairing damaged headers *//* * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition * of struct rusage, so the prototype (added by fixproto) causes havoc. */fix = { hackname = aix_syswait; files = sys/wait.h; select = "bos325,"; sed = "/^extern pid_t wait3();$/i\\\n" "struct rusage;\n";};/* * sys/signal.h on some versions of AIX uses volatile in the typedef of * sig_atomic_t, which causes gcc to generate a warning about duplicate * volatile when a sig_atomic_t variable is declared volatile, as * required by ANSI C. */fix = { hackname = aix_volatile; files = sys/signal.h; select = "typedef volatile int sig_atomic_t"; sed = "s/typedef volatile int sig_atomic_t" "/typedef int sig_atomic_t/";};/* * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX. */fix = { hackname = alpha_getopt; files = "stdio.h"; files = "stdlib.h"; select = 'getopt\(int, char \*\['; sed = 's/getopt(int, char \*\[\],[ ]*char \*)/' 'getopt(int, char *const[], const char *)/';};/* * Remove erroneous parentheses in sym.h on Alpha OSF/1. */fix = { hackname = alpha_parens; files = sym.h; select = '#ifndef\(__mips64\)'; sed = "s/#ifndef(__mips64)/#ifndef __mips64/";};/* * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0 */fix = { hackname = alpha_sbrk; files = unistd.h; select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\("; sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";};/* * Fix this ARM/RISCiX file where ___type is a Compiler * hint that is specific to the Norcroft compiler. */fix = { hackname = arm_norcroft_hint; select = "___type p_type"; files = "X11/Intrinsic.h"; sed = "s/___type p_type/p_type/";};/* * Fix this ARM/RISCiX file to avoid interfering * with the use of __wchar_t in cc1plus. */fix = { hackname = arm_wchar; files = stdlib.h; select = "#[ \t]*define[ \t]*__wchar_t"; sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/"; sed = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";};/* * This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89; * gcc doesn't understand it. */fix = { hackname = aux_asm; files = sys/param.h; select = "#ifndef NOINLINE"; sed = "s|#ifndef NOINLINE" "|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|";};/* * For C++, avoid any typedef or macro definition of bool, * and use the built in type instead. * HP/UX 10.20 also has it in curses_colr/curses.h. */fix = { hackname = avoid_bool; files = curses.h; files = curses_colr/curses.h; files = term.h; files = tinfo.h; 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" "#endif\n"; sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/i\\\n" "#ifndef __cplusplus\n"; sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/a\\\n" "#endif\n"; sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/i\\\n" "#ifndef __cplusplus\n"; sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/a\\\n" "#endif\n"; sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/i\\\n" "#ifndef __cplusplus\n"; sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n" "#endif\n";};/* * 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/";};/* * 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/";};/* * Fix #defines under Alpha OSF/1: * The following files contain '#pragma extern_prefix "_FOO"' followed by * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these * statements is to reduce namespace pollution. While these macros work * properly in most cases, they don't allow you to take a pointer to the * "something" being modified. To get around this limitation, change these * statements to be of the form '#define something _FOOsomething'. */fix = { hackname = bad_lval; files = libgen.h; files = dirent.h; files = ftw.h; files = grp.h; files = ndbm.h; files = pthread.h; files = pwd.h; files = signal.h; files = standards.h; files = stdlib.h; files = string.h; files = stropts.h; files = time.h; files = unistd.h; sed = "s/^[ \t]*#[ \t]*define[ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*" "\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";};/* * check for broken assert.h that needs stdio.h */fix = { hackname = broken_assert_stdio; files = assert.h; select = stderr; bypass = "include.*stdio.h"; sed = "1i\\\n" "#include <stdio.h>\n";};/* * check for broken assert.h that needs stdlib.h */fix = { hackname = broken_assert_stdlib; files = assert.h; select = 'exit *\(|abort *\('; bypass = "include.*stdlib.h"; sed = "1i\\\n" "#ifdef __cplusplus\\\n" "#include <stdlib.h>\\\n" "#endif\n";};/* * Note that BSD43_* are used on recent MIPS systems. */fix = { hackname = bsd43_io_macros; select = "BSD43__IO"; /* * Put single quotes aroung the character that appears after '(' * and before ',', UNLESS it is a 'c' or 'g' or 'x'. */ sed = "/[ \t]BSD43__IO[A-Z]*[ \t]*(/" 's/(\(.\),/(\'\1\',/'; sed = "/#[ \t]*define[ \t]*[ \t]BSD43__IO/" 's/\'\([cgx]\)\'/\1/g';};/* * Fix <c_asm.h> on Digital UNIX V4.0: * It contains a prototype for a DEC C internal asm() function, * clashing with gcc's asm keyword. So protect this with __DECC. */fix = { hackname = dec_intern_asm; files = c_asm.h; sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n"; sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n" "#endif\n";};#ifdef no_more/* * And also with the HP-UX 10 and HP-UX 11 sys/pci.h file */fix = { hackname = cxx_cmnt_hpux; files = sys/pci.h; select = "System Private Structures"; sed = "s|//.*$||g";};/* * Turning // comments into normal comments trashes this IRIX 4.0.1 * header file, which embeds // comments inside multi-line * comments. If this looks like the IRIX header file, we refix it by * just throwing away the // comments. */fix = { hackname = cxx_cmnt_irix; files = fam.h; select = indigo.esd; sed = "s|//.*$||g";};/* * Same problem with a file from SunOS 4.1.3 : a header file containing * the string "//" embedded in "/ * * /" */fix = { hackname = cxx_cmnt_sunos; files = sbusdev/audiovar.h; files = sys/audiovar.h; sed = "s|//.*$||g";};/* * There is a similar problem with the VxWorks drv/netif/if_med.h file. */fix = { hackname = cxx_cmnt_vxworks; files = drv/netif/if_med.h; select = "Wind River"; sed = "s|//.*$||g";};#endif/* * Remove the double-slash comments * They *must* be removed so it will not create nested comments!! * However, they will *not* be removed if the file name ends with * any of "++", ".hh" or ".H", or if the file name contains "cxx/". * * There *used* to be a number of similar problems in various OSes: * Turning // comments into normal comments trashes this IRIX 4.0.1 * header file, which embeds // comments inside multi-line * comments. If this looks like the IRIX header file, we refix it by * just throwing away the // comments. * Same problem with a file from SunOS 4.1.3 : a header file containing * the string "//" embedded in "/ * * /" * There is a similar problem with the VxWorks drv/netif/if_med.h file. * And also with the HP-UX 10 and HP-UX 11 sys/pci.h file * Now that we delete the // comments instead of converting them to / * * /, * traditional hacks like irix_bogus_cxx_cmnt, no longer work (which * strangely enough was also used on alpha-dec-osf4.0d). If we skip the * hack whenever we see ``"//"'', then the need for the secondary hack * disappears. Note: it is painful to ensure that the first quote * exists, so we just check for the trailing quote directly abutting * the //. Note: We should never touch a line that has // completely * within quotes but this is somewhat hard to check for. * Ultimately, this fix ought to go inside of C code where * we can do a better analysis on the need and method for fixing. */fix = { hackname = no_double_slash; /* * Test that the file-to-fix does not from a C++ directory * Also, only accept double slashes that are not part of URL's * and are not the end of a quoted string. */ test = ' -z "`echo ${file} | egrep \'(CC|cxx|\+\+)/\'`"'; select = '(^|[^:])//[^"*]'; sed = 's,^//.*$,,'; sed = 's,[^:]//[^"].*$,,';};/* * Fix these Sun OS files to avoid an invalid identifier in an #ifdef. */fix = { hackname = ecd_cursor; files = "sunwindow/win_lock.h"; files = "sunwindow/win_cursor.h"; sed = "s/ecd.cursor/ecd_cursor/";};/* * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains * tiny static wrappers that aren't C++ safe. */fix = { hackname = sco5_stat_wrappers; mach = "i*86-*-sco3.2v5*"; files = "sys/stat.h"; sed = "/^static int[ \t]*[a-z]*stat(/i\\\n" "#ifdef __cplusplus\\\n" "extern \"C\"\\\n" "{\\\n" "#endif\\\n"; sed = "/^}$/a\\\n" "#ifdef __cplusplus\\\n" "}\\\n" "#endif \/* __cplusplus *\/\\\n";};/* * Fix else and endif directives that contain non-commentary text */fix = { hackname = end_else_label; /* * Select files that contain '#endif' or '#else' directives with * some sort of following junk. (Between the ascii '.' * and '0' lies the character '/'. This will *NOT* * match '#endif / * foo * /', but it also wont match * '#endif / done' either. * * We have a second regexp in the selector to detect * #endif followed by a / followed by anything other * than a *. For example "#endif / * foo * /" or * "#endif /% blah %/ which appear on OSF4.0A and AIX4.2 * repsectively. * * We use the pattern [!-.0-z{|}~] instead of [^/ \t] to match a * noncomment following #else or #endif because some buggy egreps * think [^/] matches newline, and they thus think `#else ' matches * `#e[ndiflse]*[ \t]+[^/ \t]'. * [!-.0-~] does not work properly on AIX 4.1. */ select = "^[ \t]*#[ \t]*(else|endif)[ \t]+" "(" '[!-.0-z\{\|\}\~]' "|" '/[^\*]' ")"; /* * First, join the continued input lines. * IF the resulting line is an endif preprocessing directive, * then trim off the following patterns: * 1. sequences that start with '/' and is *NOT* followed by '*' * 2. Sequences that start with '*' and is *NOT* followed by '/' * 3. sequences that do not start with any of '/', '*', '\t' or ' '. * * The fixinc_eol stuff is to work around a bug in the sed */ sed = ":loop\n" '/\\\\$/' "N\n" 's/\\\\$/\\\\+++fixinc_eol+++/' "\n" '/\\\\$/' "b loop\n" 's/\\\\+++fixinc_eol+++/\\\\/g' "\n" "s%^\\([ \t]*#[ \t]*else\\)[ \t][ \t]*/[^*].*%\\1%\n" "s%^\\([ \t]*#[ \t]*else\\)[ \t][ \t]*[^/ \t].*%\\1%\n" "s%^\\([ \t]*#[ \t]*endif\\)[ \t][ \t]*/[^*].*%\\1%\n" "s%^\\([ \t]*#[ \t]*endif\\)[ \t][ \t]*\*[^/].*%\\1%\n" "s%^\\([ \t]*#[ \t]*endif\\)[ \t][ \t]*[^/* \t].*%\\1%";};/* * Fix HP's use of ../machine/inline.h to refer to * /usr/include/machine/inline.h */fix = { hackname = hp_inline; files = sys/spinlock.h; select = 'include.*"\.\./machine/'; sed = "s,\"../machine/inline.h\",<machine/inline.h>,"; sed = "s,\"../machine/psl.h\",<machine/psl.h>,";};/* * Check for (...) in C++ code in HP/UX sys/file.h. */fix = { hackname = hp_sysfile; files = sys/file.h; select = "HPUX_SOURCE"; sed = 's/(\.\.\.)/(struct file * ...)/';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -