* haifa-sched.c (find_rgns): Replace uses of alloca with xmalloc.
[official-gcc.git] / gcc / fixinc / inclhack.def
blob5802d1ea27226ce1638f28ec80921e9c037f0575
2 /* -*- Mode: C -*- */
4 autogen definitions inclhack;
6 /*
8 Define all the fixes we know about for repairing damaged headers.
9 Please see the README before adding or changing entries in this file.
11 Now, first: DO NOT DO BROKEN FIXES (empty replacement fixes) */
15 * Purge some HP-UX 11 files that are only borken after they are "fixed".
17 fix = {
18 hackname = AAA_ki_iface;
19 files = sys/ki_iface.h;
20 select = 'These definitions are for HP Internal developers';
21 replace; /* empty replacement -> no fixing the file */
26 * Purge some HP-UX 11 files that are only borken after they are "fixed".
28 fix = {
29 hackname = AAA_ki;
30 files = sys/ki.h;
31 select = '11.00 HP-UX LP64';
32 replace; /* empty replacement -> no fixing the file */
37 * Purge some HP-UX 11 files that are only borken after they are "fixed".
39 fix = {
40 hackname = AAA_ki_calls;
41 files = sys/ki_calls.h;
42 select = 'kthread_create_caller_t';
43 replace; /* empty replacement -> no fixing the file */
48 * Purge some HP-UX 11 files that are only borken after they are "fixed".
50 fix = {
51 hackname = AAA_ki_defs;
52 files = sys/ki_defs.h;
53 select = 'Kernel Instrumentation Definitions';
54 replace; /* empty replacement -> no fixing the file */
59 * This file on SunOS 4 has a very large macro. When the sed loop
60 * tries pull it in, it overflows the pattern space size of the SunOS
61 * sed (GNU sed does not have this problem). Since the file does not
62 * require fixing, we remove it from the fixed directory.
64 fix = {
65 hackname = AAA_bad_fixes;
66 files = sundev/ipi_error.h;
67 /* shouldn't there be a select expression here??? */
68 replace; /* empty replacement -> no fixing the file */
73 * Purge some HP-UX 11 files that are only borken after they are "fixed".
75 fix = {
76 hackname = AAA_time;
77 files = sys/time.h;
78 select = '11.0 and later representation of ki time';
79 replace; /* empty replacement -> no fixing the file */
82 /* And now, the real fixes, replacement text fixes first: */
85 * Completely replace <_int_varargs.h> with a file that includes gcc's
86 * stdarg.h or varargs.h files as appropriate on DG/UX
88 fix = {
89 hackname = AAB_dgux_int_varargs;
90 files = _int_varargs.h;
91 replace = "#ifndef __INT_VARARGS_H
92 \#define __INT_VARARGS_H
94 /************************************************************************/
95 /* _INT_VARARGS.H - Define the common stuff for varargs/stdarg/stdio. */
96 /************************************************************************/
99 ** This file is a DG internal header. Never include this
100 ** file directly.
103 \#ifndef ___int_features_h
104 \#include <sys/_int_features.h>
105 \#endif
107 \#if !(defined(_VA_LIST) || defined(_VA_LIST_))
108 \#define _VA_LIST
109 \#define _VA_LIST_
111 \#ifdef __LINT__
113 \#ifdef __STDC__
114 typedef void * va_list;
115 \#else
116 typedef char * va_list;
117 \#endif
119 \#else
120 \#if _M88K_ANY
122 \#if defined(__DCC__)
124 typedef struct {
125 int next_arg;
126 int *mem_ptr;
127 int *reg_ptr;
128 } va_list;
130 \#else /* ! defined(__DCC__) */
132 typedef struct {
133 int __va_arg; /* argument number */
134 int *__va_stk; /* start of args passed on stack */
135 int *__va_reg; /* start of args passed in regs */
136 } va_list;
138 \#endif /* ! defined(__DCC__) */
140 \#elif _IX86_ANY
142 \#if defined(__GNUC__) || defined(__STDC__)
143 typedef void * va_list;
144 \#else
145 typedef char * va_list;
146 \#endif
148 \#endif /* _IX86_ANY */
150 \#endif /* __LINT__ */
151 \#endif /* !(defined(_VA_LIST) || defined(_VA_LIST_)) */
152 \#endif /* #ifndef __INT_VARARGS_H */\n";
157 * Completely replace <sys/varargs.h> with a file that includes gcc's
158 * stdarg.h or varargs.h files as appropriate.
160 #ifdef SVR4
161 fix = {
162 hackname = AAB_svr4_no_varargs;
163 files = sys/varargs.h;
164 replace = "/* This file was generated by fixincludes. */\n"
165 "#ifndef _SYS_VARARGS_H\n"
166 "#define _SYS_VARARGS_H\n\n"
168 "#ifdef __STDC__\n"
169 "#include <stdarg.h>\n"
170 "#else\n"
171 "#include <varargs.h>\n"
172 "#endif\n\n"
174 "#endif /* _SYS_VARARGS_H */\n";
176 #endif
180 * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
181 * of struct rusage, so the prototype (added by fixproto) causes havoc.
183 fix = {
184 hackname = aix_syswait;
185 files = sys/wait.h;
186 select = "bos325,";
187 sed = "/^extern pid_t wait3();$/i\\\n"
188 "struct rusage;\n";
193 * sys/signal.h on some versions of AIX uses volatile in the typedef of
194 * sig_atomic_t, which causes gcc to generate a warning about duplicate
195 * volatile when a sig_atomic_t variable is declared volatile, as
196 * required by ANSI C.
198 fix = {
199 hackname = aix_volatile;
200 files = sys/signal.h;
201 select = "typedef volatile int sig_atomic_t";
202 sed = "s/typedef volatile int sig_atomic_t"
203 "/typedef int sig_atomic_t/";
208 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
210 fix = {
211 hackname = alpha_getopt;
212 files = "stdio.h";
213 files = "stdlib.h";
214 select = 'getopt\(int, char \*\[';
215 sed = 's/getopt(int, char \*\[\],[ ]*char \*)/'
216 'getopt(int, char *const[], const char *)/';
221 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
223 fix = {
224 hackname = alpha_parens;
225 files = sym.h;
226 select = '#ifndef\(__mips64\)';
227 sed = "s/#ifndef(__mips64)/#ifndef __mips64/";
232 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
234 fix = {
235 hackname = alpha_sbrk;
236 files = unistd.h;
237 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
238 sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";
243 * Fix this ARM/RISCiX file where ___type is a Compiler
244 * hint that is specific to the Norcroft compiler.
246 fix = {
247 hackname = arm_norcroft_hint;
248 select = "___type p_type";
249 files = "X11/Intrinsic.h";
250 sed = "s/___type p_type/p_type/";
255 * Fix this ARM/RISCiX file to avoid interfering
256 * with the use of __wchar_t in cc1plus.
258 fix = {
259 hackname = arm_wchar;
260 files = stdlib.h;
261 select = "#[ \t]*define[ \t]*__wchar_t";
262 sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
263 sed = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
268 * This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89;
269 * gcc doesn't understand it.
271 fix = {
272 hackname = aux_asm;
273 files = sys/param.h;
274 select = "#ifndef NOINLINE";
275 sed = "s|#ifndef NOINLINE"
276 "|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|";
281 * For C++, avoid any typedef or macro definition of bool,
282 * and use the built in type instead.
283 * HP/UX 10.20 also has it in curses_colr/curses.h.
285 fix = {
286 hackname = avoid_bool;
287 files = curses.h;
288 files = curses_colr/curses.h;
289 files = term.h;
290 files = tinfo.h;
292 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
293 "#ifndef __cplusplus\n";
295 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/a\\\n"
296 "#endif\n";
298 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/i\\\n"
299 "#ifndef __cplusplus\n";
301 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/a\\\n"
302 "#endif\n";
304 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/i\\\n"
305 "#ifndef __cplusplus\n";
307 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/a\\\n"
308 "#endif\n";
310 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/i\\\n"
311 "#ifndef __cplusplus\n";
313 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/a\\\n"
314 "#endif\n";
316 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/i\\\n"
317 "#ifndef __cplusplus\n";
319 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n"
320 "#endif\n";
325 * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
327 fix = {
328 hackname = bad_struct_term;
329 files = curses.h;
330 select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
331 sed = "s/^[ \t]*typedef[ \t][ \t]*"
332 "\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
337 * Fix one other error in this file:
338 * a mismatched quote not inside a C comment.
340 fix = {
341 hackname = badquote;
342 files = sundev/vuid_event.h;
343 sed = "s/doesn't/does not/";
348 * Fix #defines under Alpha OSF/1:
349 * The following files contain '#pragma extern_prefix "_FOO"' followed by
350 * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
351 * statements is to reduce namespace pollution. While these macros work
352 * properly in most cases, they don't allow you to take a pointer to the
353 * "something" being modified. To get around this limitation, change these
354 * statements to be of the form '#define something _FOOsomething'.
356 fix = {
357 hackname = bad_lval;
358 files = libgen.h;
359 files = dirent.h;
360 files = ftw.h;
361 files = grp.h;
362 files = ndbm.h;
363 files = pthread.h;
364 files = pwd.h;
365 files = signal.h;
366 files = standards.h;
367 files = stdlib.h;
368 files = string.h;
369 files = stropts.h;
370 files = time.h;
371 files = unistd.h;
372 sed =
373 "s/^[ \t]*#[ \t]*define[ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
374 "\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
379 * check for broken assert.h that needs stdio.h
381 fix = {
382 hackname = broken_assert_stdio;
383 files = assert.h;
384 select = stderr;
385 bypass = "include.*stdio.h";
386 sed = "1i\\\n"
387 "#include <stdio.h>\n";
392 * check for broken assert.h that needs stdlib.h
394 fix = {
395 hackname = broken_assert_stdlib;
396 files = assert.h;
397 select = 'exit *\(|abort *\(';
398 bypass = "include.*stdlib.h";
399 sed = "1i\\\n"
400 "#ifdef __cplusplus\\\n"
401 "#include <stdlib.h>\\\n"
402 "#endif\n";
407 * Note that BSD43_* are used on recent MIPS systems.
409 fix = {
410 hackname = bsd43_io_macros;
411 select = "BSD43__IO";
413 * Put single quotes aroung the character that appears after '('
414 * and before ',', UNLESS it is a 'c' or 'g' or 'x'.
416 sed = "/[ \t]BSD43__IO[A-Z]*[ \t]*(/" 's/(\(.\),/(\'\1\',/';
417 sed = "/#[ \t]*define[ \t]*[ \t]BSD43__IO/" 's/\'\([cgx]\)\'/\1/g';
422 * Fix <c_asm.h> on Digital UNIX V4.0:
423 * It contains a prototype for a DEC C internal asm() function,
424 * clashing with gcc's asm keyword. So protect this with __DECC.
426 fix = {
427 hackname = dec_intern_asm;
428 files = c_asm.h;
429 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
430 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
431 "#endif\n";
436 * Remove the double-slash comments
437 * They *must* be removed so it will not create nested comments!!
438 * However, they will *not* be removed if the file name ends with
439 * any of "++", ".hh" or ".H", or if the file name contains "cxx/".
441 * There *used* to be a number of similar problems in various OSes:
443 * Turning // comments into normal comments trashes this IRIX 4.0.1
444 * header file, which embeds // comments inside multi-line
445 * comments. If this looks like the IRIX header file, we refix it by
446 * just throwing away the // comments.
448 * Same problem with a file from SunOS 4.1.3 : a header file containing
449 * the string "//" embedded in "/ * * /"
451 * There is a similar problem with the VxWorks drv/netif/if_med.h file.
453 * And also with the HP-UX 10 and HP-UX 11 sys/pci.h file
455 * Now that we delete the // comments instead of converting them to / * * /,
456 * traditional hacks like irix_bogus_cxx_cmnt, no longer work (which
457 * strangely enough was also used on alpha-dec-osf4.0d). If we skip the
458 * hack whenever we see ``"//"' ', then the need for the secondary hack
459 * disappears. Note: it is painful to ensure that the first quote
460 * exists, so we just check for the trailing quote directly abutting
461 * the //. Note: We should never touch a line that has // completely
462 * within quotes but this is somewhat hard to check for.
464 * Ultimately, this fix ought to go inside of C code where
465 * we can do a better analysis on the need and method for fixing.
467 fix = {
468 hackname = no_double_slash;
470 * Test that the file-to-fix does not from a C++ directory
471 * Also, only accept double slashes that are not part of URL's
472 * and do not appear to be within a single-line C-style comment
473 * and are not the end of a quoted string.
475 #ifdef NO_C_TESTS
476 test = ' -z "`echo ${file} | egrep \'(CC|cxx|\+\+)/\'`"';
477 select = '(^|[^:])//[^"*]';
478 sed = 's,^//.*$,,';
479 sed = 's,\(/\*.*\)//\(.*\*/\),\1/ /\2,g';
480 sed = 's,\([^:]\)//[^"].*$,\1,';
481 sed = 's,[^:]//[^"].*$,,';
482 #else
483 c_test = "double_slash";
484 c_fix = "no_double_slash";
485 #endif
490 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
492 fix = {
493 hackname = ecd_cursor;
494 files = "sunwindow/win_lock.h";
495 files = "sunwindow/win_cursor.h";
496 sed = "s/ecd.cursor/ecd_cursor/";
500 * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
501 * tiny static wrappers that aren't C++ safe.
503 fix = {
504 hackname = sco5_stat_wrappers;
505 mach = "i*86-*-sco3.2v5*";
506 files = "sys/stat.h";
508 sed = "/^static int[ \t]*[a-z]*stat(/i\\\n"
509 "#ifdef __cplusplus\\\n"
510 "extern \"C\"\\\n"
511 "{\\\n"
512 "#endif\\\n";
514 sed = "/^}$/a\\\n"
515 "#ifdef __cplusplus\\\n"
516 "}\\\n"
517 "#endif \/* __cplusplus *\/\\\n";
523 * Fix else and endif directives that contain non-commentary text
525 fix = {
526 hackname = end_else_label;
529 * Select files that contain '#endif' or '#else' directives with
530 * some sort of following junk.
532 c_test = "else_endif_label";
533 c_fix = "else_endif_label";
538 * Fix HP's use of ../machine/inline.h to refer to
539 * /usr/include/machine/inline.h
541 fix = {
542 hackname = hp_inline;
543 files = sys/spinlock.h;
544 select = 'include.*"\.\./machine/';
545 sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
546 sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
551 * Check for (...) in C++ code in HP/UX sys/file.h.
553 fix = {
554 hackname = hp_sysfile;
555 files = sys/file.h;
556 select = "HPUX_SOURCE";
557 sed = 's/(\.\.\.)/(struct file * ...)/';
562 * sys/mman.h on HP/UX is not C++ ready,
563 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
565 * rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
566 * is defined for the alpha. The problem is the declaration of malloc.
568 fix = {
569 hackname = cxx_unready;
570 files = sys/mman.h;
571 files = rpc/types.h;
572 bypass = '"C"|__BEGIN_DECLS';
574 sed = "1i\\\n"
575 "#ifdef __cplusplus\\\n"
576 "extern \"C\" {\\\n"
577 "#endif\\\n\n";
578 sed = "$a\\\n"
579 "#ifdef __cplusplus\\\n"
580 "}\\\n"
581 "#endif\n";
586 * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
588 fix = {
589 hackname = hpux_maxint;
590 files = sys/param.h;
591 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
592 "#ifndef MAXINT\n";
594 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
595 "#endif\n";
600 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
602 fix = {
603 hackname = hpux_systime;
604 files = sys/time.h;
605 select = "^extern struct sigevent;";
606 sed = "s/^extern struct sigevent;/struct sigevent;/";
610 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
611 * of UINT32_C has undefined behavior according to ISO/ANSI:
612 * the arguments to __CONCAT__ are not macro expanded before the
613 * concatination happens so the trailing ')' in the first argument
614 * is concatinated with the 'l' in the second argument creating an
615 * invalid pp token. The behavior of invalid pp tokens is undefined.
616 * GCC does not handle these invalid tokens the way the HP compiler does.
617 * This problem will potentially occur anytime macros are used in the
618 * arguments to __CONCAT__. A general solution to this problem would be to
619 * insert another layer of macro between __CONCAT__ and its use
620 * in UINT32_C. An example of this solution can be found in the C standard.
621 * A more specific solution, the one used here, is to change the UINT32_C
622 * macro to not used macros in the arguments to __CONCAT__.
625 fix = {
626 hackname = hpux11_uint32_c;
627 files = inttypes.h;
628 select = "^#define UINT32_C\\(__c\\)[ \t]*__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
629 sed = "s/^#define UINT32_C(__c)\\([ \t]*\\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\\1__CONCAT__(__c,ul)/";
633 * Determine if we're on Interactive Unix 2.2 or later, in which case we
634 * need to fix some additional files. This is the same test for ISC that
635 * Autoconf uses. On Interactive 2.2, certain traditional Unix
636 * definitions (notably getc and putc in stdio.h) are omitted if __STDC__
637 * is defined, not just if _POSIX_SOURCE is defined. This makes it
638 * impossible to compile any nontrivial program except with -posix.
640 fix = {
641 hackname = interactv_add1;
643 test = " -d /etc/conf/kconfig.d";
644 test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
646 files = "stdio.h";
647 files = "math.h";
648 files = "ctype.h";
649 files = "sys/limits.h";
650 files = "sys/fcntl.h";
651 files = "sys/dirent.h";
653 sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
654 "!defined(_POSIX_SOURCE)/";
657 fix = {
658 hackname = interactv_add2;
660 test = " -d /etc/conf/kconfig.d";
661 test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
663 files = math.h;
664 sed = "s/fmod(double)/fmod(double, double)/";
667 fix = {
668 hackname = interactv_add3;
670 test = " -d /etc/conf/kconfig.d";
671 test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"';
673 files = sys/limits.h;
675 sed = "/CHILD_MAX/s,/\\* Max, Max,";
676 sed = "/OPEN_MAX/s,/\\* Max, Max,";
681 * Fix various _IO* defines, but do *not* quote the characters cgxtf.
683 fix = {
684 hackname = io_def_quotes;
685 select = "[ \t]*[ \t](_|DES)IO[A-Z]*[ \t]*\\( *[^,']";
686 sed = "s/\\([ \t]*[ \t]_IO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/";
687 sed = "s/\\([ \t]*[ \t]DESIO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/";
688 sed = "/#[ \t]*define[ \t]*[ \t]_IO/" "s/'\\([cgxtf]\\)'/\\1/g";
689 sed = "/#[ \t]*define[ \t]*[ \t]DESIOC/" 's/\'\([cdgx]\)\'/\1/g';
694 * Fix CTRL macros
696 * Basically, what is supposed to be happening is that every
697 * _invocation_ of the "_CTRL()" or "CTRL()" macros is supposed to have
698 * its argument inserted into single quotes. We _must_ do this because
699 * ANSI macro substitution rules prohibit looking inside quoted strings
700 * for the substitution names. A side effect is that the quotes are
701 * inserted in the definitions of those macros as well. So, the last
702 * several sed expressions are supposed to clean up the definitions, as
703 * long as those definitions are using "c", "g" or "x" as the macro
704 * argument :). Yuck.
706 fix = {
707 hackname = ioctl_fix_ctrl;
708 select = "CTRL[ \t]*\\(";
710 sed = "/[^A-Z0-9_]CTRL[ \t]*(/"
711 "s/\\([^']\\))/'\\1')/";
713 sed = "/[^A-Z0-9]_CTRL[ \t]*(/"
714 "s/\\([^']\\))/'\\1')/";
716 sed = "/#[ \t]*define[ \t]*[ \t]CTRL/"
717 "s/'\\([cgx]\\)'/\\1/g";
719 sed = "/#[ \t]*define[ \t]*[ \t]_CTRL/"
720 "s/'\\([cgx]\\)'/\\1/g";
722 sed = "/#[ \t]*define[ \t]*[ \t]BSD43_CTRL/"
723 "s/'\\([cgx]\\)'/\\1/g";
725 sed = "/#[ \t]*define[ \t]*[ \t][_]*ISCTRL/"
726 "s/'\\([cgx]\\)'/\\1/g";
731 * Check for missing ';' in struct
733 fix = {
734 hackname = ip_missing_semi;
735 files = netinet/ip.h;
736 sed = "/^struct/,/^};/s/}$/};/";
741 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
742 * in prototype without previous definition.
744 fix = {
745 hackname = irix_multiline_cmnt;
746 files = sys/types.h;
748 sed = "s@type of the result@type of the result */@";
749 sed = "s@of the sizeof@/* of the sizeof@";
754 * Some IRIX header files contain the string "//"
756 fix = {
757 hackname = irix_sockaddr;
758 files = rpc/auth.h;
759 select = "authdes_create.*struct sockaddr";
760 sed = "/authdes_create.*struct sockaddr/i\\\n"
761 "struct sockaddr;\n";
766 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
767 * in prototype without previous definition.
769 fix = {
770 hackname = irix_struct__file;
771 files = rpc/xdr.h;
772 sed = "/xdrstdio_create.*struct __file_s/i\\\n"
773 "struct __file_s;\n";
778 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
779 * that causes the assembly preprocessor to complain about an
780 * unterminated character constant.
782 fix = {
783 hackname = irix_asm_apostrophe;
784 files = sys/asm.h;
786 select = "^[ \t]*#.*[Ww]e're";
787 sed = "/^[ \t]*#/s/\\([Ww]e\\)'re/\\1 are/";
792 * Fixing ISC fmod declaration
794 fix = {
795 hackname = isc_fmod;
796 files = math.h;
797 select = 'fmod\(double\)';
798 sed = "s/fmod(double)/fmod(double, double)/";
803 * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
805 fix = {
806 hackname = motorola_nested;
807 mach = "m68k-motorola-sysv*";
808 files = limits.h;
809 files = sys/limits.h;
810 sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
811 "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
812 sed = "s@\\(/\\*#define\tHUGE_VAL\t3.40282346638528860e+38 \\)"
813 "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
818 * Fixing nested comments in ISC <sys/limits.h>
820 fix = {
821 hackname = isc_sys_limits;
822 files = sys/limits.h;
823 select = CHILD_MAX;
824 sed = "/CHILD_MAX/s,/\\* Max, Max,";
825 sed = "/OPEN_MAX/s,/\\* Max, Max,";
830 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
831 * use / * * / to concatenate tokens.
833 fix = {
834 hackname = kandr_concat;
835 files = "sparc/asm_linkage.h";
836 files = "sun3/asm_linkage.h";
837 files = "sun3x/asm_linkage.h";
838 files = "sun4/asm_linkage.h";
839 files = "sun4c/asm_linkage.h";
840 files = "sun4m/asm_linkage.h";
841 files = "sun4c/debug/asm_linkage.h";
842 files = "sun4m/debug/asm_linkage.h";
843 files = "arm/as_support.h";
844 files = "arm/mc_type.h";
845 files = "arm/xcb.h";
846 files = "dev/chardefmac.h";
847 files = "dev/ps_irq.h";
848 files = "dev/screen.h";
849 files = "dev/scsi.h";
850 files = "sys/tty.h";
851 files = "Xm.acorn/XmP.h";
852 files = bsd43/bsd43_.h;
853 select = '/\*\*/';
854 sed = 's|/\*\*/|##|g';
859 * In limits.h, put #ifndefs around things that are supposed to be defined
860 * in float.h to avoid redefinition errors if float.h is included first.
861 * On HP/UX this patch does not work, because on HP/UX limits.h uses
862 * multi line comments and the inserted #endif winds up inside the
863 * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
864 * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
865 * are there, and we do not add them ourselves.
866 * Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1
868 fix = {
869 hackname = limits_ifndefs;
870 files = "limits.h";
871 files = "sys/limits.h";
872 bypass = "ifndef[ \t]+FLT_MIN";
874 sed = "/[ \t]FLT_MIN[ \t]/i\\\n#ifndef FLT_MIN\n";
875 sed = "/[ \t]FLT_MIN[ \t]/a\\\n#endif\n";
876 sed = "/[ \t]FLT_MAX[ \t]/i\\\n#ifndef FLT_MAX\n";
877 sed = "/[ \t]FLT_MAX[ \t]/a\\\n#endif\n";
878 sed = "/[ \t]FLT_DIG[ \t]/i\\\n#ifndef FLT_DIG\n";
879 sed = "/[ \t]FLT_DIG[ \t]/a\\\n#endif\n";
880 sed = "/[ \t]DBL_MIN[ \t]/i\\\n#ifndef DBL_MIN\n";
881 sed = "/[ \t]DBL_MIN[ \t]/a\\\n#endif\n";
882 sed = "/[ \t]DBL_MAX[ \t]/i\\\n#ifndef DBL_MAX\n";
883 sed = "/[ \t]DBL_MAX[ \t]/a\\\n#endif\n";
884 sed = "/[ \t]DBL_DIG[ \t]/i\\\n#ifndef DBL_DIG\n";
885 sed = "/[ \t]DBL_DIG[ \t]/a\\\n#endif\n";
886 sed = "/^\\(\\/\\*#define\tHUGE_VAL\t3\\.[0-9e+]* *\\)\\/\\*/s//\\1/";
891 * Delete the '#define void int' line from curses.h on Lynx
893 fix = {
894 hackname = lynx_void_int;
895 files = curses.h;
896 select = "#[ \t]*define[ \t]+void[ \t]+int";
897 sed = "/#[ \t]*define[ \t][ \t]*void[ \t]int/d";
902 * Fix fcntl prototype in fcntl.h on LynxOS.
904 fix = {
905 hackname = lynxos_fcntl_proto;
906 files = fcntl.h;
907 select = 'fcntl.*\(int, int, int\)';
908 sed = 's/\(fcntl.*(int, int, \)int)/\1...)/';
913 * libm.a on m88k-motorola-sysv3 contains a stupid optimization for
914 * function hypot(), which returns the second argument without even
915 * looking at its value, if the other is 0.0. Another drawback is
916 * that fix-header doesn't fix fabs' prototype, and I have no idea why.
918 fix = {
919 hackname = m88k_bad_hypot_opt;
920 mach = "m88k-motorola-sysv3*";
921 files = "math.h";
923 sed = "s/extern double floor(), ceil(), fmod(), fabs();/"
924 "extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/";
926 sed = "/^extern double hypot();$/a\\\n"
927 "\\/* Workaround a stupid Motorola optimization if one\\\n"
928 " of x or y is 0.0 and the other is negative! *\\/\\\n"
929 "#ifdef __STDC__\\\n"
930 "static __inline__ double fake_hypot (double x, double y)\\\n"
931 "#else\\\n"
932 "static __inline__ double fake_hypot (x, y)\\\n"
933 "\tdouble x, y;\\\n"
934 "#endif\\\n"
935 "{\\\n"
936 "\treturn fabs (hypot (x, y));\\\n"
937 "}\\\n"
938 "#define hypot\tfake_hypot\n";
943 * Fix incorrect S_IF* definitions on m88k-sysv3.
945 fix = {
946 hackname = m88k_bad_s_if;
947 mach = "m88k-*-sysv3*";
948 files = sys/stat.h;
949 select = "#define[ \t]+S_IS[A-Z]*(m)[ \t]";
951 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
952 "(m[ \t]*&[ \t]*\\(S_IF[A-Z][A-Z][A-Z][A-Z]*\\)[ \t]*)/"
953 "\\1 (((m)\\&S_IFMT)==\\2)/";
955 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
956 "(m[ \t]*&[ \t]*\\(0[0-9]*\\)[ \t]*)/"
957 "\\1 (((m)\\&S_IFMT)==\\2)/";
962 * Put cpp wrappers around these include files to avoid redeclaration
963 * errors during multiple inclusion on m88k-tektronix-sysv3.
965 fix = {
966 hackname = m88k_multi_incl;
967 mach = "m88k-tektronix-sysv3*";
968 files = "time.h";
969 bypass = "#ifndef";
970 shell =
971 "echo Fixing $file, to protect against multiple inclusion. >&2
972 cpp_wrapper=`echo $file | sed -e 's,\\.,_,g' -e 's,/,_,g'`
973 echo \"#ifndef __GCC_GOT_${cpp_wrapper}_\"
974 echo \"#define __GCC_GOT_${cpp_wrapper}_\"
976 echo \"#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\"";
981 * Fix non-ansi machine name defines
982 * File selection is split into two parts: the shell version as
983 * a single patch, and the program version with each patch separate.
984 * Each is substantially faster for the particular environment.
985 * You have a dual maintenance problem here.
987 fix = {
988 hackname = machine_name;
990 * Select '#if.*' and '#elif" with possible non-ansi symbols
991 * The only non-ansi symbols we know about start with one of:
992 * MRS_bhimnprstuv
993 * If any are added to the substitution list, then add it to
994 * the selection list as well. Hopefully we can avoid names
995 * starting with "d" and "l", because this pattern would then
996 * match "defined" and "lint" as well. I suppose we could add
997 * a "bypass = lint" if we had to though.
999 * The fixinc_eol stuff is to work around a bug in the sed
1001 select = "^#[ \t]*(if|elif).*"
1002 "[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]";
1003 exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]"
1005 "M32"
1006 "|_*MIPSE[LB]"
1007 "|_*SYSTYPE_[A-Z0-9]"
1008 "|_*[Rr][34]000"
1009 "|_*host_mips"
1010 "|_*i386"
1011 "|_*mips"
1012 "|bsd4"
1013 "|is68k"
1014 "|m[68]8k"
1015 "|mc680"
1016 "|news"
1017 "|ns32000"
1018 "|pdp11"
1019 "|pyr"
1020 "|sel"
1021 "|sony_news"
1022 "|sparc"
1023 "|sun"
1024 "|tahoe"
1025 "|tower"
1026 "|u370"
1027 "|u3b"
1028 "|unix"
1029 "|vax"
1030 ")";
1032 sed = ":loop\n"
1033 '/\\\\$/' "N\n"
1034 's/\\\\$/\\\\+++fixinc_eol+++/' "\n"
1035 '/\\\\$/' "b loop\n"
1036 's/\\\\+++fixinc_eol+++/\\\\/g' "\n"
1038 "/#[\t ]*[el]*if/ {\n"
1039 "\ts/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g\n"
1041 "\ts/ M32 / __M32__ /g\n"
1042 "\ts/ _*MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n"
1043 "\ts/ _*SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n"
1044 "\ts/ _*\\([Rr][34]\\)000 / __\\1000__ /g\n"
1045 "\ts/ _*host_mips / __host_mips__ /g\n"
1046 "\ts/ _*i386 / __i386__ /g\n"
1047 "\ts/ _*mips / __mips__ /g\n"
1048 "\ts/ bsd4\\([0-9]\\) / __bsd4\\1__ /g\n"
1049 "\ts/ is68k / __is68k__ /g\n"
1050 "\ts/ m68k / __m68k__ /g\n"
1051 "\ts/ m88k / __m88k__ /g\n"
1052 "\ts/ mc680\\([0-9]\\)0 / __mc680\\10__ /g\n"
1053 "\ts/ news\\([0-9]*\\) / __news\\1__ /g\n"
1054 "\ts/ ns32000 / __ns32000__ /g\n"
1055 "\ts/ pdp11 / __pdp11__ /g\n"
1056 "\ts/ pyr / __pyr__ /g\n"
1057 "\ts/ sel / __sel__ /g\n"
1058 "\ts/ sony_news / __sony_news__ /g\n"
1059 "\ts/ sparc / __sparc__ /g\n"
1060 "\ts/ sun\\([a-z0-9]*\\) / __sun\\1__ /g\n"
1061 "\ts/ tahoe / __tahoe__ /g\n"
1062 "\ts/ tower\\([_0-9]*\\) / __tower\\1__ /g\n"
1063 "\ts/ u370 / __u370__ /g\n"
1064 "\ts/ u3b\\([0-9]*\\) / __u3b\\1__ /g\n"
1065 "\ts/ unix / __unix__ /g\n"
1066 "\ts/ vax / __vax__ /g\n"
1068 "\ts/ \\([a-zA-Z0-9_][a-zA-Z0-9_]*\\) /\\1/g\n\t}";
1073 * Some math.h files define struct exception, which conflicts with
1074 * the class exception defined in the C++ file std/stdexcept.h. We
1075 * redefine it to __math_exception. This is not a great fix, but I
1076 * haven't been able to think of anything better.
1078 fix = {
1079 hackname = math_exception;
1080 files = math.h;
1081 select = "struct exception";
1082 sed = "/struct exception/i\\\n"
1083 "#ifdef __cplusplus\\\n"
1084 "#define exception __math_exception\\\n"
1085 "#endif\n";
1086 sed = "/struct exception/a\\\n"
1087 "#ifdef __cplusplus\\\n"
1088 "#undef exception\\\n"
1089 "#endif\n";
1091 sed = "/matherr/i\\\n"
1092 "#ifdef __cplusplus\\\n"
1093 "#define exception __math_exception\\\n"
1094 "#endif\n";
1096 sed = "/matherr/a\\\n"
1097 "#ifdef __cplusplus\\\n"
1098 "#undef exception\\\n"
1099 "#endif\n";
1101 #ifdef MATH_EXCEPTION_FIXED
1103 I think this patch needs some more thinking.
1104 This is from SVR4.2 (With '#' replaced with '@').
1105 Perhaps we could do without the "/matherr/a" entries?
1106 Can we bypass the entire fix if someone was astute
1107 enough to have '#ifdef __cplusplus' anywhere in the file?
1110 *** /usr/include/math.h Fri Apr 3 18:54:59 1998
1111 --- math.h Sun May 9 07:28:58 1999
1112 ***************
1113 *** 25,31 ****
1114 --- 25,37 ----
1116 @ifndef __cplusplus
1118 + @ifdef __cplusplus
1119 + @define exception __math_exception
1120 + @endif
1121 struct exception
1122 + @ifdef __cplusplus
1123 + @undef exception
1124 + @endif
1126 int type;
1127 char *name;
1128 ***************
1129 *** 34,40 ****
1130 --- 40,58 ----
1131 double retval;
1134 + @ifdef __cplusplus
1135 + @define exception __math_exception
1136 + @endif
1137 + @ifdef __cplusplus
1138 + @define exception __math_exception
1139 + @endif
1140 extern int matherr(struct exception *);
1141 + @ifdef __cplusplus
1142 + @undef exception
1143 + @endif
1144 + @ifdef __cplusplus
1145 + @undef exception
1146 + @endif
1148 @endif /*__cplusplus*/
1149 #endif
1154 * In math.h, put #ifndefs around things that might be defined
1155 * in a gcc specific math-*.h file.
1157 fix = {
1158 hackname = math_gcc_ifndefs;
1159 files = math.h;
1161 shell =
1163 * First see if we have a definition for DBL_MAX in float.h
1164 * If we do, we will replace the one in math.h with that one.
1168 * IF we have such a define *and* HUGE_VAL is defined to be DBL_MAX
1169 * *and* DBL_MAX is _not_ defined in the current file (math.h),
1170 * THEN replace the defined value of HUGE_VAL
1171 * ELSE just copy stdin to stdout so the main filter can process it
1175 * Put conditional guards around the HUGE_VAL definition.
1178 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
1179 "2>/dev/null`\n\n"
1181 "\tif ( test -n \"${dbl_max_def}\" \\\n"
1182 "\t\t-a -n \"`egrep '#define[ \t]*HUGE_VAL[ \t]+DBL_MAX' $file`\" \\\n"
1183 "\t\t-a -z \"`egrep '#define[ \t]+DBL_MAX[ \t]+' $file`\"\n"
1184 "\t ) > /dev/null 2>&1\n"
1185 "\tthen sed -e '/define[ \t]HUGE_VAL[ \t]DBL_MAX/s/DBL_MAX/$dbl_max_def/'"
1186 "\n\telse cat ; fi |\n"
1188 "\tsed -e '/define[ \t]HUGE_VAL[ \t]/i\\\n#ifndef HUGE_VAL\n' "
1189 "-e '/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n'";
1194 * nested comment
1196 fix = {
1197 hackname = nested_comment;
1198 files = rpc/rpc.h;
1199 sed = 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@';
1204 * fix bogus recursive stdlib.h in NEWS-OS 4.0C
1206 fix = {
1207 hackname = news_os_recursion;
1208 files = stdlib.h;
1209 select = "#include <stdlib.h>";
1210 sed = "/^#include <stdlib.h>/i\\\n"
1211 "#ifdef BOGUS_RECURSION\n";
1212 sed = "/^#include <stdlib.h>/a\\\n"
1213 "#endif\n";
1218 * NeXT 3.2 adds const prefix to some math functions.
1219 * These conflict with the built-in functions.
1221 fix = {
1222 hackname = next_math_prefix;
1223 files = ansi/math.h;
1224 select = "^extern.*double.*__const__.*";
1226 sed = "/^extern.*double.*__const__.*sqrt(/s/__const__//";
1227 sed = "/^extern.*double.*__const__.*fabs(/s/__const__//";
1228 sed = "/^extern.*double.*__const__.*cos(/s/__const__//";
1229 sed = "/^extern.*double.*__const__.*hypot(/s/__const__//";
1230 sed = "/^extern.*double.*__const__.*sin(/s/__const__//";
1235 * NeXT 3.2 uses the word "template" as a parameter for some
1236 * functions. GCC reports an invalid use of a reserved key word
1237 * with the built-in functions. NeXT 3.2 includes the keyword
1238 * volatile in the prototype for abort(). This conflicts with
1239 * the built-in definition.
1241 fix = {
1242 hackname = next_template;
1243 files = bsd/libc.h;
1244 select = template;
1246 sed = '/\(.*template\)/s/template//';
1247 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1252 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
1253 * function prototypes. That conflicts with the built-in functions.
1255 fix = {
1256 hackname = next_volitile;
1257 files = ansi/stdlib.h;
1258 select = volatile;
1260 sed = "/extern.*volatile.*void.*exit/s/volatile//";
1261 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1266 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1267 * Note that version 3 of the NeXT system has wait.h in a different directory,
1268 * so that this code won't do anything. But wait.h in version 3 has a
1269 * conditional, so it doesn't need this fix. So everything is okay.
1271 fix = {
1272 hackname = next_wait_union;
1273 files = sys/wait.h;
1275 select = 'wait\(union wait';
1277 sed = "s@wait(union wait@wait(void@";
1282 * a missing semi-colon at the end of the nodeent structure definition.
1284 fix = {
1285 hackname = nodeent_syntax;
1286 files = netdnet/dnetdb.h;
1287 sed = "s/char.*na_addr *$/char *na_addr;/";
1292 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
1293 * defining regex.h related types. This causes libg++ build and usage
1294 * failures. Fixing this correctly requires checking and modifying 3 files.
1296 fix = {
1297 hackname = osf_namespace_a;
1298 files = reg_types.h;
1299 files = sys/lc_core.h;
1300 test = " -r reg_types.h";
1301 test = " -r sys/lc_core.h";
1302 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1303 test = " -z \"`grep __regex_t regex.h`\"";
1305 sed = "s/regex_t/__regex_t/g";
1306 sed = "s/regoff_t/__regoff_t/g";
1307 sed = "s/regmatch_t/__regmatch_t/g";
1310 fix = {
1311 hackname = osf_namespace_b;
1312 files = regex.h;
1313 test = " -r reg_types.h";
1314 test = " -r sys/lc_core.h";
1315 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1316 test = " -z \"`grep __regex_t regex.h`\"";
1318 sed = "/#include <reg_types.h>/a\\\n"
1319 "typedef __regex_t\tregex_t;\\\n"
1320 "typedef __regoff_t\tregoff_t;\\\n"
1321 "typedef __regmatch_t\tregmatch_t;\n";
1326 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
1327 * The original ones fail if uninitialized externs are not common.
1328 * This is the default for all ANSI standard C++ compilers.
1330 fix = {
1331 hackname = pthread_page_size;
1332 files = pthread.h;
1333 select = "^int __page_size";
1334 sed = "s/^int __page_size/extern int __page_size/";
1339 * Fix return type of fread and fwrite on sysV68
1341 fix = {
1342 hackname = read_ret_type;
1343 files = stdio.h;
1344 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
1345 sed = "s/^\\(extern int\tfclose(), fflush()\\), "
1346 "\\(fread(), fwrite()\\)\\(.*\\)$"
1347 "/extern unsigned int\t\\2;\\\n\\1\\3/";
1352 * function class(double x) conflicts with C++ keyword on rs/6000
1354 fix = {
1355 hackname = rs6000_double;
1356 files = math.h;
1357 select = '[^a-zA-Z_]class\(';
1359 sed = "/class[(]/i\\\n#ifndef __cplusplus\n";
1360 sed = "/class[(]/a\\\n#endif\n";
1365 * Wrong fchmod prototype on RS/6000.
1367 fix = {
1368 hackname = rs6000_fchmod;
1369 files = sys/stat.h;
1370 select = 'fchmod\(char';
1371 sed = 's/fchmod(char \*/fchmod(int/';
1376 * parameters conflict with C++ new on rs/6000
1378 fix = {
1379 hackname = rs6000_param;
1380 files = "stdio.h";
1381 files = "unistd.h";
1383 sed = 's@rename(const char \*old, const char \*new)@'
1384 'rename(const char *_old, const char *_new)@';
1389 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1391 #ifdef SONY
1392 fix = {
1393 hackname = sony_ctype;
1394 files = ctype.h;
1395 test = " -x /bin/sony";
1396 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1397 sed = "s/__ctype/_ctype/g";
1399 #endif
1402 * Incorrect #include in Sony News-OS 3.2.
1404 fix = {
1405 hackname = sony_include;
1406 files = machine/machparam.h;
1407 select = '"\.\./machine/endian.h"';
1408 sed = 's@"../machine/endian.h"@<machine/endian.h>@';
1413 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1415 #ifdef SONY
1416 fix = {
1417 hackname = sony_stdio;
1418 files = stdio.h;
1419 test = " -x /bin/sony";
1420 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1421 sed = "s/__filbuf/_filbuf/g\n"
1422 "s/__flsbuf/_flsbuf/g\n"
1423 "s/__iob/_iob/g";
1425 #endif
1428 * Add a `static' declaration of `getrnge' into <regexp.h>.
1430 * Don't do this if there is already a `static void getrnge' declaration
1431 * present, since this would cause a redeclaration error. Solaris 2.x has
1432 * such a declaration.
1434 #ifdef SVR4
1435 fix = {
1436 hackname = static_getrnge;
1437 files = regexp.h;
1438 bypass = "static void getrnge";
1439 sed = "/^static int[ \t]*size;/c\\\n"
1440 "static int size ;\\\n\\\n"
1441 "static int getrnge ();";
1443 #endif
1446 * a missing semi-colon at the end of the statsswtch structure definition.
1448 fix = {
1449 hackname = statsswtch;
1450 files = rpcsvc/rstat.h;
1451 select = "boottime$";
1452 sed = "s/boottime$/boottime;/";
1457 * Don't use or define the name va_list in stdio.h.
1458 * This is for ANSI and also to interoperate properly with gcc's varargs.h.
1459 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1461 fix = {
1462 hackname = stdio_va_list;
1463 files = stdio.h;
1466 * Use __gnuc_va_list in arg types in place of va_list.
1467 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1468 * trailing parentheses and semicolon save all other systems from this.
1469 * Define __va_list__ (something harmless and unused) instead of va_list.
1470 * Don't claim to have defined va_list.
1472 shell =
1473 "if ( egrep \"__need___va_list\" $file ) > /dev/null 2>&1 ; then
1475 else
1476 echo \"#define __need___va_list\"
1477 echo \"#include <stdarg.h>\"
1480 sed -e 's@ va_list @ __gnuc_va_list @' \\
1481 -e 's@ va_list)@ __gnuc_va_list)@' \\
1482 -e 's@ _BSD_VA_LIST_))@ __gnuc_va_list))@' \\
1483 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \\
1484 -e 's@ va_list@ __va_list__@' \\
1485 -e 's@\\*va_list@*__va_list__@' \\
1486 -e 's@ __va_list)@ __gnuc_va_list)@' \\
1487 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \\
1488 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \\
1489 -e 's@VA_LIST@DUMMY_VA_LIST@' \\
1490 -e 's@_Va_LIST@_VA_LIST@'";
1495 * Check for strict ansi compliance
1497 #ifdef STRICT_ANSI
1498 fix = {
1499 hackname = strict_ansi;
1500 select = "__STDC__[ \t]*[=!]=[ \t]*[01]";
1501 sed = "s/__STDC__[ \t]*==[ \t]*0/!defined (__STRICT_ANSI__)/g";
1502 sed = "s/__STDC__[ \t]*!=[ \t]*0/defined (__STRICT_ANSI__)/g";
1503 sed = "s/__STDC__[ \t]*==[ \t]*1/defined (__STRICT_ANSI__)/g";
1504 sed = "s/__STDC__[ \t]*!=[ \t]*1/!defined (__STRICT_ANSI__)/g";
1506 #endif
1509 * Fix bogus #ifdef on SunOS 4.1.
1511 fix = {
1512 hackname = sun_bogus_ifdef;
1513 files = "hsfs/hsfs_spec.h";
1514 files = "hsfs/iso_spec.h";
1515 select = '#ifdef __i386__ || __vax__';
1516 sed = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";
1521 * Fix bogus #ifdef on SunOS 4.1.
1523 fix = {
1524 hackname = sun_bogus_ifdef_sun4c;
1525 files = "hsfs/hsnode.h";
1526 select = '#ifdef __i386__ || __sun4c__';
1527 sed = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";
1532 * Fix the CAT macro in SunOS memvar.h.
1534 fix = {
1535 hackname = sun_catmacro;
1536 files = pixrect/memvar.h;
1537 select = "^#define[ \t]+CAT\\(a,b\\)";
1538 sed = "/^#define[ \t]CAT(a,b)/ i\\\n"
1539 "#ifdef __STDC__ \\\n"
1540 "#define CAT(a,b) a##b\\\n"
1541 "#else\n";
1543 sed = "/^#define[ \t]CAT(a,b)/ a\\\n"
1544 "#endif\n";
1549 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1550 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1552 fix = {
1553 hackname = sun_malloc;
1554 files = malloc.h;
1556 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
1557 sed = "s/int[ \t][ \t]*free/void\tfree/g";
1558 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
1559 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
1564 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
1565 * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
1566 * many other systems have similar text but correct versions of the file.
1567 * To ensure only Sun's is fixed, we grep for a likely unique string.
1568 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
1570 fix = {
1571 hackname = sun_memcpy;
1572 files = memory.h;
1573 select = "/\\*\t@\\(#\\)"
1574 "(head/memory.h\t50.1\t "
1575 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
1577 sed = "1i\\\n/* This file was generated by fixincludes */\\\n"
1578 "#ifndef __memory_h__\\\n"
1579 "#define __memory_h__\\\n\\\n"
1580 "#ifdef __STDC__\\\n"
1581 "extern void *memccpy();\\\n"
1582 "extern void *memchr();\\\n"
1583 "extern void *memcpy();\\\n"
1584 "extern void *memset();\\\n"
1585 "#else\\\n"
1586 "extern char *memccpy();\\\n"
1587 "extern char *memchr();\\\n"
1588 "extern char *memcpy();\\\n"
1589 "extern char *memset();\\\n"
1590 "#endif /* __STDC__ */\\\n\\\n"
1591 "extern int memcmp();\\\n\\\n"
1592 "#endif /* __memory_h__ */\n";
1594 sed = "1,$d";
1599 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
1601 fix = {
1602 hackname = sun_rusers_semi;
1603 files = rpcsvc/rusers.h;
1604 select = "_cnt$";
1605 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
1610 * signal.h on SunOS defines signal using (),
1611 * which causes trouble when compiling with g++ -pedantic.
1613 fix = {
1614 hackname = sun_signal;
1615 files = sys/signal.h;
1616 files = signal.h;
1617 select = "^void\t" '\(\*signal\(\)\)\(\);';
1619 sed = "/^void\t" '(\*signal())();$/i' "\\\n"
1620 "#ifdef __cplusplus" "\\\n"
1621 "void\t(*signal(...))(...);" "\\\n"
1622 "#else" "\n";
1624 sed = "/^void\t" '(\*signal())();$/a' "\\\n"
1625 '#endif' "\n";
1630 * Apply fix this to all OSs since this problem seems to effect
1631 * more than just SunOS. In general, fixes which are triggered
1632 * by a specific target are bad.
1634 fix = {
1635 hackname = sun_auth_proto;
1636 files = rpc/auth.h;
1637 files = rpc/clnt.h;
1638 files = rpc/svc.h;
1639 files = rpc/xdr.h;
1641 * Select those files containing '(*name)()'.
1643 select = '\(\*[a-z][a-z_]*\)\(\)';
1644 sed = 's'
1645 '/^\(.*(\*[a-z][a-z_]*)(\)' '\();.*\)'
1646 "/\\\n"
1647 "#ifdef __cplusplus\\\n"
1648 '\1...\2' "\\\n"
1649 "#else\\\n"
1650 '\1\2' "\\\n"
1651 "#endif"
1652 "/";
1657 * math.h on SunOS 4 puts the declaration of matherr before the definition
1658 * of struct exception, so the prototype (added by fixproto) causes havoc.
1660 fix = {
1661 hackname = sunos_matherr_decl;
1662 files = math.h;
1664 * Once a declaration for 'struct exception' is found,
1665 * stop trying to insert a forward reference for it.
1667 sed = "/^struct exception/,$b";
1668 sed = "/matherr/i\\\nstruct exception;\n";
1673 * Correct the return type for strlen in strings.h in SunOS 4.
1675 fix = {
1676 hackname = sunos_strlen;
1677 files = strings.h;
1678 sed = "s/int[ \t]*strlen();/__SIZE_TYPE__ strlen();/";
1683 * Solaris math.h and floatingpoint.h define __P without protection,
1684 * which conflicts with the fixproto definition. The fixproto
1685 * definition and the Solaris definition are used the same way.
1687 #ifdef SVR4
1688 fix = {
1689 hackname = svr4__p;
1690 files = math.h;
1691 files = floatingpoint.h;
1692 select = "^#define[ \t]*__P";
1693 sed = "/^#define[ \t]*__P/i\\\n#ifndef __P\n";
1694 sed = "/^#define[ \t]*__P/a\\\n#endif\n";
1696 #endif
1699 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
1700 * that is visible to any ANSI compiler using this include. Simply
1701 * delete the lines that #define some string functions to internal forms.
1703 #ifdef SVR4
1704 fix = {
1705 hackname = svr4_disable_opt;
1706 files = string.h;
1707 select = '#define.*__std_hdr_';
1708 sed = '/#define.*__std_hdr_/d';
1710 #endif
1713 * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
1715 #ifdef SVR4
1716 fix = {
1717 hackname = svr4_endian;
1718 files = sys/endian.h;
1719 bypass = '__GNUC__';
1721 sed = "/#\tifdef\t__STDC__/i\\\n"
1722 "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
1724 sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
1726 sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
1727 "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
1729 #endif
1732 * Remove useless extern keyword from struct forward declarations
1733 * in <sys/stream.h> and <sys/strsubr.h>
1735 #ifdef SVR4
1736 fix = {
1737 hackname = svr4_extern_struct;
1738 files = sys/stream.h;
1739 files = sys/strsubr.h;
1740 select = 'extern struct [a-z_]*;';
1741 sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
1743 #endif
1746 * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
1747 * systems the file <ftw.h> contains extern declarations of these
1748 * functions followed by explicitly `static' definitions of these
1749 * functions... and that's not allowed according to ANSI C. (Note
1750 * however that on Solaris, this header file glitch has been pre-fixed by
1751 * Sun. In the Solaris version of <ftw.h> there are no static
1752 * definitions of any function so we don't need to do any of this stuff
1753 * when on Solaris.
1755 #ifdef SVR4
1756 #ifndef SOLARIS
1757 fix = {
1758 hackname = svr4_ftw;
1759 files = ftw.h;
1760 select = '^extern int ftw\(const';
1762 sed = '/^extern int ftw(const/i' "\\\n"
1763 "#if !defined(_STYPES)\\\n"
1764 "static\\\n"
1765 "#else\\\n"
1766 "extern\\\n"
1767 "#endif";
1768 sed = 's/extern \(int ftw(const.*\)$/\1/';
1769 sed = "/^extern int nftw/i\\\n"
1770 "#if defined(_STYPES)\\\n"
1771 "static\\\n"
1772 "#else\\\n"
1773 "extern\\\n"
1774 "#endif";
1775 sed = 's/extern \(int nftw.*\)$/\1/';
1776 sed = "/^extern int ftw(),/c\\\n"
1777 "#if !defined(_STYPES)\\\n"
1778 "static\\\n"
1779 "#else\\\n"
1780 "extern\\\n"
1781 "#endif\\\n"
1782 " int ftw();\\\n"
1783 "#if defined(_STYPES)\\\n"
1784 "static\\\n"
1785 "#else\\\n"
1786 "extern\\\n"
1787 "#endif\\\n"
1788 " int nftw();";
1790 #endif
1791 #endif
1795 * Fix broken decl of getcwd present on some svr4 systems.
1797 #ifdef SVR4
1798 fix = {
1799 hackname = svr4_getcwd;
1800 files = stdlib.h;
1801 files = unistd.h;
1802 select = 'getcwd\(char \*, int\)';
1804 sed = 's/getcwd(char \*, int)/getcwd(char *, size_t)/';
1806 #endif
1809 * set ifdef _KERNEL
1811 #ifdef SVR4
1812 fix = {
1813 hackname = svr4_kernel;
1814 files = fs/rfs/rf_cache.h;
1815 files = sys/erec.h;
1816 files = sys/err.h;
1817 files = sys/char.h;
1818 files = sys/getpages.h;
1819 files = sys/map.h;
1820 files = sys/cmn_err.h;
1821 files = sys/kdebugger.h;
1822 bypass = '_KERNEL';
1823 sed = "1i\\\n#ifdef _KERNEL";
1824 sed = "$a\\\n#endif /* _KERNEL */";
1826 #endif
1829 * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
1830 * tend to conflict with the compiler's own definition of this symbol. (We
1831 * will use the compiler's definition.)
1832 * Likewise __sparc, for Solaris, and __i860, and a few others
1833 * (guessing it is necessary for all of them).
1835 #ifdef SVR4
1836 fix = {
1837 hackname = svr4_mach_defines;
1838 files = ieeefp.h;
1839 select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
1840 sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
1842 #endif
1845 * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
1847 #ifdef SVR4
1848 fix = {
1849 hackname = svr4_mkdev;
1850 files = sys/mkdev.h;
1852 sed = "/^dev_t makedev(const/c\\\n"
1853 "static dev_t makedev(const major_t, const minor_t);";
1855 sed = "/^dev_t makedev()/c\\\n"
1856 "static dev_t makedev();";
1858 sed = "/^major_t major(const/c\\\n"
1859 "static major_t major(const dev_t);";
1861 sed = "/^major_t major()/c\\\n"
1862 "static major_t major();";
1864 sed = "/^minor_t minor(const/c\\\n"
1865 "static minor_t minor(const dev_t);";
1867 sed = "/^minor_t minor()/c\\\n"
1868 "static minor_t minor();";
1870 #endif
1873 * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
1874 * Also fix types of array initializers.
1876 #ifdef SVR4
1877 fix = {
1878 hackname = svr4_netcspace;
1879 files = sys/netcspace.h;
1880 select = 'NC_NPI_RAW';
1881 sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
1882 sed = 's/NC_/(unsigned long) NC_/';
1884 #endif
1887 * Fix reference to NMSZ in <sys/adv.h>.
1889 #ifdef SVR4
1890 fix = {
1891 hackname = svr4_nmsz;
1892 files = sys/adv.h;
1893 select = '\[NMSZ\]';
1894 sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
1896 #endif
1899 * Fix broken decl of profil present on some svr4 systems.
1901 #ifdef SVR4
1902 fix = {
1903 hackname = svr4_profil;
1904 files = stdlib.h;
1905 files = unistd.h;
1907 sed = 's/profil(unsigned short \*, unsigned int, '
1908 'unsigned int, unsigned int)'
1909 '/profil(unsigned short *, size_t, int, unsigned)/';
1911 #endif
1914 * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
1916 #ifdef SVR4
1917 fix = {
1918 hackname = svr4_proto_form;
1919 files = sys/stat.h;
1920 select = 'const extern';
1922 sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
1923 "s/(.*)\\n/( /\n"
1924 "s/;\\n/, /\n"
1925 "s/;$/)/\n" "}";
1927 sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
1928 "s/(.*)\\n/( /\n"
1929 "s/;\\n/, /\n"
1930 "s/;$/)/\n" "}";
1932 sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
1933 "s/(.*)\\n/( /\n"
1934 "s/;\\n/, /\n"
1935 "s/;$/)/\n" "}";
1937 sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
1938 "s/(.*)\\n/( /\n"
1939 "s/;\\n/, /g\n"
1940 "s/;$/)/\n" "}";
1942 sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
1943 sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
1944 sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
1945 sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
1946 sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
1947 sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
1949 #endif
1952 * Add a prototyped declaration of mmap to <sys/mman.h>.
1954 #ifdef SVR4
1955 fix = {
1956 hackname = svr4_proto_mmap;
1957 files = sys/mman.h;
1958 select = '^extern caddr_t mmap();$';
1959 sed = '/^extern caddr_t mmap();$/c' "\\\n"
1960 "#ifdef __STDC__\\\n"
1961 "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
1962 "#else /* !defined(__STDC__) */\\\n"
1963 "extern caddr_t mmap ();\\\n"
1964 "#endif /* !defined(__STDC__) */\\\n";
1966 #endif
1969 * Add a #define of _SIGACTION_ into <sys/signal.h>.
1971 #ifdef SVR4
1972 fix = {
1973 hackname = svr4_sigaction;
1974 files = sys/signal.h;
1975 sed = "/^struct sigaction {/i\\\n"
1976 "#define _SIGACTION_";
1977 sed = 's/(void *(\*)())/(void (*)(int))/';
1979 #endif
1982 * Put storage class at start of decl, to avoid warning.
1984 #ifdef SVR4
1985 fix = {
1986 hackname = svr4_storage_class;
1987 files = rpc/types.h;
1988 select = 'const extern';
1989 sed = 's/const extern/extern const/g';
1991 #endif
1994 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
1995 * in string.h on sysV68
1996 * Correct the return type for strlen in string.h on Lynx.
1997 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
1998 * Add missing const for strdup on OSF/1 V3.0.
1999 * On sysV88 layout is slightly different.
2001 fix = {
2002 hackname = systypes;
2003 files = "sys/types.h";
2004 files = "stdlib.h";
2005 files = "sys/stdtypes.h";
2006 files = "stddef.h";
2007 files = "memory.h";
2008 files = "unistd.h";
2009 select = "typedef[ \t]+[a-z_][ \ta-z_]*[ \t]"
2010 "(size|ptrdiff|wchar)_t";
2012 sed = "/^[ \t]*\\*[ \t]*typedef unsigned int size_t;/N";
2014 sed = "s/^\\([ \t]*\\*[ \t]*typedef unsigned int size_t;\\n"
2015 "[ \t]*\\*\\/\\)/\\1\\\n"
2016 "#ifndef __SIZE_TYPE__\\\n"
2017 "#define __SIZE_TYPE__ long unsigned int\\\n"
2018 "#endif\\\n"
2019 "typedef __SIZE_TYPE__ size_t;\\\n/";
2021 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/i\\\n"
2022 "#ifndef __SIZE_TYPE__\\\n"
2023 "#define __SIZE_TYPE__ long unsigned int\\\n"
2024 "#endif\n";
2026 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/"
2027 "typedef __SIZE_TYPE__ size_t/";
2029 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/i\\\n"
2030 "#ifndef __PTRDIFF_TYPE__\\\n"
2031 "#define __PTRDIFF_TYPE__ long int\\\n"
2032 "#endif\n";
2034 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/"
2035 "typedef __PTRDIFF_TYPE__ ptrdiff_t/";
2037 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/i\\\n"
2038 "#ifndef __WCHAR_TYPE__\\\n"
2039 "#define __WCHAR_TYPE__ int\\\n"
2040 "#endif\\\n"
2041 "#ifndef __cplusplus\n";
2043 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/a\\\n"
2044 "#endif\n";
2046 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/"
2047 "typedef __WCHAR_TYPE__ wchar_t/";
2052 * Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
2053 * Also wrap protection around size_t for m88k-sysv3 systems.
2054 * We use a funny name to ensure it follows 'systypes' fix.
2056 fix = {
2057 hackname = systypes_for_aix;
2058 files = sys/types.h;
2059 select = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";
2060 bypass = "_GCC_SIZE_T";
2062 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
2063 "#ifndef _GCC_SIZE_T\\\n"
2064 "#define _GCC_SIZE_T\n";
2066 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/a\\\n"
2067 "#endif\n";
2072 * if the #if says _cplusplus, not the double underscore __cplusplus
2073 * that it should be
2075 fix = {
2076 hackname = sysv68_string;
2077 files = string.h;
2079 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
2080 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
2081 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
2082 sed = "/^extern char$/N";
2083 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
2084 sed = "/^\tstrncmp(),$/N";
2085 sed = "s/^\\(\tstrncmp()\\),\\n\\(\tstrlen(),\\)$/\\1;\\\n"
2086 "extern unsigned int\\\n\\2/";
2087 sed = "/^extern int$/N";
2088 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
2093 * Fix return type of exit and abort in <stdlib.h>
2094 * Also wrap protection around size_t.
2096 fix = {
2097 hackname = sysz_stdlib_for_sun;
2098 files = stdlib.h;
2100 sed = "s/int\tabort/void\tabort/g";
2101 sed = "s/int\tfree/void\tfree/g";
2102 sed = "s/char[ \t]*\\*[ \t]*calloc/void \\*\tcalloc/g";
2103 sed = "s/char[ \t]*\\*[ \t]*malloc/void \\*\tmalloc/g";
2104 sed = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
2105 sed = "s/char[ \t]*\\*[ \t]*bsearch/void \\*\tbsearch/g";
2106 sed = "s/int[ \t][ \t]*exit/void\texit/g";
2108 sed = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/i\\\n"
2109 "#ifndef _GCC_SIZE_T\\\n"
2110 "#define _GCC_SIZE_T\n";
2112 sed = "/typedef[ \ta-zA-Z_]*[ \t]size_t[ \t]*;/a\\\n"
2113 "#endif\n";
2118 * Fix this Sun file to avoid interfering with stddef.h.
2119 * We use a funny name to ensure it follows 'systypes' fix.
2121 fix = {
2122 hackname = sysz_stdtypes_for_sun;
2123 files = sys/stdtypes.h;
2124 sed = "/[\t ]size_t.*;/i\\\n"
2125 "#ifndef _GCC_SIZE_T\\\n"
2126 "#define _GCC_SIZE_T\n";
2128 sed = "/[\t ]size_t.*;/a\\\n"
2129 "#endif\n";
2131 sed = "/[\t ]ptrdiff_t.*;/i\\\n"
2132 "#ifndef _GCC_PTRDIFF_T\\\n"
2133 "#define _GCC_PTRDIFF_T\n";
2135 sed = "/[\t ]ptrdiff_t.*;/a\\\n"
2136 "#endif\n";
2138 sed = "/[\t ]wchar_t.*;/i\\\n"
2139 "#ifndef _GCC_WCHAR_T\\\n"
2140 "#define _GCC_WCHAR_T\n";
2142 sed = "/[\t ]wchar_t.*;/a\\\n"
2143 "#endif\n";
2148 * Fix this file to avoid interfering with stddef.h,
2149 * but don't mistakenly match ssize_t present in AIX for the ps/2,
2150 * or typedefs which use (but do not set) size_t.
2152 fix = {
2153 hackname = tinfo_cplusplus;
2154 files = tinfo.h;
2155 sed = "s/[ \t]_cplusplus/ __cplusplus/";
2160 * Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
2162 fix = {
2163 hackname = ultrix_ansi_compat;
2164 files = ansi_compat.h;
2165 select = ULTRIX;
2166 sed = "1i\\\n/* This file intentionally left blank. */\n";
2167 sed = "1,$d";
2172 * Ultrix V4.[35] puts the declaration of uname before the definition
2173 * of struct utsname, so the prototype (added by fixproto) causes havoc.
2175 fix = {
2176 hackname = ultrix_fix_fixproto;
2177 files = sys/utsname.h;
2178 select = ULTRIX;
2179 sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
2180 "struct utsname;\n";
2185 * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
2186 * also get rid of bogus inline definitions in HP-UX 8.0
2188 fix = {
2189 hackname = ultrix_atof_param;
2190 files = math.h;
2192 sed = "s@atof(\\([ \t]*char[ \t]*\\*[^)]*\\))@atof(const \\1)@";
2193 sed = "s@inline int abs(int [a-z][a-z]*) {.*}@extern \"C\" int abs(int);@";
2194 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
2195 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
2196 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
2201 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
2203 fix = {
2204 hackname = ultrix_const;
2205 files = stdio.h;
2207 sed = 's@perror( char \*__s );@perror( const char *__s );@';
2208 sed = 's@fputs( char \*__s,@fputs( const char *__s,@';
2209 sed = 's@fopen( char \*__filename, char \*__type );@'
2210 'fopen( const char *__filename, const char *__type );@';
2211 sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@';
2212 sed = 's@fscanf( FILE \*__stream, char \*__format,@'
2213 'fscanf( FILE *__stream, const char *__format,@';
2214 sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
2215 sed = 's@sscanf( char \*__s, char \*__format,@'
2216 'sscanf( const char *__s, const char *__format,@';
2217 sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
2218 sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
2223 * Check for bad #ifdef line (in Ultrix 4.1)
2225 fix = {
2226 hackname = ultrix_ifdef;
2227 select = "#ifdef KERNEL";
2228 files = sys/file.h;
2229 sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
2234 * Avoid nested comments on Ultrix 4.3.
2236 fix = {
2237 hackname = ultrix_nested_cmnt;
2238 files = rpc/svc.h;
2239 sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
2244 * Check for superfluous `static' (in Ultrix 4.2)
2245 * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
2247 fix = {
2248 hackname = ultrix_static;
2249 files = machine/cpu.h;
2250 select = '#include "r[34]_cpu';
2251 sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
2252 sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
2253 sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
2258 * Fix multiple defines for NULL
2260 fix = {
2261 hackname = undefine_null;
2262 select = "^#[ \t]*define[ \t]*[ \t]NULL[ \t]";
2263 bypass = "#[ \t]*(ifn|un)def[ \t]*[ \t]NULL($|[ \t])";
2264 sed = "/^#[ \t]*define[ \t][ \t]*NULL[ \t]/i\\\n"
2265 "#undef NULL\n";
2270 * Fix definitions of macros used by va-i960.h in VxWorks header file.
2272 fix = {
2273 hackname = va_i960_macro;
2274 files = arch/i960/archI960.h;
2275 select = "__(vsiz|vali|vpad|alignof__)";
2276 sed = "s/__vsiz/__vxvsiz/";
2277 sed = "s/__vali/__vxvali/";
2278 sed = "s/__vpad/__vxvpad/";
2279 sed = "s/__alignof__/__vxalignof__/";
2284 * AIX headers define NULL to be cast to a void pointer,
2285 * which is illegal in ANSI C++.
2287 fix = {
2288 hackname = void_null;
2289 files = curses.h;
2290 files = dbm.h;
2291 files = locale.h;
2292 files = stdio.h;
2293 files = stdlib.h;
2294 files = string.h;
2295 files = time.h;
2296 files = unistd.h;
2297 files = sys/dir.h;
2298 files = sys/param.h;
2299 files = sys/types.h;
2300 select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void";
2301 sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)"
2302 "/#define NULL 0/";
2307 * Make VxWorks header which is almost gcc ready fully gcc ready.
2309 fix = {
2310 hackname = vxworks_gcc_problem;
2311 files = types/vxTypesBase.h;
2312 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
2314 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
2315 "#if 1/";
2317 sed = "/[ \t]size_t/i\\\n"
2318 "#ifndef _GCC_SIZE_T\\\n"
2319 "#define _GCC_SIZE_T\n";
2321 sed = "/[ \t]size_t/a\\\n"
2322 "#endif\n";
2324 sed = "/[ \t]ptrdiff_t/i\\\n"
2325 "#ifndef _GCC_PTRDIFF_T\\\n"
2326 "#define _GCC_PTRDIFF_T\n";
2328 sed = "/[ \t]ptrdiff_t/a\\\n"
2329 "#endif\n";
2331 sed = "/[ \t]wchar_t/i\\\n"
2332 "#ifndef _GCC_WCHAR_T\\\n"
2333 "#define _GCC_WCHAR_T\n";
2335 sed = "/[ \t]wchar_t/a\\\n"
2336 "#endif\n";
2341 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
2343 fix = {
2344 hackname = vxworks_needs_vxtypes;
2345 files = time.h;
2346 select = "uint_t[ \t][ \t]*_clocks_per_sec";
2347 sed = "s/uint_t/unsigned int/";
2352 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2354 fix = {
2355 hackname = vxworks_needs_vxworks;
2356 files = sys/stat.h;
2357 test = " -r types/vxTypesOld.h";
2358 test = " -n \"`egrep '#include' $file`\"";
2359 test = " -n \"`egrep ULONG $file`\"";
2360 select = "#[ \t]define[ \t][ \t]*__INCstath";
2362 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
2363 "#include <types/vxTypesOld.h>\n";
2368 * Another bad dependency in VxWorks 5.2 <time.h>.
2370 fix = {
2371 hackname = vxworks_time;
2372 files = time.h;
2373 select = "VOIDFUNCPTR";
2374 test = " -r vxWorks.h";
2375 sed = "/VOIDFUNCPTR/i\\\n"
2376 "#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
2377 "#ifdef __cplusplus\\\n"
2378 "typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
2379 "#else\\\n"
2380 "typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
2381 "#endif\\\n"
2382 "#define __gcc_VOIDFUNCPTR_defined\\\n"
2383 "#endif\n";
2385 sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g";
2390 * There are several name conflicts with C++ reserved words in X11 header
2391 * files. These are fixed in some versions, so don't do the fixes if
2392 * we find __cplusplus in the file. These were found on the RS/6000.
2394 fix = {
2395 hackname = x11_class;
2396 files = X11/ShellP.h;
2397 bypass = __cplusplus;
2398 sed = "/char \\*class;/i\\\n"
2399 "#ifdef __cplusplus\\\n"
2400 "\tchar *c_class;\\\n"
2401 "#else\n";
2402 sed = "/char \\*class;/a\\\n"
2403 "#endif\n";
2408 * class in Xm/BaseClassI.h
2410 fix = {
2411 hackname = x11_class_usage;
2412 files = Xm/BaseClassI.h;
2413 bypass = "__cplusplus";
2414 sed = "s/ class[)]/ c_class)/g";
2419 * new in Xm/Traversal.h
2421 fix = {
2422 hackname = x11_new;
2423 files = Xm/Traversal.h;
2424 bypass = __cplusplus;
2426 sed = "/Widget\told, new;/i\\\n"
2427 "#ifdef __cplusplus\\\n"
2428 "\tWidget\told, c_new;\\\n"
2429 "#else\n";
2431 sed = "/Widget\told, new;/a\\\n"
2432 "#endif\n";
2434 sed = "s/Widget new,/Widget c_new,/g";
2439 * Incorrect sprintf declaration in X11/Xmu.h
2441 fix = {
2442 hackname = x11_sprintf;
2443 files = X11*/Xmu.h;
2444 sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
2445 "extern char *\tsprintf();\\\n"
2446 "#endif /* !defined __STDC__ */,";
2449 /*EOF*/