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.
786 hackname = broken_cabs;
788 select = '^extern double cabs';
789 sed = '/^extern double cabs();/d';
790 sed = '/^extern double cabs(struct dbl_hypot);/d';
791 test_text = "#ifdef __STDC__\n"
792 "extern double cabs(struct dbl_hypot);\n"
794 "extern double cabs();\n"
800 * Fix various macros used to define ioctl numbers.
801 * The traditional syntax was:
803 * #define _CTRL(n, x) (('n'<<8)+x)
804 * #define TCTRLCFOO _CTRL(T, 1)
806 * but this does not work with the C standard, which disallows macro
807 * expansion inside strings. We have to rewrite it thus:
809 * #define _CTRL(n, x) ((n<<8)+x)
810 * #define TCTRLCFOO _CTRL('T', 1)
812 * The select expressions match too much, but the c_fix code is cautious.
814 * CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
817 hackname = ctrl_quotes_def;
818 select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'";
819 c_fix = char_macro_def;
821 test_text = "#define BSD43_CTRL(n, x) (('n'<<8)+x)";
825 hackname = ctrl_quotes_use;
826 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
827 c_fix = char_macro_use;
829 test_text = "#define TIOCFOO BSD43_CTRL(T, 1)";
834 * sys/mman.h on HP/UX is not C++ ready,
835 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
837 * rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
838 * is defined for the alpha. The problem is the declaration of malloc.
841 hackname = cxx_unready;
844 select = '[^#]+malloc.*;'; /* Catch any form of declaration
845 not within a macro. */
846 bypass = '"C"|__BEGIN_DECLS';
849 c_fix_arg = "#ifdef __cplusplus\n"
852 c_fix_arg = "#ifdef __cplusplus\n"
855 test_text = "extern void* malloc( size_t );";
860 * Fix <c_asm.h> on Digital UNIX V4.0:
861 * It contains a prototype for a DEC C internal asm() function,
862 * clashing with gcc's asm keyword. So protect this with __DECC.
865 hackname = dec_intern_asm;
867 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
868 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
872 " ... asm stuff ...\n"
873 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
878 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
881 hackname = ecd_cursor;
882 files = "sunwindow/win_lock.h";
883 files = "sunwindow/win_cursor.h";
884 sed = "s/ecd.cursor/ecd_cursor/";
885 test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
890 * fix-header doesn't fix fabs' prototype, and I have no idea why.
893 hackname = fix_header_breakage;
894 mach = "m88k-motorola-sysv3*";
897 select = 'extern double floor\(\), ceil\(\), fmod\(\), fabs\(\);';
900 'extern double floor(), ceil(), fmod(), fabs _PARAMS((double));';
901 test_text = 'extern double floor(), ceil(), fmod(), fabs();';
906 * Fix HP's use of ../machine/inline.h to refer to
907 * /usr/include/machine/inline.h
910 hackname = hp_inline;
911 files = sys/spinlock.h;
912 select = 'include.*"\.\./machine/';
913 sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
914 sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
915 test_text = '# include "../machine/inline.h"' "\n"
916 '# include "../machine/dontfix.h"' "\n"
917 '# include "../machine/psl.h"';
922 * Check for (...) in C++ code in HP/UX sys/file.h.
925 hackname = hp_sysfile;
927 select = "HPUX_SOURCE";
928 sed = 's/(\.\.\.)/(struct file *, ...)/';
929 test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
934 * get rid of bogus inline definitions in HP-UX 8.0
937 hackname = hpux8_bogus_inlines;
940 sed = "s@inline int abs(int [a-z][a-z]*) {.*}"
941 "@extern \"C\" int abs(int);@";
942 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
943 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
944 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
945 test_text = "inline int abs(int v) { return (v>=0)?v:-v; }\n"
946 "inline double sqr(double v) { return v**0.5; }";
951 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
952 * of UINT32_C has undefined behavior according to ISO/ANSI:
953 * the arguments to __CONCAT__ are not macro expanded before the
954 * concatination happens so the trailing ')' in the first argument
955 * is concatinated with the 'l' in the second argument creating an
956 * invalid pp token. The behavior of invalid pp tokens is undefined.
957 * GCC does not handle these invalid tokens the way the HP compiler does.
958 * This problem will potentially occur anytime macros are used in the
959 * arguments to __CONCAT__. A general solution to this problem would be to
960 * insert another layer of macro between __CONCAT__ and its use
961 * in UINT32_C. An example of this solution can be found in the C standard.
962 * A more specific solution, the one used here, is to change the UINT32_C
963 * macro to not used macros in the arguments to __CONCAT__.
966 hackname = hpux11_uint32_c;
968 select = "^#define UINT32_C\\(__c\\)[ \t]*"
969 "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
971 c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
973 "#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
974 "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
978 * On Interactive Unix 2.2, certain traditional Unix definitions
979 * (notably getc and putc in stdio.h) are omitted if __STDC__ is
980 * defined, not just if _POSIX_SOURCE is defined. This makes it
981 * impossible to compile any nontrivial program except with -posix.
984 hackname = isc_omits_with_stdc;
989 files = "sys/limits.h";
990 files = "sys/fcntl.h";
991 files = "sys/dirent.h";
993 select = '!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)';
995 c_fix_arg = '!defined(_POSIX_SOURCE)';
996 test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
997 "\nint foo;\n#endif";
1001 * Fix various macros used to define ioctl numbers.
1002 * The traditional syntax was:
1004 * #define _IO(n, x) (('n'<<8)+x)
1005 * #define TIOCFOO _IO(T, 1)
1007 * but this does not work with the C standard, which disallows macro
1008 * expansion inside strings. We have to rewrite it thus:
1010 * #define _IO(n, x) ((n<<8)+x)
1011 * #define TIOCFOO _IO('T', 1)
1013 * The select expressions match too much, but the c_fix code is cautious.
1015 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
1018 hackname = io_quotes_def;
1019 select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\1'";
1020 c_fix = char_macro_def;
1022 test_text = "#define BSD43__IOWR(n, x) (('n'<<8)+x)";
1026 hackname = io_quotes_use;
1027 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*"
1029 c_fix = char_macro_use;
1031 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)";
1036 * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
1039 hackname = hpux_maxint;
1040 files = sys/param.h;
1041 select = "^#[ \t]*define[ \t]*MAXINT[ \t]";
1042 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
1045 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
1047 test_text = '#define MAXINT 0x7FFFFFFF';
1052 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
1055 hackname = hpux_systime;
1057 select = "^extern struct sigevent;";
1058 sed = "s/^extern struct sigevent;/struct sigevent;/";
1059 test_text = 'extern struct sigevent;';
1064 * Check for missing ';' in struct
1067 hackname = ip_missing_semi;
1068 files = netinet/ip.h;
1070 sed = "/^struct/,/^};/s/}$/};/";
1076 "}; /* mumbled struct */\n";
1081 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
1082 * that causes the assembly preprocessor to complain about an
1083 * unterminated character constant.
1086 hackname = irix_asm_apostrophe;
1089 select = "^[ \t]*#.*[Ww]e're";
1091 c_fix_arg = "%1 are";
1092 c_fix_arg = "^([ \t]*#.*[Ww]e)'re";
1093 test_text = "\t# and we're on vacation";
1098 * Some IRIX header files contain the string "//"
1101 hackname = irix_multiline_cmnt;
1102 files = sys/types.h;
1104 sed = "s@type of the result@type of the result */@";
1105 sed = "s@of the sizeof@/* of the sizeof@";
1107 "/* we check the type of the result\n"
1108 "// of the sizeof something. This is a bad test :-( */";
1113 * Fixing ISC fmod declaration
1116 hackname = isc_fmod;
1118 select = 'fmod\(double\)';
1120 c_fix_arg = "fmod(double, double)";
1121 test_text = "extern double fmod(double);";
1126 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
1127 * use / * * / to concatenate tokens.
1130 hackname = kandr_concat;
1131 files = "sparc/asm_linkage.h";
1132 files = "sun3/asm_linkage.h";
1133 files = "sun3x/asm_linkage.h";
1134 files = "sun4/asm_linkage.h";
1135 files = "sun4c/asm_linkage.h";
1136 files = "sun4m/asm_linkage.h";
1137 files = "sun4c/debug/asm_linkage.h";
1138 files = "sun4m/debug/asm_linkage.h";
1139 files = "arm/as_support.h";
1140 files = "arm/mc_type.h";
1141 files = "arm/xcb.h";
1142 files = "dev/chardefmac.h";
1143 files = "dev/ps_irq.h";
1144 files = "dev/screen.h";
1145 files = "dev/scsi.h";
1146 files = "sys/tty.h";
1147 files = "Xm.acorn/XmP.h";
1148 files = bsd43/bsd43_.h;
1152 test_text = "#define __CONCAT__(a,b) a/**/b";
1157 * In limits.h, put #ifndefs around things that are supposed to be defined
1158 * in float.h to avoid redefinition errors if float.h is included first.
1159 * On HP/UX this patch does not work, because on HP/UX limits.h uses
1160 * multi line comments and the inserted #endif winds up inside the
1161 * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1162 * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1163 * are there, and we do not add them ourselves.
1166 hackname = limits_ifndefs;
1168 files = "sys/limits.h";
1169 bypass = "ifndef[ \t]+FLT_MIN";
1172 c_fix_arg = "#ifndef %1\n%0#endif\n";
1173 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+"
1174 "((FLT|DBL)_(MIN|MAX|DIG))"
1176 test_text = " #\tdefine\tDBL_DIG \t 0 /* somthin' */";
1181 * Delete the '#define void int' line from curses.h on Lynx
1184 hackname = lynx_void_int;
1186 select = "#[ \t]*define[ \t]+void[ \t]+int[ \t]*";
1189 test_text = "# define\tvoid\tint \t/* curses foiled again */";
1194 * Fix fcntl prototype in fcntl.h on LynxOS.
1197 hackname = lynxos_fcntl_proto;
1199 select = "fcntl[ \t]*" '\(int, int, int\)';
1201 c_fix_arg = '%1...)';
1202 c_fix_arg = "(fcntl[ \t]*" '\(int, int, )int\)';
1203 test_text = "extern int fcntl(int, int, int);";
1208 * libm.a on m88k-motorola-sysv3 contains a stupid optimization for
1209 * function hypot(), which returns the second argument without even
1210 * looking at its value, if the other is 0.0.
1213 hackname = m88k_bad_hypot_opt;
1214 mach = "m88k-motorola-sysv3*";
1216 select = "^extern double hypot\\(\\);\n";
1219 "/* Workaround a stupid Motorola optimization if one\n"
1220 " of x or y is 0.0 and the other is negative! */\n"
1222 "static __inline__ double fake_hypot (double x, double y)\n"
1224 "static __inline__ double fake_hypot (x, y)\n"
1228 "\treturn fabs (hypot (x, y));\n"
1230 "#define hypot\tfake_hypot\n";
1231 test_text = "extern double hypot();";
1236 * Fix incorrect S_IF* definitions on m88k-sysv3.
1239 hackname = m88k_bad_s_if;
1240 mach = "m88k-*-sysv3*";
1242 select = "#define[ \t]+S_IS[A-Z]+\\(m\\)[ \t]+\\(m[ \t]*&";
1245 c_fix_arg = '#define %1(m) (((m) & S_IFMT) == %2)';
1246 c_fix_arg = "#define[ \t]+(S_IS[A-Z]+)\\(m\\)[ \t]+"
1248 "(S_IF[A-Z][A-Z][A-Z]+|0[0-9]+)"
1250 test_text = '#define S_ISREG(m) (m & S_IFREG) /* is regular? */';
1255 * Put cpp wrappers around these include files to avoid redeclaration
1256 * errors during multiple inclusion on m88k-tektronix-sysv3.
1259 hackname = m88k_multi_incl;
1260 mach = "m88k-tektronix-sysv3*";
1264 "echo Fixing $file, to protect against multiple inclusion. >&2
1265 cpp_wrapper=`echo $file | sed -e 's,\\.,_,g' -e 's,/,_,g'`
1266 echo \"#ifndef __GCC_GOT_${cpp_wrapper}_\"
1267 echo \"#define __GCC_GOT_${cpp_wrapper}_\"
1269 echo \"#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\"";
1274 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
1277 hackname = machine_ansi_h_va_list;
1278 files = machine/ansi.h;
1279 select = '_BSD_VA_LIST_';
1280 bypass = '__builtin_va_list';
1282 sed = "s/\\(_BSD_VA_LIST_[ \t][ \t]*\\).*$/\\1__builtin_va_list/";
1287 * Fix non-ansi machine name defines
1290 hackname = machine_name;
1291 c_test = machine_name;
1292 c_fix = machine_name;
1293 test_text = "#ifdef i386 /* no uniform machine_name test, so\n"
1294 " this only works on i?86 machines */";
1299 * Some math.h files define struct exception, which conflicts with
1300 * the class exception defined in the C++ file std/stdexcept.h. We
1301 * redefine it to __math_exception. This is not a great fix, but I
1302 * haven't been able to think of anything better.
1303 * Note that we have to put the #ifdef/#endif blocks at beginning
1304 * and end of file, because fixproto runs after us and may insert
1305 * additional references to struct exception.
1308 hackname = math_exception;
1310 select = "struct exception";
1311 bypass = "We have a problem when using C\\+\\+";
1314 c_fix_arg = "#ifdef __cplusplus\n"
1315 "#define exception __math_exception\n"
1318 c_fix_arg = "#ifdef __cplusplus\n"
1319 "#undef exception\n"
1322 test_text = "typedef struct exception t_math_exception;";
1326 hackname = math_huge_val_from_dbl_max;
1329 * IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined
1330 * in math.h, this fix applies.
1332 select = "define[ \t]*HUGE_VAL[ \t]*DBL_MAX";
1333 bypass = "define[ \t]*DBL_MAX";
1337 * See if we have a definition for DBL_MAX in float.h.
1338 * If we do, we will replace the one in math.h with that one.
1341 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
1344 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
1345 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
1346 "s/DBL_MAX/'\"$dbl_max_def/\"\n"
1352 * In any case, put #ifndef .. #endif around #define HUGE_VAL in math.h.
1355 hackname = math_huge_val_ifndef;
1356 files = math/math.h;
1357 select = "define[ \t]*HUGE_VAL";
1359 sed = "/define[ \t]HUGE_VAL[ \t]/i\\\n#ifndef HUGE_VAL\n";
1360 sed = "/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n";
1365 * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
1368 hackname = nested_motorola;
1369 mach = "m68k-motorola-sysv*";
1371 files = sys/limits.h;
1372 sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
1373 "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
1374 sed = "s@\\(/\\*#define\tHUGE_VAL\t3.[0-9e+]* \\)"
1375 "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
1380 * Fixing nested comments in ISC <sys/limits.h>
1383 hackname = nested_sys_limits;
1384 files = sys/limits.h;
1386 sed = "/CHILD_MAX/s,/\\* Max, Max,";
1387 sed = "/OPEN_MAX/s,/\\* Max, Max,";
1388 test_text = "/*\n#define CHILD_MAX 20 /* Max, Max, ... */ /*\n"
1389 "#define OPEN_MAX 20 /* Max, Max, ... */\n";
1396 hackname = nested_auth_des;
1398 select = '(/\*.*rpc/auth_des\.h>.*)/\*';
1400 c_fix_arg = "%1*/ /*";
1401 test_text = "/*#include <rpc/auth_des.h> /* skip this */";
1406 * Avoid nested comments on Ultrix 4.3.
1409 hackname = nested_ultrix;
1411 sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
1416 * fix bogus recursive stdlib.h in NEWS-OS 4.0C
1419 hackname = news_os_recursion;
1421 select = "#include <stdlib.h>";
1422 sed = "/^#include <stdlib.h>/i\\\n"
1423 "#ifdef BOGUS_RECURSION\n";
1424 sed = "/^#include <stdlib.h>/a\\\n"
1430 * NeXT 3.2 adds const prefix to some math functions.
1431 * These conflict with the built-in functions.
1434 hackname = next_math_prefix;
1435 files = ansi/math.h;
1436 select = "^extern.*double.*__const__.*";
1438 sed = "/^extern.*double.*__const__.*sqrt(/s/__const__//";
1439 sed = "/^extern.*double.*__const__.*fabs(/s/__const__//";
1440 sed = "/^extern.*double.*__const__.*cos(/s/__const__//";
1441 sed = "/^extern.*double.*__const__.*hypot(/s/__const__//";
1442 sed = "/^extern.*double.*__const__.*sin(/s/__const__//";
1447 * NeXT 3.2 uses the word "template" as a parameter for some
1448 * functions. GCC reports an invalid use of a reserved key word
1449 * with the built-in functions. NeXT 3.2 includes the keyword
1450 * volatile in the prototype for abort(). This conflicts with
1451 * the built-in definition.
1454 hackname = next_template;
1458 sed = '/\(.*template\)/s/template//';
1459 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1464 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
1465 * function prototypes. That conflicts with the built-in functions.
1468 hackname = next_volitile;
1469 files = ansi/stdlib.h;
1472 sed = "/extern.*volatile.*void.*exit/s/volatile//";
1473 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1478 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1479 * Note that version 3 of the NeXT system has wait.h in a different directory,
1480 * so that this code won't do anything. But wait.h in version 3 has a
1481 * conditional, so it doesn't need this fix. So everything is okay.
1484 hackname = next_wait_union;
1487 select = 'wait\(union wait';
1489 sed = "s@wait(union wait@wait(void@";
1494 * a missing semi-colon at the end of the nodeent structure definition.
1497 hackname = nodeent_syntax;
1498 files = netdnet/dnetdb.h;
1499 sed = "s/char.*na_addr *$/char *na_addr;/";
1504 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
1505 * defining regex.h related types. This causes libg++ build and usage
1506 * failures. Fixing this correctly requires checking and modifying 3 files.
1509 hackname = osf_namespace_a;
1510 files = reg_types.h;
1511 files = sys/lc_core.h;
1512 test = " -r reg_types.h";
1513 test = " -r sys/lc_core.h";
1514 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1515 test = " -z \"`grep __regex_t regex.h`\"";
1517 sed = "s/regex_t/__regex_t/g";
1518 sed = "s/regoff_t/__regoff_t/g";
1519 sed = "s/regmatch_t/__regmatch_t/g";
1523 hackname = osf_namespace_b;
1525 test = " -r reg_types.h";
1526 test = " -r sys/lc_core.h";
1527 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1528 test = " -z \"`grep __regex_t regex.h`\"";
1530 sed = "/#include <reg_types.h>/a\\\n"
1531 "typedef __regex_t\tregex_t;\\\n"
1532 "typedef __regoff_t\tregoff_t;\\\n"
1533 "typedef __regmatch_t\tregmatch_t;\n";
1538 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
1539 * The original ones fail if uninitialized externs are not common.
1540 * This is the default for all ANSI standard C++ compilers.
1543 hackname = pthread_page_size;
1545 select = "^int __page_size";
1546 sed = "s/^int __page_size/extern int __page_size/";
1551 * Fix return type of fread and fwrite on sysV68
1554 hackname = read_ret_type;
1556 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
1557 sed = "s/^\\(extern int\tfclose(), fflush()\\), "
1558 "\\(fread(), fwrite()\\)\\(.*\\)$"
1559 "/extern unsigned int\t\\2;\\\n\\1\\3/";
1564 * function class(double x) conflicts with C++ keyword on rs/6000
1567 hackname = rs6000_double;
1569 select = '[^a-zA-Z_]class\(';
1571 sed = "/class[(]/i\\\n#ifndef __cplusplus\n";
1572 sed = "/class[(]/a\\\n#endif\n";
1577 * Wrong fchmod prototype on RS/6000.
1580 hackname = rs6000_fchmod;
1582 select = 'fchmod\(char';
1583 sed = 's/fchmod(char \*/fchmod(int/';
1588 * parameters conflict with C++ new on rs/6000
1591 hackname = rs6000_param;
1594 select = 'const char new';
1596 sed = 's@rename(const char \*old, const char \*new)@'
1597 'rename(const char *_old, const char *_new)@';
1602 * The static functions lstat() and fchmod() in <sys/stat.h>
1603 * cause G++ grief since they're not wrapped in "if __cplusplus".
1605 * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
1606 * tiny static wrappers that aren't C++ safe.
1609 hackname = sco_static_func;
1611 mach = "i?86-*-sco3.2*";
1612 select = "^static int";
1614 sed = "/^static int/i\\\n"
1615 "#if __cplusplus\\\n"
1616 "extern \"C\" {\\\n"
1617 "#endif /* __cplusplus */";
1620 "#if __cplusplus\\\n"
1622 "#endif /* __cplusplus */";
1627 * "!__STDC__" is "!defined( __STRICT_ANSI__ )"
1630 hackname = sco_strict_ansi;
1631 mach = "i?86-*-sco3.2*";
1632 select = "^[ \t]*#[ \t]*if.*!__STDC__";
1633 sed = 's/!__STDC__/!defined(__STRICT_ANSI__)/g';
1638 * Fix prototype declaration of utime in sys/times.h.
1639 * In 3.2v4.0 the const is missing.
1642 hackname = sco_utime;
1643 files = sys/times.h;
1644 mach = "i?86-*-sco3.2v4*";
1645 select = "\(const char \*, struct utimbuf \*\);";
1646 sed = 's/(const char \*, struct utimbuf \*);/'
1647 '(const char *, const struct utimbuf *);/';
1652 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1656 hackname = sony_ctype;
1658 test = " -x /bin/sony";
1659 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1660 sed = "s/__ctype/_ctype/g";
1665 * Incorrect #include in Sony News-OS 3.2.
1668 hackname = sony_include;
1669 files = machine/machparam.h;
1670 select = '"\.\./machine/endian.h"';
1671 sed = 's@"../machine/endian.h"@<machine/endian.h>@';
1676 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1680 hackname = sony_stdio;
1682 test = " -x /bin/sony";
1683 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1684 sed = "s/__filbuf/_filbuf/g\n"
1685 "s/__flsbuf/_flsbuf/g\n"
1691 * Add a `static' declaration of `getrnge' into <regexp.h>.
1693 * Don't do this if there is already a `static void getrnge' declaration
1694 * present, since this would cause a redeclaration error. Solaris 2.x has
1695 * such a declaration.
1699 hackname = static_getrnge;
1701 bypass = "static void getrnge";
1702 sed = "/^static int[ \t]*size;/c\\\n"
1703 "static int size ;\\\n\\\n"
1704 "static int getrnge ();";
1710 * a missing semi-colon at the end of the statsswtch structure definition.
1713 hackname = statsswtch;
1714 files = rpcsvc/rstat.h;
1715 select = "boottime$";
1716 sed = "s/boottime$/boottime;/";
1721 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
1722 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
1726 hackname = stdio_stdarg_h;
1728 bypass = "include.*(stdarg\.h|machine/ansi\.h)";
1732 c_fix_arg = "#define __need___va_list\n#include <stdarg.h>\n";
1739 * Don't use or define the name va_list in stdio.h.
1740 * This is for ANSI and also to interoperate properly with gcc's varargs.h.
1741 * Note _BSD_VA_LIST_ is dealt with elsewhere.
1744 hackname = stdio_va_list;
1746 bypass = '__gnuc_va_list|_BSD_VA_LIST_';
1749 * Use __gnuc_va_list in arg types in place of va_list.
1750 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1751 * trailing parentheses and semicolon save all other systems from this.
1752 * Define __not_va_list__ (something harmless and unused)
1753 * instead of va_list.
1754 * Don't claim to have defined va_list.
1756 sed = "s@ va_list @ __gnuc_va_list @\n"
1757 "s@ va_list)@ __gnuc_va_list)@\n"
1758 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
1759 "s@ va_list@ __not_va_list__@\n"
1760 "s@\\*va_list@*__not_va_list__@\n"
1761 "s@ __va_list)@ __gnuc_va_list)@\n"
1762 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
1763 "@typedef \\1 __not_va_list__;@\n"
1764 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
1765 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
1766 "s@VA_LIST@DUMMY_VA_LIST@\n"
1767 "s@_Va_LIST@_VA_LIST@";
1772 * Check for strict ansi compliance
1776 hackname = strict_ansi;
1777 select = "__STDC__[ \t]*[=!]=[ \t]*[01]";
1778 sed = "s/__STDC__[ \t]*==[ \t]*0/!defined (__STRICT_ANSI__)/g";
1779 sed = "s/__STDC__[ \t]*!=[ \t]*0/defined (__STRICT_ANSI__)/g";
1780 sed = "s/__STDC__[ \t]*==[ \t]*1/defined (__STRICT_ANSI__)/g";
1781 sed = "s/__STDC__[ \t]*!=[ \t]*1/!defined (__STRICT_ANSI__)/g";
1787 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
1788 * in prototype without previous definition.
1791 hackname = struct_file;
1793 select = '^.*xdrstdio_create.*struct __file_s';
1795 c_fix_arg = "struct __file_s;\n%0";
1796 test_text = "extern void xdrstdio_create( struct __file_s* );";
1801 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
1802 * in prototype without previous definition.
1805 hackname = struct_sockaddr;
1807 select = "^.*authdes_create.*struct sockaddr";
1808 bypass = "<sys/socket\.h>";
1810 c_fix_arg = "struct sockaddr;\n%0";
1811 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
1816 * Apply fix this to all OSs since this problem seems to effect
1817 * more than just SunOS.
1820 hackname = sun_auth_proto;
1826 * Select those files containing '(*name)()'.
1828 select = '\(\*[a-z][a-z_]*\)\(\)';
1830 '/^\(.*(\*[a-z][a-z_]*)(\)' '\();.*\)'
1832 "#ifdef __cplusplus\\\n"
1842 * Fix bogus #ifdef on SunOS 4.1.
1845 hackname = sun_bogus_ifdef;
1846 files = "hsfs/hsfs_spec.h";
1847 files = "hsfs/iso_spec.h";
1848 select = '#ifdef __i386__ || __vax__';
1849 sed = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";
1854 * Fix bogus #ifdef on SunOS 4.1.
1857 hackname = sun_bogus_ifdef_sun4c;
1858 files = "hsfs/hsnode.h";
1859 select = '#ifdef __i386__ || __sun4c__';
1860 sed = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";
1865 * Fix the CAT macro in SunOS memvar.h.
1868 hackname = sun_catmacro;
1869 files = pixrect/memvar.h;
1870 select = "^#define[ \t]+CAT\\(a,b\\)";
1871 sed = "/^#define[ \t]CAT(a,b)/ i\\\n"
1872 "#ifdef __STDC__ \\\n"
1873 "#define CAT(a,b) a##b\\\n"
1876 sed = "/^#define[ \t]CAT(a,b)/ a\\\n"
1882 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1883 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1886 hackname = sun_malloc;
1889 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
1890 sed = "s/int[ \t][ \t]*free/void\tfree/g";
1891 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
1892 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
1897 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
1900 hackname = sun_rusers_semi;
1901 files = rpcsvc/rusers.h;
1903 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
1908 * signal.h on SunOS defines signal using (),
1909 * which causes trouble when compiling with g++ -pedantic.
1912 hackname = sun_signal;
1913 files = sys/signal.h;
1915 select = "^void\t" '\(\*signal\(\)\)\(\);';
1917 sed = "/^void\t" '(\*signal())();$/i' "\\\n"
1918 "#ifdef __cplusplus" "\\\n"
1919 "void\t(*signal(...))(...);" "\\\n"
1922 sed = "/^void\t" '(\*signal())();$/a' "\\\n"
1928 * math.h on SunOS 4 puts the declaration of matherr before the definition
1929 * of struct exception, so the prototype (added by fixproto) causes havoc.
1932 hackname = sunos_matherr_decl;
1934 /* If matherr has a prototype already, the header needs no fix. */
1935 bypass = 'matherr.*struct exception';
1937 * Once a declaration for 'struct exception' is found,
1938 * stop trying to insert a forward reference for it.
1940 sed = "/^struct exception/,$b";
1941 sed = "/matherr/i\\\nstruct exception;\n";
1946 * Correct the return type for strlen in strings.h in SunOS 4.
1949 hackname = sunos_strlen;
1951 select = "int[ \t]*strlen";
1952 sed = "s/int[ \t]*strlen();/__SIZE_TYPE__ strlen();/";
1957 * Solaris math.h and floatingpoint.h define __P without protection,
1958 * which conflicts with the fixproto definition. The fixproto
1959 * definition and the Solaris definition are used the same way.
1965 files = floatingpoint.h;
1966 select = "^#define[ \t]*__P";
1967 sed = "/^#define[ \t]*__P/i\\\n#ifndef __P\n";
1968 sed = "/^#define[ \t]*__P/a\\\n#endif\n";
1973 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
1974 * that is visible to any ANSI compiler using this include. Simply
1975 * delete the lines that #define some string functions to internal forms.
1979 hackname = svr4_disable_opt;
1981 select = '#define.*__std_hdr_';
1982 sed = '/#define.*__std_hdr_/d';
1988 * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
1989 * On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
1990 * but we still "hijack" it and redirect it to the GNU byteorder.h..
1996 hackname = svr4_endian;
1997 files = sys/endian.h;
2000 * since we emit our own sys/byteorder.h,
2001 * this fix can never be applied to that file.
2003 files = sys/byteorder.h;
2005 bypass = '__GNUC__';
2007 sed = "/#\tifdef\t__STDC__/i\\\n"
2008 "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
2010 sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
2012 sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
2013 "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
2019 * Remove useless extern keyword from struct forward declarations
2020 * in <sys/stream.h> and <sys/strsubr.h>
2024 hackname = svr4_extern_struct;
2025 files = sys/stream.h;
2026 files = sys/strsubr.h;
2027 select = 'extern struct [a-z_]*;';
2028 sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
2033 * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
2034 * systems the file <ftw.h> contains extern declarations of these
2035 * functions followed by explicitly `static' definitions of these
2036 * functions... and that's not allowed according to ANSI C. (Note
2037 * however that on Solaris, this header file glitch has been pre-fixed by
2038 * Sun. In the Solaris version of <ftw.h> there are no static
2039 * definitions of any function so we don't need to do any of this stuff
2045 hackname = svr4_ftw;
2047 select = '^extern int ftw\(const';
2049 sed = '/^extern int ftw(const/i' "\\\n"
2050 "#if !defined(_STYPES)\\\n"
2055 sed = 's/extern \(int ftw(const.*\)$/\1/';
2056 sed = "/^extern int nftw/i\\\n"
2057 "#if defined(_STYPES)\\\n"
2062 sed = 's/extern \(int nftw.*\)$/\1/';
2063 sed = "/^extern int ftw(),/c\\\n"
2064 "#if !defined(_STYPES)\\\n"
2070 "#if defined(_STYPES)\\\n"
2082 * Fix broken decl of getcwd present on some svr4 systems.
2085 hackname = svr4_getcwd;
2088 files = prototypes.h;
2089 select = 'getcwd\(char \*, int\)';
2091 sed = 's/getcwd(char \*, int)/getcwd(char *, size_t)/';
2100 hackname = svr4_kernel;
2101 files = fs/rfs/rf_cache.h;
2105 files = sys/getpages.h;
2107 files = sys/cmn_err.h;
2108 files = sys/kdebugger.h;
2112 c_fix_arg = "#ifdef _KERNEL\n";
2113 c_fix_arg = "#endif /* _KERNEL */\n";
2119 * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
2120 * tend to conflict with the compiler's own definition of this symbol. (We
2121 * will use the compiler's definition.)
2122 * Likewise __sparc, for Solaris, and __i860, and a few others
2123 * (guessing it is necessary for all of them).
2127 hackname = svr4_mach_defines;
2129 select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
2130 sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
2136 * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
2137 * They are declared as non-static then immediately redeclared as static.
2141 hackname = svr4_mkdev;
2142 files = sys/mkdev.h;
2145 sed = "/^dev_t makedev(/s/^/static /";
2146 sed = "/^major_t major(/s/^/static /";
2147 sed = "/^minor_t minor(/s/^/static /";
2153 * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
2154 * Also fix types of array initializers.
2158 hackname = svr4_netcspace;
2159 files = sys/netcspace.h;
2160 select = 'NC_NPI_RAW';
2161 sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
2162 sed = 's/NC_/(unsigned long) NC_/';
2167 * Fix reference to NMSZ in <sys/adv.h>.
2171 hackname = svr4_nmsz;
2173 select = '\[NMSZ\]';
2174 sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
2180 * Fix broken decl of profil present on some svr4 systems.
2183 hackname = svr4_profil;
2187 sed = 's/profil(unsigned short \*, unsigned int, '
2188 'unsigned int, unsigned int)'
2189 '/profil(unsigned short *, size_t, int, unsigned)/';
2194 * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
2198 hackname = svr4_proto_form;
2200 select = 'const extern';
2202 sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
2207 sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
2212 sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
2217 sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
2222 sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
2223 sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
2224 sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
2225 sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
2226 sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
2227 sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
2232 * Add a prototyped declaration of mmap to <sys/mman.h>.
2236 hackname = svr4_proto_mmap;
2238 select = '^extern caddr_t mmap();$';
2239 sed = '/^extern caddr_t mmap();$/c' "\\\n"
2240 "#ifdef __STDC__\\\n"
2241 "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
2242 "#else /* !defined(__STDC__) */\\\n"
2243 "extern caddr_t mmap ();\\\n"
2244 "#endif /* !defined(__STDC__) */\\\n";
2249 * Add a #define of _SIGACTION_ into <sys/signal.h>.
2253 hackname = svr4_sigaction;
2254 files = sys/signal.h;
2255 sed = "/^struct sigaction {/i\\\n"
2256 "#define _SIGACTION_";
2257 sed = 's/(void *(\*)())/(void (*)(int))/';
2262 * Put storage class at start of decl, to avoid warning.
2266 hackname = svr4_storage_class;
2267 files = rpc/types.h;
2268 select = 'const extern';
2269 sed = 's/const extern/extern const/g';
2275 * Like svr4_mach_defines, but with newfangled syntax.
2276 * Source lines are of #define __i386 #machine(i386). Delete them.
2280 hackname = svr5_mach_defines;
2282 select = "#define[ \t]*__i386.*\(i386\)";
2283 sed = "/#define[ \t]*__i386.*/d";
2289 * Fix these files to use the same types that we think they should.
2290 * XXX - extremely dubious changes here.
2293 hackname = systypes;
2294 files = "sys/types.h";
2296 files = "sys/stdtypes.h";
2300 select = "typedef[ \t]+[a-z_][ \ta-z_]*[ \t]"
2301 "(size|ptrdiff|wchar)_t";
2303 sed = "/^[ \t]*\\*[ \t]*typedef unsigned int size_t;/N";
2305 sed = "s/^\\([ \t]*\\*[ \t]*typedef unsigned int size_t;\\n"
2306 "[ \t]*\\*\\/\\)/\\1\\\n"
2307 "#ifndef __SIZE_TYPE__\\\n"
2308 "#define __SIZE_TYPE__ long unsigned int\\\n"
2310 "typedef __SIZE_TYPE__ size_t;\\\n/";
2312 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/i\\\n"
2313 "#ifndef __SIZE_TYPE__\\\n"
2314 "#define __SIZE_TYPE__ long unsigned int\\\n"
2317 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/"
2318 "typedef __SIZE_TYPE__ size_t/";
2320 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/i\\\n"
2321 "#ifndef __PTRDIFF_TYPE__\\\n"
2322 "#define __PTRDIFF_TYPE__ long int\\\n"
2325 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/"
2326 "typedef __PTRDIFF_TYPE__ ptrdiff_t/";
2328 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/i\\\n"
2329 "#ifndef __WCHAR_TYPE__\\\n"
2330 "#define __WCHAR_TYPE__ int\\\n"
2332 "#ifndef __cplusplus\n";
2334 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/a\\\n"
2337 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/"
2338 "typedef __WCHAR_TYPE__ wchar_t/";
2343 * Fix files that may contain a stray definition of size_t. Take care
2344 * not to match ssize_t or mere uses of size_t.
2347 hackname = systypes_stdlib_size_t;
2348 files = sys/types.h;
2350 select = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";
2351 bypass = "_(GCC|BSD)_SIZE_T";
2353 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
2354 "#ifndef _GCC_SIZE_T\\\n"
2355 "#define _GCC_SIZE_T\n";
2357 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/a\\\n"
2363 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
2364 * in string.h on sysV68
2365 * Correct the return type for strlen in string.h on Lynx.
2366 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
2367 * Add missing const for strdup on OSF/1 V3.0.
2368 * On sysV88 layout is slightly different.
2371 hackname = sysv68_string;
2374 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
2375 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
2376 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
2377 sed = "/^extern char$/N";
2378 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
2379 sed = "/^\tstrncmp(),$/N";
2380 sed = "s/^\\(\tstrncmp()\\),\\n\\(\tstrlen(),\\)$/\\1;\\\n"
2381 "extern unsigned int\\\n\\2/";
2382 sed = "/^extern int$/N";
2383 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
2388 * Fix return type of exit and abort in <stdlib.h>
2391 hackname = sysz_stdlib_for_sun;
2394 sed = "s/int\tabort/void\tabort/g";
2395 sed = "s/int\tfree/void\tfree/g";
2396 sed = "s/char[ \t]*\\*[ \t]*calloc/void \\*\tcalloc/g";
2397 sed = "s/char[ \t]*\\*[ \t]*malloc/void \\*\tmalloc/g";
2398 sed = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
2399 sed = "s/char[ \t]*\\*[ \t]*bsearch/void \\*\tbsearch/g";
2400 sed = "s/int[ \t][ \t]*exit/void\texit/g";
2405 * Fix this Sun file to avoid interfering with stddef.h.
2406 * We use a funny name to ensure it follows 'systypes' fix.
2409 hackname = sysz_stdtypes_for_sun;
2410 files = sys/stdtypes.h;
2411 sed = "/[\t ]size_t.*;/i\\\n"
2412 "#ifndef _GCC_SIZE_T\\\n"
2413 "#define _GCC_SIZE_T\n";
2415 sed = "/[\t ]size_t.*;/a\\\n"
2418 sed = "/[\t ]ptrdiff_t.*;/i\\\n"
2419 "#ifndef _GCC_PTRDIFF_T\\\n"
2420 "#define _GCC_PTRDIFF_T\n";
2422 sed = "/[\t ]ptrdiff_t.*;/a\\\n"
2425 sed = "/[\t ]wchar_t.*;/i\\\n"
2426 "#ifndef _GCC_WCHAR_T\\\n"
2427 "#define _GCC_WCHAR_T\n";
2429 sed = "/[\t ]wchar_t.*;/a\\\n"
2435 * if the #if says _cplusplus, not the double underscore __cplusplus
2439 hackname = tinfo_cplusplus;
2441 select = "[ \t]_cplusplus";
2442 sed = "s/[ \t]_cplusplus/ __cplusplus/";
2447 * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
2450 hackname = ultrix_atof_param;
2452 select = "atof\\([ \t]*char";
2454 sed = "s@atof(\\([ \t]*char[ \t]*\\*[^)]*\\))@atof(const \\1)@";
2459 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
2462 hackname = ultrix_const;
2465 sed = 's@perror( char \*__s );@perror( const char *__s );@';
2466 sed = 's@fputs( char \*__s,@fputs( const char *__s,@';
2467 sed = 's@fopen( char \*__filename, char \*__type );@'
2468 'fopen( const char *__filename, const char *__type );@';
2469 sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@';
2470 sed = 's@fscanf( FILE \*__stream, char \*__format,@'
2471 'fscanf( FILE *__stream, const char *__format,@';
2472 sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
2473 sed = 's@sscanf( char \*__s, char \*__format,@'
2474 'sscanf( const char *__s, const char *__format,@';
2475 sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
2476 sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
2481 * Ultrix V4.[35] puts the declaration of uname before the definition
2482 * of struct utsname, so the prototype (added by fixproto) causes havoc.
2485 hackname = ultrix_fix_fixproto;
2486 files = sys/utsname.h;
2488 sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
2489 "struct utsname;\n";
2494 * Check for bad #ifdef line (in Ultrix 4.1)
2497 hackname = ultrix_ifdef;
2498 select = "#ifdef KERNEL[ \t]*[^ \t]";
2500 sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
2505 * Check for superfluous `static' (in Ultrix 4.2)
2506 * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
2509 hackname = ultrix_static;
2510 files = machine/cpu.h;
2511 select = '#include "r[34]_cpu';
2512 sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
2513 sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
2514 sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
2519 * Fix multiple defines for NULL. Sometimes, we stumble into \r\n
2520 * terminated lines, so accommodate these. Test both ways.
2523 hackname = undefine_null;
2524 select = "^#[ \t]*define[ \t]+NULL[ \t]";
2525 bypass = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
2528 c_fix_arg = "#ifndef NULL%2\n#define NULL%1%2\n#endif%2\n";
2529 c_fix_arg = "^#[ \t]*define[ \t]*[ \t]NULL([^\r\n]+)([\r]*)\n";
2531 test_text = "#define NULL 0UL\r\n#define NULL\t((void*)0)\n";
2536 * If arpa/inet.h prototypes are incompatible with the ones we just
2537 * installed in <sys/byteorder.h>, just remove the protos.
2538 * Because of this close association, this patch must be applied only
2539 * on those systems where the replacement byteorder header is installed.
2542 hackname = unixware7_byteorder_fix;
2543 files = arpa/inet.h;
2544 select = "in_port_t";
2546 mach = "*-*-sysv4*";
2547 mach = "i[34567]86-*-sysv5*";
2548 mach = "i[34567]86-*-udk*";
2549 mach = "i[34567]86-*-solaris2.[0-4]";
2550 mach = "powerpcle-*-solaris2.[0-4]";
2551 mach = "sparc-*-solaris2.[0-4]";
2553 sed = '/^extern.*htons.*(in_port_t)/d';
2554 sed = '/^extern.*ntohs.*(in_port_t)/d';
2559 * Fix definitions of macros used by va-i960.h in VxWorks header file.
2562 hackname = va_i960_macro;
2563 files = arch/i960/archI960.h;
2564 select = "__(vsiz|vali|vpad|alignof__)";
2565 sed = "s/__vsiz/__vxvsiz/";
2566 sed = "s/__vali/__vxvali/";
2567 sed = "s/__vpad/__vxvpad/";
2568 sed = "s/__alignof__/__vxalignof__/";
2573 * AIX headers define NULL to be cast to a void pointer,
2574 * which is illegal in ANSI C++.
2577 hackname = void_null;
2587 files = sys/param.h;
2588 files = sys/types.h;
2589 select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void";
2590 sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)"
2596 * Make VxWorks header which is almost gcc ready fully gcc ready.
2599 hackname = vxworks_gcc_problem;
2600 files = types/vxTypesBase.h;
2601 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
2603 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
2606 sed = "/[ \t]size_t/i\\\n"
2607 "#ifndef _GCC_SIZE_T\\\n"
2608 "#define _GCC_SIZE_T\n";
2610 sed = "/[ \t]size_t/a\\\n"
2613 sed = "/[ \t]ptrdiff_t/i\\\n"
2614 "#ifndef _GCC_PTRDIFF_T\\\n"
2615 "#define _GCC_PTRDIFF_T\n";
2617 sed = "/[ \t]ptrdiff_t/a\\\n"
2620 sed = "/[ \t]wchar_t/i\\\n"
2621 "#ifndef _GCC_WCHAR_T\\\n"
2622 "#define _GCC_WCHAR_T\n";
2624 sed = "/[ \t]wchar_t/a\\\n"
2630 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
2633 hackname = vxworks_needs_vxtypes;
2635 select = "uint_t[ \t][ \t]*_clocks_per_sec";
2636 sed = "s/uint_t/unsigned int/";
2637 test_text = "uint_t\t_clocks_per_sec;";
2642 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2645 hackname = vxworks_needs_vxworks;
2647 test = " -r types/vxTypesOld.h";
2648 test = " -n \"`egrep '#include' $file`\"";
2649 test = " -n \"`egrep ULONG $file`\"";
2650 select = "#[ \t]define[ \t][ \t]*__INCstath";
2652 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
2653 "#include <types/vxTypesOld.h>\n";
2658 * Another bad dependency in VxWorks 5.2 <time.h>.
2661 hackname = vxworks_time;
2663 select = "VOIDFUNCPTR";
2664 test = " -r vxWorks.h";
2665 sed = "/VOIDFUNCPTR/i\\\n"
2666 "#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
2667 "#ifdef __cplusplus\\\n"
2668 "typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
2670 "typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
2672 "#define __gcc_VOIDFUNCPTR_defined\\\n"
2675 sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g";
2680 * There are several name conflicts with C++ reserved words in X11 header
2681 * files. These are fixed in some versions, so don't do the fixes if
2682 * we find __cplusplus in the file. These were found on the RS/6000.
2685 hackname = x11_class;
2686 files = X11/ShellP.h;
2687 bypass = __cplusplus;
2688 sed = "/char \\*class;/i\\\n"
2689 "#ifdef __cplusplus\\\n"
2690 "\tchar *c_class;\\\n"
2692 sed = "/char \\*class;/a\\\n"
2702 * class in Xm/BaseClassI.h
2705 hackname = x11_class_usage;
2706 files = Xm/BaseClassI.h;
2707 bypass = "__cplusplus";
2708 sed = "s/ class[)]/ c_class)/g";
2709 test_text = "extern mumble (int class);\n";
2714 * new in Xm/Traversal.h
2718 files = Xm/Traversal.h;
2719 bypass = __cplusplus;
2721 sed = "/Widget\told, new;/i\\\n"
2722 "#ifdef __cplusplus\\\n"
2723 "\tWidget\told, c_new;\\\n"
2726 sed = "/Widget\told, new;/a\\\n"
2729 sed = "s/Widget new,/Widget c_new,/g";
2732 " Widget\told, new; /* fix the new */\n"
2733 "};\nextern Wedged( Widget new, Widget old );";
2738 * Incorrect sprintf declaration in X11/Xmu.h
2741 hackname = x11_sprintf;
2743 files = X11/Xmu/Xmu.h;
2744 select = 'sprintf\(\)';
2746 sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
2747 "extern char *\tsprintf();\\\n"
2748 "#endif /* !defined __STDC__ */,";
2749 test_text = "extern char *\tsprintf();";