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 Set up a debug test so we can make the templates emit special
12 code while debugging these fixes: */
18 /* DO NOT DO BROKEN FIXES (empty replacement fixes) */
21 * Purge some HP-UX 11 files that are only broken after they are "fixed".
24 hackname = AAA_ki_iface;
25 files = sys/ki_iface.h;
26 select = 'These definitions are for HP Internal developers';
27 replace; /* empty replacement -> no fixing the file */
32 * Purge some HP-UX 11 files that are only broken after they are "fixed".
37 select = '11.00 HP-UX LP64';
38 replace; /* empty replacement -> no fixing the file */
43 * Purge some HP-UX 11 files that are only broken after they are "fixed".
46 hackname = AAA_ki_calls;
47 files = sys/ki_calls.h;
48 select = 'kthread_create_caller_t';
49 replace; /* empty replacement -> no fixing the file */
54 * Purge some HP-UX 11 files that are only broken after they are "fixed".
57 hackname = AAA_ki_defs;
58 files = sys/ki_defs.h;
59 select = 'Kernel Instrumentation Definitions';
60 replace; /* empty replacement -> no fixing the file */
65 * This file on SunOS 4 has a very large macro. When the sed loop
66 * tries pull it in, it overflows the pattern space size of the SunOS
67 * sed (GNU sed does not have this problem). Since the file does not
68 * require fixing, we remove it from the fixed directory.
71 hackname = AAA_bad_fixes;
72 files = sundev/ipi_error.h;
73 /* shouldn't there be a select expression here??? */
74 replace; /* empty replacement -> no fixing the file */
79 * Purge some HP-UX 11 files that are only broken after they are "fixed".
84 select = '11.0 and later representation of ki time';
85 replace; /* empty replacement -> no fixing the file */
88 /* And now, the real fixes, replacement text fixes first: */
91 * Completely replace <_int_varargs.h> with a file that includes gcc's
92 * stdarg.h or varargs.h files as appropriate on DG/UX
95 hackname = AAB_dgux_int_varargs;
96 files = _int_varargs.h;
97 replace = "#ifndef __INT_VARARGS_H
98 \#define __INT_VARARGS_H
100 /************************************************************************/
101 /* _INT_VARARGS.H - Define the common stuff for varargs/stdarg/stdio. */
102 /************************************************************************/
105 ** This file is a DG internal header. Never include this
109 \#ifndef ___int_features_h
110 \#include <sys/_int_features.h>
113 \#if !(defined(_VA_LIST) || defined(_VA_LIST_))
120 typedef void * va_list;
122 typedef char * va_list;
128 \#if defined(__DCC__)
136 \#else /* ! defined(__DCC__) */
139 int __va_arg; /* argument number */
140 int *__va_stk; /* start of args passed on stack */
141 int *__va_reg; /* start of args passed in regs */
144 \#endif /* ! defined(__DCC__) */
148 \#if defined(__GNUC__) || defined(__STDC__)
149 typedef void * va_list;
151 typedef char * va_list;
154 \#endif /* _IX86_ANY */
156 \#endif /* __LINT__ */
157 \#endif /* !(defined(_VA_LIST) || defined(_VA_LIST_)) */
158 \#endif /* #ifndef __INT_VARARGS_H */\n";
163 * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
166 hackname = AAB_fd_zero_asm_posix_types_h;
167 files = asm/posix_types.h;
168 mach = 'i[34567]86-*-linux-gnu*';
172 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
173 * the start, so that if #include_next gets another instance of
174 * the wrapper, this will follow the #include_next chain until
175 * we arrive at the real <asm/posix_types.h>.
179 '/* This file fixes a bug in the __FD_ZERO macro
180 for older versions of the Linux kernel. */
181 \#ifndef _POSIX_TYPES_H_WRAPPER
182 \#include <features.h>
183 \#include_next <asm/posix_types.h>
185 \#if defined(__FD_ZERO) && !defined(__GLIBC__)
187 \#define __FD_ZERO(fdsetp) \\
190 __asm__ __volatile__("cld ; rep ; stosl" \\
191 : "=&c" (__d0), "=&D" (__d1) \\
192 : "a" (0), "0" (__FDSET_LONGS), \\
193 "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \\
197 \#define _POSIX_TYPES_H_WRAPPER
198 \#endif /* _POSIX_TYPES_H_WRAPPER */
204 * This fixes __FD_ZERO bug for glibc-1.x
207 hackname = AAB_fd_zero_gnu_types_h;
209 mach = 'i[34567]86-*-linux-gnu*';
212 * Define _TYPES_H_WRAPPER at the end of the wrapper, not
213 * the start, so that if #include_next gets another instance of
214 * the wrapper, this will follow the #include_next chain until
215 * we arrive at the real <gnu/types.h>.
219 '/* This file fixes a bug in the __FD_ZERO macro present in glibc 1.x. */
220 \#ifndef _TYPES_H_WRAPPER
221 \#include <features.h>
222 \#include_next <gnu/types.h>
224 \#if defined(__FD_ZERO) && !defined(__GLIBC__)
226 \# define __FD_ZERO(fdsetp) \\
229 __asm__ __volatile__("cld ; rep ; stosl" \\
230 : "=&c" (__d0), "=&D" (__d1) \\
231 : "a" (0), "0" (__FDSET_LONGS), \\
232 "1" ((__fd_set *) (fdsetp)) :"memory"); \\
236 \#define _TYPES_H_WRAPPER
237 \#endif /* _TYPES_H_WRAPPER */
243 * This fixes __FD_ZERO bug for glibc-2.0.x
246 hackname = AAB_fd_zero_selectbits_h;
247 files = selectbits.h;
248 mach = 'i[34567]86-*-linux-gnu*';
251 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not
252 * the start, so that if #include_next gets another instance of
253 * the wrapper, this will follow the #include_next chain until
254 * we arrive at the real <selectbits.h>.
258 '/* This file fixes a bug in the __FD_ZERO macro present in glibc 2.0.x. */
259 \#ifndef _SELECTBITS_H_WRAPPER
260 \#include <features.h>
261 \#include_next <selectbits.h>
263 \#if defined(__FD_ZERO) && defined(__GLIBC__) \\
264 && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 \\
265 && __GLIBC_MINOR__ == 0
267 \#define __FD_ZERO(fdsetp) \\
270 __asm__ __volatile__ ("cld; rep; stosl" \\
271 : "=&c" (__d0), "=&D" (__d1) \\
272 : "a" (0), "0" (sizeof (__fd_set) \\
273 / sizeof (__fd_mask)), \\
274 "1" ((__fd_mask *) (fdsetp)) \\
279 \#define _SELECTBITS_H_WRAPPER
280 \#endif /* _SELECTBITS_H_WRAPPER */
286 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
287 * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
288 * many other systems have similar text but correct versions of the file.
289 * To ensure only Sun's is fixed, we grep for a likely unique string.
290 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
293 hackname = AAB_sun_memcpy;
295 select = "/\\*\t@\\(#\\)"
296 "(head/memory.h\t50.1\t "
297 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
300 '/* This file was generated by fixincludes */
301 \#ifndef __memory_h__
302 \#define __memory_h__
305 extern void *memccpy();
306 extern void *memchr();
307 extern void *memcpy();
308 extern void *memset();
310 extern char *memccpy();
311 extern char *memchr();
312 extern char *memcpy();
313 extern char *memset();
314 \#endif /* __STDC__ */
318 \#endif /* __memory_h__ */
325 * Completely replace <sys/byteorder.h>; with a file that implements gcc's
326 * optimized byteswapping. Restricted to "SVR4" machines until either
327 * it is shown to be safe to replace this file always, or we get bolder ;-)
330 hackname = AAB_svr4_replace_byteorder;
333 mach = "i[34567]86-*-sysv5*";
334 mach = "i[34567]86-*-udk*";
335 mach = "i[34567]86-*-solaris2.[0-4]";
336 mach = "powerpcle-*-solaris2.[0-4]";
337 mach = "sparc-*-solaris2.[0-4]";
339 files = sys/byteorder.h;
340 replace = '#ifndef _SYS_BYTEORDER_H
341 \#define _SYS_BYTEORDER_H
343 /* Functions to convert `short\' and `long\' quantities from host byte order
344 to (internet) network byte order (i.e. big-endian).
346 Written by Ron Guilmette (rfg@ncd.com).
348 This isn\'t actually used by GCC. It is installed by fixinc.svr4.
350 For big-endian machines these functions are essentially no-ops.
352 For little-endian machines, we define the functions using specialized
353 asm sequences in cases where doing so yields better code (e.g. i386). */
355 \#if !defined (__GNUC__) && !defined (__GNUG__)
356 \#error You lose! This file is only useful with GNU compilers.
359 \#ifndef __BYTE_ORDER__
360 /* Byte order defines. These are as defined on UnixWare 1.1, but with
361 double underscores added at the front and back. */
362 \#define __LITTLE_ENDIAN__ 1234
363 \#define __BIG_ENDIAN__ 4321
364 \#define __PDP_ENDIAN__ 3412
368 static __inline__ unsigned long htonl (unsigned long);
369 static __inline__ unsigned short htons (unsigned int);
370 static __inline__ unsigned long ntohl (unsigned long);
371 static __inline__ unsigned short ntohs (unsigned int);
372 \#endif /* defined (__STDC__) */
374 \#if defined (__i386__)
376 \#ifndef __BYTE_ORDER__
377 \#define __BYTE_ORDER__ __LITTLE_ENDIAN__
380 /* Convert a host long to a network long. */
382 /* We must use a new-style function definition, so that this will also
384 static __inline__ unsigned long
385 htonl (unsigned long __arg)
387 register unsigned long __result;
389 __asm__ ("xchg%B0 %b0,%h0
391 xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
395 /* Convert a host short to a network short. */
397 static __inline__ unsigned short
398 htons (unsigned int __arg)
400 register unsigned short __result;
402 __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
406 \#elif ((defined (__i860__) && !defined (__i860_big_endian__)) \\
407 || defined (__ns32k__) || defined (__vax__) \\
408 || defined (__spur__) || defined (__arm__))
410 \#ifndef __BYTE_ORDER__
411 \#define __BYTE_ORDER__ __LITTLE_ENDIAN__
414 /* For other little-endian machines, using C code is just as efficient as
415 using assembly code. */
417 /* Convert a host long to a network long. */
419 static __inline__ unsigned long
420 htonl (unsigned long __arg)
422 register unsigned long __result;
424 __result = (__arg >> 24) & 0x000000ff;
425 __result |= (__arg >> 8) & 0x0000ff00;
426 __result |= (__arg << 8) & 0x00ff0000;
427 __result |= (__arg << 24) & 0xff000000;
431 /* Convert a host short to a network short. */
433 static __inline__ unsigned short
434 htons (unsigned int __arg)
436 register unsigned short __result;
438 __result = (__arg << 8) & 0xff00;
439 __result |= (__arg >> 8) & 0x00ff;
443 \#else /* must be a big-endian machine */
445 \#ifndef __BYTE_ORDER__
446 \#define __BYTE_ORDER__ __BIG_ENDIAN__
449 /* Convert a host long to a network long. */
451 static __inline__ unsigned long
452 htonl (unsigned long __arg)
457 /* Convert a host short to a network short. */
459 static __inline__ unsigned short
460 htons (unsigned int __arg)
465 \#endif /* big-endian */
467 /* Convert a network long to a host long. */
469 static __inline__ unsigned long
470 ntohl (unsigned long __arg)
472 return htonl (__arg);
475 /* Convert a network short to a host short. */
477 static __inline__ unsigned short
478 ntohs (unsigned int __arg)
480 return htons (__arg);
488 * Completely replace <sys/varargs.h> with a file that includes gcc's
489 * stdarg.h or varargs.h files as appropriate.
493 hackname = AAB_svr4_no_varargs;
494 files = sys/varargs.h;
495 replace = "/* This file was generated by fixincludes. */\n"
496 "#ifndef _SYS_VARARGS_H\n"
497 "#define _SYS_VARARGS_H\n\n"
500 "#include <stdarg.h>\n"
502 "#include <varargs.h>\n"
505 "#endif /* _SYS_VARARGS_H */\n";
511 * Cancel out ansi_compat.h on Ultrix. Replace it with an empty file.
514 hackname = AAB_ultrix_ansi_compat;
515 files = ansi_compat.h;
517 replace = "/* This file intentionally left blank. */\n";
522 * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
523 * of struct rusage, so the prototype (added by fixproto) causes havoc.
526 hackname = aix_syswait;
529 sed = "/^extern pid_t wait3();$/i\\\n"
535 * sys/signal.h on some versions of AIX uses volatile in the typedef of
536 * sig_atomic_t, which causes gcc to generate a warning about duplicate
537 * volatile when a sig_atomic_t variable is declared volatile, as
538 * required by ANSI C.
541 hackname = aix_volatile;
542 files = sys/signal.h;
543 select = "typedef volatile int sig_atomic_t";
544 sed = "s/typedef volatile int sig_atomic_t"
545 "/typedef int sig_atomic_t/";
550 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
553 hackname = alpha_getopt;
556 select = 'getopt\(int, char \*\[';
557 sed = 's/getopt(int, char \*\[\],[ ]*char \*)/'
558 'getopt(int, char *const[], const char *)/';
563 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
566 hackname = alpha_parens;
568 select = '#ifndef\(__mips64\)';
569 sed = "s/#ifndef(__mips64)/#ifndef __mips64/";
574 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
577 hackname = alpha_sbrk;
579 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
580 sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";
585 * Fix this ARM/RISCiX file where ___type is a Compiler
586 * hint that is specific to the Norcroft compiler.
589 hackname = arm_norcroft_hint;
590 select = "___type p_type";
591 files = "X11/Intrinsic.h";
592 sed = "s/___type p_type/p_type/";
597 * Fix this ARM/RISCiX file to avoid interfering
598 * with the use of __wchar_t in cc1plus.
601 hackname = arm_wchar;
603 select = "#[ \t]*define[ \t]*__wchar_t";
604 sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
605 sed = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
610 * This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89;
611 * gcc doesn't understand it.
616 select = "#ifndef NOINLINE";
617 sed = "s|#ifndef NOINLINE"
618 "|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|";
623 * For C++, avoid any typedef or macro definition of bool,
624 * and use the built in type instead.
625 * HP/UX 10.20 also has it in curses_colr/curses.h.
628 hackname = avoid_bool;
630 files = curses_colr/curses.h;
634 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
635 "#ifndef __cplusplus\n";
637 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/a\\\n"
640 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/i\\\n"
641 "#ifndef __cplusplus\n";
643 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/a\\\n"
646 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/i\\\n"
647 "#ifndef __cplusplus\n";
649 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/a\\\n"
652 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/i\\\n"
653 "#ifndef __cplusplus\n";
655 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/a\\\n"
658 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/i\\\n"
659 "#ifndef __cplusplus\n";
661 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n"
667 * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
670 hackname = bad_struct_term;
672 select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
673 sed = "s/^[ \t]*typedef[ \t][ \t]*"
674 "\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
679 * Fix one other error in this file:
680 * a mismatched quote not inside a C comment.
684 files = sundev/vuid_event.h;
685 sed = "s/doesn't/does not/";
690 * Fix #defines under Alpha OSF/1:
691 * The following files contain '#pragma extern_prefix "_FOO"' followed by
692 * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
693 * statements is to reduce namespace pollution. While these macros work
694 * properly in most cases, they don't allow you to take a pointer to the
695 * "something" being modified. To get around this limitation, change these
696 * statements to be of the form '#define something _FOOsomething'.
701 select = "^[ \t]*#[ \t]*pragma[ \t][ \t]*extern_prefix";
718 "s/^[ \t]*#[ \t]*define[ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
719 "\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
724 * check for broken assert.h that needs stdio.h
727 hackname = broken_assert_stdio;
730 bypass = "include.*stdio.h";
732 "#include <stdio.h>\n";
737 * check for broken assert.h that needs stdlib.h
740 hackname = broken_assert_stdlib;
742 select = 'exit *\(|abort *\(';
743 bypass = "include.*stdlib.h";
745 "#ifdef __cplusplus\\\n"
746 "#include <stdlib.h>\\\n"
752 * Note that BSD43_* are used on recent MIPS systems.
755 hackname = bsd43_io_macros;
756 select = "BSD43__IO";
758 * Put single quotes aroung the character that appears after '('
759 * and before ',', UNLESS it is a 'c' or 'g' or 'x'.
761 sed = "/[ \t]BSD43__IO[A-Z]*[ \t]*(/" 's/(\(.\),/(\'\1\',/';
762 sed = "/#[ \t]*define[ \t]*[ \t]BSD43__IO/" 's/\'\([cgx]\)\'/\1/g';
767 * Fix <c_asm.h> on Digital UNIX V4.0:
768 * It contains a prototype for a DEC C internal asm() function,
769 * clashing with gcc's asm keyword. So protect this with __DECC.
772 hackname = dec_intern_asm;
774 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
775 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
781 * Remove the double-slash comments. The "double_slash" test will
782 * try to ignore C++ headers by checking for "CC/", "xx/" and "++/"
783 * in the file name. There are still the occasional C++ headers
784 * that have their comments stripped. Too bad.
787 hackname = no_double_slash;
788 c_test = "double_slash";
789 c_fix = "no_double_slash";
794 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
797 hackname = ecd_cursor;
798 files = "sunwindow/win_lock.h";
799 files = "sunwindow/win_cursor.h";
800 sed = "s/ecd.cursor/ecd_cursor/";
805 * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
806 * tiny static wrappers that aren't C++ safe.
809 hackname = sco5_stat_wrappers;
810 mach = "i*86-*-sco3.2v5*";
811 files = "sys/stat.h";
813 sed = "/^static int[ \t]*[a-z]*stat(/i\\\n"
814 "#ifdef __cplusplus\\\n"
820 "#ifdef __cplusplus\\\n"
822 "#endif \/* __cplusplus *\/\\\n";
827 * Fix else and endif directives that contain non-commentary text
830 hackname = end_else_label;
833 * Select files that contain '#endif' or '#else' directives with
834 * some sort of following junk.
836 c_test = "else_endif_label";
837 c_fix = "else_endif_label";
842 * Fix HP's use of ../machine/inline.h to refer to
843 * /usr/include/machine/inline.h
846 hackname = hp_inline;
847 files = sys/spinlock.h;
848 select = 'include.*"\.\./machine/';
849 sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
850 sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
855 * Check for (...) in C++ code in HP/UX sys/file.h.
858 hackname = hp_sysfile;
860 select = "HPUX_SOURCE";
861 sed = 's/(\.\.\.)/(struct file * ...)/';
866 * sys/mman.h on HP/UX is not C++ ready,
867 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
869 * rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
870 * is defined for the alpha. The problem is the declaration of malloc.
873 hackname = cxx_unready;
876 bypass = '"C"|__BEGIN_DECLS';
879 "#ifdef __cplusplus\\\n"
883 "#ifdef __cplusplus\\\n"
890 * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
893 hackname = hpux_maxint;
895 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
898 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
904 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
907 hackname = hpux_systime;
909 select = "^extern struct sigevent;";
910 sed = "s/^extern struct sigevent;/struct sigevent;/";
914 * get rid of bogus inline definitions in HP-UX 8.0
917 hackname = hpux8_bogus_inlines;
920 sed = "s@inline int abs(int [a-z][a-z]*) {.*}@extern \"C\" int abs(int);@";
921 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
922 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
923 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
928 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
929 * of UINT32_C has undefined behavior according to ISO/ANSI:
930 * the arguments to __CONCAT__ are not macro expanded before the
931 * concatination happens so the trailing ')' in the first argument
932 * is concatinated with the 'l' in the second argument creating an
933 * invalid pp token. The behavior of invalid pp tokens is undefined.
934 * GCC does not handle these invalid tokens the way the HP compiler does.
935 * This problem will potentially occur anytime macros are used in the
936 * arguments to __CONCAT__. A general solution to this problem would be to
937 * insert another layer of macro between __CONCAT__ and its use
938 * in UINT32_C. An example of this solution can be found in the C standard.
939 * A more specific solution, the one used here, is to change the UINT32_C
940 * macro to not used macros in the arguments to __CONCAT__.
944 hackname = hpux11_uint32_c;
946 select = "^#define UINT32_C\\(__c\\)[ \t]*__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
947 sed = "s/^#define UINT32_C(__c)\\([ \t]*\\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\\1__CONCAT__(__c,ul)/";
951 * On Interactive Unix 2.2, certain traditional Unix definitions
952 * (notably getc and putc in stdio.h) are omitted if __STDC__ is
953 * defined, not just if _POSIX_SOURCE is defined. This makes it
954 * impossible to compile any nontrivial program except with -posix.
957 hackname = isc_omits_with_stdc;
962 files = "sys/limits.h";
963 files = "sys/fcntl.h";
964 files = "sys/dirent.h";
966 select = "defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)";
968 sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
969 "!defined(_POSIX_SOURCE)/";
973 * Fix various _IO* defines, but do *not* quote the characters cgxtf.
976 hackname = io_def_quotes;
977 select = "[ \t]*[ \t](_|DES)IO[A-Z]*[ \t]*\\( *[^,']";
978 sed = "s/\\([ \t]*[ \t]_IO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/";
979 sed = "s/\\([ \t]*[ \t]DESIO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/";
980 sed = "/#[ \t]*define[ \t]*[ \t]_IO/" "s/'\\([cgxtf]\\)'/\\1/g";
981 sed = "/#[ \t]*define[ \t]*[ \t]DESIOC/" 's/\'\([cdgx]\)\'/\1/g';
988 * Basically, what is supposed to be happening is that every
989 * _invocation_ of the "_CTRL()" or "CTRL()" macros is supposed to have
990 * its argument inserted into single quotes. We _must_ do this because
991 * ANSI macro substitution rules prohibit looking inside quoted strings
992 * for the substitution names. A side effect is that the quotes are
993 * inserted in the definitions of those macros as well. So, the last
994 * several sed expressions are supposed to clean up the definitions, as
995 * long as those definitions are using "c", "g" or "x" as the macro
999 hackname = ioctl_fix_ctrl;
1000 select = "CTRL[ \t]*\\(";
1002 sed = "/[^A-Z0-9_]CTRL[ \t]*(/"
1003 "s/\\([^']\\))/'\\1')/";
1005 sed = "/[^A-Z0-9]_CTRL[ \t]*(/"
1006 "s/\\([^']\\))/'\\1')/";
1008 sed = "/#[ \t]*define[ \t]*[ \t]CTRL/"
1009 "s/'\\([cgx]\\)'/\\1/g";
1011 sed = "/#[ \t]*define[ \t]*[ \t]_CTRL/"
1012 "s/'\\([cgx]\\)'/\\1/g";
1014 sed = "/#[ \t]*define[ \t]*[ \t]BSD43_CTRL/"
1015 "s/'\\([cgx]\\)'/\\1/g";
1017 sed = "/#[ \t]*define[ \t]*[ \t][_]*ISCTRL/"
1018 "s/'\\([cgx]\\)'/\\1/g";
1023 * Check for missing ';' in struct
1026 hackname = ip_missing_semi;
1027 files = netinet/ip.h;
1029 sed = "/^struct/,/^};/s/}$/};/";
1034 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
1035 * in prototype without previous definition.
1038 hackname = irix_multiline_cmnt;
1039 files = sys/types.h;
1041 sed = "s@type of the result@type of the result */@";
1042 sed = "s@of the sizeof@/* of the sizeof@";
1047 * Some IRIX header files contain the string "//"
1050 hackname = irix_sockaddr;
1052 select = "authdes_create.*struct sockaddr";
1053 sed = "/authdes_create.*struct sockaddr/i\\\n"
1054 "struct sockaddr;\n";
1059 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
1060 * in prototype without previous definition.
1063 hackname = irix_struct__file;
1065 sed = "/xdrstdio_create.*struct __file_s/i\\\n"
1066 "struct __file_s;\n";
1071 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
1072 * that causes the assembly preprocessor to complain about an
1073 * unterminated character constant.
1076 hackname = irix_asm_apostrophe;
1079 select = "^[ \t]*#.*[Ww]e're";
1080 sed = "/^[ \t]*#/s/\\([Ww]e\\)'re/\\1 are/";
1085 * Fixing ISC fmod declaration
1088 hackname = isc_fmod;
1090 select = 'fmod\(double\)';
1091 sed = "s/fmod(double)/fmod(double, double)/";
1096 * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
1099 hackname = motorola_nested;
1100 mach = "m68k-motorola-sysv*";
1102 files = sys/limits.h;
1103 sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
1104 "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
1105 sed = "s@\\(/\\*#define\tHUGE_VAL\t3.40282346638528860e+38 \\)"
1106 "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
1111 * Fixing nested comments in ISC <sys/limits.h>
1114 hackname = isc_sys_limits;
1115 files = sys/limits.h;
1117 sed = "/CHILD_MAX/s,/\\* Max, Max,";
1118 sed = "/OPEN_MAX/s,/\\* Max, Max,";
1123 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
1124 * use / * * / to concatenate tokens.
1127 hackname = kandr_concat;
1128 files = "sparc/asm_linkage.h";
1129 files = "sun3/asm_linkage.h";
1130 files = "sun3x/asm_linkage.h";
1131 files = "sun4/asm_linkage.h";
1132 files = "sun4c/asm_linkage.h";
1133 files = "sun4m/asm_linkage.h";
1134 files = "sun4c/debug/asm_linkage.h";
1135 files = "sun4m/debug/asm_linkage.h";
1136 files = "arm/as_support.h";
1137 files = "arm/mc_type.h";
1138 files = "arm/xcb.h";
1139 files = "dev/chardefmac.h";
1140 files = "dev/ps_irq.h";
1141 files = "dev/screen.h";
1142 files = "dev/scsi.h";
1143 files = "sys/tty.h";
1144 files = "Xm.acorn/XmP.h";
1145 files = bsd43/bsd43_.h;
1147 sed = 's|/\*\*/|##|g';
1152 * In limits.h, put #ifndefs around things that are supposed to be defined
1153 * in float.h to avoid redefinition errors if float.h is included first.
1154 * On HP/UX this patch does not work, because on HP/UX limits.h uses
1155 * multi line comments and the inserted #endif winds up inside the
1156 * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1157 * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1158 * are there, and we do not add them ourselves.
1159 * Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1
1162 hackname = limits_ifndefs;
1164 files = "sys/limits.h";
1165 bypass = "ifndef[ \t]+FLT_MIN";
1167 sed = "/[ \t]FLT_MIN[ \t]/i\\\n#ifndef FLT_MIN\n";
1168 sed = "/[ \t]FLT_MIN[ \t]/a\\\n#endif\n";
1169 sed = "/[ \t]FLT_MAX[ \t]/i\\\n#ifndef FLT_MAX\n";
1170 sed = "/[ \t]FLT_MAX[ \t]/a\\\n#endif\n";
1171 sed = "/[ \t]FLT_DIG[ \t]/i\\\n#ifndef FLT_DIG\n";
1172 sed = "/[ \t]FLT_DIG[ \t]/a\\\n#endif\n";
1173 sed = "/[ \t]DBL_MIN[ \t]/i\\\n#ifndef DBL_MIN\n";
1174 sed = "/[ \t]DBL_MIN[ \t]/a\\\n#endif\n";
1175 sed = "/[ \t]DBL_MAX[ \t]/i\\\n#ifndef DBL_MAX\n";
1176 sed = "/[ \t]DBL_MAX[ \t]/a\\\n#endif\n";
1177 sed = "/[ \t]DBL_DIG[ \t]/i\\\n#ifndef DBL_DIG\n";
1178 sed = "/[ \t]DBL_DIG[ \t]/a\\\n#endif\n";
1179 sed = "/^\\(\\/\\*#define\tHUGE_VAL\t3\\.[0-9e+]* *\\)\\/\\*/s//\\1/";
1184 * Delete the '#define void int' line from curses.h on Lynx
1187 hackname = lynx_void_int;
1189 select = "#[ \t]*define[ \t]+void[ \t]+int";
1190 sed = "/#[ \t]*define[ \t][ \t]*void[ \t]int/d";
1195 * Fix fcntl prototype in fcntl.h on LynxOS.
1198 hackname = lynxos_fcntl_proto;
1200 select = 'fcntl.*\(int, int, int\)';
1201 sed = 's/\(fcntl.*(int, int, \)int)/\1...)/';
1206 * libm.a on m88k-motorola-sysv3 contains a stupid optimization for
1207 * function hypot(), which returns the second argument without even
1208 * looking at its value, if the other is 0.0. Another drawback is
1209 * that fix-header doesn't fix fabs' prototype, and I have no idea why.
1212 hackname = m88k_bad_hypot_opt;
1213 mach = "m88k-motorola-sysv3*";
1216 sed = "s/extern double floor(), ceil(), fmod(), fabs();/"
1217 "extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/";
1219 sed = "/^extern double hypot();$/a\\\n"
1220 "\\/* Workaround a stupid Motorola optimization if one\\\n"
1221 " of x or y is 0.0 and the other is negative! *\\/\\\n"
1222 "#ifdef __STDC__\\\n"
1223 "static __inline__ double fake_hypot (double x, double y)\\\n"
1225 "static __inline__ double fake_hypot (x, y)\\\n"
1226 "\tdouble x, y;\\\n"
1229 "\treturn fabs (hypot (x, y));\\\n"
1231 "#define hypot\tfake_hypot\n";
1236 * Fix incorrect S_IF* definitions on m88k-sysv3.
1239 hackname = m88k_bad_s_if;
1240 mach = "m88k-*-sysv3*";
1242 select = "#define[ \t]+S_IS[A-Z]*(m)[ \t]";
1244 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
1245 "(m[ \t]*&[ \t]*\\(S_IF[A-Z][A-Z][A-Z][A-Z]*\\)[ \t]*)/"
1246 "\\1 (((m)\\&S_IFMT)==\\2)/";
1248 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
1249 "(m[ \t]*&[ \t]*\\(0[0-9]*\\)[ \t]*)/"
1250 "\\1 (((m)\\&S_IFMT)==\\2)/";
1255 * Put cpp wrappers around these include files to avoid redeclaration
1256 * errors during multiple inclusion on m88k-tektronix-sysv3.
1259 hackname = m88k_multi_incl;
1260 mach = "m88k-tektronix-sysv3*";
1264 "echo Fixing $file, to protect against multiple inclusion. >&2
1265 cpp_wrapper=`echo $file | sed -e 's,\\.,_,g' -e 's,/,_,g'`
1266 echo \"#ifndef __GCC_GOT_${cpp_wrapper}_\"
1267 echo \"#define __GCC_GOT_${cpp_wrapper}_\"
1269 echo \"#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\"";
1274 * Fix non-ansi machine name defines
1275 * File selection is split into two parts: the shell version as
1276 * a single patch, and the program version with each patch separate.
1277 * Each is substantially faster for the particular environment.
1278 * You have a dual maintenance problem here.
1281 hackname = machine_name;
1283 * Select '#if.*' and '#elif" with possible non-ansi symbols
1284 * The only non-ansi symbols we know about start with one of:
1286 * If any are added to the substitution list, then add it to
1287 * the selection list as well. Hopefully we can avoid names
1288 * starting with "d" and "l", because this pattern would then
1289 * match "defined" and "lint" as well. I suppose we could add
1290 * a "bypass = lint" if we had to though.
1292 * The fixinc_eol stuff is to work around a bug in the sed
1294 select = "^#[ \t]*(if|elif).*"
1295 "[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]";
1296 exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]"
1300 "|_*SYSTYPE_[A-Z0-9]"
1327 's/\\\\$/\\\\+++fixinc_eol+++/' "\n"
1328 '/\\\\$/' "b loop\n"
1329 's/\\\\+++fixinc_eol+++/\\\\/g' "\n"
1331 "/#[\t ]*[el]*if/ {\n"
1332 "\ts/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g\n"
1334 "\ts/ M32 / __M32__ /g\n"
1335 "\ts/ _*MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n"
1336 "\ts/ _*SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n"
1337 "\ts/ _*\\([Rr][34]\\)000 / __\\1000__ /g\n"
1338 "\ts/ _*host_mips / __host_mips__ /g\n"
1339 "\ts/ _*i386 / __i386__ /g\n"
1340 "\ts/ _*mips / __mips__ /g\n"
1341 "\ts/ bsd4\\([0-9]\\) / __bsd4\\1__ /g\n"
1342 "\ts/ is68k / __is68k__ /g\n"
1343 "\ts/ m68k / __m68k__ /g\n"
1344 "\ts/ m88k / __m88k__ /g\n"
1345 "\ts/ mc680\\([0-9]\\)0 / __mc680\\10__ /g\n"
1346 "\ts/ news\\([0-9]*\\) / __news\\1__ /g\n"
1347 "\ts/ ns32000 / __ns32000__ /g\n"
1348 "\ts/ pdp11 / __pdp11__ /g\n"
1349 "\ts/ pyr / __pyr__ /g\n"
1350 "\ts/ sel / __sel__ /g\n"
1351 "\ts/ sony_news / __sony_news__ /g\n"
1352 "\ts/ sparc / __sparc__ /g\n"
1353 "\ts/ sun\\([a-z0-9]*\\) / __sun\\1__ /g\n"
1354 "\ts/ tahoe / __tahoe__ /g\n"
1355 "\ts/ tower\\([_0-9]*\\) / __tower\\1__ /g\n"
1356 "\ts/ u370 / __u370__ /g\n"
1357 "\ts/ u3b\\([0-9]*\\) / __u3b\\1__ /g\n"
1358 "\ts/ unix / __unix__ /g\n"
1359 "\ts/ vax / __vax__ /g\n"
1361 "\ts/ \\([a-zA-Z0-9_][a-zA-Z0-9_]*\\) /\\1/g\n\t}";
1366 * Some math.h files define struct exception, which conflicts with
1367 * the class exception defined in the C++ file std/stdexcept.h. We
1368 * redefine it to __math_exception. This is not a great fix, but I
1369 * haven't been able to think of anything better.
1372 hackname = math_exception;
1374 select = "struct exception";
1375 bypass = "We have a problem when using C++";
1376 sed = "/struct exception/i\\\n"
1377 "#ifdef __cplusplus\\\n"
1378 "#define exception __math_exception\\\n"
1380 sed = "/struct exception/a\\\n"
1381 "#ifdef __cplusplus\\\n"
1382 "#undef exception\\\n"
1385 #ifdef MATH_EXCEPTION_FIXED
1386 sed = "/matherr/i\\\n"
1387 "#ifdef __cplusplus\\\n"
1388 "#define exception __math_exception\\\n"
1391 sed = "/matherr/a\\\n"
1392 "#ifdef __cplusplus\\\n"
1393 "#undef exception\\\n"
1396 I think this patch needs some more thinking.
1397 This is from SVR4.2 (With '#' replaced with '@').
1398 Perhaps we could do without the "/matherr/a" entries?
1399 Can we bypass the entire fix if someone was astute
1400 enough to have '#ifdef __cplusplus' anywhere in the file?
1402 We can definitely do without the "/matherr/a" entries. They are
1403 there to cover the case where matherr is declared with no prototype
1404 -- extern int matherr(); -- but we don't need a fix then since there
1405 is no reference to struct exception.
1407 Bypassing on "#ifdef __cplusplus" is too optimistic, but I've stuck
1408 in a bypass for the comment in the glibc 2.1 header that indicates
1409 awareness of the problem. Hmm. Could we use a shell test that did
1410 cpp -D__cplusplus | grep "struct exception" ?
1412 *** /usr/include/math.h Fri Apr 3 18:54:59 1998
1413 --- math.h Sun May 9 07:28:58 1999
1420 + @ifdef __cplusplus
1421 + @define exception __math_exception
1424 + @ifdef __cplusplus
1436 + @ifdef __cplusplus
1437 + @define exception __math_exception
1439 + @ifdef __cplusplus
1440 + @define exception __math_exception
1442 extern int matherr(struct exception *);
1443 + @ifdef __cplusplus
1446 + @ifdef __cplusplus
1450 @endif /*__cplusplus*/
1455 hackname = math_huge_val_from_dbl_max;
1458 * IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined
1459 * in math.h, this fix applies.
1461 select = "define[ \t]*HUGE_VAL[ \t]*DBL_MAX";
1462 bypass = "define[ \t]*DBL_MAX";
1466 * See if we have a definition for DBL_MAX in float.h.
1467 * If we do, we will replace the one in math.h with that one.
1470 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
1473 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
1474 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
1475 "s/DBL_MAX/'\"$dbl_max_def/\"\n"
1481 * In any case, put #ifndef .. #endif around #define HUGE_VAL in math.h.
1484 hackname = math_huge_val_ifndef;
1485 files = math/math.h;
1486 select = "define[ \t]*HUGE_VAL";
1488 sed = "/define[ \t]HUGE_VAL[ \t]/i\\\n#ifndef HUGE_VAL\n";
1489 sed = "/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n";
1496 hackname = nested_comment;
1498 sed = 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@';
1503 * fix bogus recursive stdlib.h in NEWS-OS 4.0C
1506 hackname = news_os_recursion;
1508 select = "#include <stdlib.h>";
1509 sed = "/^#include <stdlib.h>/i\\\n"
1510 "#ifdef BOGUS_RECURSION\n";
1511 sed = "/^#include <stdlib.h>/a\\\n"
1517 * NeXT 3.2 adds const prefix to some math functions.
1518 * These conflict with the built-in functions.
1521 hackname = next_math_prefix;
1522 files = ansi/math.h;
1523 select = "^extern.*double.*__const__.*";
1525 sed = "/^extern.*double.*__const__.*sqrt(/s/__const__//";
1526 sed = "/^extern.*double.*__const__.*fabs(/s/__const__//";
1527 sed = "/^extern.*double.*__const__.*cos(/s/__const__//";
1528 sed = "/^extern.*double.*__const__.*hypot(/s/__const__//";
1529 sed = "/^extern.*double.*__const__.*sin(/s/__const__//";
1534 * NeXT 3.2 uses the word "template" as a parameter for some
1535 * functions. GCC reports an invalid use of a reserved key word
1536 * with the built-in functions. NeXT 3.2 includes the keyword
1537 * volatile in the prototype for abort(). This conflicts with
1538 * the built-in definition.
1541 hackname = next_template;
1545 sed = '/\(.*template\)/s/template//';
1546 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1551 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
1552 * function prototypes. That conflicts with the built-in functions.
1555 hackname = next_volitile;
1556 files = ansi/stdlib.h;
1559 sed = "/extern.*volatile.*void.*exit/s/volatile//";
1560 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1565 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1566 * Note that version 3 of the NeXT system has wait.h in a different directory,
1567 * so that this code won't do anything. But wait.h in version 3 has a
1568 * conditional, so it doesn't need this fix. So everything is okay.
1571 hackname = next_wait_union;
1574 select = 'wait\(union wait';
1576 sed = "s@wait(union wait@wait(void@";
1581 * a missing semi-colon at the end of the nodeent structure definition.
1584 hackname = nodeent_syntax;
1585 files = netdnet/dnetdb.h;
1586 sed = "s/char.*na_addr *$/char *na_addr;/";
1591 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
1592 * defining regex.h related types. This causes libg++ build and usage
1593 * failures. Fixing this correctly requires checking and modifying 3 files.
1596 hackname = osf_namespace_a;
1597 files = reg_types.h;
1598 files = sys/lc_core.h;
1599 test = " -r reg_types.h";
1600 test = " -r sys/lc_core.h";
1601 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1602 test = " -z \"`grep __regex_t regex.h`\"";
1604 sed = "s/regex_t/__regex_t/g";
1605 sed = "s/regoff_t/__regoff_t/g";
1606 sed = "s/regmatch_t/__regmatch_t/g";
1610 hackname = osf_namespace_b;
1612 test = " -r reg_types.h";
1613 test = " -r sys/lc_core.h";
1614 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1615 test = " -z \"`grep __regex_t regex.h`\"";
1617 sed = "/#include <reg_types.h>/a\\\n"
1618 "typedef __regex_t\tregex_t;\\\n"
1619 "typedef __regoff_t\tregoff_t;\\\n"
1620 "typedef __regmatch_t\tregmatch_t;\n";
1625 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
1626 * The original ones fail if uninitialized externs are not common.
1627 * This is the default for all ANSI standard C++ compilers.
1630 hackname = pthread_page_size;
1632 select = "^int __page_size";
1633 sed = "s/^int __page_size/extern int __page_size/";
1638 * Fix return type of fread and fwrite on sysV68
1641 hackname = read_ret_type;
1643 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
1644 sed = "s/^\\(extern int\tfclose(), fflush()\\), "
1645 "\\(fread(), fwrite()\\)\\(.*\\)$"
1646 "/extern unsigned int\t\\2;\\\n\\1\\3/";
1651 * function class(double x) conflicts with C++ keyword on rs/6000
1654 hackname = rs6000_double;
1656 select = '[^a-zA-Z_]class\(';
1658 sed = "/class[(]/i\\\n#ifndef __cplusplus\n";
1659 sed = "/class[(]/a\\\n#endif\n";
1664 * Wrong fchmod prototype on RS/6000.
1667 hackname = rs6000_fchmod;
1669 select = 'fchmod\(char';
1670 sed = 's/fchmod(char \*/fchmod(int/';
1675 * parameters conflict with C++ new on rs/6000
1678 hackname = rs6000_param;
1681 select = 'const char new';
1683 sed = 's@rename(const char \*old, const char \*new)@'
1684 'rename(const char *_old, const char *_new)@';
1689 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1693 hackname = sony_ctype;
1695 test = " -x /bin/sony";
1696 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1697 sed = "s/__ctype/_ctype/g";
1702 * Incorrect #include in Sony News-OS 3.2.
1705 hackname = sony_include;
1706 files = machine/machparam.h;
1707 select = '"\.\./machine/endian.h"';
1708 sed = 's@"../machine/endian.h"@<machine/endian.h>@';
1713 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1717 hackname = sony_stdio;
1719 test = " -x /bin/sony";
1720 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1721 sed = "s/__filbuf/_filbuf/g\n"
1722 "s/__flsbuf/_flsbuf/g\n"
1728 * Add a `static' declaration of `getrnge' into <regexp.h>.
1730 * Don't do this if there is already a `static void getrnge' declaration
1731 * present, since this would cause a redeclaration error. Solaris 2.x has
1732 * such a declaration.
1736 hackname = static_getrnge;
1738 bypass = "static void getrnge";
1739 sed = "/^static int[ \t]*size;/c\\\n"
1740 "static int size ;\\\n\\\n"
1741 "static int getrnge ();";
1746 * a missing semi-colon at the end of the statsswtch structure definition.
1749 hackname = statsswtch;
1750 files = rpcsvc/rstat.h;
1751 select = "boottime$";
1752 sed = "s/boottime$/boottime;/";
1757 * Don't use or define the name va_list in stdio.h.
1758 * This is for ANSI and also to interoperate properly with gcc's varargs.h.
1759 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1762 hackname = stdio_va_list;
1764 bypass = "__gnuc_va_list";
1767 * Use __gnuc_va_list in arg types in place of va_list.
1768 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1769 * trailing parentheses and semicolon save all other systems from this.
1770 * Define __not_va_list__ (something harmless and unused) instead of va_list.
1771 * Don't claim to have defined va_list.
1774 "if ( egrep \"__need___va_list\" $file ) > /dev/null 2>&1 ; then
1777 echo \"#define __need___va_list\"
1778 echo \"#include <stdarg.h>\"
1781 sed -e 's@ va_list @ __gnuc_va_list @' \\
1782 -e 's@ va_list)@ __gnuc_va_list)@' \\
1783 -e 's@ _BSD_VA_LIST_))@ __gnuc_va_list))@' \\
1784 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \\
1785 -e 's@ va_list@ __not_va_list__@' \\
1786 -e 's@\\*va_list@*__not_va_list__@' \\
1787 -e 's@ __va_list)@ __gnuc_va_list)@' \\
1788 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \\
1789 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \\
1790 -e 's@VA_LIST@DUMMY_VA_LIST@' \\
1791 -e 's@_Va_LIST@_VA_LIST@'";
1796 * Check for strict ansi compliance
1800 hackname = strict_ansi;
1801 select = "__STDC__[ \t]*[=!]=[ \t]*[01]";
1802 sed = "s/__STDC__[ \t]*==[ \t]*0/!defined (__STRICT_ANSI__)/g";
1803 sed = "s/__STDC__[ \t]*!=[ \t]*0/defined (__STRICT_ANSI__)/g";
1804 sed = "s/__STDC__[ \t]*==[ \t]*1/defined (__STRICT_ANSI__)/g";
1805 sed = "s/__STDC__[ \t]*!=[ \t]*1/!defined (__STRICT_ANSI__)/g";
1810 * Fix bogus #ifdef on SunOS 4.1.
1813 hackname = sun_bogus_ifdef;
1814 files = "hsfs/hsfs_spec.h";
1815 files = "hsfs/iso_spec.h";
1816 select = '#ifdef __i386__ || __vax__';
1817 sed = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";
1822 * Fix bogus #ifdef on SunOS 4.1.
1825 hackname = sun_bogus_ifdef_sun4c;
1826 files = "hsfs/hsnode.h";
1827 select = '#ifdef __i386__ || __sun4c__';
1828 sed = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";
1833 * Fix the CAT macro in SunOS memvar.h.
1836 hackname = sun_catmacro;
1837 files = pixrect/memvar.h;
1838 select = "^#define[ \t]+CAT\\(a,b\\)";
1839 sed = "/^#define[ \t]CAT(a,b)/ i\\\n"
1840 "#ifdef __STDC__ \\\n"
1841 "#define CAT(a,b) a##b\\\n"
1844 sed = "/^#define[ \t]CAT(a,b)/ a\\\n"
1850 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1851 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1854 hackname = sun_malloc;
1857 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
1858 sed = "s/int[ \t][ \t]*free/void\tfree/g";
1859 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
1860 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
1865 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
1868 hackname = sun_rusers_semi;
1869 files = rpcsvc/rusers.h;
1871 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
1876 * signal.h on SunOS defines signal using (),
1877 * which causes trouble when compiling with g++ -pedantic.
1880 hackname = sun_signal;
1881 files = sys/signal.h;
1883 select = "^void\t" '\(\*signal\(\)\)\(\);';
1885 sed = "/^void\t" '(\*signal())();$/i' "\\\n"
1886 "#ifdef __cplusplus" "\\\n"
1887 "void\t(*signal(...))(...);" "\\\n"
1890 sed = "/^void\t" '(\*signal())();$/a' "\\\n"
1896 * Apply fix this to all OSs since this problem seems to effect
1897 * more than just SunOS. In general, fixes which are triggered
1898 * by a specific target are bad.
1901 hackname = sun_auth_proto;
1907 * Select those files containing '(*name)()'.
1909 select = '\(\*[a-z][a-z_]*\)\(\)';
1911 '/^\(.*(\*[a-z][a-z_]*)(\)' '\();.*\)'
1913 "#ifdef __cplusplus\\\n"
1923 * math.h on SunOS 4 puts the declaration of matherr before the definition
1924 * of struct exception, so the prototype (added by fixproto) causes havoc.
1927 hackname = sunos_matherr_decl;
1929 /* If matherr has a prototype already, the header needs no fix. */
1930 bypass = 'matherr.*struct exception';
1932 * Once a declaration for 'struct exception' is found,
1933 * stop trying to insert a forward reference for it.
1935 sed = "/^struct exception/,$b";
1936 sed = "/matherr/i\\\nstruct exception;\n";
1941 * Correct the return type for strlen in strings.h in SunOS 4.
1944 hackname = sunos_strlen;
1946 select = "int[ \t]*strlen";
1947 sed = "s/int[ \t]*strlen();/__SIZE_TYPE__ strlen();/";
1952 * Solaris math.h and floatingpoint.h define __P without protection,
1953 * which conflicts with the fixproto definition. The fixproto
1954 * definition and the Solaris definition are used the same way.
1960 files = floatingpoint.h;
1961 select = "^#define[ \t]*__P";
1962 sed = "/^#define[ \t]*__P/i\\\n#ifndef __P\n";
1963 sed = "/^#define[ \t]*__P/a\\\n#endif\n";
1968 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
1969 * that is visible to any ANSI compiler using this include. Simply
1970 * delete the lines that #define some string functions to internal forms.
1974 hackname = svr4_disable_opt;
1976 select = '#define.*__std_hdr_';
1977 sed = '/#define.*__std_hdr_/d';
1983 * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
1984 * On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
1985 * but we still "hijack" it and redirect it to the GNU byteorder.h..
1991 hackname = svr4_endian;
1992 files = sys/endian.h;
1995 * since we emit our own sys/byteorder.h,
1996 * this fix can never be applied to that file.
1998 files = sys/byteorder.h;
2000 bypass = '__GNUC__';
2002 sed = "/#\tifdef\t__STDC__/i\\\n"
2003 "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
2005 sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
2007 sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
2008 "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
2014 * Remove useless extern keyword from struct forward declarations
2015 * in <sys/stream.h> and <sys/strsubr.h>
2019 hackname = svr4_extern_struct;
2020 files = sys/stream.h;
2021 files = sys/strsubr.h;
2022 select = 'extern struct [a-z_]*;';
2023 sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
2028 * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
2029 * systems the file <ftw.h> contains extern declarations of these
2030 * functions followed by explicitly `static' definitions of these
2031 * functions... and that's not allowed according to ANSI C. (Note
2032 * however that on Solaris, this header file glitch has been pre-fixed by
2033 * Sun. In the Solaris version of <ftw.h> there are no static
2034 * definitions of any function so we don't need to do any of this stuff
2040 hackname = svr4_ftw;
2042 select = '^extern int ftw\(const';
2044 sed = '/^extern int ftw(const/i' "\\\n"
2045 "#if !defined(_STYPES)\\\n"
2050 sed = 's/extern \(int ftw(const.*\)$/\1/';
2051 sed = "/^extern int nftw/i\\\n"
2052 "#if defined(_STYPES)\\\n"
2057 sed = 's/extern \(int nftw.*\)$/\1/';
2058 sed = "/^extern int ftw(),/c\\\n"
2059 "#if !defined(_STYPES)\\\n"
2065 "#if defined(_STYPES)\\\n"
2077 * Fix broken decl of getcwd present on some svr4 systems.
2081 hackname = svr4_getcwd;
2084 select = 'getcwd\(char \*, int\)';
2086 sed = 's/getcwd(char \*, int)/getcwd(char *, size_t)/';
2095 hackname = svr4_kernel;
2096 files = fs/rfs/rf_cache.h;
2100 files = sys/getpages.h;
2102 files = sys/cmn_err.h;
2103 files = sys/kdebugger.h;
2105 sed = "1i\\\n#ifdef _KERNEL";
2106 sed = "$a\\\n#endif /* _KERNEL */";
2111 * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
2112 * tend to conflict with the compiler's own definition of this symbol. (We
2113 * will use the compiler's definition.)
2114 * Likewise __sparc, for Solaris, and __i860, and a few others
2115 * (guessing it is necessary for all of them).
2119 hackname = svr4_mach_defines;
2121 select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
2122 sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
2128 * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
2129 * They are declared as non-static then immediately redeclared as static.
2133 hackname = svr4_mkdev;
2134 files = sys/mkdev.h;
2137 sed = "/^dev_t makedev(/s/^/static /";
2138 sed = "/^major_t major(/s/^/static /";
2139 sed = "/^minor_t minor(/s/^/static /";
2145 * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
2146 * Also fix types of array initializers.
2150 hackname = svr4_netcspace;
2151 files = sys/netcspace.h;
2152 select = 'NC_NPI_RAW';
2153 sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
2154 sed = 's/NC_/(unsigned long) NC_/';
2159 * Fix reference to NMSZ in <sys/adv.h>.
2163 hackname = svr4_nmsz;
2165 select = '\[NMSZ\]';
2166 sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
2171 * Fix broken decl of profil present on some svr4 systems.
2175 hackname = svr4_profil;
2179 sed = 's/profil(unsigned short \*, unsigned int, '
2180 'unsigned int, unsigned int)'
2181 '/profil(unsigned short *, size_t, int, unsigned)/';
2186 * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
2190 hackname = svr4_proto_form;
2192 select = 'const extern';
2194 sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
2199 sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
2204 sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
2209 sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
2214 sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
2215 sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
2216 sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
2217 sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
2218 sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
2219 sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
2224 * Add a prototyped declaration of mmap to <sys/mman.h>.
2228 hackname = svr4_proto_mmap;
2230 select = '^extern caddr_t mmap();$';
2231 sed = '/^extern caddr_t mmap();$/c' "\\\n"
2232 "#ifdef __STDC__\\\n"
2233 "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
2234 "#else /* !defined(__STDC__) */\\\n"
2235 "extern caddr_t mmap ();\\\n"
2236 "#endif /* !defined(__STDC__) */\\\n";
2241 * Add a #define of _SIGACTION_ into <sys/signal.h>.
2245 hackname = svr4_sigaction;
2246 files = sys/signal.h;
2247 sed = "/^struct sigaction {/i\\\n"
2248 "#define _SIGACTION_";
2249 sed = 's/(void *(\*)())/(void (*)(int))/';
2254 * Put storage class at start of decl, to avoid warning.
2258 hackname = svr4_storage_class;
2259 files = rpc/types.h;
2260 select = 'const extern';
2261 sed = 's/const extern/extern const/g';
2267 * Like svr4_mach_defines, but with newfangled syntax.
2268 * Source lines are of #define __i386 #machine(i386). Delete them.
2272 hackname = svr5_mach_defines;
2274 select = "#define[ \t]*__i386.*\(i386\)";
2275 sed = "/#define[ \t]*__i386.*/d";
2281 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
2282 * in string.h on sysV68
2283 * Correct the return type for strlen in string.h on Lynx.
2284 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
2285 * Add missing const for strdup on OSF/1 V3.0.
2286 * On sysV88 layout is slightly different.
2289 hackname = systypes;
2290 files = "sys/types.h";
2292 files = "sys/stdtypes.h";
2296 select = "typedef[ \t]+[a-z_][ \ta-z_]*[ \t]"
2297 "(size|ptrdiff|wchar)_t";
2299 sed = "/^[ \t]*\\*[ \t]*typedef unsigned int size_t;/N";
2301 sed = "s/^\\([ \t]*\\*[ \t]*typedef unsigned int size_t;\\n"
2302 "[ \t]*\\*\\/\\)/\\1\\\n"
2303 "#ifndef __SIZE_TYPE__\\\n"
2304 "#define __SIZE_TYPE__ long unsigned int\\\n"
2306 "typedef __SIZE_TYPE__ size_t;\\\n/";
2308 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/i\\\n"
2309 "#ifndef __SIZE_TYPE__\\\n"
2310 "#define __SIZE_TYPE__ long unsigned int\\\n"
2313 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/"
2314 "typedef __SIZE_TYPE__ size_t/";
2316 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/i\\\n"
2317 "#ifndef __PTRDIFF_TYPE__\\\n"
2318 "#define __PTRDIFF_TYPE__ long int\\\n"
2321 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/"
2322 "typedef __PTRDIFF_TYPE__ ptrdiff_t/";
2324 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/i\\\n"
2325 "#ifndef __WCHAR_TYPE__\\\n"
2326 "#define __WCHAR_TYPE__ int\\\n"
2328 "#ifndef __cplusplus\n";
2330 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/a\\\n"
2333 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/"
2334 "typedef __WCHAR_TYPE__ wchar_t/";
2339 * Fix this file to avoid interfering with stddef.h,
2340 * but don't mistakenly match ssize_t present in AIX for the ps/2,
2341 * or typedefs which use (but do not set) size_t.
2344 hackname = systypes_for_aix;
2345 files = sys/types.h;
2346 select = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";
2347 bypass = "_GCC_SIZE_T";
2349 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
2350 "#ifndef _GCC_SIZE_T\\\n"
2351 "#define _GCC_SIZE_T\n";
2353 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/a\\\n"
2359 * Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
2360 * Also wrap protection around size_t for m88k-sysv3 systems.
2361 * We use a funny name to ensure it follows 'systypes' fix.
2364 hackname = sysv68_string;
2367 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
2368 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
2369 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
2370 sed = "/^extern char$/N";
2371 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
2372 sed = "/^\tstrncmp(),$/N";
2373 sed = "s/^\\(\tstrncmp()\\),\\n\\(\tstrlen(),\\)$/\\1;\\\n"
2374 "extern unsigned int\\\n\\2/";
2375 sed = "/^extern int$/N";
2376 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
2381 * Fix return type of exit and abort in <stdlib.h>
2382 * Also wrap protection around size_t.
2385 hackname = sysz_stdlib_for_sun;
2388 sed = "s/int\tabort/void\tabort/g";
2389 sed = "s/int\tfree/void\tfree/g";
2390 sed = "s/char[ \t]*\\*[ \t]*calloc/void \\*\tcalloc/g";
2391 sed = "s/char[ \t]*\\*[ \t]*malloc/void \\*\tmalloc/g";
2392 sed = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
2393 sed = "s/char[ \t]*\\*[ \t]*bsearch/void \\*\tbsearch/g";
2394 sed = "s/int[ \t][ \t]*exit/void\texit/g";
2396 sed = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/i\\\n"
2397 "#ifndef _GCC_SIZE_T\\\n"
2398 "#define _GCC_SIZE_T\n";
2400 sed = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/a\\\n"
2406 * Fix this Sun file to avoid interfering with stddef.h.
2407 * We use a funny name to ensure it follows 'systypes' fix.
2410 hackname = sysz_stdtypes_for_sun;
2411 files = sys/stdtypes.h;
2412 sed = "/[\t ]size_t.*;/i\\\n"
2413 "#ifndef _GCC_SIZE_T\\\n"
2414 "#define _GCC_SIZE_T\n";
2416 sed = "/[\t ]size_t.*;/a\\\n"
2419 sed = "/[\t ]ptrdiff_t.*;/i\\\n"
2420 "#ifndef _GCC_PTRDIFF_T\\\n"
2421 "#define _GCC_PTRDIFF_T\n";
2423 sed = "/[\t ]ptrdiff_t.*;/a\\\n"
2426 sed = "/[\t ]wchar_t.*;/i\\\n"
2427 "#ifndef _GCC_WCHAR_T\\\n"
2428 "#define _GCC_WCHAR_T\n";
2430 sed = "/[\t ]wchar_t.*;/a\\\n"
2436 * if the #if says _cplusplus, not the double underscore __cplusplus
2440 hackname = tinfo_cplusplus;
2442 select = "[ \t]_cplusplus";
2443 sed = "s/[ \t]_cplusplus/ __cplusplus/";
2448 * Ultrix V4.[35] puts the declaration of uname before the definition
2449 * of struct utsname, so the prototype (added by fixproto) causes havoc.
2452 hackname = ultrix_fix_fixproto;
2453 files = sys/utsname.h;
2455 sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
2456 "struct utsname;\n";
2461 * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
2464 hackname = ultrix_atof_param;
2466 select = "atof\\([ \t]*char";
2468 sed = "s@atof(\\([ \t]*char[ \t]*\\*[^)]*\\))@atof(const \\1)@";
2473 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
2476 hackname = ultrix_const;
2479 sed = 's@perror( char \*__s );@perror( const char *__s );@';
2480 sed = 's@fputs( char \*__s,@fputs( const char *__s,@';
2481 sed = 's@fopen( char \*__filename, char \*__type );@'
2482 'fopen( const char *__filename, const char *__type );@';
2483 sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@';
2484 sed = 's@fscanf( FILE \*__stream, char \*__format,@'
2485 'fscanf( FILE *__stream, const char *__format,@';
2486 sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
2487 sed = 's@sscanf( char \*__s, char \*__format,@'
2488 'sscanf( const char *__s, const char *__format,@';
2489 sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
2490 sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
2495 * Check for bad #ifdef line (in Ultrix 4.1)
2498 hackname = ultrix_ifdef;
2499 select = "#ifdef KERNEL";
2501 sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
2506 * Avoid nested comments on Ultrix 4.3.
2509 hackname = ultrix_nested_cmnt;
2511 sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
2516 * Check for superfluous `static' (in Ultrix 4.2)
2517 * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
2520 hackname = ultrix_static;
2521 files = machine/cpu.h;
2522 select = '#include "r[34]_cpu';
2523 sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
2524 sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
2525 sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
2530 * Fix multiple defines for NULL
2533 hackname = undefine_null;
2534 select = "^#[ \t]*define[ \t]*[ \t]NULL[ \t]";
2535 bypass = "#[ \t]*(ifn|un)def[ \t]*[ \t]NULL($|[ \t])";
2536 sed = "/^#[ \t]*define[ \t][ \t]*NULL[ \t]/i\\\n"
2542 * If arpa/inet.h prototypes are incompatible with the ones we just
2543 * installed in <sys/byteorder.h>, just remove the protos.
2544 * Because of this close association, this patch must be applied only
2545 * on those systems where the replacement byteorder header is installed.
2548 hackname = unixware7_byteorder_fix;
2549 files = arpa/inet.h;
2550 select = "in_port_t";
2552 mach = "*-*-sysv4*";
2553 mach = "i[34567]86-*-sysv5*";
2554 mach = "i[34567]86-*-udk*";
2555 mach = "i[34567]86-*-solaris2.[0-4]";
2556 mach = "powerpcle-*-solaris2.[0-4]";
2557 mach = "sparc-*-solaris2.[0-4]";
2559 sed = '/^extern.*htons.*(in_port_t)/d';
2560 sed = '/^extern.*ntohs.*(in_port_t)/d';
2565 * Fix definitions of macros used by va-i960.h in VxWorks header file.
2568 hackname = va_i960_macro;
2569 files = arch/i960/archI960.h;
2570 select = "__(vsiz|vali|vpad|alignof__)";
2571 sed = "s/__vsiz/__vxvsiz/";
2572 sed = "s/__vali/__vxvali/";
2573 sed = "s/__vpad/__vxvpad/";
2574 sed = "s/__alignof__/__vxalignof__/";
2579 * AIX headers define NULL to be cast to a void pointer,
2580 * which is illegal in ANSI C++.
2583 hackname = void_null;
2593 files = sys/param.h;
2594 files = sys/types.h;
2595 select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void";
2596 sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)"
2602 * Make VxWorks header which is almost gcc ready fully gcc ready.
2605 hackname = vxworks_gcc_problem;
2606 files = types/vxTypesBase.h;
2607 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
2609 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
2612 sed = "/[ \t]size_t/i\\\n"
2613 "#ifndef _GCC_SIZE_T\\\n"
2614 "#define _GCC_SIZE_T\n";
2616 sed = "/[ \t]size_t/a\\\n"
2619 sed = "/[ \t]ptrdiff_t/i\\\n"
2620 "#ifndef _GCC_PTRDIFF_T\\\n"
2621 "#define _GCC_PTRDIFF_T\n";
2623 sed = "/[ \t]ptrdiff_t/a\\\n"
2626 sed = "/[ \t]wchar_t/i\\\n"
2627 "#ifndef _GCC_WCHAR_T\\\n"
2628 "#define _GCC_WCHAR_T\n";
2630 sed = "/[ \t]wchar_t/a\\\n"
2636 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
2639 hackname = vxworks_needs_vxtypes;
2641 select = "uint_t[ \t][ \t]*_clocks_per_sec";
2642 sed = "s/uint_t/unsigned int/";
2647 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2650 hackname = vxworks_needs_vxworks;
2652 test = " -r types/vxTypesOld.h";
2653 test = " -n \"`egrep '#include' $file`\"";
2654 test = " -n \"`egrep ULONG $file`\"";
2655 select = "#[ \t]define[ \t][ \t]*__INCstath";
2657 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
2658 "#include <types/vxTypesOld.h>\n";
2663 * Another bad dependency in VxWorks 5.2 <time.h>.
2666 hackname = vxworks_time;
2668 select = "VOIDFUNCPTR";
2669 test = " -r vxWorks.h";
2670 sed = "/VOIDFUNCPTR/i\\\n"
2671 "#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
2672 "#ifdef __cplusplus\\\n"
2673 "typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
2675 "typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
2677 "#define __gcc_VOIDFUNCPTR_defined\\\n"
2680 sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g";
2685 * There are several name conflicts with C++ reserved words in X11 header
2686 * files. These are fixed in some versions, so don't do the fixes if
2687 * we find __cplusplus in the file. These were found on the RS/6000.
2690 hackname = x11_class;
2691 files = X11/ShellP.h;
2692 bypass = __cplusplus;
2693 sed = "/char \\*class;/i\\\n"
2694 "#ifdef __cplusplus\\\n"
2695 "\tchar *c_class;\\\n"
2697 sed = "/char \\*class;/a\\\n"
2703 * class in Xm/BaseClassI.h
2706 hackname = x11_class_usage;
2707 files = Xm/BaseClassI.h;
2708 bypass = "__cplusplus";
2709 sed = "s/ class[)]/ c_class)/g";
2714 * new in Xm/Traversal.h
2718 files = Xm/Traversal.h;
2719 bypass = __cplusplus;
2721 sed = "/Widget\told, new;/i\\\n"
2722 "#ifdef __cplusplus\\\n"
2723 "\tWidget\told, c_new;\\\n"
2726 sed = "/Widget\told, new;/a\\\n"
2729 sed = "s/Widget new,/Widget c_new,/g";
2734 * Incorrect sprintf declaration in X11/Xmu.h
2737 hackname = x11_sprintf;
2739 files = X11/Xmu/Xmu.h;
2740 select = 'sprintf\(\)';
2742 sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
2743 "extern char *\tsprintf();\\\n"
2744 "#endif /* !defined __STDC__ */,";