4 autogen definitions fixincl;
6 /* Define all the fixes we know about for repairing damaged headers.
7 Please see the README before adding or changing entries in this file.
9 Set up a debug test so we can make the templates emit special
10 code while debugging these fixes: */
16 /* DO NOT DO BROKEN FIXES (empty replacement fixes) */
19 * Purge some HP-UX 11 files that are only broken after they are "fixed".
22 hackname = AAA_ki_iface;
23 files = sys/ki_iface.h;
24 select = 'These definitions are for HP Internal developers';
25 replace; /* empty replacement -> no fixing the file */
30 * Purge some HP-UX 11 files that are only broken after they are "fixed".
35 select = '11.00 HP-UX LP64';
36 replace; /* empty replacement -> no fixing the file */
41 * Purge some HP-UX 11 files that are only broken after they are "fixed".
44 hackname = AAA_ki_calls;
45 files = sys/ki_calls.h;
46 select = 'kthread_create_caller_t';
47 replace; /* empty replacement -> no fixing the file */
52 * Purge some HP-UX 11 files that are only broken after they are "fixed".
55 hackname = AAA_ki_defs;
56 files = sys/ki_defs.h;
57 select = 'Kernel Instrumentation Definitions';
58 replace; /* empty replacement -> no fixing the file */
63 * This file on SunOS 4 has a very large macro. When the sed loop
64 * tries pull it in, it overflows the pattern space size of the SunOS
65 * sed (GNU sed does not have this problem). Since the file does not
66 * require fixing, we remove it from the fixed directory.
69 hackname = AAA_bad_fixes;
70 files = sundev/ipi_error.h;
71 /* shouldn't there be a select expression here??? */
72 replace; /* empty replacement -> no fixing the file */
77 * Purge some HP-UX 11 files that are only broken after they are "fixed".
82 select = '11.0 and later representation of ki time';
83 replace; /* empty replacement -> no fixing the file */
86 /* And now, the real fixes, replacement text fixes first: */
89 * Completely replace <_int_varargs.h> with a file that includes gcc's
90 * stdarg.h or varargs.h files as appropriate on DG/UX
93 hackname = AAB_dgux_int_varargs;
94 files = _int_varargs.h;
95 replace = "#ifndef __INT_VARARGS_H
96 \#define __INT_VARARGS_H
98 /************************************************************************/
99 /* _INT_VARARGS.H - Define the common stuff for varargs/stdarg/stdio. */
100 /************************************************************************/
103 ** This file is a DG internal header. Never include this
107 \#ifndef ___int_features_h
108 \#include <sys/_int_features.h>
111 \#if !(defined(_VA_LIST) || defined(_VA_LIST_))
118 typedef void * va_list;
120 typedef char * va_list;
126 \#if defined(__DCC__)
134 \#else /* ! defined(__DCC__) */
137 int __va_arg; /* argument number */
138 int *__va_stk; /* start of args passed on stack */
139 int *__va_reg; /* start of args passed in regs */
142 \#endif /* ! defined(__DCC__) */
146 \#if defined(__GNUC__) || defined(__STDC__)
147 typedef void * va_list;
149 typedef char * va_list;
152 \#endif /* _IX86_ANY */
154 \#endif /* __LINT__ */
155 \#endif /* !(defined(_VA_LIST) || defined(_VA_LIST_)) */
156 \#endif /* #ifndef __INT_VARARGS_H */\n";
161 * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
164 hackname = AAB_fd_zero_asm_posix_types_h;
165 files = asm/posix_types.h;
166 mach = 'i[34567]86-*-linux-gnu*';
170 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
171 * the start, so that if #include_next gets another instance of
172 * the wrapper, this will follow the #include_next chain until
173 * we arrive at the real <asm/posix_types.h>.
177 '/* This file fixes a bug in the __FD_ZERO macro
178 for older versions of the Linux kernel. */
179 \#ifndef _POSIX_TYPES_H_WRAPPER
180 \#include <features.h>
181 \#include_next <asm/posix_types.h>
183 \#if defined(__FD_ZERO) && !defined(__GLIBC__)
185 \#define __FD_ZERO(fdsetp) \\
188 __asm__ __volatile__("cld ; rep ; stosl" \\
189 : "=&c" (__d0), "=&D" (__d1) \\
190 : "a" (0), "0" (__FDSET_LONGS), \\
191 "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \\
195 \#define _POSIX_TYPES_H_WRAPPER
196 \#endif /* _POSIX_TYPES_H_WRAPPER */
202 * This fixes __FD_ZERO bug for glibc-1.x
205 hackname = AAB_fd_zero_gnu_types_h;
207 mach = 'i[34567]86-*-linux-gnu*';
210 * Define _TYPES_H_WRAPPER at the end of the wrapper, not
211 * the start, so that if #include_next gets another instance of
212 * the wrapper, this will follow the #include_next chain until
213 * we arrive at the real <gnu/types.h>.
217 '/* This file fixes a bug in the __FD_ZERO macro present in glibc 1.x. */
218 \#ifndef _TYPES_H_WRAPPER
219 \#include <features.h>
220 \#include_next <gnu/types.h>
222 \#if defined(__FD_ZERO) && !defined(__GLIBC__)
224 \# define __FD_ZERO(fdsetp) \\
227 __asm__ __volatile__("cld ; rep ; stosl" \\
228 : "=&c" (__d0), "=&D" (__d1) \\
229 : "a" (0), "0" (__FDSET_LONGS), \\
230 "1" ((__fd_set *) (fdsetp)) :"memory"); \\
234 \#define _TYPES_H_WRAPPER
235 \#endif /* _TYPES_H_WRAPPER */
241 * This fixes __FD_ZERO bug for glibc-2.0.x
244 hackname = AAB_fd_zero_selectbits_h;
245 files = selectbits.h;
246 mach = 'i[34567]86-*-linux-gnu*';
249 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not
250 * the start, so that if #include_next gets another instance of
251 * the wrapper, this will follow the #include_next chain until
252 * we arrive at the real <selectbits.h>.
256 '/* This file fixes a bug in the __FD_ZERO macro present in glibc 2.0.x. */
257 \#ifndef _SELECTBITS_H_WRAPPER
258 \#include <features.h>
259 \#include_next <selectbits.h>
261 \#if defined(__FD_ZERO) && defined(__GLIBC__) \\
262 && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 \\
263 && __GLIBC_MINOR__ == 0
265 \#define __FD_ZERO(fdsetp) \\
268 __asm__ __volatile__ ("cld; rep; stosl" \\
269 : "=&c" (__d0), "=&D" (__d1) \\
270 : "a" (0), "0" (sizeof (__fd_set) \\
271 / sizeof (__fd_mask)), \\
272 "1" ((__fd_mask *) (fdsetp)) \\
277 \#define _SELECTBITS_H_WRAPPER
278 \#endif /* _SELECTBITS_H_WRAPPER */
284 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
285 * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
286 * many other systems have similar text but correct versions of the file.
287 * To ensure only Sun's is fixed, we grep for a likely unique string.
288 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
291 hackname = AAB_sun_memcpy;
293 select = "/\\*\t@\\(#\\)"
294 "(head/memory.h\t50.1\t "
295 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
298 '/* This file was generated by fixincludes */
299 \#ifndef __memory_h__
300 \#define __memory_h__
303 extern void *memccpy();
304 extern void *memchr();
305 extern void *memcpy();
306 extern void *memset();
308 extern char *memccpy();
309 extern char *memchr();
310 extern char *memcpy();
311 extern char *memset();
312 \#endif /* __STDC__ */
316 \#endif /* __memory_h__ */
323 * Completely replace <sys/byteorder.h>; with a file that implements gcc's
324 * optimized byteswapping. Restricted to "SVR4" machines until either
325 * it is shown to be safe to replace this file always, or we get bolder ;-)
328 hackname = AAB_svr4_replace_byteorder;
331 mach = "i[34567]86-*-sysv5*";
332 mach = "i[34567]86-*-udk*";
333 mach = "i[34567]86-*-solaris2.[0-4]";
334 mach = "powerpcle-*-solaris2.[0-4]";
335 mach = "sparc-*-solaris2.[0-4]";
337 files = sys/byteorder.h;
338 replace = '#ifndef _SYS_BYTEORDER_H
339 \#define _SYS_BYTEORDER_H
341 /* Functions to convert `short\' and `long\' quantities from host byte order
342 to (internet) network byte order (i.e. big-endian).
344 Written by Ron Guilmette (rfg@ncd.com).
346 This isn\'t actually used by GCC. It is installed by fixinc.svr4.
348 For big-endian machines these functions are essentially no-ops.
350 For little-endian machines, we define the functions using specialized
351 asm sequences in cases where doing so yields better code (e.g. i386). */
353 \#if !defined (__GNUC__) && !defined (__GNUG__)
354 \#error You lose! This file is only useful with GNU compilers.
357 \#ifndef __BYTE_ORDER__
358 /* Byte order defines. These are as defined on UnixWare 1.1, but with
359 double underscores added at the front and back. */
360 \#define __LITTLE_ENDIAN__ 1234
361 \#define __BIG_ENDIAN__ 4321
362 \#define __PDP_ENDIAN__ 3412
366 static __inline__ unsigned long htonl (unsigned long);
367 static __inline__ unsigned short htons (unsigned int);
368 static __inline__ unsigned long ntohl (unsigned long);
369 static __inline__ unsigned short ntohs (unsigned int);
370 \#endif /* defined (__STDC__) */
372 \#if defined (__i386__)
374 \#ifndef __BYTE_ORDER__
375 \#define __BYTE_ORDER__ __LITTLE_ENDIAN__
378 /* Convert a host long to a network long. */
380 /* We must use a new-style function definition, so that this will also
382 static __inline__ unsigned long
383 htonl (unsigned long __arg)
385 register unsigned long __result;
387 __asm__ ("xchg%B0 %b0,%h0
389 xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
393 /* Convert a host short to a network short. */
395 static __inline__ unsigned short
396 htons (unsigned int __arg)
398 register unsigned short __result;
400 __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
404 \#elif ((defined (__i860__) && !defined (__i860_big_endian__)) \\
405 || defined (__ns32k__) || defined (__vax__) \\
406 || defined (__spur__) || defined (__arm__))
408 \#ifndef __BYTE_ORDER__
409 \#define __BYTE_ORDER__ __LITTLE_ENDIAN__
412 /* For other little-endian machines, using C code is just as efficient as
413 using assembly code. */
415 /* Convert a host long to a network long. */
417 static __inline__ unsigned long
418 htonl (unsigned long __arg)
420 register unsigned long __result;
422 __result = (__arg >> 24) & 0x000000ff;
423 __result |= (__arg >> 8) & 0x0000ff00;
424 __result |= (__arg << 8) & 0x00ff0000;
425 __result |= (__arg << 24) & 0xff000000;
429 /* Convert a host short to a network short. */
431 static __inline__ unsigned short
432 htons (unsigned int __arg)
434 register unsigned short __result;
436 __result = (__arg << 8) & 0xff00;
437 __result |= (__arg >> 8) & 0x00ff;
441 \#else /* must be a big-endian machine */
443 \#ifndef __BYTE_ORDER__
444 \#define __BYTE_ORDER__ __BIG_ENDIAN__
447 /* Convert a host long to a network long. */
449 static __inline__ unsigned long
450 htonl (unsigned long __arg)
455 /* Convert a host short to a network short. */
457 static __inline__ unsigned short
458 htons (unsigned int __arg)
463 \#endif /* big-endian */
465 /* Convert a network long to a host long. */
467 static __inline__ unsigned long
468 ntohl (unsigned long __arg)
470 return htonl (__arg);
473 /* Convert a network short to a host short. */
475 static __inline__ unsigned short
476 ntohs (unsigned int __arg)
478 return htons (__arg);
486 * Completely replace <sys/varargs.h> with a file that includes gcc's
487 * stdarg.h or varargs.h files as appropriate.
491 hackname = AAB_svr4_no_varargs;
492 files = sys/varargs.h;
493 replace = "/* This file was generated by fixincludes. */\n"
494 "#ifndef _SYS_VARARGS_H\n"
495 "#define _SYS_VARARGS_H\n\n"
498 "#include <stdarg.h>\n"
500 "#include <varargs.h>\n"
503 "#endif /* _SYS_VARARGS_H */\n";
509 * Cancel out ansi_compat.h on Ultrix. Replace it with an empty file.
512 hackname = AAB_ultrix_ansi_compat;
513 files = ansi_compat.h;
515 replace = "/* This file intentionally left blank. */\n";
520 * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
521 * of struct rusage, so the prototype (added by fixproto) causes havoc.
524 hackname = aix_syswait;
526 select = "^extern pid_t wait3\\(\\);\n";
529 c_fix_arg = "struct rusage;\n%0";
530 test_text = "/* bos325, */\nextern pid_t wait3();";
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/";
546 test_text = "typedef volatile int sig_atomic_t;";
551 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
554 hackname = alpha_getopt;
557 select = 'getopt\(int, char \*\[\], *char \*\)';
558 sed = 's/getopt(int, char \*\[\],[ ]*char \*)/'
559 'getopt(int, char *const[], const char *)/';
560 test_text = 'extern int getopt(int, char *[], char *);';
565 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
568 hackname = alpha_parens;
570 select = '#ifndef\(__mips64\)';
571 sed = "s/#ifndef(__mips64)/#ifndef __mips64/";
572 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
577 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
580 hackname = alpha_sbrk;
582 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
583 sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";
584 test_text = "extern char* sbrk(ptrdiff_t increment);";
589 * Fix this ARM/RISCiX file where ___type is a Compiler
590 * hint that is specific to the Norcroft compiler.
593 hackname = arm_norcroft_hint;
594 select = "___type p_type";
595 files = "X11/Intrinsic.h";
596 sed = "s/___type p_type/p_type/";
597 test_text = "___type p_type mumble;";
602 * Fix this ARM/RISCiX file to avoid interfering
603 * with the use of __wchar_t in cc1plus.
606 hackname = arm_wchar;
608 select = "#[ \t]*define[ \t]*__wchar_t";
609 sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
610 sed = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
612 "# ifndef \t __wchar_t /* we don't have wchar_t yet, ... */\n"
613 "# define __wchar_t short\n"
614 "# endif /* __wchar_t */";
619 * This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89;
620 * gcc doesn't understand it.
625 select = "#ifndef NOINLINE";
626 sed = "s|#ifndef NOINLINE"
627 "|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|";
629 "#ifndef NOINLINE /* ain't got no inline, so we got it */\n"
630 "#endif /* NOINLINE */";
635 * For C++, avoid any typedef or macro definition of bool,
636 * and use the built in type instead.
637 * HP/UX 10.20 also has it in curses_colr/curses.h.
640 hackname = avoid_bool;
642 files = curses_colr/curses.h;
646 select = "char[ \t]+bool|bool[ \t]+char";
647 bypass = "we must use the C\\+\\+ compiler's type";
649 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
650 "#ifndef __cplusplus\n";
652 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/a\\\n"
655 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/i\\\n"
656 "#ifndef __cplusplus\n";
658 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/a\\\n"
661 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/i\\\n"
662 "#ifndef __cplusplus\n";
664 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/a\\\n"
667 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/i\\\n"
668 "#ifndef __cplusplus\n";
670 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/a\\\n"
673 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/i\\\n"
674 "#ifndef __cplusplus\n";
676 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n"
678 test_text = "# define bool\t char \n"
679 "typedef unsigned int\tbool \t; /* bool type */";
684 * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
687 hackname = bad_struct_term;
689 select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
690 sed = "s/^[ \t]*typedef[ \t][ \t]*"
691 "\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
692 test_text = 'typedef struct term;';
697 * Fix one other error in this file:
698 * a mismatched quote not inside a C comment.
702 files = sundev/vuid_event.h;
703 sed = "s/doesn't/does not/";
704 test_text = "/* doesn't have matched single quotes */";
709 * Fix #defines under Alpha OSF/1:
710 * The following files contain '#pragma extern_prefix "_FOO"' followed by
711 * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
712 * statements is to reduce namespace pollution. While these macros work
713 * properly in most cases, they don't allow you to take a pointer to the
714 * "something" being modified. To get around this limitation, change these
715 * statements to be of the form '#define something _FOOsomething'.
720 select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
737 "s/^[ \t]*#[ \t]*define[ \t]+\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
738 "\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
740 test_text = '#pragma extern_prefix "_FOO"'"\n"
741 "#define something(x,y,z) _FOOsomething(x,y,z)\n"
742 "#define otherwise(x,y,z) BAR_Something(x,y,z)\n"
743 "#define mumble _FOOmumble";
748 * check for broken assert.h that needs stdio.h
751 hackname = broken_assert_stdio;
754 bypass = "include.*stdio\\.h";
756 "#include <stdio.h>\n";
757 test_text = "extern FILE* stderr;";
762 * check for broken assert.h that needs stdlib.h
765 hackname = broken_assert_stdlib;
767 select = 'exit *\(|abort *\(';
768 bypass = "include.*stdlib\\.h";
770 "#ifdef __cplusplus\\\n"
771 "#include <stdlib.h>\\\n"
772 "#endif /* BROKEN_ASSERT_STDLIB_CHECK fix stamp */\n";
773 test_text = "extern void exit ( int );";
778 * Remove `extern double cabs' declarations from math.h.
779 * This conflicts with C9x. Discovered on AIX.
782 hackname = broken_cabs;
784 select = '^extern double cabs';
785 sed = '/^extern double cabs();/d';
786 sed = '/^extern double cabs(struct dbl_hypot);/d';
787 test_text = "#ifdef __STDC__\n"
788 "extern double cabs(struct dbl_hypot);\n"
790 "extern double cabs();\n"
796 * Fix <c_asm.h> on Digital UNIX V4.0:
797 * It contains a prototype for a DEC C internal asm() function,
798 * clashing with gcc's asm keyword. So protect this with __DECC.
801 hackname = dec_intern_asm;
803 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
804 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
808 " ... asm stuff ...\n"
809 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
814 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
817 hackname = ecd_cursor;
818 files = "sunwindow/win_lock.h";
819 files = "sunwindow/win_cursor.h";
820 sed = "s/ecd.cursor/ecd_cursor/";
821 test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
826 * Fix HP's use of ../machine/inline.h to refer to
827 * /usr/include/machine/inline.h
830 hackname = hp_inline;
831 files = sys/spinlock.h;
832 select = 'include.*"\.\./machine/';
833 sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
834 sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
835 test_text = '# include "../machine/inline.h"' "\n"
836 '# include "../machine/dontfix.h"' "\n"
837 '# include "../machine/psl.h"';
842 * Check for (...) in C++ code in HP/UX sys/file.h.
845 hackname = hp_sysfile;
847 select = "HPUX_SOURCE";
848 sed = 's/(\.\.\.)/(struct file *, ...)/';
849 test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
854 * sys/mman.h on HP/UX is not C++ ready,
855 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
857 * rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
858 * is defined for the alpha. The problem is the declaration of malloc.
861 hackname = cxx_unready;
864 select = '[^#]+malloc.*;'; /* Should catch any form of a declaration
865 but not mention within a macro. */
866 bypass = '"C"|__BEGIN_DECLS';
869 "#ifdef __cplusplus\\\n"
871 "#endif /* CXX_UNREADY_CHECK */\\\n\n";
873 "#ifdef __cplusplus\\\n"
875 "#endif /* CXX_UNREADY_CHECK */\n";
876 test_text = "extern void* malloc( size_t );";
881 * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
884 hackname = hpux_maxint;
886 select = "^#[ \t]*define[ \t]*MAXINT[ \t]";
887 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
890 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
892 test_text = '#define MAXINT 0x7FFFFFFF';
897 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
900 hackname = hpux_systime;
902 select = "^extern struct sigevent;";
903 sed = "s/^extern struct sigevent;/struct sigevent;/";
904 test_text = 'extern struct sigevent;';
909 * get rid of bogus inline definitions in HP-UX 8.0
912 hackname = hpux8_bogus_inlines;
915 sed = "s@inline int abs(int [a-z][a-z]*) {.*}@extern \"C\" int abs(int);@";
916 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
917 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
918 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
923 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
924 * of UINT32_C has undefined behavior according to ISO/ANSI:
925 * the arguments to __CONCAT__ are not macro expanded before the
926 * concatination happens so the trailing ')' in the first argument
927 * is concatinated with the 'l' in the second argument creating an
928 * invalid pp token. The behavior of invalid pp tokens is undefined.
929 * GCC does not handle these invalid tokens the way the HP compiler does.
930 * This problem will potentially occur anytime macros are used in the
931 * arguments to __CONCAT__. A general solution to this problem would be to
932 * insert another layer of macro between __CONCAT__ and its use
933 * in UINT32_C. An example of this solution can be found in the C standard.
934 * A more specific solution, the one used here, is to change the UINT32_C
935 * macro to not used macros in the arguments to __CONCAT__.
939 hackname = hpux11_uint32_c;
941 select = "^#define UINT32_C\\(__c\\)[ \t]*"
942 "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
943 sed = "s/^#define UINT32_C(__c)\\([ \t]*\\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\\1__CONCAT__(__c,ul)/";
944 c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
948 * On Interactive Unix 2.2, certain traditional Unix definitions
949 * (notably getc and putc in stdio.h) are omitted if __STDC__ is
950 * defined, not just if _POSIX_SOURCE is defined. This makes it
951 * impossible to compile any nontrivial program except with -posix.
954 hackname = isc_omits_with_stdc;
959 files = "sys/limits.h";
960 files = "sys/fcntl.h";
961 files = "sys/dirent.h";
963 select = '!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)';
965 sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
966 "!defined(_POSIX_SOURCE)/";
967 test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
968 "\nint foo;\n#endif";
972 * Fix various macros used to define ioctl numbers. The traditional
974 * #define _IO(n, x) (('n'<<8)+x)
975 * #define TIOCFOO _IO(T, 1)
976 * but this does not work with the C standard, which disallows macro
977 * expansion inside strings. We have to rewrite it thus:
978 * #define _IO(n, x) ((n<<8)+x)
979 * #define TIOCFOO _IO('T', 1)
980 * The select expressions match too much, but the c_fix code is cautious.
982 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
985 hackname = io_quotes_use;
986 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*"
988 c_fix = char_macro_use;
993 hackname = io_quotes_def;
994 select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\1'";
995 c_fix = char_macro_def;
1001 * Fix various macros used to define ioctl numbers. The traditional
1003 * #define _CTRL(n, x) (('n'<<8)+x)
1004 * #define TIOCFOO _CTRL(T, 1)
1005 * but this does not work with the C standard, which disallows macro
1006 * expansion inside strings. We have to rewrite it thus:
1007 * #define _CTRL(n, x) ((n<<8)+x)
1008 * #define TIOCFOO _CTRL('T', 1)
1009 * The select expressions match too much, but the c_fix code is cautious.
1011 * CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
1014 hackname = ctrl_quotes_use;
1015 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1016 c_fix = char_macro_use;
1021 hackname = ctrl_quotes_def;
1022 select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'";
1023 c_fix = char_macro_def;
1029 * Check for missing ';' in struct
1032 hackname = ip_missing_semi;
1033 files = netinet/ip.h;
1035 sed = "/^struct/,/^};/s/}$/};/";
1040 * Some IRIX header files contain the string "//"
1043 hackname = irix_multiline_cmnt;
1044 files = sys/types.h;
1046 sed = "s@type of the result@type of the result */@";
1047 sed = "s@of the sizeof@/* of the sizeof@";
1052 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
1053 * in prototype without previous definition.
1056 hackname = irix_sockaddr;
1058 select = "authdes_create.*struct sockaddr";
1059 bypass = "<sys/socket\.h>";
1060 sed = "/authdes_create.*struct sockaddr/i\\\n"
1061 "struct sockaddr;\n";
1066 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
1067 * in prototype without previous definition.
1070 hackname = irix_struct__file;
1072 sed = "/xdrstdio_create.*struct __file_s/i\\\n"
1073 "struct __file_s;\n";
1078 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
1079 * that causes the assembly preprocessor to complain about an
1080 * unterminated character constant.
1083 hackname = irix_asm_apostrophe;
1086 select = "^[ \t]*#.*[Ww]e're";
1087 sed = "/^[ \t]*#/s/\\([Ww]e\\)'re/\\1 are/";
1092 * Fixing ISC fmod declaration
1095 hackname = isc_fmod;
1097 select = 'fmod\(double\)';
1098 sed = "s/fmod(double)/fmod(double, double)/";
1103 * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
1106 hackname = motorola_nested;
1107 mach = "m68k-motorola-sysv*";
1109 files = sys/limits.h;
1110 sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
1111 "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
1112 sed = "s@\\(/\\*#define\tHUGE_VAL\t3.40282346638528860e+38 \\)"
1113 "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
1118 * Fixing nested comments in ISC <sys/limits.h>
1121 hackname = isc_sys_limits;
1122 files = sys/limits.h;
1124 sed = "/CHILD_MAX/s,/\\* Max, Max,";
1125 sed = "/OPEN_MAX/s,/\\* Max, Max,";
1130 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
1131 * use / * * / to concatenate tokens.
1134 hackname = kandr_concat;
1135 files = "sparc/asm_linkage.h";
1136 files = "sun3/asm_linkage.h";
1137 files = "sun3x/asm_linkage.h";
1138 files = "sun4/asm_linkage.h";
1139 files = "sun4c/asm_linkage.h";
1140 files = "sun4m/asm_linkage.h";
1141 files = "sun4c/debug/asm_linkage.h";
1142 files = "sun4m/debug/asm_linkage.h";
1143 files = "arm/as_support.h";
1144 files = "arm/mc_type.h";
1145 files = "arm/xcb.h";
1146 files = "dev/chardefmac.h";
1147 files = "dev/ps_irq.h";
1148 files = "dev/screen.h";
1149 files = "dev/scsi.h";
1150 files = "sys/tty.h";
1151 files = "Xm.acorn/XmP.h";
1152 files = bsd43/bsd43_.h;
1154 sed = 's|/\*\*/|##|g';
1159 * In limits.h, put #ifndefs around things that are supposed to be defined
1160 * in float.h to avoid redefinition errors if float.h is included first.
1161 * On HP/UX this patch does not work, because on HP/UX limits.h uses
1162 * multi line comments and the inserted #endif winds up inside the
1163 * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1164 * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1165 * are there, and we do not add them ourselves.
1166 * Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1
1169 hackname = limits_ifndefs;
1171 files = "sys/limits.h";
1172 bypass = "ifndef[ \t]+FLT_MIN";
1174 sed = "/[ \t]FLT_MIN[ \t]/i\\\n#ifndef FLT_MIN\n";
1175 sed = "/[ \t]FLT_MIN[ \t]/a\\\n#endif\n";
1176 sed = "/[ \t]FLT_MAX[ \t]/i\\\n#ifndef FLT_MAX\n";
1177 sed = "/[ \t]FLT_MAX[ \t]/a\\\n#endif\n";
1178 sed = "/[ \t]FLT_DIG[ \t]/i\\\n#ifndef FLT_DIG\n";
1179 sed = "/[ \t]FLT_DIG[ \t]/a\\\n#endif\n";
1180 sed = "/[ \t]DBL_MIN[ \t]/i\\\n#ifndef DBL_MIN\n";
1181 sed = "/[ \t]DBL_MIN[ \t]/a\\\n#endif\n";
1182 sed = "/[ \t]DBL_MAX[ \t]/i\\\n#ifndef DBL_MAX\n";
1183 sed = "/[ \t]DBL_MAX[ \t]/a\\\n#endif\n";
1184 sed = "/[ \t]DBL_DIG[ \t]/i\\\n#ifndef DBL_DIG\n";
1185 sed = "/[ \t]DBL_DIG[ \t]/a\\\n#endif\n";
1186 sed = "/^\\(\\/\\*#define\tHUGE_VAL\t3\\.[0-9e+]* *\\)\\/\\*/s//\\1/";
1191 * Delete the '#define void int' line from curses.h on Lynx
1194 hackname = lynx_void_int;
1196 select = "#[ \t]*define[ \t]+void[ \t]+int";
1197 sed = "/#[ \t]*define[ \t][ \t]*void[ \t]int/d";
1202 * Fix fcntl prototype in fcntl.h on LynxOS.
1205 hackname = lynxos_fcntl_proto;
1207 select = 'fcntl.*\(int, int, int\)';
1208 sed = 's/\(fcntl.*(int, int, \)int)/\1...)/';
1213 * libm.a on m88k-motorola-sysv3 contains a stupid optimization for
1214 * function hypot(), which returns the second argument without even
1215 * looking at its value, if the other is 0.0. Another drawback is
1216 * that fix-header doesn't fix fabs' prototype, and I have no idea why.
1219 hackname = m88k_bad_hypot_opt;
1220 mach = "m88k-motorola-sysv3*";
1223 sed = "s/extern double floor(), ceil(), fmod(), fabs();/"
1224 "extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/";
1226 sed = "/^extern double hypot();$/a\\\n"
1227 "\\/* Workaround a stupid Motorola optimization if one\\\n"
1228 " of x or y is 0.0 and the other is negative! *\\/\\\n"
1229 "#ifdef __STDC__\\\n"
1230 "static __inline__ double fake_hypot (double x, double y)\\\n"
1232 "static __inline__ double fake_hypot (x, y)\\\n"
1233 "\tdouble x, y;\\\n"
1236 "\treturn fabs (hypot (x, y));\\\n"
1238 "#define hypot\tfake_hypot\n";
1243 * Fix incorrect S_IF* definitions on m88k-sysv3.
1246 hackname = m88k_bad_s_if;
1247 mach = "m88k-*-sysv3*";
1249 select = "#define[ \t]+S_IS[A-Z]*(m)[ \t]";
1251 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
1252 "(m[ \t]*&[ \t]*\\(S_IF[A-Z][A-Z][A-Z][A-Z]*\\)[ \t]*)/"
1253 "\\1 (((m)\\&S_IFMT)==\\2)/";
1255 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
1256 "(m[ \t]*&[ \t]*\\(0[0-9]*\\)[ \t]*)/"
1257 "\\1 (((m)\\&S_IFMT)==\\2)/";
1262 * Put cpp wrappers around these include files to avoid redeclaration
1263 * errors during multiple inclusion on m88k-tektronix-sysv3.
1266 hackname = m88k_multi_incl;
1267 mach = "m88k-tektronix-sysv3*";
1271 "echo Fixing $file, to protect against multiple inclusion. >&2
1272 cpp_wrapper=`echo $file | sed -e 's,\\.,_,g' -e 's,/,_,g'`
1273 echo \"#ifndef __GCC_GOT_${cpp_wrapper}_\"
1274 echo \"#define __GCC_GOT_${cpp_wrapper}_\"
1276 echo \"#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\"";
1281 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
1284 hackname = machine_ansi_h_va_list;
1285 files = machine/ansi.h;
1286 select = '_BSD_VA_LIST_';
1287 bypass = '__builtin_va_list';
1289 sed = "s/\\(_BSD_VA_LIST_[ \t][ \t]*\\).*$/\\1__builtin_va_list/";
1294 * Fix non-ansi machine name defines
1297 hackname = machine_name;
1298 c_test = machine_name;
1299 c_fix = machine_name;
1304 * Some math.h files define struct exception, which conflicts with
1305 * the class exception defined in the C++ file std/stdexcept.h. We
1306 * redefine it to __math_exception. This is not a great fix, but I
1307 * haven't been able to think of anything better.
1308 * Note that we have to put the #ifdef/#endif blocks at beginning
1309 * and end of file, because fixproto runs after us and may insert
1310 * additional references to struct exception.
1313 hackname = math_exception;
1315 select = "struct exception";
1316 bypass = "We have a problem when using C\\+\\+";
1318 "#ifdef __cplusplus\\\n"
1319 "#define exception __math_exception\\\n"
1322 "#ifdef __cplusplus\\\n"
1323 "#undef exception\\\n"
1328 hackname = math_huge_val_from_dbl_max;
1331 * IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined
1332 * in math.h, this fix applies.
1334 select = "define[ \t]*HUGE_VAL[ \t]*DBL_MAX";
1335 bypass = "define[ \t]*DBL_MAX";
1339 * See if we have a definition for DBL_MAX in float.h.
1340 * If we do, we will replace the one in math.h with that one.
1343 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
1346 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
1347 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
1348 "s/DBL_MAX/'\"$dbl_max_def/\"\n"
1354 * In any case, put #ifndef .. #endif around #define HUGE_VAL in math.h.
1357 hackname = math_huge_val_ifndef;
1358 files = math/math.h;
1359 select = "define[ \t]*HUGE_VAL";
1361 sed = "/define[ \t]HUGE_VAL[ \t]/i\\\n#ifndef HUGE_VAL\n";
1362 sed = "/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n";
1369 hackname = nested_comment;
1371 sed = 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@';
1376 * fix bogus recursive stdlib.h in NEWS-OS 4.0C
1379 hackname = news_os_recursion;
1381 select = "#include <stdlib.h>";
1382 sed = "/^#include <stdlib.h>/i\\\n"
1383 "#ifdef BOGUS_RECURSION\n";
1384 sed = "/^#include <stdlib.h>/a\\\n"
1390 * NeXT 3.2 adds const prefix to some math functions.
1391 * These conflict with the built-in functions.
1394 hackname = next_math_prefix;
1395 files = ansi/math.h;
1396 select = "^extern.*double.*__const__.*";
1398 sed = "/^extern.*double.*__const__.*sqrt(/s/__const__//";
1399 sed = "/^extern.*double.*__const__.*fabs(/s/__const__//";
1400 sed = "/^extern.*double.*__const__.*cos(/s/__const__//";
1401 sed = "/^extern.*double.*__const__.*hypot(/s/__const__//";
1402 sed = "/^extern.*double.*__const__.*sin(/s/__const__//";
1407 * NeXT 3.2 uses the word "template" as a parameter for some
1408 * functions. GCC reports an invalid use of a reserved key word
1409 * with the built-in functions. NeXT 3.2 includes the keyword
1410 * volatile in the prototype for abort(). This conflicts with
1411 * the built-in definition.
1414 hackname = next_template;
1418 sed = '/\(.*template\)/s/template//';
1419 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1424 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
1425 * function prototypes. That conflicts with the built-in functions.
1428 hackname = next_volitile;
1429 files = ansi/stdlib.h;
1432 sed = "/extern.*volatile.*void.*exit/s/volatile//";
1433 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1438 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1439 * Note that version 3 of the NeXT system has wait.h in a different directory,
1440 * so that this code won't do anything. But wait.h in version 3 has a
1441 * conditional, so it doesn't need this fix. So everything is okay.
1444 hackname = next_wait_union;
1447 select = 'wait\(union wait';
1449 sed = "s@wait(union wait@wait(void@";
1454 * a missing semi-colon at the end of the nodeent structure definition.
1457 hackname = nodeent_syntax;
1458 files = netdnet/dnetdb.h;
1459 sed = "s/char.*na_addr *$/char *na_addr;/";
1464 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
1465 * defining regex.h related types. This causes libg++ build and usage
1466 * failures. Fixing this correctly requires checking and modifying 3 files.
1469 hackname = osf_namespace_a;
1470 files = reg_types.h;
1471 files = sys/lc_core.h;
1472 test = " -r reg_types.h";
1473 test = " -r sys/lc_core.h";
1474 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1475 test = " -z \"`grep __regex_t regex.h`\"";
1477 sed = "s/regex_t/__regex_t/g";
1478 sed = "s/regoff_t/__regoff_t/g";
1479 sed = "s/regmatch_t/__regmatch_t/g";
1483 hackname = osf_namespace_b;
1485 test = " -r reg_types.h";
1486 test = " -r sys/lc_core.h";
1487 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1488 test = " -z \"`grep __regex_t regex.h`\"";
1490 sed = "/#include <reg_types.h>/a\\\n"
1491 "typedef __regex_t\tregex_t;\\\n"
1492 "typedef __regoff_t\tregoff_t;\\\n"
1493 "typedef __regmatch_t\tregmatch_t;\n";
1498 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
1499 * The original ones fail if uninitialized externs are not common.
1500 * This is the default for all ANSI standard C++ compilers.
1503 hackname = pthread_page_size;
1505 select = "^int __page_size";
1506 sed = "s/^int __page_size/extern int __page_size/";
1511 * Fix return type of fread and fwrite on sysV68
1514 hackname = read_ret_type;
1516 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
1517 sed = "s/^\\(extern int\tfclose(), fflush()\\), "
1518 "\\(fread(), fwrite()\\)\\(.*\\)$"
1519 "/extern unsigned int\t\\2;\\\n\\1\\3/";
1524 * function class(double x) conflicts with C++ keyword on rs/6000
1527 hackname = rs6000_double;
1529 select = '[^a-zA-Z_]class\(';
1531 sed = "/class[(]/i\\\n#ifndef __cplusplus\n";
1532 sed = "/class[(]/a\\\n#endif\n";
1537 * Wrong fchmod prototype on RS/6000.
1540 hackname = rs6000_fchmod;
1542 select = 'fchmod\(char';
1543 sed = 's/fchmod(char \*/fchmod(int/';
1548 * parameters conflict with C++ new on rs/6000
1551 hackname = rs6000_param;
1554 select = 'const char new';
1556 sed = 's@rename(const char \*old, const char \*new)@'
1557 'rename(const char *_old, const char *_new)@';
1562 * "!__STDC__" is "!defined( __STRICT_ANSI__ )"
1565 hackname = sco_strict_ansi;
1566 mach = "i?86-*-sco3.2*";
1567 select = "^[ \t]*#[ \t]*if.*!__STDC__";
1568 sed = 's/!__STDC__/!defined(__STRICT_ANSI__)/g';
1573 * The static functions lstat() and fchmod() in <sys/stat.h>
1574 * cause G++ grief since they're not wrapped in "if __cplusplus".
1576 * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
1577 * tiny static wrappers that aren't C++ safe.
1580 hackname = sco_static_func;
1582 mach = "i?86-*-sco3.2*";
1583 select = "^static int";
1585 sed = "/^static int/i\\\n"
1586 "#if __cplusplus\\\n"
1587 "extern \"C\" {\\\n"
1588 "#endif /* __cplusplus */";
1591 "#if __cplusplus\\\n"
1593 "#endif /* __cplusplus */";
1598 * Fix prototype declaration of utime in sys/times.h.
1599 * In 3.2v4.0 the const is missing.
1602 hackname = sco_utime;
1603 files = sys/times.h;
1604 mach = "i?86-*-sco3.2v4*";
1605 select = "\(const char \*, struct utimbuf \*\);";
1606 sed = 's/(const char \*, struct utimbuf \*);/'
1607 '(const char *, const struct utimbuf *);/';
1612 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1616 hackname = sony_ctype;
1618 test = " -x /bin/sony";
1619 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1620 sed = "s/__ctype/_ctype/g";
1625 * Incorrect #include in Sony News-OS 3.2.
1628 hackname = sony_include;
1629 files = machine/machparam.h;
1630 select = '"\.\./machine/endian.h"';
1631 sed = 's@"../machine/endian.h"@<machine/endian.h>@';
1636 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1640 hackname = sony_stdio;
1642 test = " -x /bin/sony";
1643 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1644 sed = "s/__filbuf/_filbuf/g\n"
1645 "s/__flsbuf/_flsbuf/g\n"
1651 * Add a `static' declaration of `getrnge' into <regexp.h>.
1653 * Don't do this if there is already a `static void getrnge' declaration
1654 * present, since this would cause a redeclaration error. Solaris 2.x has
1655 * such a declaration.
1659 hackname = static_getrnge;
1661 bypass = "static void getrnge";
1662 sed = "/^static int[ \t]*size;/c\\\n"
1663 "static int size ;\\\n\\\n"
1664 "static int getrnge ();";
1670 * a missing semi-colon at the end of the statsswtch structure definition.
1673 hackname = statsswtch;
1674 files = rpcsvc/rstat.h;
1675 select = "boottime$";
1676 sed = "s/boottime$/boottime;/";
1681 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
1682 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
1686 hackname = stdio_stdarg_h;
1688 bypass = "include.*(stdarg\.h|machine/ansi\.h)";
1691 \#define __need___va_list\\
1692 \#include <stdarg.h>
1699 * Don't use or define the name va_list in stdio.h.
1700 * This is for ANSI and also to interoperate properly with gcc's varargs.h.
1701 * Note _BSD_VA_LIST_ is dealt with elsewhere.
1704 hackname = stdio_va_list;
1706 bypass = '__gnuc_va_list|_BSD_VA_LIST_';
1709 * Use __gnuc_va_list in arg types in place of va_list.
1710 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1711 * trailing parentheses and semicolon save all other systems from this.
1712 * Define __not_va_list__ (something harmless and unused)
1713 * instead of va_list.
1714 * Don't claim to have defined va_list.
1716 sed = "s@ va_list @ __gnuc_va_list @\n"
1717 "s@ va_list)@ __gnuc_va_list)@\n"
1718 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
1719 "s@ va_list@ __not_va_list__@\n"
1720 "s@\\*va_list@*__not_va_list__@\n"
1721 "s@ __va_list)@ __gnuc_va_list)@\n"
1722 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
1723 "@typedef \\1 __not_va_list__;@\n"
1724 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
1725 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
1726 "s@VA_LIST@DUMMY_VA_LIST@\n"
1727 "s@_Va_LIST@_VA_LIST@";
1732 * Check for strict ansi compliance
1736 hackname = strict_ansi;
1737 select = "__STDC__[ \t]*[=!]=[ \t]*[01]";
1738 sed = "s/__STDC__[ \t]*==[ \t]*0/!defined (__STRICT_ANSI__)/g";
1739 sed = "s/__STDC__[ \t]*!=[ \t]*0/defined (__STRICT_ANSI__)/g";
1740 sed = "s/__STDC__[ \t]*==[ \t]*1/defined (__STRICT_ANSI__)/g";
1741 sed = "s/__STDC__[ \t]*!=[ \t]*1/!defined (__STRICT_ANSI__)/g";
1747 * Apply fix this to all OSs since this problem seems to effect
1748 * more than just SunOS.
1751 hackname = sun_auth_proto;
1757 * Select those files containing '(*name)()'.
1759 select = '\(\*[a-z][a-z_]*\)\(\)';
1761 '/^\(.*(\*[a-z][a-z_]*)(\)' '\();.*\)'
1763 "#ifdef __cplusplus\\\n"
1773 * Fix bogus #ifdef on SunOS 4.1.
1776 hackname = sun_bogus_ifdef;
1777 files = "hsfs/hsfs_spec.h";
1778 files = "hsfs/iso_spec.h";
1779 select = '#ifdef __i386__ || __vax__';
1780 sed = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";
1785 * Fix bogus #ifdef on SunOS 4.1.
1788 hackname = sun_bogus_ifdef_sun4c;
1789 files = "hsfs/hsnode.h";
1790 select = '#ifdef __i386__ || __sun4c__';
1791 sed = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";
1796 * Fix the CAT macro in SunOS memvar.h.
1799 hackname = sun_catmacro;
1800 files = pixrect/memvar.h;
1801 select = "^#define[ \t]+CAT\\(a,b\\)";
1802 sed = "/^#define[ \t]CAT(a,b)/ i\\\n"
1803 "#ifdef __STDC__ \\\n"
1804 "#define CAT(a,b) a##b\\\n"
1807 sed = "/^#define[ \t]CAT(a,b)/ a\\\n"
1813 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1814 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1817 hackname = sun_malloc;
1820 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
1821 sed = "s/int[ \t][ \t]*free/void\tfree/g";
1822 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
1823 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
1828 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
1831 hackname = sun_rusers_semi;
1832 files = rpcsvc/rusers.h;
1834 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
1839 * signal.h on SunOS defines signal using (),
1840 * which causes trouble when compiling with g++ -pedantic.
1843 hackname = sun_signal;
1844 files = sys/signal.h;
1846 select = "^void\t" '\(\*signal\(\)\)\(\);';
1848 sed = "/^void\t" '(\*signal())();$/i' "\\\n"
1849 "#ifdef __cplusplus" "\\\n"
1850 "void\t(*signal(...))(...);" "\\\n"
1853 sed = "/^void\t" '(\*signal())();$/a' "\\\n"
1859 * math.h on SunOS 4 puts the declaration of matherr before the definition
1860 * of struct exception, so the prototype (added by fixproto) causes havoc.
1863 hackname = sunos_matherr_decl;
1865 /* If matherr has a prototype already, the header needs no fix. */
1866 bypass = 'matherr.*struct exception';
1868 * Once a declaration for 'struct exception' is found,
1869 * stop trying to insert a forward reference for it.
1871 sed = "/^struct exception/,$b";
1872 sed = "/matherr/i\\\nstruct exception;\n";
1877 * Correct the return type for strlen in strings.h in SunOS 4.
1880 hackname = sunos_strlen;
1882 select = "int[ \t]*strlen";
1883 sed = "s/int[ \t]*strlen();/__SIZE_TYPE__ strlen();/";
1888 * Solaris math.h and floatingpoint.h define __P without protection,
1889 * which conflicts with the fixproto definition. The fixproto
1890 * definition and the Solaris definition are used the same way.
1896 files = floatingpoint.h;
1897 select = "^#define[ \t]*__P";
1898 sed = "/^#define[ \t]*__P/i\\\n#ifndef __P\n";
1899 sed = "/^#define[ \t]*__P/a\\\n#endif\n";
1904 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
1905 * that is visible to any ANSI compiler using this include. Simply
1906 * delete the lines that #define some string functions to internal forms.
1910 hackname = svr4_disable_opt;
1912 select = '#define.*__std_hdr_';
1913 sed = '/#define.*__std_hdr_/d';
1919 * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
1920 * On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
1921 * but we still "hijack" it and redirect it to the GNU byteorder.h..
1927 hackname = svr4_endian;
1928 files = sys/endian.h;
1931 * since we emit our own sys/byteorder.h,
1932 * this fix can never be applied to that file.
1934 files = sys/byteorder.h;
1936 bypass = '__GNUC__';
1938 sed = "/#\tifdef\t__STDC__/i\\\n"
1939 "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
1941 sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
1943 sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
1944 "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
1950 * Remove useless extern keyword from struct forward declarations
1951 * in <sys/stream.h> and <sys/strsubr.h>
1955 hackname = svr4_extern_struct;
1956 files = sys/stream.h;
1957 files = sys/strsubr.h;
1958 select = 'extern struct [a-z_]*;';
1959 sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
1964 * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
1965 * systems the file <ftw.h> contains extern declarations of these
1966 * functions followed by explicitly `static' definitions of these
1967 * functions... and that's not allowed according to ANSI C. (Note
1968 * however that on Solaris, this header file glitch has been pre-fixed by
1969 * Sun. In the Solaris version of <ftw.h> there are no static
1970 * definitions of any function so we don't need to do any of this stuff
1976 hackname = svr4_ftw;
1978 select = '^extern int ftw\(const';
1980 sed = '/^extern int ftw(const/i' "\\\n"
1981 "#if !defined(_STYPES)\\\n"
1986 sed = 's/extern \(int ftw(const.*\)$/\1/';
1987 sed = "/^extern int nftw/i\\\n"
1988 "#if defined(_STYPES)\\\n"
1993 sed = 's/extern \(int nftw.*\)$/\1/';
1994 sed = "/^extern int ftw(),/c\\\n"
1995 "#if !defined(_STYPES)\\\n"
2001 "#if defined(_STYPES)\\\n"
2013 * Fix broken decl of getcwd present on some svr4 systems.
2016 hackname = svr4_getcwd;
2019 files = prototypes.h;
2020 select = 'getcwd\(char \*, int\)';
2022 sed = 's/getcwd(char \*, int)/getcwd(char *, size_t)/';
2031 hackname = svr4_kernel;
2032 files = fs/rfs/rf_cache.h;
2036 files = sys/getpages.h;
2038 files = sys/cmn_err.h;
2039 files = sys/kdebugger.h;
2041 sed = "1i\\\n#ifdef _KERNEL";
2042 sed = "$a\\\n#endif /* _KERNEL */";
2047 * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
2048 * tend to conflict with the compiler's own definition of this symbol. (We
2049 * will use the compiler's definition.)
2050 * Likewise __sparc, for Solaris, and __i860, and a few others
2051 * (guessing it is necessary for all of them).
2055 hackname = svr4_mach_defines;
2057 select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
2058 sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
2064 * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
2065 * They are declared as non-static then immediately redeclared as static.
2069 hackname = svr4_mkdev;
2070 files = sys/mkdev.h;
2073 sed = "/^dev_t makedev(/s/^/static /";
2074 sed = "/^major_t major(/s/^/static /";
2075 sed = "/^minor_t minor(/s/^/static /";
2081 * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
2082 * Also fix types of array initializers.
2086 hackname = svr4_netcspace;
2087 files = sys/netcspace.h;
2088 select = 'NC_NPI_RAW';
2089 sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
2090 sed = 's/NC_/(unsigned long) NC_/';
2095 * Fix reference to NMSZ in <sys/adv.h>.
2099 hackname = svr4_nmsz;
2101 select = '\[NMSZ\]';
2102 sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
2108 * Fix broken decl of profil present on some svr4 systems.
2111 hackname = svr4_profil;
2115 sed = 's/profil(unsigned short \*, unsigned int, '
2116 'unsigned int, unsigned int)'
2117 '/profil(unsigned short *, size_t, int, unsigned)/';
2122 * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
2126 hackname = svr4_proto_form;
2128 select = 'const extern';
2130 sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
2135 sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
2140 sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
2145 sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
2150 sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
2151 sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
2152 sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
2153 sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
2154 sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
2155 sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
2160 * Add a prototyped declaration of mmap to <sys/mman.h>.
2164 hackname = svr4_proto_mmap;
2166 select = '^extern caddr_t mmap();$';
2167 sed = '/^extern caddr_t mmap();$/c' "\\\n"
2168 "#ifdef __STDC__\\\n"
2169 "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
2170 "#else /* !defined(__STDC__) */\\\n"
2171 "extern caddr_t mmap ();\\\n"
2172 "#endif /* !defined(__STDC__) */\\\n";
2177 * Add a #define of _SIGACTION_ into <sys/signal.h>.
2181 hackname = svr4_sigaction;
2182 files = sys/signal.h;
2183 sed = "/^struct sigaction {/i\\\n"
2184 "#define _SIGACTION_";
2185 sed = 's/(void *(\*)())/(void (*)(int))/';
2190 * Put storage class at start of decl, to avoid warning.
2194 hackname = svr4_storage_class;
2195 files = rpc/types.h;
2196 select = 'const extern';
2197 sed = 's/const extern/extern const/g';
2203 * Like svr4_mach_defines, but with newfangled syntax.
2204 * Source lines are of #define __i386 #machine(i386). Delete them.
2208 hackname = svr5_mach_defines;
2210 select = "#define[ \t]*__i386.*\(i386\)";
2211 sed = "/#define[ \t]*__i386.*/d";
2217 * Fix these files to use the same types that we think they should.
2218 * XXX - extremely dubious changes here.
2221 hackname = systypes;
2222 files = "sys/types.h";
2224 files = "sys/stdtypes.h";
2228 select = "typedef[ \t]+[a-z_][ \ta-z_]*[ \t]"
2229 "(size|ptrdiff|wchar)_t";
2231 sed = "/^[ \t]*\\*[ \t]*typedef unsigned int size_t;/N";
2233 sed = "s/^\\([ \t]*\\*[ \t]*typedef unsigned int size_t;\\n"
2234 "[ \t]*\\*\\/\\)/\\1\\\n"
2235 "#ifndef __SIZE_TYPE__\\\n"
2236 "#define __SIZE_TYPE__ long unsigned int\\\n"
2238 "typedef __SIZE_TYPE__ size_t;\\\n/";
2240 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/i\\\n"
2241 "#ifndef __SIZE_TYPE__\\\n"
2242 "#define __SIZE_TYPE__ long unsigned int\\\n"
2245 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/"
2246 "typedef __SIZE_TYPE__ size_t/";
2248 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/i\\\n"
2249 "#ifndef __PTRDIFF_TYPE__\\\n"
2250 "#define __PTRDIFF_TYPE__ long int\\\n"
2253 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/"
2254 "typedef __PTRDIFF_TYPE__ ptrdiff_t/";
2256 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/i\\\n"
2257 "#ifndef __WCHAR_TYPE__\\\n"
2258 "#define __WCHAR_TYPE__ int\\\n"
2260 "#ifndef __cplusplus\n";
2262 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/a\\\n"
2265 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/"
2266 "typedef __WCHAR_TYPE__ wchar_t/";
2271 * Fix files that may contain a stray definition of size_t. Take care
2272 * not to match ssize_t or mere uses of size_t.
2275 hackname = systypes_stdlib_size_t;
2276 files = sys/types.h;
2278 select = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";
2279 bypass = "_(GCC|BSD)_SIZE_T";
2281 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
2282 "#ifndef _GCC_SIZE_T\\\n"
2283 "#define _GCC_SIZE_T\n";
2285 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/a\\\n"
2291 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
2292 * in string.h on sysV68
2293 * Correct the return type for strlen in string.h on Lynx.
2294 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
2295 * Add missing const for strdup on OSF/1 V3.0.
2296 * On sysV88 layout is slightly different.
2299 hackname = sysv68_string;
2302 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
2303 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
2304 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
2305 sed = "/^extern char$/N";
2306 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
2307 sed = "/^\tstrncmp(),$/N";
2308 sed = "s/^\\(\tstrncmp()\\),\\n\\(\tstrlen(),\\)$/\\1;\\\n"
2309 "extern unsigned int\\\n\\2/";
2310 sed = "/^extern int$/N";
2311 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
2316 * Fix return type of exit and abort in <stdlib.h>
2319 hackname = sysz_stdlib_for_sun;
2322 sed = "s/int\tabort/void\tabort/g";
2323 sed = "s/int\tfree/void\tfree/g";
2324 sed = "s/char[ \t]*\\*[ \t]*calloc/void \\*\tcalloc/g";
2325 sed = "s/char[ \t]*\\*[ \t]*malloc/void \\*\tmalloc/g";
2326 sed = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
2327 sed = "s/char[ \t]*\\*[ \t]*bsearch/void \\*\tbsearch/g";
2328 sed = "s/int[ \t][ \t]*exit/void\texit/g";
2333 * Fix this Sun file to avoid interfering with stddef.h.
2334 * We use a funny name to ensure it follows 'systypes' fix.
2337 hackname = sysz_stdtypes_for_sun;
2338 files = sys/stdtypes.h;
2339 sed = "/[\t ]size_t.*;/i\\\n"
2340 "#ifndef _GCC_SIZE_T\\\n"
2341 "#define _GCC_SIZE_T\n";
2343 sed = "/[\t ]size_t.*;/a\\\n"
2346 sed = "/[\t ]ptrdiff_t.*;/i\\\n"
2347 "#ifndef _GCC_PTRDIFF_T\\\n"
2348 "#define _GCC_PTRDIFF_T\n";
2350 sed = "/[\t ]ptrdiff_t.*;/a\\\n"
2353 sed = "/[\t ]wchar_t.*;/i\\\n"
2354 "#ifndef _GCC_WCHAR_T\\\n"
2355 "#define _GCC_WCHAR_T\n";
2357 sed = "/[\t ]wchar_t.*;/a\\\n"
2363 * if the #if says _cplusplus, not the double underscore __cplusplus
2367 hackname = tinfo_cplusplus;
2369 select = "[ \t]_cplusplus";
2370 sed = "s/[ \t]_cplusplus/ __cplusplus/";
2375 * Ultrix V4.[35] puts the declaration of uname before the definition
2376 * of struct utsname, so the prototype (added by fixproto) causes havoc.
2379 hackname = ultrix_fix_fixproto;
2380 files = sys/utsname.h;
2382 sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
2383 "struct utsname;\n";
2388 * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
2391 hackname = ultrix_atof_param;
2393 select = "atof\\([ \t]*char";
2395 sed = "s@atof(\\([ \t]*char[ \t]*\\*[^)]*\\))@atof(const \\1)@";
2400 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
2403 hackname = ultrix_const;
2406 sed = 's@perror( char \*__s );@perror( const char *__s );@';
2407 sed = 's@fputs( char \*__s,@fputs( const char *__s,@';
2408 sed = 's@fopen( char \*__filename, char \*__type );@'
2409 'fopen( const char *__filename, const char *__type );@';
2410 sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@';
2411 sed = 's@fscanf( FILE \*__stream, char \*__format,@'
2412 'fscanf( FILE *__stream, const char *__format,@';
2413 sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
2414 sed = 's@sscanf( char \*__s, char \*__format,@'
2415 'sscanf( const char *__s, const char *__format,@';
2416 sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
2417 sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
2422 * Check for bad #ifdef line (in Ultrix 4.1)
2425 hackname = ultrix_ifdef;
2426 select = "#ifdef KERNEL[ \t]*[^ \t]";
2428 sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
2433 * Avoid nested comments on Ultrix 4.3.
2436 hackname = ultrix_nested_cmnt;
2438 sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
2443 * Check for superfluous `static' (in Ultrix 4.2)
2444 * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
2447 hackname = ultrix_static;
2448 files = machine/cpu.h;
2449 select = '#include "r[34]_cpu';
2450 sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
2451 sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
2452 sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
2457 * Fix multiple defines for NULL
2460 hackname = undefine_null;
2461 select = "^#[ \t]*define[ \t]*[ \t]NULL[ \t\r]";
2462 bypass = "#[ \t]*(ifn|un)def[ \t]*[ \t]NULL($|[ \t\r])";
2463 sed = "/^#[ \t]*define[ \t][ \t]*NULL[ \t\r]/i\\\n"
2469 * If arpa/inet.h prototypes are incompatible with the ones we just
2470 * installed in <sys/byteorder.h>, just remove the protos.
2471 * Because of this close association, this patch must be applied only
2472 * on those systems where the replacement byteorder header is installed.
2475 hackname = unixware7_byteorder_fix;
2476 files = arpa/inet.h;
2477 select = "in_port_t";
2479 mach = "*-*-sysv4*";
2480 mach = "i[34567]86-*-sysv5*";
2481 mach = "i[34567]86-*-udk*";
2482 mach = "i[34567]86-*-solaris2.[0-4]";
2483 mach = "powerpcle-*-solaris2.[0-4]";
2484 mach = "sparc-*-solaris2.[0-4]";
2486 sed = '/^extern.*htons.*(in_port_t)/d';
2487 sed = '/^extern.*ntohs.*(in_port_t)/d';
2492 * Fix definitions of macros used by va-i960.h in VxWorks header file.
2495 hackname = va_i960_macro;
2496 files = arch/i960/archI960.h;
2497 select = "__(vsiz|vali|vpad|alignof__)";
2498 sed = "s/__vsiz/__vxvsiz/";
2499 sed = "s/__vali/__vxvali/";
2500 sed = "s/__vpad/__vxvpad/";
2501 sed = "s/__alignof__/__vxalignof__/";
2506 * AIX headers define NULL to be cast to a void pointer,
2507 * which is illegal in ANSI C++.
2510 hackname = void_null;
2520 files = sys/param.h;
2521 files = sys/types.h;
2522 select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void";
2523 sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)"
2529 * Make VxWorks header which is almost gcc ready fully gcc ready.
2532 hackname = vxworks_gcc_problem;
2533 files = types/vxTypesBase.h;
2534 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
2536 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
2539 sed = "/[ \t]size_t/i\\\n"
2540 "#ifndef _GCC_SIZE_T\\\n"
2541 "#define _GCC_SIZE_T\n";
2543 sed = "/[ \t]size_t/a\\\n"
2546 sed = "/[ \t]ptrdiff_t/i\\\n"
2547 "#ifndef _GCC_PTRDIFF_T\\\n"
2548 "#define _GCC_PTRDIFF_T\n";
2550 sed = "/[ \t]ptrdiff_t/a\\\n"
2553 sed = "/[ \t]wchar_t/i\\\n"
2554 "#ifndef _GCC_WCHAR_T\\\n"
2555 "#define _GCC_WCHAR_T\n";
2557 sed = "/[ \t]wchar_t/a\\\n"
2563 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
2566 hackname = vxworks_needs_vxtypes;
2568 select = "uint_t[ \t][ \t]*_clocks_per_sec";
2569 sed = "s/uint_t/unsigned int/";
2570 test_text = "uint_t\t_clocks_per_sec;";
2575 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2578 hackname = vxworks_needs_vxworks;
2580 test = " -r types/vxTypesOld.h";
2581 test = " -n \"`egrep '#include' $file`\"";
2582 test = " -n \"`egrep ULONG $file`\"";
2583 select = "#[ \t]define[ \t][ \t]*__INCstath";
2585 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
2586 "#include <types/vxTypesOld.h>\n";
2591 * Another bad dependency in VxWorks 5.2 <time.h>.
2594 hackname = vxworks_time;
2596 select = "VOIDFUNCPTR";
2597 test = " -r vxWorks.h";
2598 sed = "/VOIDFUNCPTR/i\\\n"
2599 "#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
2600 "#ifdef __cplusplus\\\n"
2601 "typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
2603 "typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
2605 "#define __gcc_VOIDFUNCPTR_defined\\\n"
2608 sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g";
2613 * There are several name conflicts with C++ reserved words in X11 header
2614 * files. These are fixed in some versions, so don't do the fixes if
2615 * we find __cplusplus in the file. These were found on the RS/6000.
2618 hackname = x11_class;
2619 files = X11/ShellP.h;
2620 bypass = __cplusplus;
2621 sed = "/char \\*class;/i\\\n"
2622 "#ifdef __cplusplus\\\n"
2623 "\tchar *c_class;\\\n"
2625 sed = "/char \\*class;/a\\\n"
2635 * class in Xm/BaseClassI.h
2638 hackname = x11_class_usage;
2639 files = Xm/BaseClassI.h;
2640 bypass = "__cplusplus";
2641 sed = "s/ class[)]/ c_class)/g";
2642 test_text = "extern mumble (int class);\n";
2647 * new in Xm/Traversal.h
2651 files = Xm/Traversal.h;
2652 bypass = __cplusplus;
2654 sed = "/Widget\told, new;/i\\\n"
2655 "#ifdef __cplusplus\\\n"
2656 "\tWidget\told, c_new;\\\n"
2659 sed = "/Widget\told, new;/a\\\n"
2662 sed = "s/Widget new,/Widget c_new,/g";
2665 " Widget\told, new; /* fix the new */\n"
2666 "};\nextern Wedged( Widget new, Widget old );";
2671 * Incorrect sprintf declaration in X11/Xmu.h
2674 hackname = x11_sprintf;
2676 files = X11/Xmu/Xmu.h;
2677 select = 'sprintf\(\)';
2679 sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
2680 "extern char *\tsprintf();\\\n"
2681 "#endif /* !defined __STDC__ */,";
2682 test_text = "extern char *\tsprintf();";