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
521 * definition of struct rusage, so the prototype added by fixproto fails.
524 hackname = aix_syswait;
526 select = "^extern pid_t wait3\\(\\);\n";
529 c_fix_arg = "struct rusage;\n%0";
530 test_text = "/* bos325, */\n"
531 "extern pid_t wait3();\n"
532 "\t/* pid_t wait3(int *, int, struct rusage *); */";
537 * sys/signal.h on some versions of AIX uses volatile in the typedef of
538 * sig_atomic_t, which causes gcc to generate a warning about duplicate
539 * volatile when a sig_atomic_t variable is declared volatile, as
540 * required by ANSI C.
543 hackname = aix_volatile;
544 files = sys/signal.h;
545 select = "typedef volatile int sig_atomic_t";
547 c_fix_arg = "typedef int sig_atomic_t";
548 test_text = "typedef volatile int sig_atomic_t;";
553 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
556 hackname = alpha_getopt;
559 select = 'getopt\(int, char \*\[\], *char \*\)';
561 c_fix_arg = "getopt(int, char *const[], const char *)";
562 test_text = 'extern int getopt(int, char *[], char *);';
567 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
570 hackname = alpha_parens;
572 select = '#ifndef\(__mips64\)';
574 c_fix_arg = "#ifndef __mips64";
575 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
580 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
583 hackname = alpha_sbrk;
585 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
587 c_fix_arg = "void *sbrk(";
588 test_text = "extern char* sbrk(ptrdiff_t increment);";
593 * Fix this ARM/RISCiX file where ___type is a Compiler
594 * hint that is specific to the Norcroft compiler.
597 hackname = arm_norcroft_hint;
598 select = "___type p_type";
599 files = "X11/Intrinsic.h";
600 sed = "s/___type p_type/p_type/";
601 test_text = "___type p_type mumble;";
606 * Fix this ARM/RISCiX file to avoid interfering
607 * with the use of __wchar_t in cc1plus.
610 hackname = arm_wchar;
612 select = "#[ \t]*define[ \t]*__wchar_t";
613 sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
614 sed = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
616 "# ifndef \t __wchar_t /* we don't have wchar_t yet, ... */\n"
617 "# define __wchar_t short\n"
618 "# endif /* __wchar_t */";
623 * This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89;
624 * gcc doesn't understand it.
629 select = "#ifndef NOINLINE";
630 sed = "s|#ifndef NOINLINE"
631 "|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|";
633 "#ifndef NOINLINE /* ain't got no inline, so we got it */\n"
634 "#endif /* NOINLINE */";
639 * For C++, avoid any typedef or macro definition of bool,
640 * and use the built in type instead.
641 * HP/UX 10.20 also has it in curses_colr/curses.h.
644 hackname = avoid_bool;
646 files = curses_colr/curses.h;
650 select = "char[ \t]+bool|bool[ \t]+char";
651 bypass = "we must use the C\\+\\+ compiler's type";
653 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
654 "#ifndef __cplusplus\n";
656 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/a\\\n"
659 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/i\\\n"
660 "#ifndef __cplusplus\n";
662 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/a\\\n"
665 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/i\\\n"
666 "#ifndef __cplusplus\n";
668 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/a\\\n"
671 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/i\\\n"
672 "#ifndef __cplusplus\n";
674 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/a\\\n"
677 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/i\\\n"
678 "#ifndef __cplusplus\n";
680 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n"
682 test_text = "# define bool\t char \n"
683 "typedef unsigned int\tbool \t; /* bool type */";
688 * Fix #defines under Alpha OSF/1:
689 * The following files contain '#pragma extern_prefix "_FOO"' followed by
690 * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
691 * statements is to reduce namespace pollution. While these macros work
692 * properly in most cases, they don't allow you to take a pointer to the
693 * "something" being modified. To get around this limitation, change these
694 * statements to be of the form '#define something _FOOsomething'.
699 select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
717 "s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
718 "\\(_.*\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
720 test_text = '#pragma extern_prefix "_FOO"'"\n"
721 "#define something(x,y,z) _FOOsomething(x,y,z)\n"
722 "#define mumble _FOOmumble";
727 * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
730 hackname = bad_struct_term;
732 select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
733 sed = "s/^[ \t]*typedef[ \t][ \t]*"
734 "\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
735 test_text = 'typedef struct term;';
740 * Fix one other error in this file:
741 * a mismatched quote not inside a C comment.
745 files = sundev/vuid_event.h;
746 sed = "s/doesn't/does not/";
747 test_text = "/* doesn't have matched single quotes */";
752 * check for broken assert.h that needs stdio.h
755 hackname = broken_assert_stdio;
758 bypass = "include.*stdio\\.h";
760 c_fix_arg = "#include <stdio.h>\n";
761 test_text = "extern FILE* stderr;";
766 * check for broken assert.h that needs stdlib.h
769 hackname = broken_assert_stdlib;
771 select = 'exit *\(|abort *\(';
772 bypass = "include.*stdlib\\.h";
774 c_fix_arg = "#ifdef __cplusplus\n"
775 "#include <stdlib.h>\n"
777 test_text = "extern void exit ( int );";
782 * Remove `extern double cabs' declarations from math.h.
783 * This conflicts with C9x. Discovered on AIX.
784 * SunOS4 has its cabs() declaration followed by a comment which
785 * terminates on the following line.
788 hackname = broken_cabs;
790 select = '^extern double cabs';
791 sed = 's/^extern double cabs();//';
792 sed = 's/^extern double cabs(struct dbl_hypot);//';
793 test_text = "#ifdef __STDC__\n"
794 "extern double cabs(struct dbl_hypot);\n"
796 "extern double cabs();\n"
798 "extern double cabs(); /* This is a comment\n"
799 " and it ends here. */";
804 * Fix various macros used to define ioctl numbers.
805 * The traditional syntax was:
807 * #define _CTRL(n, x) (('n'<<8)+x)
808 * #define TCTRLCFOO _CTRL(T, 1)
810 * but this does not work with the C standard, which disallows macro
811 * expansion inside strings. We have to rewrite it thus:
813 * #define _CTRL(n, x) ((n<<8)+x)
814 * #define TCTRLCFOO _CTRL('T', 1)
816 * The select expressions match too much, but the c_fix code is cautious.
818 * CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
821 hackname = ctrl_quotes_def;
822 select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'";
823 c_fix = char_macro_def;
825 test_text = "#define BSD43_CTRL(n, x) (('n'<<8)+x)";
829 hackname = ctrl_quotes_use;
830 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
831 c_fix = char_macro_use;
833 test_text = "#define TIOCFOO BSD43_CTRL(T, 1)";
838 * sys/mman.h on HP/UX is not C++ ready,
839 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
841 * rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
842 * is defined for the alpha. The problem is the declaration of malloc.
845 hackname = cxx_unready;
848 select = '[^#]+malloc.*;'; /* Catch any form of declaration
849 not within a macro. */
850 bypass = '"C"|__BEGIN_DECLS';
853 c_fix_arg = "#ifdef __cplusplus\n"
856 c_fix_arg = "#ifdef __cplusplus\n"
859 test_text = "extern void* malloc( size_t );";
864 * Fix <c_asm.h> on Digital UNIX V4.0:
865 * It contains a prototype for a DEC C internal asm() function,
866 * clashing with gcc's asm keyword. So protect this with __DECC.
869 hackname = dec_intern_asm;
871 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
872 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
876 " ... asm stuff ...\n"
877 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
882 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
885 hackname = ecd_cursor;
886 files = "sunwindow/win_lock.h";
887 files = "sunwindow/win_cursor.h";
888 sed = "s/ecd.cursor/ecd_cursor/";
889 test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
894 * fix-header doesn't fix fabs' prototype, and I have no idea why.
897 hackname = fix_header_breakage;
898 mach = "m88k-motorola-sysv3*";
901 select = 'extern double floor\(\), ceil\(\), fmod\(\), fabs\(\);';
904 'extern double floor(), ceil(), fmod(), fabs _PARAMS((double));';
905 test_text = 'extern double floor(), ceil(), fmod(), fabs();';
910 * Fix HP's use of ../machine/inline.h to refer to
911 * /usr/include/machine/inline.h
914 hackname = hp_inline;
915 files = sys/spinlock.h;
916 select = 'include.*"\.\./machine/';
917 sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
918 sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
919 test_text = '# include "../machine/inline.h"' "\n"
920 '# include "../machine/dontfix.h"' "\n"
921 '# include "../machine/psl.h"';
926 * Check for (...) in C++ code in HP/UX sys/file.h.
929 hackname = hp_sysfile;
931 select = "HPUX_SOURCE";
932 sed = 's/(\.\.\.)/(struct file *, ...)/';
933 test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
938 * Keep HP-UX 11 from stomping on C++ math namespace
939 * with defines for fabsf.
942 hackname = hpux11_fabsf;
944 select = "^[ \t]*#[ \t]*define[ \t]+fabsf\\(.*";
945 bypass = "__cplusplus";
948 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
952 "# define fabsf(x) ((float)fabs((double)(float)(x)))\n"
958 * get rid of bogus inline definitions in HP-UX 8.0
961 hackname = hpux8_bogus_inlines;
964 sed = "s@inline int abs(int [a-z][a-z]*) {.*}"
965 "@extern \"C\" int abs(int);@";
966 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
967 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
968 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
969 test_text = "inline int abs(int v) { return (v>=0)?v:-v; }\n"
970 "inline double sqr(double v) { return v**0.5; }";
975 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
976 * of UINT32_C has undefined behavior according to ISO/ANSI:
977 * the arguments to __CONCAT__ are not macro expanded before the
978 * concatination happens so the trailing ')' in the first argument
979 * is concatinated with the 'l' in the second argument creating an
980 * invalid pp token. The behavior of invalid pp tokens is undefined.
981 * GCC does not handle these invalid tokens the way the HP compiler does.
982 * This problem will potentially occur anytime macros are used in the
983 * arguments to __CONCAT__. A general solution to this problem would be to
984 * insert another layer of macro between __CONCAT__ and its use
985 * in UINT32_C. An example of this solution can be found in the C standard.
986 * A more specific solution, the one used here, is to change the UINT32_C
987 * macro to not used macros in the arguments to __CONCAT__.
990 hackname = hpux11_uint32_c;
992 select = "^#define UINT32_C\\(__c\\)[ \t]*"
993 "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
995 c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
997 "#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
998 "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
1002 * On Interactive Unix 2.2, certain traditional Unix definitions
1003 * (notably getc and putc in stdio.h) are omitted if __STDC__ is
1004 * defined, not just if _POSIX_SOURCE is defined. This makes it
1005 * impossible to compile any nontrivial program except with -posix.
1008 hackname = isc_omits_with_stdc;
1013 files = "sys/limits.h";
1014 files = "sys/fcntl.h";
1015 files = "sys/dirent.h";
1017 select = '!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)';
1019 c_fix_arg = '!defined(_POSIX_SOURCE)';
1020 test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
1021 "\nint foo;\n#endif";
1025 * Fix various macros used to define ioctl numbers.
1026 * The traditional syntax was:
1028 * #define _IO(n, x) (('n'<<8)+x)
1029 * #define TIOCFOO _IO(T, 1)
1031 * but this does not work with the C standard, which disallows macro
1032 * expansion inside strings. We have to rewrite it thus:
1034 * #define _IO(n, x) ((n<<8)+x)
1035 * #define TIOCFOO _IO('T', 1)
1037 * The select expressions match too much, but the c_fix code is cautious.
1039 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
1042 hackname = io_quotes_def;
1043 select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\1'";
1044 c_fix = char_macro_def;
1046 test_text = "#define BSD43__IOWR(n, x) (('n'<<8)+x)";
1050 hackname = io_quotes_use;
1051 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*"
1053 c_fix = char_macro_use;
1055 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)";
1060 * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
1063 hackname = hpux_maxint;
1064 files = sys/param.h;
1065 select = "^#[ \t]*define[ \t]*MAXINT[ \t]";
1066 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
1069 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
1071 test_text = '#define MAXINT 0x7FFFFFFF';
1076 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
1079 hackname = hpux_systime;
1081 select = "^extern struct sigevent;";
1082 sed = "s/^extern struct sigevent;/struct sigevent;/";
1083 test_text = 'extern struct sigevent;';
1088 * Check for missing ';' in struct
1091 hackname = ip_missing_semi;
1092 files = netinet/ip.h;
1094 sed = "/^struct/,/^};/s/}$/};/";
1100 "}; /* mumbled struct */\n";
1105 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
1106 * that causes the assembly preprocessor to complain about an
1107 * unterminated character constant.
1110 hackname = irix_asm_apostrophe;
1113 select = "^[ \t]*#.*[Ww]e're";
1115 c_fix_arg = "%1 are";
1116 c_fix_arg = "^([ \t]*#.*[Ww]e)'re";
1117 test_text = "\t# and we're on vacation";
1122 * Some IRIX header files contain the string "//"
1125 hackname = irix_multiline_cmnt;
1126 files = sys/types.h;
1128 sed = "s@type of the result@type of the result */@";
1129 sed = "s@of the sizeof@/* of the sizeof@";
1131 "/* we check the type of the result\n"
1132 "// of the sizeof something. This is a bad test :-( */";
1137 * Fixing ISC fmod declaration
1140 hackname = isc_fmod;
1142 select = 'fmod\(double\)';
1144 c_fix_arg = "fmod(double, double)";
1145 test_text = "extern double fmod(double);";
1150 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
1151 * use / * * / to concatenate tokens.
1154 hackname = kandr_concat;
1155 files = "sparc/asm_linkage.h";
1156 files = "sun3/asm_linkage.h";
1157 files = "sun3x/asm_linkage.h";
1158 files = "sun4/asm_linkage.h";
1159 files = "sun4c/asm_linkage.h";
1160 files = "sun4m/asm_linkage.h";
1161 files = "sun4c/debug/asm_linkage.h";
1162 files = "sun4m/debug/asm_linkage.h";
1163 files = "arm/as_support.h";
1164 files = "arm/mc_type.h";
1165 files = "arm/xcb.h";
1166 files = "dev/chardefmac.h";
1167 files = "dev/ps_irq.h";
1168 files = "dev/screen.h";
1169 files = "dev/scsi.h";
1170 files = "sys/tty.h";
1171 files = "Xm.acorn/XmP.h";
1172 files = bsd43/bsd43_.h;
1176 test_text = "#define __CONCAT__(a,b) a/**/b";
1181 * In limits.h, put #ifndefs around things that are supposed to be defined
1182 * in float.h to avoid redefinition errors if float.h is included first.
1183 * On HP/UX this patch does not work, because on HP/UX limits.h uses
1184 * multi line comments and the inserted #endif winds up inside the
1185 * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1186 * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1187 * are there, and we do not add them ourselves.
1190 hackname = limits_ifndefs;
1192 files = "sys/limits.h";
1193 bypass = "ifndef[ \t]+FLT_MIN";
1196 c_fix_arg = "#ifndef %1\n%0#endif\n";
1197 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+"
1198 "((FLT|DBL)_(MIN|MAX|DIG))"
1200 test_text = " #\tdefine\tDBL_DIG \t 0 /* somthin' */";
1205 * Delete the '#define void int' line from curses.h on Lynx
1208 hackname = lynx_void_int;
1210 select = "#[ \t]*define[ \t]+void[ \t]+int[ \t]*";
1213 test_text = "# define\tvoid\tint \t/* curses foiled again */";
1218 * Fix fcntl prototype in fcntl.h on LynxOS.
1221 hackname = lynxos_fcntl_proto;
1223 select = "fcntl[ \t]*" '\(int, int, int\)';
1225 c_fix_arg = '%1...)';
1226 c_fix_arg = "(fcntl[ \t]*" '\(int, int, )int\)';
1227 test_text = "extern int fcntl(int, int, int);";
1232 * libm.a on m88k-motorola-sysv3 contains a stupid optimization for
1233 * function hypot(), which returns the second argument without even
1234 * looking at its value, if the other is 0.0.
1237 hackname = m88k_bad_hypot_opt;
1238 mach = "m88k-motorola-sysv3*";
1240 select = "^extern double hypot\\(\\);\n";
1243 "/* Workaround a stupid Motorola optimization if one\n"
1244 " of x or y is 0.0 and the other is negative! */\n"
1246 "static __inline__ double fake_hypot (double x, double y)\n"
1248 "static __inline__ double fake_hypot (x, y)\n"
1252 "\treturn fabs (hypot (x, y));\n"
1254 "#define hypot\tfake_hypot\n";
1255 test_text = "extern double hypot();";
1260 * Fix incorrect S_IF* definitions on m88k-sysv3.
1263 hackname = m88k_bad_s_if;
1264 mach = "m88k-*-sysv3*";
1266 select = "#define[ \t]+S_IS[A-Z]+\\(m\\)[ \t]+\\(m[ \t]*&";
1269 c_fix_arg = '#define %1(m) (((m) & S_IFMT) == %2)';
1270 c_fix_arg = "#define[ \t]+(S_IS[A-Z]+)\\(m\\)[ \t]+"
1272 "(S_IF[A-Z][A-Z][A-Z]+|0[0-9]+)"
1274 test_text = '#define S_ISREG(m) (m & S_IFREG) /* is regular? */';
1279 * Put cpp wrappers around these include files to avoid redeclaration
1280 * errors during multiple inclusion on m88k-tektronix-sysv3.
1283 hackname = m88k_multi_incl;
1284 mach = "m88k-tektronix-sysv3*";
1288 "echo Fixing $file, to protect against multiple inclusion. >&2
1289 cpp_wrapper=`echo $file | sed -e 's,\\.,_,g' -e 's,/,_,g'`
1290 echo \"#ifndef __GCC_GOT_${cpp_wrapper}_\"
1291 echo \"#define __GCC_GOT_${cpp_wrapper}_\"
1293 echo \"#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\"";
1298 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
1301 hackname = machine_ansi_h_va_list;
1302 files = machine/ansi.h;
1303 select = '_BSD_VA_LIST_';
1304 bypass = '__builtin_va_list';
1306 sed = "s/\\(_BSD_VA_LIST_[ \t][ \t]*\\).*$/\\1__builtin_va_list/";
1311 * Fix non-ansi machine name defines
1314 hackname = machine_name;
1315 c_test = machine_name;
1316 c_fix = machine_name;
1317 test_text = "#ifdef i386 /* no uniform machine_name test, so\n"
1318 " this only works on i?86 machines */";
1323 * Some math.h files define struct exception, which conflicts with
1324 * the class exception defined in the C++ file std/stdexcept.h. We
1325 * redefine it to __math_exception. This is not a great fix, but I
1326 * haven't been able to think of anything better.
1327 * Note that we have to put the #ifdef/#endif blocks at beginning
1328 * and end of file, because fixproto runs after us and may insert
1329 * additional references to struct exception.
1332 hackname = math_exception;
1334 select = "struct exception";
1335 bypass = "We have a problem when using C\\+\\+";
1338 c_fix_arg = "#ifdef __cplusplus\n"
1339 "#define exception __math_exception\n"
1342 c_fix_arg = "#ifdef __cplusplus\n"
1343 "#undef exception\n"
1346 test_text = "typedef struct exception t_math_exception;";
1350 hackname = math_huge_val_from_dbl_max;
1353 * IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined
1354 * in math.h, this fix applies.
1356 select = "define[ \t]*HUGE_VAL[ \t]*DBL_MAX";
1357 bypass = "define[ \t]*DBL_MAX";
1361 * See if we have a definition for DBL_MAX in float.h.
1362 * If we do, we will replace the one in math.h with that one.
1365 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
1368 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
1369 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
1370 "s/DBL_MAX/'\"$dbl_max_def/\"\n"
1376 * In any case, put #ifndef .. #endif around #define HUGE_VAL in math.h.
1379 hackname = math_huge_val_ifndef;
1380 files = math/math.h;
1381 select = "define[ \t]*HUGE_VAL";
1383 sed = "/define[ \t]HUGE_VAL[ \t]/i\\\n#ifndef HUGE_VAL\n";
1384 sed = "/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n";
1389 * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
1392 hackname = nested_motorola;
1393 mach = "m68k-motorola-sysv*";
1395 files = sys/limits.h;
1396 sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
1397 "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
1398 sed = "s@\\(/\\*#define\tHUGE_VAL\t3.[0-9e+]* \\)"
1399 "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
1404 * Fixing nested comments in ISC <sys/limits.h>
1407 hackname = nested_sys_limits;
1408 files = sys/limits.h;
1410 sed = "/CHILD_MAX/s,/\\* Max, Max,";
1411 sed = "/OPEN_MAX/s,/\\* Max, Max,";
1412 test_text = "/*\n#define CHILD_MAX 20 /* Max, Max, ... */ /*\n"
1413 "#define OPEN_MAX 20 /* Max, Max, ... */\n";
1420 hackname = nested_auth_des;
1422 select = '(/\*.*rpc/auth_des\.h>.*)/\*';
1424 c_fix_arg = "%1*/ /*";
1425 test_text = "/*#include <rpc/auth_des.h> /* skip this */";
1430 * Avoid nested comments on Ultrix 4.3.
1433 hackname = nested_ultrix;
1435 sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
1440 * fix bogus recursive stdlib.h in NEWS-OS 4.0C
1443 hackname = news_os_recursion;
1445 select = "#include <stdlib.h>";
1446 sed = "/^#include <stdlib.h>/i\\\n"
1447 "#ifdef BOGUS_RECURSION\n";
1448 sed = "/^#include <stdlib.h>/a\\\n"
1454 * NeXT 3.2 adds const prefix to some math functions.
1455 * These conflict with the built-in functions.
1458 hackname = next_math_prefix;
1459 files = ansi/math.h;
1460 select = "^extern.*double.*__const__.*";
1462 sed = "/^extern.*double.*__const__.*sqrt(/s/__const__//";
1463 sed = "/^extern.*double.*__const__.*fabs(/s/__const__//";
1464 sed = "/^extern.*double.*__const__.*cos(/s/__const__//";
1465 sed = "/^extern.*double.*__const__.*hypot(/s/__const__//";
1466 sed = "/^extern.*double.*__const__.*sin(/s/__const__//";
1471 * NeXT 3.2 uses the word "template" as a parameter for some
1472 * functions. GCC reports an invalid use of a reserved key word
1473 * with the built-in functions. NeXT 3.2 includes the keyword
1474 * volatile in the prototype for abort(). This conflicts with
1475 * the built-in definition.
1478 hackname = next_template;
1482 sed = '/\(.*template\)/s/template//';
1483 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1488 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
1489 * function prototypes. That conflicts with the built-in functions.
1492 hackname = next_volitile;
1493 files = ansi/stdlib.h;
1496 sed = "/extern.*volatile.*void.*exit/s/volatile//";
1497 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1502 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1503 * Note that version 3 of the NeXT system has wait.h in a different directory,
1504 * so that this code won't do anything. But wait.h in version 3 has a
1505 * conditional, so it doesn't need this fix. So everything is okay.
1508 hackname = next_wait_union;
1511 select = 'wait\(union wait';
1513 sed = "s@wait(union wait@wait(void@";
1518 * a missing semi-colon at the end of the nodeent structure definition.
1521 hackname = nodeent_syntax;
1522 files = netdnet/dnetdb.h;
1523 sed = "s/char.*na_addr *$/char *na_addr;/";
1528 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
1529 * defining regex.h related types. This causes libg++ build and usage
1530 * failures. Fixing this correctly requires checking and modifying 3 files.
1533 hackname = osf_namespace_a;
1534 files = reg_types.h;
1535 files = sys/lc_core.h;
1536 test = " -r reg_types.h";
1537 test = " -r sys/lc_core.h";
1538 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1539 test = " -z \"`grep __regex_t regex.h`\"";
1541 sed = "s/regex_t/__regex_t/g";
1542 sed = "s/regoff_t/__regoff_t/g";
1543 sed = "s/regmatch_t/__regmatch_t/g";
1547 hackname = osf_namespace_b;
1549 test = " -r reg_types.h";
1550 test = " -r sys/lc_core.h";
1551 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1552 test = " -z \"`grep __regex_t regex.h`\"";
1554 sed = "/#include <reg_types.h>/a\\\n"
1555 "typedef __regex_t\tregex_t;\\\n"
1556 "typedef __regoff_t\tregoff_t;\\\n"
1557 "typedef __regmatch_t\tregmatch_t;\n";
1562 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
1563 * The original ones fail if uninitialized externs are not common.
1564 * This is the default for all ANSI standard C++ compilers.
1567 hackname = pthread_page_size;
1569 select = "^int __page_size";
1570 sed = "s/^int __page_size/extern int __page_size/";
1575 * Fix return type of fread and fwrite on sysV68
1578 hackname = read_ret_type;
1580 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
1581 sed = "s/^\\(extern int\tfclose(), fflush()\\), "
1582 "\\(fread(), fwrite()\\)\\(.*\\)$"
1583 "/extern unsigned int\t\\2;\\\n\\1\\3/";
1588 * function class(double x) conflicts with C++ keyword on rs/6000
1591 hackname = rs6000_double;
1593 select = '[^a-zA-Z_]class\(';
1595 sed = "/class[(]/i\\\n#ifndef __cplusplus\n";
1596 sed = "/class[(]/a\\\n#endif\n";
1601 * Wrong fchmod prototype on RS/6000.
1604 hackname = rs6000_fchmod;
1606 select = 'fchmod\(char';
1607 sed = 's/fchmod(char \*/fchmod(int/';
1612 * parameters conflict with C++ new on rs/6000
1615 hackname = rs6000_param;
1618 select = 'const char new';
1620 sed = 's@rename(const char \*old, const char \*new)@'
1621 'rename(const char *_old, const char *_new)@';
1626 * The static functions lstat() and fchmod() in <sys/stat.h>
1627 * cause G++ grief since they're not wrapped in "if __cplusplus".
1629 * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
1630 * tiny static wrappers that aren't C++ safe.
1633 hackname = sco_static_func;
1635 mach = "i?86-*-sco3.2*";
1636 select = "^static int";
1638 sed = "/^static int/i\\\n"
1639 "#if __cplusplus\\\n"
1640 "extern \"C\" {\\\n"
1641 "#endif /* __cplusplus */";
1644 "#if __cplusplus\\\n"
1646 "#endif /* __cplusplus */";
1651 * "!__STDC__" is "!defined( __STRICT_ANSI__ )"
1654 hackname = sco_strict_ansi;
1655 mach = "i?86-*-sco3.2*";
1656 select = "^[ \t]*#[ \t]*if.*!__STDC__";
1657 sed = 's/!__STDC__/!defined(__STRICT_ANSI__)/g';
1662 * Fix prototype declaration of utime in sys/times.h.
1663 * In 3.2v4.0 the const is missing.
1666 hackname = sco_utime;
1667 files = sys/times.h;
1668 mach = "i?86-*-sco3.2v4*";
1669 select = "\(const char \*, struct utimbuf \*\);";
1670 sed = 's/(const char \*, struct utimbuf \*);/'
1671 '(const char *, const struct utimbuf *);/';
1676 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1680 hackname = sony_ctype;
1682 test = " -x /bin/sony";
1683 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1684 sed = "s/__ctype/_ctype/g";
1689 * Incorrect #include in Sony News-OS 3.2.
1692 hackname = sony_include;
1693 files = machine/machparam.h;
1694 select = '"\.\./machine/endian.h"';
1695 sed = 's@"../machine/endian.h"@<machine/endian.h>@';
1700 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1704 hackname = sony_stdio;
1706 test = " -x /bin/sony";
1707 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1708 sed = "s/__filbuf/_filbuf/g\n"
1709 "s/__flsbuf/_flsbuf/g\n"
1715 * Add a `static' declaration of `getrnge' into <regexp.h>.
1717 * Don't do this if there is already a `static void getrnge' declaration
1718 * present, since this would cause a redeclaration error. Solaris 2.x has
1719 * such a declaration.
1723 hackname = static_getrnge;
1725 bypass = "static void getrnge";
1726 sed = "/^static int[ \t]*size;/c\\\n"
1727 "static int size ;\\\n\\\n"
1728 "static int getrnge ();";
1734 * a missing semi-colon at the end of the statsswtch structure definition.
1737 hackname = statsswtch;
1738 files = rpcsvc/rstat.h;
1739 select = "boottime$";
1740 sed = "s/boottime$/boottime;/";
1745 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
1746 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
1750 hackname = stdio_stdarg_h;
1752 bypass = "include.*(stdarg\.h|machine/ansi\.h)";
1756 c_fix_arg = "#define __need___va_list\n#include <stdarg.h>\n";
1763 * Don't use or define the name va_list in stdio.h.
1764 * This is for ANSI and also to interoperate properly with gcc's varargs.h.
1765 * Note _BSD_VA_LIST_ is dealt with elsewhere.
1768 hackname = stdio_va_list;
1770 bypass = '__gnuc_va_list|_BSD_VA_LIST_';
1773 * Use __gnuc_va_list in arg types in place of va_list.
1774 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1775 * trailing parentheses and semicolon save all other systems from this.
1776 * Define __not_va_list__ (something harmless and unused)
1777 * instead of va_list.
1778 * Don't claim to have defined va_list.
1780 sed = "s@ va_list @ __gnuc_va_list @\n"
1781 "s@ va_list)@ __gnuc_va_list)@\n"
1782 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
1783 "s@ va_list@ __not_va_list__@\n"
1784 "s@\\*va_list@*__not_va_list__@\n"
1785 "s@ __va_list)@ __gnuc_va_list)@\n"
1786 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
1787 "@typedef \\1 __not_va_list__;@\n"
1788 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
1789 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
1790 "s@VA_LIST@DUMMY_VA_LIST@\n"
1791 "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";
1811 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
1812 * in prototype without previous definition.
1815 hackname = struct_file;
1817 select = '^.*xdrstdio_create.*struct __file_s';
1819 c_fix_arg = "struct __file_s;\n%0";
1820 test_text = "extern void xdrstdio_create( struct __file_s* );";
1825 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
1826 * in prototype without previous definition.
1829 hackname = struct_sockaddr;
1831 select = "^.*authdes_create.*struct sockaddr";
1832 bypass = "<sys/socket\.h>";
1834 c_fix_arg = "struct sockaddr;\n%0";
1835 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
1840 * Apply fix this to all OSs since this problem seems to effect
1841 * more than just SunOS.
1844 hackname = sun_auth_proto;
1850 * Select those files containing '(*name)()'.
1852 select = '\(\*[a-z][a-z_]*\)\(\)';
1854 '/^\(.*(\*[a-z][a-z_]*)(\)' '\();.*\)'
1856 "#ifdef __cplusplus\\\n"
1866 * Fix bogus #ifdef on SunOS 4.1.
1869 hackname = sun_bogus_ifdef;
1870 files = "hsfs/hsfs_spec.h";
1871 files = "hsfs/iso_spec.h";
1872 select = '#ifdef __i386__ || __vax__';
1873 sed = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";
1878 * Fix bogus #ifdef on SunOS 4.1.
1881 hackname = sun_bogus_ifdef_sun4c;
1882 files = "hsfs/hsnode.h";
1883 select = '#ifdef __i386__ || __sun4c__';
1884 sed = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";
1889 * Fix the CAT macro in SunOS memvar.h.
1892 hackname = sun_catmacro;
1893 files = pixrect/memvar.h;
1894 select = "^#define[ \t]+CAT\\(a,b\\)";
1895 sed = "/^#define[ \t]CAT(a,b)/ i\\\n"
1896 "#ifdef __STDC__ \\\n"
1897 "#define CAT(a,b) a##b\\\n"
1900 sed = "/^#define[ \t]CAT(a,b)/ a\\\n"
1906 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1907 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1910 hackname = sun_malloc;
1913 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
1914 sed = "s/int[ \t][ \t]*free/void\tfree/g";
1915 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
1916 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
1921 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
1924 hackname = sun_rusers_semi;
1925 files = rpcsvc/rusers.h;
1927 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
1932 * signal.h on SunOS defines signal using (),
1933 * which causes trouble when compiling with g++ -pedantic.
1936 hackname = sun_signal;
1937 files = sys/signal.h;
1939 select = "^void\t" '\(\*signal\(\)\)\(\);';
1941 sed = "/^void\t" '(\*signal())();$/i' "\\\n"
1942 "#ifdef __cplusplus" "\\\n"
1943 "void\t(*signal(...))(...);" "\\\n"
1946 sed = "/^void\t" '(\*signal())();$/a' "\\\n"
1952 * math.h on SunOS 4 puts the declaration of matherr before the definition
1953 * of struct exception, so the prototype (added by fixproto) causes havoc.
1956 hackname = sunos_matherr_decl;
1958 /* If matherr has a prototype already, the header needs no fix. */
1959 bypass = 'matherr.*struct exception';
1961 * Once a declaration for 'struct exception' is found,
1962 * stop trying to insert a forward reference for it.
1964 sed = "/^struct exception/,$b";
1965 sed = "/matherr/i\\\nstruct exception;\n";
1970 * Correct the return type for strlen in strings.h in SunOS 4.
1973 hackname = sunos_strlen;
1975 select = "int[ \t]*strlen";
1976 sed = "s/int[ \t]*strlen();/__SIZE_TYPE__ strlen();/";
1981 * Solaris math.h and floatingpoint.h define __P without protection,
1982 * which conflicts with the fixproto definition. The fixproto
1983 * definition and the Solaris definition are used the same way.
1989 files = floatingpoint.h;
1990 select = "^#define[ \t]*__P";
1991 sed = "/^#define[ \t]*__P/i\\\n#ifndef __P\n";
1992 sed = "/^#define[ \t]*__P/a\\\n#endif\n";
1997 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
1998 * that is visible to any ANSI compiler using this include. Simply
1999 * delete the lines that #define some string functions to internal forms.
2003 hackname = svr4_disable_opt;
2005 select = '#define.*__std_hdr_';
2006 sed = '/#define.*__std_hdr_/d';
2012 * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
2013 * On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
2014 * but we still "hijack" it and redirect it to the GNU byteorder.h..
2020 hackname = svr4_endian;
2021 files = sys/endian.h;
2024 * since we emit our own sys/byteorder.h,
2025 * this fix can never be applied to that file.
2027 files = sys/byteorder.h;
2029 bypass = '__GNUC__';
2031 sed = "/#\tifdef\t__STDC__/i\\\n"
2032 "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
2034 sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
2036 sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
2037 "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
2043 * Remove useless extern keyword from struct forward declarations
2044 * in <sys/stream.h> and <sys/strsubr.h>
2048 hackname = svr4_extern_struct;
2049 files = sys/stream.h;
2050 files = sys/strsubr.h;
2051 select = 'extern struct [a-z_]*;';
2052 sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
2057 * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
2058 * systems the file <ftw.h> contains extern declarations of these
2059 * functions followed by explicitly `static' definitions of these
2060 * functions... and that's not allowed according to ANSI C. (Note
2061 * however that on Solaris, this header file glitch has been pre-fixed by
2062 * Sun. In the Solaris version of <ftw.h> there are no static
2063 * definitions of any function so we don't need to do any of this stuff
2069 hackname = svr4_ftw;
2071 select = '^extern int ftw\(const';
2073 sed = '/^extern int ftw(const/i' "\\\n"
2074 "#if !defined(_STYPES)\\\n"
2079 sed = 's/extern \(int ftw(const.*\)$/\1/';
2080 sed = "/^extern int nftw/i\\\n"
2081 "#if defined(_STYPES)\\\n"
2086 sed = 's/extern \(int nftw.*\)$/\1/';
2087 sed = "/^extern int ftw(),/c\\\n"
2088 "#if !defined(_STYPES)\\\n"
2094 "#if defined(_STYPES)\\\n"
2106 * Fix broken decl of getcwd present on some svr4 systems.
2109 hackname = svr4_getcwd;
2112 files = prototypes.h;
2113 select = 'getcwd\(char \*, int\)';
2115 sed = 's/getcwd(char \*, int)/getcwd(char *, size_t)/';
2124 hackname = svr4_kernel;
2125 files = fs/rfs/rf_cache.h;
2129 files = sys/getpages.h;
2131 files = sys/cmn_err.h;
2132 files = sys/kdebugger.h;
2136 c_fix_arg = "#ifdef _KERNEL\n";
2137 c_fix_arg = "#endif /* _KERNEL */\n";
2143 * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
2144 * tend to conflict with the compiler's own definition of this symbol. (We
2145 * will use the compiler's definition.)
2146 * Likewise __sparc, for Solaris, and __i860, and a few others
2147 * (guessing it is necessary for all of them).
2151 hackname = svr4_mach_defines;
2153 select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
2154 sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
2160 * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
2161 * They are declared as non-static then immediately redeclared as static.
2165 hackname = svr4_mkdev;
2166 files = sys/mkdev.h;
2169 sed = "/^dev_t makedev(/s/^/static /";
2170 sed = "/^major_t major(/s/^/static /";
2171 sed = "/^minor_t minor(/s/^/static /";
2177 * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
2178 * Also fix types of array initializers.
2182 hackname = svr4_netcspace;
2183 files = sys/netcspace.h;
2184 select = 'NC_NPI_RAW';
2185 sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
2186 sed = 's/NC_/(unsigned long) NC_/';
2191 * Fix reference to NMSZ in <sys/adv.h>.
2195 hackname = svr4_nmsz;
2197 select = '\[NMSZ\]';
2198 sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
2204 * Fix broken decl of profil present on some svr4 systems.
2207 hackname = svr4_profil;
2211 sed = 's/profil(unsigned short \*, unsigned int, '
2212 'unsigned int, unsigned int)'
2213 '/profil(unsigned short *, size_t, int, unsigned)/';
2218 * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
2222 hackname = svr4_proto_form;
2224 select = 'const extern';
2226 sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
2231 sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
2236 sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
2241 sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
2246 sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
2247 sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
2248 sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
2249 sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
2250 sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
2251 sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
2256 * Add a prototyped declaration of mmap to <sys/mman.h>.
2260 hackname = svr4_proto_mmap;
2262 select = '^extern caddr_t mmap();$';
2263 sed = '/^extern caddr_t mmap();$/c' "\\\n"
2264 "#ifdef __STDC__\\\n"
2265 "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
2266 "#else /* !defined(__STDC__) */\\\n"
2267 "extern caddr_t mmap ();\\\n"
2268 "#endif /* !defined(__STDC__) */\\\n";
2273 * Add a #define of _SIGACTION_ into <sys/signal.h>.
2277 hackname = svr4_sigaction;
2278 files = sys/signal.h;
2279 sed = "/^struct sigaction {/i\\\n"
2280 "#define _SIGACTION_";
2281 sed = 's/(void *(\*)())/(void (*)(int))/';
2286 * Put storage class at start of decl, to avoid warning.
2290 hackname = svr4_storage_class;
2291 files = rpc/types.h;
2292 select = 'const extern';
2293 sed = 's/const extern/extern const/g';
2299 * Like svr4_mach_defines, but with newfangled syntax.
2300 * Source lines are of #define __i386 #machine(i386). Delete them.
2304 hackname = svr5_mach_defines;
2306 select = "#define[ \t]*__i386.*\(i386\)";
2307 sed = "/#define[ \t]*__i386.*/d";
2313 * Fix these files to use the same types that we think they should.
2314 * XXX - extremely dubious changes here.
2317 hackname = systypes;
2318 files = "sys/types.h";
2320 files = "sys/stdtypes.h";
2324 select = "typedef[ \t]+[a-z_][ \ta-z_]*[ \t]"
2325 "(size|ptrdiff|wchar)_t";
2327 sed = "/^[ \t]*\\*[ \t]*typedef unsigned int size_t;/N";
2329 sed = "s/^\\([ \t]*\\*[ \t]*typedef unsigned int size_t;\\n"
2330 "[ \t]*\\*\\/\\)/\\1\\\n"
2331 "#ifndef __SIZE_TYPE__\\\n"
2332 "#define __SIZE_TYPE__ long unsigned int\\\n"
2334 "typedef __SIZE_TYPE__ size_t;\\\n/";
2336 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/i\\\n"
2337 "#ifndef __SIZE_TYPE__\\\n"
2338 "#define __SIZE_TYPE__ long unsigned int\\\n"
2341 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/"
2342 "typedef __SIZE_TYPE__ size_t/";
2344 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/i\\\n"
2345 "#ifndef __PTRDIFF_TYPE__\\\n"
2346 "#define __PTRDIFF_TYPE__ long int\\\n"
2349 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/"
2350 "typedef __PTRDIFF_TYPE__ ptrdiff_t/";
2352 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/i\\\n"
2353 "#ifndef __WCHAR_TYPE__\\\n"
2354 "#define __WCHAR_TYPE__ int\\\n"
2356 "#ifndef __cplusplus\n";
2358 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/a\\\n"
2361 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/"
2362 "typedef __WCHAR_TYPE__ wchar_t/";
2367 * Fix files that may contain a stray definition of size_t. Take care
2368 * not to match ssize_t or mere uses of size_t.
2371 hackname = systypes_stdlib_size_t;
2372 files = sys/types.h;
2374 select = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";
2375 bypass = "_(GCC|BSD)_SIZE_T";
2377 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
2378 "#ifndef _GCC_SIZE_T\\\n"
2379 "#define _GCC_SIZE_T\n";
2381 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/a\\\n"
2387 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
2388 * in string.h on sysV68
2389 * Correct the return type for strlen in string.h on Lynx.
2390 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
2391 * Add missing const for strdup on OSF/1 V3.0.
2392 * On sysV88 layout is slightly different.
2395 hackname = sysv68_string;
2398 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
2399 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
2400 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
2401 sed = "/^extern char$/N";
2402 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
2403 sed = "/^\tstrncmp(),$/N";
2404 sed = "s/^\\(\tstrncmp()\\),\\n\\(\tstrlen(),\\)$/\\1;\\\n"
2405 "extern unsigned int\\\n\\2/";
2406 sed = "/^extern int$/N";
2407 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
2412 * Fix return type of exit and abort in <stdlib.h>
2415 hackname = sysz_stdlib_for_sun;
2418 sed = "s/int\tabort/void\tabort/g";
2419 sed = "s/int\tfree/void\tfree/g";
2420 sed = "s/char[ \t]*\\*[ \t]*calloc/void \\*\tcalloc/g";
2421 sed = "s/char[ \t]*\\*[ \t]*malloc/void \\*\tmalloc/g";
2422 sed = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
2423 sed = "s/char[ \t]*\\*[ \t]*bsearch/void \\*\tbsearch/g";
2424 sed = "s/int[ \t][ \t]*exit/void\texit/g";
2429 * Fix this Sun file to avoid interfering with stddef.h.
2430 * We use a funny name to ensure it follows 'systypes' fix.
2433 hackname = sysz_stdtypes_for_sun;
2434 files = sys/stdtypes.h;
2435 sed = "/[\t ]size_t.*;/i\\\n"
2436 "#ifndef _GCC_SIZE_T\\\n"
2437 "#define _GCC_SIZE_T\n";
2439 sed = "/[\t ]size_t.*;/a\\\n"
2442 sed = "/[\t ]ptrdiff_t.*;/i\\\n"
2443 "#ifndef _GCC_PTRDIFF_T\\\n"
2444 "#define _GCC_PTRDIFF_T\n";
2446 sed = "/[\t ]ptrdiff_t.*;/a\\\n"
2449 sed = "/[\t ]wchar_t.*;/i\\\n"
2450 "#ifndef _GCC_WCHAR_T\\\n"
2451 "#define _GCC_WCHAR_T\n";
2453 sed = "/[\t ]wchar_t.*;/a\\\n"
2459 * if the #if says _cplusplus, not the double underscore __cplusplus
2463 hackname = tinfo_cplusplus;
2465 select = "[ \t]_cplusplus";
2466 sed = "s/[ \t]_cplusplus/ __cplusplus/";
2471 * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
2474 hackname = ultrix_atof_param;
2476 select = "atof\\([ \t]*char";
2478 sed = "s@atof(\\([ \t]*char[ \t]*\\*[^)]*\\))@atof(const \\1)@";
2483 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
2486 hackname = ultrix_const;
2489 sed = 's@perror( char \*__s );@perror( const char *__s );@';
2490 sed = 's@fputs( char \*__s,@fputs( const char *__s,@';
2491 sed = 's@fopen( char \*__filename, char \*__type );@'
2492 'fopen( const char *__filename, const char *__type );@';
2493 sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@';
2494 sed = 's@fscanf( FILE \*__stream, char \*__format,@'
2495 'fscanf( FILE *__stream, const char *__format,@';
2496 sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
2497 sed = 's@sscanf( char \*__s, char \*__format,@'
2498 'sscanf( const char *__s, const char *__format,@';
2499 sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
2500 sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
2505 * Ultrix V4.[35] puts the declaration of uname before the definition
2506 * of struct utsname, so the prototype (added by fixproto) causes havoc.
2509 hackname = ultrix_fix_fixproto;
2510 files = sys/utsname.h;
2512 sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
2513 "struct utsname;\n";
2518 * Check for bad #ifdef line (in Ultrix 4.1)
2521 hackname = ultrix_ifdef;
2522 select = "#ifdef KERNEL[ \t]*[^ \t]";
2524 sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
2529 * Check for superfluous `static' (in Ultrix 4.2)
2530 * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
2533 hackname = ultrix_static;
2534 files = machine/cpu.h;
2535 select = '#include "r[34]_cpu';
2536 sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
2537 sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
2538 sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
2543 * Fix multiple defines for NULL. Sometimes, we stumble into \r\n
2544 * terminated lines, so accommodate these. Test both ways.
2547 hackname = undefine_null;
2548 select = "^#[ \t]*define[ \t]+NULL[ \t]";
2549 bypass = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
2552 c_fix_arg = "#ifndef NULL%2\n#define NULL%1%2\n#endif%2\n";
2553 c_fix_arg = "^#[ \t]*define[ \t]*[ \t]NULL([^\r\n]+)([\r]*)\n";
2555 test_text = "#define NULL 0UL\r\n#define NULL\t((void*)0)\n";
2560 * If arpa/inet.h prototypes are incompatible with the ones we just
2561 * installed in <sys/byteorder.h>, just remove the protos.
2562 * Because of this close association, this patch must be applied only
2563 * on those systems where the replacement byteorder header is installed.
2566 hackname = unixware7_byteorder_fix;
2567 files = arpa/inet.h;
2568 select = "in_port_t";
2570 mach = "*-*-sysv4*";
2571 mach = "i[34567]86-*-sysv5*";
2572 mach = "i[34567]86-*-udk*";
2573 mach = "i[34567]86-*-solaris2.[0-4]";
2574 mach = "powerpcle-*-solaris2.[0-4]";
2575 mach = "sparc-*-solaris2.[0-4]";
2577 sed = '/^extern.*htons.*(in_port_t)/d';
2578 sed = '/^extern.*ntohs.*(in_port_t)/d';
2583 * Fix definitions of macros used by va-i960.h in VxWorks header file.
2586 hackname = va_i960_macro;
2587 files = arch/i960/archI960.h;
2588 select = "__(vsiz|vali|vpad|alignof__)";
2589 sed = "s/__vsiz/__vxvsiz/";
2590 sed = "s/__vali/__vxvali/";
2591 sed = "s/__vpad/__vxvpad/";
2592 sed = "s/__alignof__/__vxalignof__/";
2597 * AIX headers define NULL to be cast to a void pointer,
2598 * which is illegal in ANSI C++.
2601 hackname = void_null;
2611 files = sys/param.h;
2612 files = sys/types.h;
2613 select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void";
2614 sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)"
2620 * Make VxWorks header which is almost gcc ready fully gcc ready.
2623 hackname = vxworks_gcc_problem;
2624 files = types/vxTypesBase.h;
2625 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
2627 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
2630 sed = "/[ \t]size_t/i\\\n"
2631 "#ifndef _GCC_SIZE_T\\\n"
2632 "#define _GCC_SIZE_T\n";
2634 sed = "/[ \t]size_t/a\\\n"
2637 sed = "/[ \t]ptrdiff_t/i\\\n"
2638 "#ifndef _GCC_PTRDIFF_T\\\n"
2639 "#define _GCC_PTRDIFF_T\n";
2641 sed = "/[ \t]ptrdiff_t/a\\\n"
2644 sed = "/[ \t]wchar_t/i\\\n"
2645 "#ifndef _GCC_WCHAR_T\\\n"
2646 "#define _GCC_WCHAR_T\n";
2648 sed = "/[ \t]wchar_t/a\\\n"
2654 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
2657 hackname = vxworks_needs_vxtypes;
2659 select = "uint_t[ \t][ \t]*_clocks_per_sec";
2660 sed = "s/uint_t/unsigned int/";
2661 test_text = "uint_t\t_clocks_per_sec;";
2666 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2669 hackname = vxworks_needs_vxworks;
2671 test = " -r types/vxTypesOld.h";
2672 test = " -n \"`egrep '#include' $file`\"";
2673 test = " -n \"`egrep ULONG $file`\"";
2674 select = "#[ \t]define[ \t][ \t]*__INCstath";
2676 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
2677 "#include <types/vxTypesOld.h>\n";
2682 * Another bad dependency in VxWorks 5.2 <time.h>.
2685 hackname = vxworks_time;
2687 select = "VOIDFUNCPTR";
2688 test = " -r vxWorks.h";
2689 sed = "/VOIDFUNCPTR/i\\\n"
2690 "#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
2691 "#ifdef __cplusplus\\\n"
2692 "typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
2694 "typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
2696 "#define __gcc_VOIDFUNCPTR_defined\\\n"
2699 sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g";
2704 * There are several name conflicts with C++ reserved words in X11 header
2705 * files. These are fixed in some versions, so don't do the fixes if
2706 * we find __cplusplus in the file. These were found on the RS/6000.
2709 hackname = x11_class;
2710 files = X11/ShellP.h;
2711 bypass = __cplusplus;
2712 sed = "/char \\*class;/i\\\n"
2713 "#ifdef __cplusplus\\\n"
2714 "\tchar *c_class;\\\n"
2716 sed = "/char \\*class;/a\\\n"
2726 * class in Xm/BaseClassI.h
2729 hackname = x11_class_usage;
2730 files = Xm/BaseClassI.h;
2731 bypass = "__cplusplus";
2732 sed = "s/ class[)]/ c_class)/g";
2733 test_text = "extern mumble (int class);\n";
2738 * new in Xm/Traversal.h
2742 files = Xm/Traversal.h;
2743 bypass = __cplusplus;
2745 sed = "/Widget\told, new;/i\\\n"
2746 "#ifdef __cplusplus\\\n"
2747 "\tWidget\told, c_new;\\\n"
2750 sed = "/Widget\told, new;/a\\\n"
2753 sed = "s/Widget new,/Widget c_new,/g";
2756 " Widget\told, new; /* fix the new */\n"
2757 "};\nextern Wedged( Widget new, Widget old );";
2762 * Incorrect sprintf declaration in X11/Xmu.h
2765 hackname = x11_sprintf;
2767 files = X11/Xmu/Xmu.h;
2768 select = 'sprintf\(\)';
2770 sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
2771 "extern char *\tsprintf();\\\n"
2772 "#endif /* !defined __STDC__ */,";
2773 test_text = "extern char *\tsprintf();";