4 autogen definitions inclhack;
8 Define all the fixes we know about for repairing damaged headers.
9 Please see the README before adding or changing entries in this file.
11 Now, first: DO NOT DO BROKEN FIXES (empty replacement fixes) */
16 * Purge some HP-UX 11 files that are only borken after they are "fixed".
19 hackname = AAA_ki_iface;
20 files = sys/ki_iface.h;
21 select = 'These definitions are for HP Internal developers';
22 replace; /* empty replacement -> no fixing the file */
27 * Purge some HP-UX 11 files that are only borken after they are "fixed".
32 select = '11.00 HP-UX LP64';
33 replace; /* empty replacement -> no fixing the file */
38 * Purge some HP-UX 11 files that are only borken after they are "fixed".
41 hackname = AAA_ki_calls;
42 files = sys/ki_calls.h;
43 select = 'kthread_create_caller_t';
44 replace; /* empty replacement -> no fixing the file */
49 * Purge some HP-UX 11 files that are only borken after they are "fixed".
52 hackname = AAA_ki_defs;
53 files = sys/ki_defs.h;
54 select = 'Kernel Instrumentation Definitions';
55 replace; /* empty replacement -> no fixing the file */
60 * This file on SunOS 4 has a very large macro. When the sed loop
61 * tries pull it in, it overflows the pattern space size of the SunOS
62 * sed (GNU sed does not have this problem). Since the file does not
63 * require fixing, we remove it from the fixed directory.
66 hackname = AAA_bad_fixes;
67 files = sundev/ipi_error.h;
68 /* shouldn't there be a select expression here??? */
69 replace; /* empty replacement -> no fixing the file */
74 * Purge some HP-UX 11 files that are only borken after they are "fixed".
79 select = '11.0 and later representation of ki time';
80 replace; /* empty replacement -> no fixing the file */
83 /* And now, the real fixes, replacement text fixes first: */
86 * Completely replace <_int_varargs.h> with a file that includes gcc's
87 * stdarg.h or varargs.h files as appropriate on DG/UX
90 hackname = AAB_dgux_int_varargs;
91 files = _int_varargs.h;
92 replace = "#ifndef __INT_VARARGS_H
93 \#define __INT_VARARGS_H
95 /************************************************************************/
96 /* _INT_VARARGS.H - Define the common stuff for varargs/stdarg/stdio. */
97 /************************************************************************/
100 ** This file is a DG internal header. Never include this
104 \#ifndef ___int_features_h
105 \#include <sys/_int_features.h>
108 \#if !(defined(_VA_LIST) || defined(_VA_LIST_))
115 typedef void * va_list;
117 typedef char * va_list;
123 \#if defined(__DCC__)
131 \#else /* ! defined(__DCC__) */
134 int __va_arg; /* argument number */
135 int *__va_stk; /* start of args passed on stack */
136 int *__va_reg; /* start of args passed in regs */
139 \#endif /* ! defined(__DCC__) */
143 \#if defined(__GNUC__) || defined(__STDC__)
144 typedef void * va_list;
146 typedef char * va_list;
149 \#endif /* _IX86_ANY */
151 \#endif /* __LINT__ */
152 \#endif /* !(defined(_VA_LIST) || defined(_VA_LIST_)) */
153 \#endif /* #ifndef __INT_VARARGS_H */\n";
158 * This fixes __FD_ZERO bug for glibc-1.0.x
161 hackname = AAB_fd_zero_glibc_1_0;
162 files = asm/posix_types.h;
163 mach = 'i[34567]86-*-linux-gnu*';
166 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
167 * the start, so that if #include_next gets another instance of
168 * the wrapper, this will follow the #include_next chain until
169 * we arrive at the real <asm/posix_types.h>.
173 '/* This file fixes __FD_ZERO bug for glibc-1.x. */
174 \#ifndef _POSIX_TYPES_H_WRAPPER
175 \#include <features.h>
176 \#include_next <asm/posix_types.h>
178 \#if defined(__FD_ZERO) && !defined(__GLIBC__)
180 \#define __FD_ZERO(fdsetp) \
183 __asm__ __volatile__("cld ; rep ; stosl" \
184 : "=&c" (__d0), "=&D" (__d1) \
185 : "a" (0), "0" (__FDSET_LONGS), \
186 "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \
190 \#define _POSIX_TYPES_H_WRAPPER
191 \#endif /* _POSIX_TYPES_H_WRAPPER */
197 * This fixes __FD_ZERO bug for glibc-1.x
200 hackname = AAB_fd_zero_glibc_1_x;
202 mach = 'i[34567]86-*-linux-gnu*';
205 * Define _TYPES_H_WRAPPER at the end of the wrapper, not
206 * the start, so that if #include_next gets another instance of
207 * the wrapper, this will follow the #include_next chain until
208 * we arrive at the real <gnu/types.h>.
212 '/* This file fixes __FD_ZERO bug for glibc-1.x. */
213 \#ifndef _TYPES_H_WRAPPER
214 \#include <features.h>
215 \#include_next <gnu/types.h>
217 \#if defined(__FD_ZERO) && !defined(__GLIBC__)
219 \# define __FD_ZERO(fdsetp) \
222 __asm__ __volatile__("cld ; rep ; stosl" \
223 : "=&c" (__d0), "=&D" (__d1) \
224 : "a" (0), "0" (__FDSET_LONGS), \
225 "1" ((__fd_set *) (fdsetp)) :"memory"); \
229 \#define _TYPES_H_WRAPPER
230 \#endif /* _TYPES_H_WRAPPER */
236 * This fixes __FD_ZERO bug for glibc-2.0.x
239 hackname = AAB_fd_zero_glibc_2_0;
240 files = selectbits.h;
241 mach = 'i[34567]86-*-linux-gnu*';
244 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not
245 * the start, so that if #include_next gets another instance of
246 * the wrapper, this will follow the #include_next chain until
247 * we arrive at the real <selectbits.h>.
251 '/* This file fixes __FD_ZERO bug for glibc-2.0.x. */
252 \#ifndef _SELECTBITS_H_WRAPPER
253 \#include <features.h>
254 \#include_next <selectbits.h>
256 \#if defined(__FD_ZERO) && defined(__GLIBC__) \
257 && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 \
258 && __GLIBC_MINOR__ == 0
260 \#define __FD_ZERO(fdsetp) \
263 __asm__ __volatile__ ("cld; rep; stosl" \
264 : "=&c" (__d0), "=&D" (__d1) \
265 : "a" (0), "0" (sizeof (__fd_set) \
266 / sizeof (__fd_mask)), \
267 "1" ((__fd_mask *) (fdsetp)) \
272 \#define _SELECTBITS_H_WRAPPER
273 \#endif /* _SELECTBITS_H_WRAPPER */
279 * Completely replace <sys/byteorder.h>; with a file that implements gcc's
280 * optimized byteswapping. Restricted to "SVR4" machines until either
281 * it is shown to be safe to replace this file always, or we get bolder ;-)
284 hackname = AAB_svr4_replace_byteorder;
287 mach = "i[34567]86-*-sysv5*";
288 mach = "i[34567]86-*-udk*";
289 mach = "i[34567]86-*-solaris2.[0-4]";
290 mach = "powerpcle-*-solaris2.[0-4]";
291 mach = "sparc-*-solaris2.[0-4]";
293 files = sys/byteorder.h;
294 replace = '#ifndef _SYS_BYTEORDER_H
295 \#define _SYS_BYTEORDER_H
297 /* Functions to convert `short\' and `long\' quantities from host byte order
298 to (internet) network byte order (i.e. big-endian).
300 Written by Ron Guilmette (rfg@ncd.com).
302 This isn\'t actually used by GCC. It is installed by fixinc.svr4.
304 For big-endian machines these functions are essentially no-ops.
306 For little-endian machines, we define the functions using specialized
307 asm sequences in cases where doing so yields better code (e.g. i386). */
309 \#if !defined (__GNUC__) && !defined (__GNUG__)
310 \#error You lose! This file is only useful with GNU compilers.
313 \#ifndef __BYTE_ORDER__
314 /* Byte order defines. These are as defined on UnixWare 1.1, but with
315 double underscores added at the front and back. */
316 \#define __LITTLE_ENDIAN__ 1234
317 \#define __BIG_ENDIAN__ 4321
318 \#define __PDP_ENDIAN__ 3412
322 static __inline__ unsigned long htonl (unsigned long);
323 static __inline__ unsigned short htons (unsigned int);
324 static __inline__ unsigned long ntohl (unsigned long);
325 static __inline__ unsigned short ntohs (unsigned int);
326 \#endif /* defined (__STDC__) */
328 \#if defined (__i386__)
330 \#ifndef __BYTE_ORDER__
331 \#define __BYTE_ORDER__ __LITTLE_ENDIAN__
334 /* Convert a host long to a network long. */
336 /* We must use a new-style function definition, so that this will also
338 static __inline__ unsigned long
339 htonl (unsigned long __arg)
341 register unsigned long __result;
343 __asm__ ("xchg%B0 %b0,%h0
345 xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
349 /* Convert a host short to a network short. */
351 static __inline__ unsigned short
352 htons (unsigned int __arg)
354 register unsigned short __result;
356 __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
360 \#elif ((defined (__i860__) && !defined (__i860_big_endian__)) \
361 || defined (__ns32k__) || defined (__vax__) \
362 || defined (__spur__) || defined (__arm__))
364 \#ifndef __BYTE_ORDER__
365 \#define __BYTE_ORDER__ __LITTLE_ENDIAN__
368 /* For other little-endian machines, using C code is just as efficient as
369 using assembly code. */
371 /* Convert a host long to a network long. */
373 static __inline__ unsigned long
374 htonl (unsigned long __arg)
376 register unsigned long __result;
378 __result = (__arg >> 24) & 0x000000ff;
379 __result |= (__arg >> 8) & 0x0000ff00;
380 __result |= (__arg << 8) & 0x00ff0000;
381 __result |= (__arg << 24) & 0xff000000;
385 /* Convert a host short to a network short. */
387 static __inline__ unsigned short
388 htons (unsigned int __arg)
390 register unsigned short __result;
392 __result = (__arg << 8) & 0xff00;
393 __result |= (__arg >> 8) & 0x00ff;
397 \#else /* must be a big-endian machine */
399 \#ifndef __BYTE_ORDER__
400 \#define __BYTE_ORDER__ __BIG_ENDIAN__
403 /* Convert a host long to a network long. */
405 static __inline__ unsigned long
406 htonl (unsigned long __arg)
411 /* Convert a host short to a network short. */
413 static __inline__ unsigned short
414 htons (unsigned int __arg)
419 \#endif /* big-endian */
421 /* Convert a network long to a host long. */
423 static __inline__ unsigned long
424 ntohl (unsigned long __arg)
426 return htonl (__arg);
429 /* Convert a network short to a host short. */
431 static __inline__ unsigned short
432 ntohs (unsigned int __arg)
434 return htons (__arg);
442 * Completely replace <sys/varargs.h> with a file that includes gcc's
443 * stdarg.h or varargs.h files as appropriate.
447 hackname = AAB_svr4_no_varargs;
448 files = sys/varargs.h;
449 replace = "/* This file was generated by fixincludes. */\n"
450 "#ifndef _SYS_VARARGS_H\n"
451 "#define _SYS_VARARGS_H\n\n"
454 "#include <stdarg.h>\n"
456 "#include <varargs.h>\n"
459 "#endif /* _SYS_VARARGS_H */\n";
465 * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
466 * of struct rusage, so the prototype (added by fixproto) causes havoc.
469 hackname = aix_syswait;
472 sed = "/^extern pid_t wait3();$/i\\\n"
478 * sys/signal.h on some versions of AIX uses volatile in the typedef of
479 * sig_atomic_t, which causes gcc to generate a warning about duplicate
480 * volatile when a sig_atomic_t variable is declared volatile, as
481 * required by ANSI C.
484 hackname = aix_volatile;
485 files = sys/signal.h;
486 select = "typedef volatile int sig_atomic_t";
487 sed = "s/typedef volatile int sig_atomic_t"
488 "/typedef int sig_atomic_t/";
493 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
496 hackname = alpha_getopt;
499 select = 'getopt\(int, char \*\[';
500 sed = 's/getopt(int, char \*\[\],[ ]*char \*)/'
501 'getopt(int, char *const[], const char *)/';
506 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
509 hackname = alpha_parens;
511 select = '#ifndef\(__mips64\)';
512 sed = "s/#ifndef(__mips64)/#ifndef __mips64/";
517 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
520 hackname = alpha_sbrk;
522 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
523 sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";
528 * Fix this ARM/RISCiX file where ___type is a Compiler
529 * hint that is specific to the Norcroft compiler.
532 hackname = arm_norcroft_hint;
533 select = "___type p_type";
534 files = "X11/Intrinsic.h";
535 sed = "s/___type p_type/p_type/";
540 * Fix this ARM/RISCiX file to avoid interfering
541 * with the use of __wchar_t in cc1plus.
544 hackname = arm_wchar;
546 select = "#[ \t]*define[ \t]*__wchar_t";
547 sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
548 sed = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
553 * This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89;
554 * gcc doesn't understand it.
559 select = "#ifndef NOINLINE";
560 sed = "s|#ifndef NOINLINE"
561 "|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|";
566 * For C++, avoid any typedef or macro definition of bool,
567 * and use the built in type instead.
568 * HP/UX 10.20 also has it in curses_colr/curses.h.
571 hackname = avoid_bool;
573 files = curses_colr/curses.h;
577 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
578 "#ifndef __cplusplus\n";
580 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/a\\\n"
583 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/i\\\n"
584 "#ifndef __cplusplus\n";
586 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/a\\\n"
589 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/i\\\n"
590 "#ifndef __cplusplus\n";
592 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/a\\\n"
595 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/i\\\n"
596 "#ifndef __cplusplus\n";
598 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/a\\\n"
601 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/i\\\n"
602 "#ifndef __cplusplus\n";
604 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n"
610 * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
613 hackname = bad_struct_term;
615 select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
616 sed = "s/^[ \t]*typedef[ \t][ \t]*"
617 "\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
622 * Fix one other error in this file:
623 * a mismatched quote not inside a C comment.
627 files = sundev/vuid_event.h;
628 sed = "s/doesn't/does not/";
633 * Fix #defines under Alpha OSF/1:
634 * The following files contain '#pragma extern_prefix "_FOO"' followed by
635 * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
636 * statements is to reduce namespace pollution. While these macros work
637 * properly in most cases, they don't allow you to take a pointer to the
638 * "something" being modified. To get around this limitation, change these
639 * statements to be of the form '#define something _FOOsomething'.
644 select = "^[ \t]*#[ \t]*pragma[ \t][ \t]*extern_prefix";
661 "s/^[ \t]*#[ \t]*define[ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
662 "\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
667 * check for broken assert.h that needs stdio.h
670 hackname = broken_assert_stdio;
673 bypass = "include.*stdio.h";
675 "#include <stdio.h>\n";
680 * check for broken assert.h that needs stdlib.h
683 hackname = broken_assert_stdlib;
685 select = 'exit *\(|abort *\(';
686 bypass = "include.*stdlib.h";
688 "#ifdef __cplusplus\\\n"
689 "#include <stdlib.h>\\\n"
695 * Note that BSD43_* are used on recent MIPS systems.
698 hackname = bsd43_io_macros;
699 select = "BSD43__IO";
701 * Put single quotes aroung the character that appears after '('
702 * and before ',', UNLESS it is a 'c' or 'g' or 'x'.
704 sed = "/[ \t]BSD43__IO[A-Z]*[ \t]*(/" 's/(\(.\),/(\'\1\',/';
705 sed = "/#[ \t]*define[ \t]*[ \t]BSD43__IO/" 's/\'\([cgx]\)\'/\1/g';
710 * Fix <c_asm.h> on Digital UNIX V4.0:
711 * It contains a prototype for a DEC C internal asm() function,
712 * clashing with gcc's asm keyword. So protect this with __DECC.
715 hackname = dec_intern_asm;
717 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
718 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
724 * Remove the double-slash comments. The "double_slash" test will
725 * try to ignore C++ headers by checking for "CC/", "xx/" and "++/"
726 * in the file name. There are still the occasional C++ headers
727 * that have their comments stripped. Too bad.
730 hackname = no_double_slash;
731 c_test = "double_slash";
732 c_fix = "no_double_slash";
737 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
740 hackname = ecd_cursor;
741 files = "sunwindow/win_lock.h";
742 files = "sunwindow/win_cursor.h";
743 sed = "s/ecd.cursor/ecd_cursor/";
748 * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
749 * tiny static wrappers that aren't C++ safe.
752 hackname = sco5_stat_wrappers;
753 mach = "i*86-*-sco3.2v5*";
754 files = "sys/stat.h";
756 sed = "/^static int[ \t]*[a-z]*stat(/i\\\n"
757 "#ifdef __cplusplus\\\n"
763 "#ifdef __cplusplus\\\n"
765 "#endif \/* __cplusplus *\/\\\n";
770 * Fix else and endif directives that contain non-commentary text
773 hackname = end_else_label;
776 * Select files that contain '#endif' or '#else' directives with
777 * some sort of following junk.
779 c_test = "else_endif_label";
780 c_fix = "else_endif_label";
785 * Fix HP's use of ../machine/inline.h to refer to
786 * /usr/include/machine/inline.h
789 hackname = hp_inline;
790 files = sys/spinlock.h;
791 select = 'include.*"\.\./machine/';
792 sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
793 sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
798 * Check for (...) in C++ code in HP/UX sys/file.h.
801 hackname = hp_sysfile;
803 select = "HPUX_SOURCE";
804 sed = 's/(\.\.\.)/(struct file * ...)/';
809 * sys/mman.h on HP/UX is not C++ ready,
810 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
812 * rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
813 * is defined for the alpha. The problem is the declaration of malloc.
816 hackname = cxx_unready;
819 bypass = '"C"|__BEGIN_DECLS';
822 "#ifdef __cplusplus\\\n"
826 "#ifdef __cplusplus\\\n"
833 * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
836 hackname = hpux_maxint;
838 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
841 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
847 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
850 hackname = hpux_systime;
852 select = "^extern struct sigevent;";
853 sed = "s/^extern struct sigevent;/struct sigevent;/";
857 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
858 * of UINT32_C has undefined behavior according to ISO/ANSI:
859 * the arguments to __CONCAT__ are not macro expanded before the
860 * concatination happens so the trailing ')' in the first argument
861 * is concatinated with the 'l' in the second argument creating an
862 * invalid pp token. The behavior of invalid pp tokens is undefined.
863 * GCC does not handle these invalid tokens the way the HP compiler does.
864 * This problem will potentially occur anytime macros are used in the
865 * arguments to __CONCAT__. A general solution to this problem would be to
866 * insert another layer of macro between __CONCAT__ and its use
867 * in UINT32_C. An example of this solution can be found in the C standard.
868 * A more specific solution, the one used here, is to change the UINT32_C
869 * macro to not used macros in the arguments to __CONCAT__.
873 hackname = hpux11_uint32_c;
875 select = "^#define UINT32_C\\(__c\\)[ \t]*__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
876 sed = "s/^#define UINT32_C(__c)\\([ \t]*\\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\\1__CONCAT__(__c,ul)/";
880 * Determine if we're on Interactive Unix 2.2 or later, in which case we
881 * need to fix some additional files. This is the same test for ISC that
882 * Autoconf uses. On Interactive 2.2, certain traditional Unix
883 * definitions (notably getc and putc in stdio.h) are omitted if __STDC__
884 * is defined, not just if _POSIX_SOURCE is defined. This makes it
885 * impossible to compile any nontrivial program except with -posix.
888 hackname = interactv_add1;
890 test = " -d /etc/conf/kconfig.d";
891 test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
896 files = "sys/limits.h";
897 files = "sys/fcntl.h";
898 files = "sys/dirent.h";
900 sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
901 "!defined(_POSIX_SOURCE)/";
905 hackname = interactv_add2;
907 test = " -d /etc/conf/kconfig.d";
908 test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
911 sed = "s/fmod(double)/fmod(double, double)/";
915 hackname = interactv_add3;
917 test = " -d /etc/conf/kconfig.d";
918 test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
920 files = sys/limits.h;
922 sed = "/CHILD_MAX/s,/\\* Max, Max,";
923 sed = "/OPEN_MAX/s,/\\* Max, Max,";
928 * Fix various _IO* defines, but do *not* quote the characters cgxtf.
931 hackname = io_def_quotes;
932 select = "[ \t]*[ \t](_|DES)IO[A-Z]*[ \t]*\\( *[^,']";
933 sed = "s/\\([ \t]*[ \t]_IO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/";
934 sed = "s/\\([ \t]*[ \t]DESIO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/";
935 sed = "/#[ \t]*define[ \t]*[ \t]_IO/" "s/'\\([cgxtf]\\)'/\\1/g";
936 sed = "/#[ \t]*define[ \t]*[ \t]DESIOC/" 's/\'\([cdgx]\)\'/\1/g';
943 * Basically, what is supposed to be happening is that every
944 * _invocation_ of the "_CTRL()" or "CTRL()" macros is supposed to have
945 * its argument inserted into single quotes. We _must_ do this because
946 * ANSI macro substitution rules prohibit looking inside quoted strings
947 * for the substitution names. A side effect is that the quotes are
948 * inserted in the definitions of those macros as well. So, the last
949 * several sed expressions are supposed to clean up the definitions, as
950 * long as those definitions are using "c", "g" or "x" as the macro
954 hackname = ioctl_fix_ctrl;
955 select = "CTRL[ \t]*\\(";
957 sed = "/[^A-Z0-9_]CTRL[ \t]*(/"
958 "s/\\([^']\\))/'\\1')/";
960 sed = "/[^A-Z0-9]_CTRL[ \t]*(/"
961 "s/\\([^']\\))/'\\1')/";
963 sed = "/#[ \t]*define[ \t]*[ \t]CTRL/"
964 "s/'\\([cgx]\\)'/\\1/g";
966 sed = "/#[ \t]*define[ \t]*[ \t]_CTRL/"
967 "s/'\\([cgx]\\)'/\\1/g";
969 sed = "/#[ \t]*define[ \t]*[ \t]BSD43_CTRL/"
970 "s/'\\([cgx]\\)'/\\1/g";
972 sed = "/#[ \t]*define[ \t]*[ \t][_]*ISCTRL/"
973 "s/'\\([cgx]\\)'/\\1/g";
978 * Check for missing ';' in struct
981 hackname = ip_missing_semi;
982 files = netinet/ip.h;
983 sed = "/^struct/,/^};/s/}$/};/";
988 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
989 * in prototype without previous definition.
992 hackname = irix_multiline_cmnt;
995 sed = "s@type of the result@type of the result */@";
996 sed = "s@of the sizeof@/* of the sizeof@";
1001 * Some IRIX header files contain the string "//"
1004 hackname = irix_sockaddr;
1006 select = "authdes_create.*struct sockaddr";
1007 sed = "/authdes_create.*struct sockaddr/i\\\n"
1008 "struct sockaddr;\n";
1013 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
1014 * in prototype without previous definition.
1017 hackname = irix_struct__file;
1019 sed = "/xdrstdio_create.*struct __file_s/i\\\n"
1020 "struct __file_s;\n";
1025 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
1026 * that causes the assembly preprocessor to complain about an
1027 * unterminated character constant.
1030 hackname = irix_asm_apostrophe;
1033 select = "^[ \t]*#.*[Ww]e're";
1034 sed = "/^[ \t]*#/s/\\([Ww]e\\)'re/\\1 are/";
1039 * Fixing ISC fmod declaration
1042 hackname = isc_fmod;
1044 select = 'fmod\(double\)';
1045 sed = "s/fmod(double)/fmod(double, double)/";
1050 * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
1053 hackname = motorola_nested;
1054 mach = "m68k-motorola-sysv*";
1056 files = sys/limits.h;
1057 sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
1058 "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
1059 sed = "s@\\(/\\*#define\tHUGE_VAL\t3.40282346638528860e+38 \\)"
1060 "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
1065 * Fixing nested comments in ISC <sys/limits.h>
1068 hackname = isc_sys_limits;
1069 files = sys/limits.h;
1071 sed = "/CHILD_MAX/s,/\\* Max, Max,";
1072 sed = "/OPEN_MAX/s,/\\* Max, Max,";
1077 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
1078 * use / * * / to concatenate tokens.
1081 hackname = kandr_concat;
1082 files = "sparc/asm_linkage.h";
1083 files = "sun3/asm_linkage.h";
1084 files = "sun3x/asm_linkage.h";
1085 files = "sun4/asm_linkage.h";
1086 files = "sun4c/asm_linkage.h";
1087 files = "sun4m/asm_linkage.h";
1088 files = "sun4c/debug/asm_linkage.h";
1089 files = "sun4m/debug/asm_linkage.h";
1090 files = "arm/as_support.h";
1091 files = "arm/mc_type.h";
1092 files = "arm/xcb.h";
1093 files = "dev/chardefmac.h";
1094 files = "dev/ps_irq.h";
1095 files = "dev/screen.h";
1096 files = "dev/scsi.h";
1097 files = "sys/tty.h";
1098 files = "Xm.acorn/XmP.h";
1099 files = bsd43/bsd43_.h;
1101 sed = 's|/\*\*/|##|g';
1106 * In limits.h, put #ifndefs around things that are supposed to be defined
1107 * in float.h to avoid redefinition errors if float.h is included first.
1108 * On HP/UX this patch does not work, because on HP/UX limits.h uses
1109 * multi line comments and the inserted #endif winds up inside the
1110 * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1111 * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1112 * are there, and we do not add them ourselves.
1113 * Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1
1116 hackname = limits_ifndefs;
1118 files = "sys/limits.h";
1119 bypass = "ifndef[ \t]+FLT_MIN";
1121 sed = "/[ \t]FLT_MIN[ \t]/i\\\n#ifndef FLT_MIN\n";
1122 sed = "/[ \t]FLT_MIN[ \t]/a\\\n#endif\n";
1123 sed = "/[ \t]FLT_MAX[ \t]/i\\\n#ifndef FLT_MAX\n";
1124 sed = "/[ \t]FLT_MAX[ \t]/a\\\n#endif\n";
1125 sed = "/[ \t]FLT_DIG[ \t]/i\\\n#ifndef FLT_DIG\n";
1126 sed = "/[ \t]FLT_DIG[ \t]/a\\\n#endif\n";
1127 sed = "/[ \t]DBL_MIN[ \t]/i\\\n#ifndef DBL_MIN\n";
1128 sed = "/[ \t]DBL_MIN[ \t]/a\\\n#endif\n";
1129 sed = "/[ \t]DBL_MAX[ \t]/i\\\n#ifndef DBL_MAX\n";
1130 sed = "/[ \t]DBL_MAX[ \t]/a\\\n#endif\n";
1131 sed = "/[ \t]DBL_DIG[ \t]/i\\\n#ifndef DBL_DIG\n";
1132 sed = "/[ \t]DBL_DIG[ \t]/a\\\n#endif\n";
1133 sed = "/^\\(\\/\\*#define\tHUGE_VAL\t3\\.[0-9e+]* *\\)\\/\\*/s//\\1/";
1138 * Delete the '#define void int' line from curses.h on Lynx
1141 hackname = lynx_void_int;
1143 select = "#[ \t]*define[ \t]+void[ \t]+int";
1144 sed = "/#[ \t]*define[ \t][ \t]*void[ \t]int/d";
1149 * Fix fcntl prototype in fcntl.h on LynxOS.
1152 hackname = lynxos_fcntl_proto;
1154 select = 'fcntl.*\(int, int, int\)';
1155 sed = 's/\(fcntl.*(int, int, \)int)/\1...)/';
1160 * libm.a on m88k-motorola-sysv3 contains a stupid optimization for
1161 * function hypot(), which returns the second argument without even
1162 * looking at its value, if the other is 0.0. Another drawback is
1163 * that fix-header doesn't fix fabs' prototype, and I have no idea why.
1166 hackname = m88k_bad_hypot_opt;
1167 mach = "m88k-motorola-sysv3*";
1170 sed = "s/extern double floor(), ceil(), fmod(), fabs();/"
1171 "extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/";
1173 sed = "/^extern double hypot();$/a\\\n"
1174 "\\/* Workaround a stupid Motorola optimization if one\\\n"
1175 " of x or y is 0.0 and the other is negative! *\\/\\\n"
1176 "#ifdef __STDC__\\\n"
1177 "static __inline__ double fake_hypot (double x, double y)\\\n"
1179 "static __inline__ double fake_hypot (x, y)\\\n"
1180 "\tdouble x, y;\\\n"
1183 "\treturn fabs (hypot (x, y));\\\n"
1185 "#define hypot\tfake_hypot\n";
1190 * Fix incorrect S_IF* definitions on m88k-sysv3.
1193 hackname = m88k_bad_s_if;
1194 mach = "m88k-*-sysv3*";
1196 select = "#define[ \t]+S_IS[A-Z]*(m)[ \t]";
1198 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
1199 "(m[ \t]*&[ \t]*\\(S_IF[A-Z][A-Z][A-Z][A-Z]*\\)[ \t]*)/"
1200 "\\1 (((m)\\&S_IFMT)==\\2)/";
1202 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
1203 "(m[ \t]*&[ \t]*\\(0[0-9]*\\)[ \t]*)/"
1204 "\\1 (((m)\\&S_IFMT)==\\2)/";
1209 * Put cpp wrappers around these include files to avoid redeclaration
1210 * errors during multiple inclusion on m88k-tektronix-sysv3.
1213 hackname = m88k_multi_incl;
1214 mach = "m88k-tektronix-sysv3*";
1218 "echo Fixing $file, to protect against multiple inclusion. >&2
1219 cpp_wrapper=`echo $file | sed -e 's,\\.,_,g' -e 's,/,_,g'`
1220 echo \"#ifndef __GCC_GOT_${cpp_wrapper}_\"
1221 echo \"#define __GCC_GOT_${cpp_wrapper}_\"
1223 echo \"#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\"";
1228 * Fix non-ansi machine name defines
1229 * File selection is split into two parts: the shell version as
1230 * a single patch, and the program version with each patch separate.
1231 * Each is substantially faster for the particular environment.
1232 * You have a dual maintenance problem here.
1235 hackname = machine_name;
1237 * Select '#if.*' and '#elif" with possible non-ansi symbols
1238 * The only non-ansi symbols we know about start with one of:
1240 * If any are added to the substitution list, then add it to
1241 * the selection list as well. Hopefully we can avoid names
1242 * starting with "d" and "l", because this pattern would then
1243 * match "defined" and "lint" as well. I suppose we could add
1244 * a "bypass = lint" if we had to though.
1246 * The fixinc_eol stuff is to work around a bug in the sed
1248 select = "^#[ \t]*(if|elif).*"
1249 "[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]";
1250 exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]"
1254 "|_*SYSTYPE_[A-Z0-9]"
1281 's/\\\\$/\\\\+++fixinc_eol+++/' "\n"
1282 '/\\\\$/' "b loop\n"
1283 's/\\\\+++fixinc_eol+++/\\\\/g' "\n"
1285 "/#[\t ]*[el]*if/ {\n"
1286 "\ts/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g\n"
1288 "\ts/ M32 / __M32__ /g\n"
1289 "\ts/ _*MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n"
1290 "\ts/ _*SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n"
1291 "\ts/ _*\\([Rr][34]\\)000 / __\\1000__ /g\n"
1292 "\ts/ _*host_mips / __host_mips__ /g\n"
1293 "\ts/ _*i386 / __i386__ /g\n"
1294 "\ts/ _*mips / __mips__ /g\n"
1295 "\ts/ bsd4\\([0-9]\\) / __bsd4\\1__ /g\n"
1296 "\ts/ is68k / __is68k__ /g\n"
1297 "\ts/ m68k / __m68k__ /g\n"
1298 "\ts/ m88k / __m88k__ /g\n"
1299 "\ts/ mc680\\([0-9]\\)0 / __mc680\\10__ /g\n"
1300 "\ts/ news\\([0-9]*\\) / __news\\1__ /g\n"
1301 "\ts/ ns32000 / __ns32000__ /g\n"
1302 "\ts/ pdp11 / __pdp11__ /g\n"
1303 "\ts/ pyr / __pyr__ /g\n"
1304 "\ts/ sel / __sel__ /g\n"
1305 "\ts/ sony_news / __sony_news__ /g\n"
1306 "\ts/ sparc / __sparc__ /g\n"
1307 "\ts/ sun\\([a-z0-9]*\\) / __sun\\1__ /g\n"
1308 "\ts/ tahoe / __tahoe__ /g\n"
1309 "\ts/ tower\\([_0-9]*\\) / __tower\\1__ /g\n"
1310 "\ts/ u370 / __u370__ /g\n"
1311 "\ts/ u3b\\([0-9]*\\) / __u3b\\1__ /g\n"
1312 "\ts/ unix / __unix__ /g\n"
1313 "\ts/ vax / __vax__ /g\n"
1315 "\ts/ \\([a-zA-Z0-9_][a-zA-Z0-9_]*\\) /\\1/g\n\t}";
1320 * Some math.h files define struct exception, which conflicts with
1321 * the class exception defined in the C++ file std/stdexcept.h. We
1322 * redefine it to __math_exception. This is not a great fix, but I
1323 * haven't been able to think of anything better.
1326 hackname = math_exception;
1328 select = "struct exception";
1329 sed = "/struct exception/i\\\n"
1330 "#ifdef __cplusplus\\\n"
1331 "#define exception __math_exception\\\n"
1333 sed = "/struct exception/a\\\n"
1334 "#ifdef __cplusplus\\\n"
1335 "#undef exception\\\n"
1338 sed = "/matherr/i\\\n"
1339 "#ifdef __cplusplus\\\n"
1340 "#define exception __math_exception\\\n"
1343 sed = "/matherr/a\\\n"
1344 "#ifdef __cplusplus\\\n"
1345 "#undef exception\\\n"
1348 #ifdef MATH_EXCEPTION_FIXED
1350 I think this patch needs some more thinking.
1351 This is from SVR4.2 (With '#' replaced with '@').
1352 Perhaps we could do without the "/matherr/a" entries?
1353 Can we bypass the entire fix if someone was astute
1354 enough to have '#ifdef __cplusplus' anywhere in the file?
1357 *** /usr/include/math.h Fri Apr 3 18:54:59 1998
1358 --- math.h Sun May 9 07:28:58 1999
1365 + @ifdef __cplusplus
1366 + @define exception __math_exception
1369 + @ifdef __cplusplus
1381 + @ifdef __cplusplus
1382 + @define exception __math_exception
1384 + @ifdef __cplusplus
1385 + @define exception __math_exception
1387 extern int matherr(struct exception *);
1388 + @ifdef __cplusplus
1391 + @ifdef __cplusplus
1395 @endif /*__cplusplus*/
1401 * In math.h, put #ifndefs around things that might be defined
1402 * in a gcc specific math-*.h file.
1405 hackname = math_gcc_ifndefs;
1410 * First see if we have a definition for DBL_MAX in float.h
1411 * If we do, we will replace the one in math.h with that one.
1415 * IF we have such a define *and* HUGE_VAL is defined to be DBL_MAX
1416 * *and* DBL_MAX is _not_ defined in the current file (math.h),
1417 * THEN replace the defined value of HUGE_VAL
1418 * ELSE just copy stdin to stdout so the main filter can process it
1422 * Put conditional guards around the HUGE_VAL definition.
1425 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
1428 "\tif ( test -n \"${dbl_max_def}\" \\\n"
1429 "\t\t-a -n \"`egrep '#define[ \t]*HUGE_VAL[ \t]+DBL_MAX' $file`\" \\\n"
1430 "\t\t-a -z \"`egrep '#define[ \t]+DBL_MAX[ \t]+' $file`\"\n"
1431 "\t ) > /dev/null 2>&1\n"
1432 "\tthen sed -e '/define[ \t]HUGE_VAL[ \t]DBL_MAX/s/DBL_MAX/$dbl_max_def/'"
1433 "\n\telse cat ; fi |\n"
1435 "\tsed -e '/define[ \t]HUGE_VAL[ \t]/i\\\n#ifndef HUGE_VAL\n' "
1436 "-e '/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n'";
1444 hackname = nested_comment;
1446 sed = 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@';
1451 * fix bogus recursive stdlib.h in NEWS-OS 4.0C
1454 hackname = news_os_recursion;
1456 select = "#include <stdlib.h>";
1457 sed = "/^#include <stdlib.h>/i\\\n"
1458 "#ifdef BOGUS_RECURSION\n";
1459 sed = "/^#include <stdlib.h>/a\\\n"
1465 * NeXT 3.2 adds const prefix to some math functions.
1466 * These conflict with the built-in functions.
1469 hackname = next_math_prefix;
1470 files = ansi/math.h;
1471 select = "^extern.*double.*__const__.*";
1473 sed = "/^extern.*double.*__const__.*sqrt(/s/__const__//";
1474 sed = "/^extern.*double.*__const__.*fabs(/s/__const__//";
1475 sed = "/^extern.*double.*__const__.*cos(/s/__const__//";
1476 sed = "/^extern.*double.*__const__.*hypot(/s/__const__//";
1477 sed = "/^extern.*double.*__const__.*sin(/s/__const__//";
1482 * NeXT 3.2 uses the word "template" as a parameter for some
1483 * functions. GCC reports an invalid use of a reserved key word
1484 * with the built-in functions. NeXT 3.2 includes the keyword
1485 * volatile in the prototype for abort(). This conflicts with
1486 * the built-in definition.
1489 hackname = next_template;
1493 sed = '/\(.*template\)/s/template//';
1494 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1499 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
1500 * function prototypes. That conflicts with the built-in functions.
1503 hackname = next_volitile;
1504 files = ansi/stdlib.h;
1507 sed = "/extern.*volatile.*void.*exit/s/volatile//";
1508 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1513 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1514 * Note that version 3 of the NeXT system has wait.h in a different directory,
1515 * so that this code won't do anything. But wait.h in version 3 has a
1516 * conditional, so it doesn't need this fix. So everything is okay.
1519 hackname = next_wait_union;
1522 select = 'wait\(union wait';
1524 sed = "s@wait(union wait@wait(void@";
1529 * a missing semi-colon at the end of the nodeent structure definition.
1532 hackname = nodeent_syntax;
1533 files = netdnet/dnetdb.h;
1534 sed = "s/char.*na_addr *$/char *na_addr;/";
1539 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
1540 * defining regex.h related types. This causes libg++ build and usage
1541 * failures. Fixing this correctly requires checking and modifying 3 files.
1544 hackname = osf_namespace_a;
1545 files = reg_types.h;
1546 files = sys/lc_core.h;
1547 test = " -r reg_types.h";
1548 test = " -r sys/lc_core.h";
1549 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1550 test = " -z \"`grep __regex_t regex.h`\"";
1552 sed = "s/regex_t/__regex_t/g";
1553 sed = "s/regoff_t/__regoff_t/g";
1554 sed = "s/regmatch_t/__regmatch_t/g";
1558 hackname = osf_namespace_b;
1560 test = " -r reg_types.h";
1561 test = " -r sys/lc_core.h";
1562 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1563 test = " -z \"`grep __regex_t regex.h`\"";
1565 sed = "/#include <reg_types.h>/a\\\n"
1566 "typedef __regex_t\tregex_t;\\\n"
1567 "typedef __regoff_t\tregoff_t;\\\n"
1568 "typedef __regmatch_t\tregmatch_t;\n";
1573 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
1574 * The original ones fail if uninitialized externs are not common.
1575 * This is the default for all ANSI standard C++ compilers.
1578 hackname = pthread_page_size;
1580 select = "^int __page_size";
1581 sed = "s/^int __page_size/extern int __page_size/";
1586 * Fix return type of fread and fwrite on sysV68
1589 hackname = read_ret_type;
1591 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
1592 sed = "s/^\\(extern int\tfclose(), fflush()\\), "
1593 "\\(fread(), fwrite()\\)\\(.*\\)$"
1594 "/extern unsigned int\t\\2;\\\n\\1\\3/";
1599 * function class(double x) conflicts with C++ keyword on rs/6000
1602 hackname = rs6000_double;
1604 select = '[^a-zA-Z_]class\(';
1606 sed = "/class[(]/i\\\n#ifndef __cplusplus\n";
1607 sed = "/class[(]/a\\\n#endif\n";
1612 * Wrong fchmod prototype on RS/6000.
1615 hackname = rs6000_fchmod;
1617 select = 'fchmod\(char';
1618 sed = 's/fchmod(char \*/fchmod(int/';
1623 * parameters conflict with C++ new on rs/6000
1626 hackname = rs6000_param;
1630 sed = 's@rename(const char \*old, const char \*new)@'
1631 'rename(const char *_old, const char *_new)@';
1636 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1640 hackname = sony_ctype;
1642 test = " -x /bin/sony";
1643 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1644 sed = "s/__ctype/_ctype/g";
1649 * Incorrect #include in Sony News-OS 3.2.
1652 hackname = sony_include;
1653 files = machine/machparam.h;
1654 select = '"\.\./machine/endian.h"';
1655 sed = 's@"../machine/endian.h"@<machine/endian.h>@';
1660 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1664 hackname = sony_stdio;
1666 test = " -x /bin/sony";
1667 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1668 sed = "s/__filbuf/_filbuf/g\n"
1669 "s/__flsbuf/_flsbuf/g\n"
1675 * Add a `static' declaration of `getrnge' into <regexp.h>.
1677 * Don't do this if there is already a `static void getrnge' declaration
1678 * present, since this would cause a redeclaration error. Solaris 2.x has
1679 * such a declaration.
1683 hackname = static_getrnge;
1685 bypass = "static void getrnge";
1686 sed = "/^static int[ \t]*size;/c\\\n"
1687 "static int size ;\\\n\\\n"
1688 "static int getrnge ();";
1693 * a missing semi-colon at the end of the statsswtch structure definition.
1696 hackname = statsswtch;
1697 files = rpcsvc/rstat.h;
1698 select = "boottime$";
1699 sed = "s/boottime$/boottime;/";
1704 * Don't use or define the name va_list in stdio.h.
1705 * This is for ANSI and also to interoperate properly with gcc's varargs.h.
1706 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1709 hackname = stdio_va_list;
1713 * Use __gnuc_va_list in arg types in place of va_list.
1714 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1715 * trailing parentheses and semicolon save all other systems from this.
1716 * Define __va_list__ (something harmless and unused) instead of va_list.
1717 * Don't claim to have defined va_list.
1720 "if ( egrep \"__need___va_list\" $file ) > /dev/null 2>&1 ; then
1723 echo \"#define __need___va_list\"
1724 echo \"#include <stdarg.h>\"
1727 sed -e 's@ va_list @ __gnuc_va_list @' \\
1728 -e 's@ va_list)@ __gnuc_va_list)@' \\
1729 -e 's@ _BSD_VA_LIST_))@ __gnuc_va_list))@' \\
1730 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \\
1731 -e 's@ va_list@ __va_list__@' \\
1732 -e 's@\\*va_list@*__va_list__@' \\
1733 -e 's@ __va_list)@ __gnuc_va_list)@' \\
1734 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \\
1735 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \\
1736 -e 's@VA_LIST@DUMMY_VA_LIST@' \\
1737 -e 's@_Va_LIST@_VA_LIST@'";
1742 * Check for strict ansi compliance
1746 hackname = strict_ansi;
1747 select = "__STDC__[ \t]*[=!]=[ \t]*[01]";
1748 sed = "s/__STDC__[ \t]*==[ \t]*0/!defined (__STRICT_ANSI__)/g";
1749 sed = "s/__STDC__[ \t]*!=[ \t]*0/defined (__STRICT_ANSI__)/g";
1750 sed = "s/__STDC__[ \t]*==[ \t]*1/defined (__STRICT_ANSI__)/g";
1751 sed = "s/__STDC__[ \t]*!=[ \t]*1/!defined (__STRICT_ANSI__)/g";
1756 * Fix bogus #ifdef on SunOS 4.1.
1759 hackname = sun_bogus_ifdef;
1760 files = "hsfs/hsfs_spec.h";
1761 files = "hsfs/iso_spec.h";
1762 select = '#ifdef __i386__ || __vax__';
1763 sed = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";
1768 * Fix bogus #ifdef on SunOS 4.1.
1771 hackname = sun_bogus_ifdef_sun4c;
1772 files = "hsfs/hsnode.h";
1773 select = '#ifdef __i386__ || __sun4c__';
1774 sed = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";
1779 * Fix the CAT macro in SunOS memvar.h.
1782 hackname = sun_catmacro;
1783 files = pixrect/memvar.h;
1784 select = "^#define[ \t]+CAT\\(a,b\\)";
1785 sed = "/^#define[ \t]CAT(a,b)/ i\\\n"
1786 "#ifdef __STDC__ \\\n"
1787 "#define CAT(a,b) a##b\\\n"
1790 sed = "/^#define[ \t]CAT(a,b)/ a\\\n"
1796 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1797 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1800 hackname = sun_malloc;
1803 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
1804 sed = "s/int[ \t][ \t]*free/void\tfree/g";
1805 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
1806 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
1811 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
1812 * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
1813 * many other systems have similar text but correct versions of the file.
1814 * To ensure only Sun's is fixed, we grep for a likely unique string.
1815 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
1818 hackname = sun_memcpy;
1820 select = "/\\*\t@\\(#\\)"
1821 "(head/memory.h\t50.1\t "
1822 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
1824 sed = "1i\\\n/* This file was generated by fixincludes */\\\n"
1825 "#ifndef __memory_h__\\\n"
1826 "#define __memory_h__\\\n\\\n"
1827 "#ifdef __STDC__\\\n"
1828 "extern void *memccpy();\\\n"
1829 "extern void *memchr();\\\n"
1830 "extern void *memcpy();\\\n"
1831 "extern void *memset();\\\n"
1833 "extern char *memccpy();\\\n"
1834 "extern char *memchr();\\\n"
1835 "extern char *memcpy();\\\n"
1836 "extern char *memset();\\\n"
1837 "#endif /* __STDC__ */\\\n\\\n"
1838 "extern int memcmp();\\\n\\\n"
1839 "#endif /* __memory_h__ */\n";
1846 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
1849 hackname = sun_rusers_semi;
1850 files = rpcsvc/rusers.h;
1852 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
1857 * signal.h on SunOS defines signal using (),
1858 * which causes trouble when compiling with g++ -pedantic.
1861 hackname = sun_signal;
1862 files = sys/signal.h;
1864 select = "^void\t" '\(\*signal\(\)\)\(\);';
1866 sed = "/^void\t" '(\*signal())();$/i' "\\\n"
1867 "#ifdef __cplusplus" "\\\n"
1868 "void\t(*signal(...))(...);" "\\\n"
1871 sed = "/^void\t" '(\*signal())();$/a' "\\\n"
1877 * Apply fix this to all OSs since this problem seems to effect
1878 * more than just SunOS. In general, fixes which are triggered
1879 * by a specific target are bad.
1882 hackname = sun_auth_proto;
1888 * Select those files containing '(*name)()'.
1890 select = '\(\*[a-z][a-z_]*\)\(\)';
1892 '/^\(.*(\*[a-z][a-z_]*)(\)' '\();.*\)'
1894 "#ifdef __cplusplus\\\n"
1904 * math.h on SunOS 4 puts the declaration of matherr before the definition
1905 * of struct exception, so the prototype (added by fixproto) causes havoc.
1908 hackname = sunos_matherr_decl;
1911 * Once a declaration for 'struct exception' is found,
1912 * stop trying to insert a forward reference for it.
1914 sed = "/^struct exception/,$b";
1915 sed = "/matherr/i\\\nstruct exception;\n";
1920 * Correct the return type for strlen in strings.h in SunOS 4.
1923 hackname = sunos_strlen;
1925 sed = "s/int[ \t]*strlen();/__SIZE_TYPE__ strlen();/";
1930 * Solaris math.h and floatingpoint.h define __P without protection,
1931 * which conflicts with the fixproto definition. The fixproto
1932 * definition and the Solaris definition are used the same way.
1938 files = floatingpoint.h;
1939 select = "^#define[ \t]*__P";
1940 sed = "/^#define[ \t]*__P/i\\\n#ifndef __P\n";
1941 sed = "/^#define[ \t]*__P/a\\\n#endif\n";
1946 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
1947 * that is visible to any ANSI compiler using this include. Simply
1948 * delete the lines that #define some string functions to internal forms.
1952 hackname = svr4_disable_opt;
1954 select = '#define.*__std_hdr_';
1955 sed = '/#define.*__std_hdr_/d';
1961 * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
1962 * On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
1963 * but we still "hijack" it and redirect it to the GNU byteorder.h..
1969 hackname = svr4_endian;
1970 files = sys/endian.h;
1973 * since we emit our own sys/byteorder.h,
1974 * this fix can never be applied to that file.
1976 files = sys/byteorder.h;
1978 bypass = '__GNUC__';
1980 sed = "/#\tifdef\t__STDC__/i\\\n"
1981 "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
1983 sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
1985 sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
1986 "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
1992 * Remove useless extern keyword from struct forward declarations
1993 * in <sys/stream.h> and <sys/strsubr.h>
1997 hackname = svr4_extern_struct;
1998 files = sys/stream.h;
1999 files = sys/strsubr.h;
2000 select = 'extern struct [a-z_]*;';
2001 sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
2006 * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
2007 * systems the file <ftw.h> contains extern declarations of these
2008 * functions followed by explicitly `static' definitions of these
2009 * functions... and that's not allowed according to ANSI C. (Note
2010 * however that on Solaris, this header file glitch has been pre-fixed by
2011 * Sun. In the Solaris version of <ftw.h> there are no static
2012 * definitions of any function so we don't need to do any of this stuff
2018 hackname = svr4_ftw;
2020 select = '^extern int ftw\(const';
2022 sed = '/^extern int ftw(const/i' "\\\n"
2023 "#if !defined(_STYPES)\\\n"
2028 sed = 's/extern \(int ftw(const.*\)$/\1/';
2029 sed = "/^extern int nftw/i\\\n"
2030 "#if defined(_STYPES)\\\n"
2035 sed = 's/extern \(int nftw.*\)$/\1/';
2036 sed = "/^extern int ftw(),/c\\\n"
2037 "#if !defined(_STYPES)\\\n"
2043 "#if defined(_STYPES)\\\n"
2055 * Fix broken decl of getcwd present on some svr4 systems.
2059 hackname = svr4_getcwd;
2062 select = 'getcwd\(char \*, int\)';
2064 sed = 's/getcwd(char \*, int)/getcwd(char *, size_t)/';
2073 hackname = svr4_kernel;
2074 files = fs/rfs/rf_cache.h;
2078 files = sys/getpages.h;
2080 files = sys/cmn_err.h;
2081 files = sys/kdebugger.h;
2083 sed = "1i\\\n#ifdef _KERNEL";
2084 sed = "$a\\\n#endif /* _KERNEL */";
2089 * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
2090 * tend to conflict with the compiler's own definition of this symbol. (We
2091 * will use the compiler's definition.)
2092 * Likewise __sparc, for Solaris, and __i860, and a few others
2093 * (guessing it is necessary for all of them).
2097 hackname = svr4_mach_defines;
2099 select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
2100 sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
2106 * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
2107 * They are declared as non-static then immediately redeclared as static.
2111 hackname = svr4_mkdev;
2112 files = sys/mkdev.h;
2115 sed = "/^dev_t makedev(/s/^/static /";
2116 sed = "/^major_t major(/s/^/static /";
2117 sed = "/^minor_t minor(/s/^/static /";
2123 * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
2124 * Also fix types of array initializers.
2128 hackname = svr4_netcspace;
2129 files = sys/netcspace.h;
2130 select = 'NC_NPI_RAW';
2131 sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
2132 sed = 's/NC_/(unsigned long) NC_/';
2137 * Fix reference to NMSZ in <sys/adv.h>.
2141 hackname = svr4_nmsz;
2143 select = '\[NMSZ\]';
2144 sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
2149 * Fix broken decl of profil present on some svr4 systems.
2153 hackname = svr4_profil;
2157 sed = 's/profil(unsigned short \*, unsigned int, '
2158 'unsigned int, unsigned int)'
2159 '/profil(unsigned short *, size_t, int, unsigned)/';
2164 * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
2168 hackname = svr4_proto_form;
2170 select = 'const extern';
2172 sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
2177 sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
2182 sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
2187 sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
2192 sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
2193 sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
2194 sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
2195 sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
2196 sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
2197 sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
2202 * Add a prototyped declaration of mmap to <sys/mman.h>.
2206 hackname = svr4_proto_mmap;
2208 select = '^extern caddr_t mmap();$';
2209 sed = '/^extern caddr_t mmap();$/c' "\\\n"
2210 "#ifdef __STDC__\\\n"
2211 "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
2212 "#else /* !defined(__STDC__) */\\\n"
2213 "extern caddr_t mmap ();\\\n"
2214 "#endif /* !defined(__STDC__) */\\\n";
2219 * Add a #define of _SIGACTION_ into <sys/signal.h>.
2223 hackname = svr4_sigaction;
2224 files = sys/signal.h;
2225 sed = "/^struct sigaction {/i\\\n"
2226 "#define _SIGACTION_";
2227 sed = 's/(void *(\*)())/(void (*)(int))/';
2232 * Put storage class at start of decl, to avoid warning.
2236 hackname = svr4_storage_class;
2237 files = rpc/types.h;
2238 select = 'const extern';
2239 sed = 's/const extern/extern const/g';
2245 * Like svr4_mach_defines, but with newfangled syntax.
2246 * Source lines are of #define __i386 #machine(i386). Delete them.
2250 hackname = svr5_mach_defines;
2252 select = "#define[ \t]*__i386.*\(i386\)";
2253 sed = "/#define[ \t]*__i386.*/d";
2259 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
2260 * in string.h on sysV68
2261 * Correct the return type for strlen in string.h on Lynx.
2262 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
2263 * Add missing const for strdup on OSF/1 V3.0.
2264 * On sysV88 layout is slightly different.
2267 hackname = systypes;
2268 files = "sys/types.h";
2270 files = "sys/stdtypes.h";
2274 select = "typedef[ \t]+[a-z_][ \ta-z_]*[ \t]"
2275 "(size|ptrdiff|wchar)_t";
2277 sed = "/^[ \t]*\\*[ \t]*typedef unsigned int size_t;/N";
2279 sed = "s/^\\([ \t]*\\*[ \t]*typedef unsigned int size_t;\\n"
2280 "[ \t]*\\*\\/\\)/\\1\\\n"
2281 "#ifndef __SIZE_TYPE__\\\n"
2282 "#define __SIZE_TYPE__ long unsigned int\\\n"
2284 "typedef __SIZE_TYPE__ size_t;\\\n/";
2286 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/i\\\n"
2287 "#ifndef __SIZE_TYPE__\\\n"
2288 "#define __SIZE_TYPE__ long unsigned int\\\n"
2291 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/"
2292 "typedef __SIZE_TYPE__ size_t/";
2294 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/i\\\n"
2295 "#ifndef __PTRDIFF_TYPE__\\\n"
2296 "#define __PTRDIFF_TYPE__ long int\\\n"
2299 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/"
2300 "typedef __PTRDIFF_TYPE__ ptrdiff_t/";
2302 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/i\\\n"
2303 "#ifndef __WCHAR_TYPE__\\\n"
2304 "#define __WCHAR_TYPE__ int\\\n"
2306 "#ifndef __cplusplus\n";
2308 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/a\\\n"
2311 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/"
2312 "typedef __WCHAR_TYPE__ wchar_t/";
2317 * Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
2318 * Also wrap protection around size_t for m88k-sysv3 systems.
2319 * We use a funny name to ensure it follows 'systypes' fix.
2322 hackname = systypes_for_aix;
2323 files = sys/types.h;
2324 select = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";
2325 bypass = "_GCC_SIZE_T";
2327 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
2328 "#ifndef _GCC_SIZE_T\\\n"
2329 "#define _GCC_SIZE_T\n";
2331 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/a\\\n"
2337 * if the #if says _cplusplus, not the double underscore __cplusplus
2341 hackname = sysv68_string;
2344 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
2345 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
2346 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
2347 sed = "/^extern char$/N";
2348 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
2349 sed = "/^\tstrncmp(),$/N";
2350 sed = "s/^\\(\tstrncmp()\\),\\n\\(\tstrlen(),\\)$/\\1;\\\n"
2351 "extern unsigned int\\\n\\2/";
2352 sed = "/^extern int$/N";
2353 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
2358 * Fix return type of exit and abort in <stdlib.h>
2359 * Also wrap protection around size_t.
2362 hackname = sysz_stdlib_for_sun;
2365 sed = "s/int\tabort/void\tabort/g";
2366 sed = "s/int\tfree/void\tfree/g";
2367 sed = "s/char[ \t]*\\*[ \t]*calloc/void \\*\tcalloc/g";
2368 sed = "s/char[ \t]*\\*[ \t]*malloc/void \\*\tmalloc/g";
2369 sed = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
2370 sed = "s/char[ \t]*\\*[ \t]*bsearch/void \\*\tbsearch/g";
2371 sed = "s/int[ \t][ \t]*exit/void\texit/g";
2373 sed = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/i\\\n"
2374 "#ifndef _GCC_SIZE_T\\\n"
2375 "#define _GCC_SIZE_T\n";
2377 sed = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/a\\\n"
2383 * Fix this Sun file to avoid interfering with stddef.h.
2384 * We use a funny name to ensure it follows 'systypes' fix.
2387 hackname = sysz_stdtypes_for_sun;
2388 files = sys/stdtypes.h;
2389 sed = "/[\t ]size_t.*;/i\\\n"
2390 "#ifndef _GCC_SIZE_T\\\n"
2391 "#define _GCC_SIZE_T\n";
2393 sed = "/[\t ]size_t.*;/a\\\n"
2396 sed = "/[\t ]ptrdiff_t.*;/i\\\n"
2397 "#ifndef _GCC_PTRDIFF_T\\\n"
2398 "#define _GCC_PTRDIFF_T\n";
2400 sed = "/[\t ]ptrdiff_t.*;/a\\\n"
2403 sed = "/[\t ]wchar_t.*;/i\\\n"
2404 "#ifndef _GCC_WCHAR_T\\\n"
2405 "#define _GCC_WCHAR_T\n";
2407 sed = "/[\t ]wchar_t.*;/a\\\n"
2413 * Fix this file to avoid interfering with stddef.h,
2414 * but don't mistakenly match ssize_t present in AIX for the ps/2,
2415 * or typedefs which use (but do not set) size_t.
2418 hackname = tinfo_cplusplus;
2420 sed = "s/[ \t]_cplusplus/ __cplusplus/";
2425 * Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
2428 hackname = ultrix_ansi_compat;
2429 files = ansi_compat.h;
2431 sed = "1i\\\n/* This file intentionally left blank. */\n";
2437 * Ultrix V4.[35] puts the declaration of uname before the definition
2438 * of struct utsname, so the prototype (added by fixproto) causes havoc.
2441 hackname = ultrix_fix_fixproto;
2442 files = sys/utsname.h;
2444 sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
2445 "struct utsname;\n";
2450 * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
2451 * also get rid of bogus inline definitions in HP-UX 8.0
2454 hackname = ultrix_atof_param;
2457 sed = "s@atof(\\([ \t]*char[ \t]*\\*[^)]*\\))@atof(const \\1)@";
2458 sed = "s@inline int abs(int [a-z][a-z]*) {.*}@extern \"C\" int abs(int);@";
2459 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
2460 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
2461 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
2466 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
2469 hackname = ultrix_const;
2472 sed = 's@perror( char \*__s );@perror( const char *__s );@';
2473 sed = 's@fputs( char \*__s,@fputs( const char *__s,@';
2474 sed = 's@fopen( char \*__filename, char \*__type );@'
2475 'fopen( const char *__filename, const char *__type );@';
2476 sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@';
2477 sed = 's@fscanf( FILE \*__stream, char \*__format,@'
2478 'fscanf( FILE *__stream, const char *__format,@';
2479 sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
2480 sed = 's@sscanf( char \*__s, char \*__format,@'
2481 'sscanf( const char *__s, const char *__format,@';
2482 sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
2483 sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
2488 * Check for bad #ifdef line (in Ultrix 4.1)
2491 hackname = ultrix_ifdef;
2492 select = "#ifdef KERNEL";
2494 sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
2499 * Avoid nested comments on Ultrix 4.3.
2502 hackname = ultrix_nested_cmnt;
2504 sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
2509 * Check for superfluous `static' (in Ultrix 4.2)
2510 * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
2513 hackname = ultrix_static;
2514 files = machine/cpu.h;
2515 select = '#include "r[34]_cpu';
2516 sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
2517 sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
2518 sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
2523 * Fix multiple defines for NULL
2526 hackname = undefine_null;
2527 select = "^#[ \t]*define[ \t]*[ \t]NULL[ \t]";
2528 bypass = "#[ \t]*(ifn|un)def[ \t]*[ \t]NULL($|[ \t])";
2529 sed = "/^#[ \t]*define[ \t][ \t]*NULL[ \t]/i\\\n"
2535 * If arpa/inet.h prototypes are incompatible with the ones we just
2536 * installed in <sys/byteorder.h>, just remove the protos.
2537 * Because of this close association, this patch must be applied only
2538 * on those systems where the replacement byteorder header is installed.
2541 hackname = unixware7_byteorder_fix;
2542 files = arpa/inet.h;
2543 select = "in_port_t";
2545 mach = "*-*-sysv4*";
2546 mach = "i[34567]86-*-sysv5*";
2547 mach = "i[34567]86-*-udk*";
2548 mach = "i[34567]86-*-solaris2.[0-4]";
2549 mach = "powerpcle-*-solaris2.[0-4]";
2550 mach = "sparc-*-solaris2.[0-4]";
2552 sed = '/^extern.*htons.*(in_port_t)/d';
2553 sed = '/^extern.*ntohs.*(in_port_t)/d';
2558 * Fix definitions of macros used by va-i960.h in VxWorks header file.
2561 hackname = va_i960_macro;
2562 files = arch/i960/archI960.h;
2563 select = "__(vsiz|vali|vpad|alignof__)";
2564 sed = "s/__vsiz/__vxvsiz/";
2565 sed = "s/__vali/__vxvali/";
2566 sed = "s/__vpad/__vxvpad/";
2567 sed = "s/__alignof__/__vxalignof__/";
2572 * AIX headers define NULL to be cast to a void pointer,
2573 * which is illegal in ANSI C++.
2576 hackname = void_null;
2586 files = sys/param.h;
2587 files = sys/types.h;
2588 select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void";
2589 sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)"
2595 * Make VxWorks header which is almost gcc ready fully gcc ready.
2598 hackname = vxworks_gcc_problem;
2599 files = types/vxTypesBase.h;
2600 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
2602 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
2605 sed = "/[ \t]size_t/i\\\n"
2606 "#ifndef _GCC_SIZE_T\\\n"
2607 "#define _GCC_SIZE_T\n";
2609 sed = "/[ \t]size_t/a\\\n"
2612 sed = "/[ \t]ptrdiff_t/i\\\n"
2613 "#ifndef _GCC_PTRDIFF_T\\\n"
2614 "#define _GCC_PTRDIFF_T\n";
2616 sed = "/[ \t]ptrdiff_t/a\\\n"
2619 sed = "/[ \t]wchar_t/i\\\n"
2620 "#ifndef _GCC_WCHAR_T\\\n"
2621 "#define _GCC_WCHAR_T\n";
2623 sed = "/[ \t]wchar_t/a\\\n"
2629 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
2632 hackname = vxworks_needs_vxtypes;
2634 select = "uint_t[ \t][ \t]*_clocks_per_sec";
2635 sed = "s/uint_t/unsigned int/";
2640 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2643 hackname = vxworks_needs_vxworks;
2645 test = " -r types/vxTypesOld.h";
2646 test = " -n \"`egrep '#include' $file`\"";
2647 test = " -n \"`egrep ULONG $file`\"";
2648 select = "#[ \t]define[ \t][ \t]*__INCstath";
2650 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
2651 "#include <types/vxTypesOld.h>\n";
2656 * Another bad dependency in VxWorks 5.2 <time.h>.
2659 hackname = vxworks_time;
2661 select = "VOIDFUNCPTR";
2662 test = " -r vxWorks.h";
2663 sed = "/VOIDFUNCPTR/i\\\n"
2664 "#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
2665 "#ifdef __cplusplus\\\n"
2666 "typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
2668 "typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
2670 "#define __gcc_VOIDFUNCPTR_defined\\\n"
2673 sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g";
2678 * There are several name conflicts with C++ reserved words in X11 header
2679 * files. These are fixed in some versions, so don't do the fixes if
2680 * we find __cplusplus in the file. These were found on the RS/6000.
2683 hackname = x11_class;
2684 files = X11/ShellP.h;
2685 bypass = __cplusplus;
2686 sed = "/char \\*class;/i\\\n"
2687 "#ifdef __cplusplus\\\n"
2688 "\tchar *c_class;\\\n"
2690 sed = "/char \\*class;/a\\\n"
2696 * class in Xm/BaseClassI.h
2699 hackname = x11_class_usage;
2700 files = Xm/BaseClassI.h;
2701 bypass = "__cplusplus";
2702 sed = "s/ class[)]/ c_class)/g";
2707 * new in Xm/Traversal.h
2711 files = Xm/Traversal.h;
2712 bypass = __cplusplus;
2714 sed = "/Widget\told, new;/i\\\n"
2715 "#ifdef __cplusplus\\\n"
2716 "\tWidget\told, c_new;\\\n"
2719 sed = "/Widget\told, new;/a\\\n"
2722 sed = "s/Widget new,/Widget c_new,/g";
2727 * Incorrect sprintf declaration in X11/Xmu.h
2730 hackname = x11_sprintf;
2732 sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
2733 "extern char *\tsprintf();\\\n"
2734 "#endif /* !defined __STDC__ */,";