]> gcc.gnu.org Git - gcc.git/blob - gcc/fixinc/inclhack.def
cppinit.c (cpp_start_read): Turn off -Wtraditional if processing C++.
[gcc.git] / gcc / fixinc / inclhack.def
1
2 /* -*- Mode: C -*- */
3
4 autogen definitions inclhack;
5
6 /*
7
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.
10
11 Set up a debug test so we can make the templates emit special
12 code while debugging these fixes: */
13
14 #ifdef DEBUG
15 FIXINC_DEBUG = yes;
16 #endif
17
18 /* DO NOT DO BROKEN FIXES (empty replacement fixes) */
19
20 /*
21 * Purge some HP-UX 11 files that are only broken after they are "fixed".
22 */
23 fix = {
24 hackname = AAA_ki_iface;
25 files = sys/ki_iface.h;
26 select = 'These definitions are for HP Internal developers';
27 replace; /* empty replacement -> no fixing the file */
28 };
29
30
31 /*
32 * Purge some HP-UX 11 files that are only broken after they are "fixed".
33 */
34 fix = {
35 hackname = AAA_ki;
36 files = sys/ki.h;
37 select = '11.00 HP-UX LP64';
38 replace; /* empty replacement -> no fixing the file */
39 };
40
41
42 /*
43 * Purge some HP-UX 11 files that are only broken after they are "fixed".
44 */
45 fix = {
46 hackname = AAA_ki_calls;
47 files = sys/ki_calls.h;
48 select = 'kthread_create_caller_t';
49 replace; /* empty replacement -> no fixing the file */
50 };
51
52
53 /*
54 * Purge some HP-UX 11 files that are only broken after they are "fixed".
55 */
56 fix = {
57 hackname = AAA_ki_defs;
58 files = sys/ki_defs.h;
59 select = 'Kernel Instrumentation Definitions';
60 replace; /* empty replacement -> no fixing the file */
61 };
62
63
64 /*
65 * This file on SunOS 4 has a very large macro. When the sed loop
66 * tries pull it in, it overflows the pattern space size of the SunOS
67 * sed (GNU sed does not have this problem). Since the file does not
68 * require fixing, we remove it from the fixed directory.
69 */
70 fix = {
71 hackname = AAA_bad_fixes;
72 files = sundev/ipi_error.h;
73 /* shouldn't there be a select expression here??? */
74 replace; /* empty replacement -> no fixing the file */
75 };
76
77
78 /*
79 * Purge some HP-UX 11 files that are only broken after they are "fixed".
80 */
81 fix = {
82 hackname = AAA_time;
83 files = sys/time.h;
84 select = '11.0 and later representation of ki time';
85 replace; /* empty replacement -> no fixing the file */
86 };
87
88 /* And now, the real fixes, replacement text fixes first: */
89
90 /*
91 * Completely replace <_int_varargs.h> with a file that includes gcc's
92 * stdarg.h or varargs.h files as appropriate on DG/UX
93 */
94 fix = {
95 hackname = AAB_dgux_int_varargs;
96 files = _int_varargs.h;
97 replace = "#ifndef __INT_VARARGS_H
98 \#define __INT_VARARGS_H
99
100 /************************************************************************/
101 /* _INT_VARARGS.H - Define the common stuff for varargs/stdarg/stdio. */
102 /************************************************************************/
103
104 /*
105 ** This file is a DG internal header. Never include this
106 ** file directly.
107 */
108
109 \#ifndef ___int_features_h
110 \#include <sys/_int_features.h>
111 \#endif
112
113 \#if !(defined(_VA_LIST) || defined(_VA_LIST_))
114 \#define _VA_LIST
115 \#define _VA_LIST_
116
117 \#ifdef __LINT__
118
119 \#ifdef __STDC__
120 typedef void * va_list;
121 \#else
122 typedef char * va_list;
123 \#endif
124
125 \#else
126 \#if _M88K_ANY
127
128 \#if defined(__DCC__)
129
130 typedef struct {
131 int next_arg;
132 int *mem_ptr;
133 int *reg_ptr;
134 } va_list;
135
136 \#else /* ! defined(__DCC__) */
137
138 typedef struct {
139 int __va_arg; /* argument number */
140 int *__va_stk; /* start of args passed on stack */
141 int *__va_reg; /* start of args passed in regs */
142 } va_list;
143
144 \#endif /* ! defined(__DCC__) */
145
146 \#elif _IX86_ANY
147
148 \#if defined(__GNUC__) || defined(__STDC__)
149 typedef void * va_list;
150 \#else
151 typedef char * va_list;
152 \#endif
153
154 \#endif /* _IX86_ANY */
155
156 \#endif /* __LINT__ */
157 \#endif /* !(defined(_VA_LIST) || defined(_VA_LIST_)) */
158 \#endif /* #ifndef __INT_VARARGS_H */\n";
159 };
160
161
162 /*
163 * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
164 */
165 fix = {
166 hackname = AAB_fd_zero_asm_posix_types_h;
167 files = asm/posix_types.h;
168 mach = 'i[34567]86-*-linux-gnu*';
169 bypass = '} while';
170
171 /*
172 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
173 * the start, so that if #include_next gets another instance of
174 * the wrapper, this will follow the #include_next chain until
175 * we arrive at the real <asm/posix_types.h>.
176 */
177 replace =
178
179 '/* This file fixes a bug in the __FD_ZERO macro
180 for older versions of the Linux kernel. */
181 \#ifndef _POSIX_TYPES_H_WRAPPER
182 \#include <features.h>
183 \#include_next <asm/posix_types.h>
184
185 \#if defined(__FD_ZERO) && !defined(__GLIBC__)
186 \#undef __FD_ZERO
187 \#define __FD_ZERO(fdsetp) \\
188 do { \\
189 int __d0, __d1; \\
190 __asm__ __volatile__("cld ; rep ; stosl" \\
191 : "=&c" (__d0), "=&D" (__d1) \\
192 : "a" (0), "0" (__FDSET_LONGS), \\
193 "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \\
194 } while (0)
195 \#endif
196
197 \#define _POSIX_TYPES_H_WRAPPER
198 \#endif /* _POSIX_TYPES_H_WRAPPER */
199 ';
200 };
201
202
203 /*
204 * This fixes __FD_ZERO bug for glibc-1.x
205 */
206 fix = {
207 hackname = AAB_fd_zero_gnu_types_h;
208 files = gnu/types.h;
209 mach = 'i[34567]86-*-linux-gnu*';
210
211 /*
212 * Define _TYPES_H_WRAPPER at the end of the wrapper, not
213 * the start, so that if #include_next gets another instance of
214 * the wrapper, this will follow the #include_next chain until
215 * we arrive at the real <gnu/types.h>.
216 */
217 replace =
218
219 '/* This file fixes a bug in the __FD_ZERO macro present in glibc 1.x. */
220 \#ifndef _TYPES_H_WRAPPER
221 \#include <features.h>
222 \#include_next <gnu/types.h>
223
224 \#if defined(__FD_ZERO) && !defined(__GLIBC__)
225 \#undef __FD_ZERO
226 \# define __FD_ZERO(fdsetp) \\
227 do { \\
228 int __d0, __d1; \\
229 __asm__ __volatile__("cld ; rep ; stosl" \\
230 : "=&c" (__d0), "=&D" (__d1) \\
231 : "a" (0), "0" (__FDSET_LONGS), \\
232 "1" ((__fd_set *) (fdsetp)) :"memory"); \\
233 } while (0)
234 \#endif
235
236 \#define _TYPES_H_WRAPPER
237 \#endif /* _TYPES_H_WRAPPER */
238 ';
239 };
240
241
242 /*
243 * This fixes __FD_ZERO bug for glibc-2.0.x
244 */
245 fix = {
246 hackname = AAB_fd_zero_selectbits_h;
247 files = selectbits.h;
248 mach = 'i[34567]86-*-linux-gnu*';
249
250 /*
251 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not
252 * the start, so that if #include_next gets another instance of
253 * the wrapper, this will follow the #include_next chain until
254 * we arrive at the real <selectbits.h>.
255 */
256 replace =
257
258 '/* This file fixes a bug in the __FD_ZERO macro present in glibc 2.0.x. */
259 \#ifndef _SELECTBITS_H_WRAPPER
260 \#include <features.h>
261 \#include_next <selectbits.h>
262
263 \#if defined(__FD_ZERO) && defined(__GLIBC__) \\
264 && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 \\
265 && __GLIBC_MINOR__ == 0
266 \#undef __FD_ZERO
267 \#define __FD_ZERO(fdsetp) \\
268 do { \\
269 int __d0, __d1; \\
270 __asm__ __volatile__ ("cld; rep; stosl" \\
271 : "=&c" (__d0), "=&D" (__d1) \\
272 : "a" (0), "0" (sizeof (__fd_set) \\
273 / sizeof (__fd_mask)), \\
274 "1" ((__fd_mask *) (fdsetp)) \\
275 : "memory"); \\
276 } while (0)
277 \#endif
278
279 \#define _SELECTBITS_H_WRAPPER
280 \#endif /* _SELECTBITS_H_WRAPPER */
281 ';
282 };
283
284
285 /*
286 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
287 * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
288 * many other systems have similar text but correct versions of the file.
289 * To ensure only Sun's is fixed, we grep for a likely unique string.
290 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
291 */
292 fix = {
293 hackname = AAB_sun_memcpy;
294 files = memory.h;
295 select = "/\\*\t@\\(#\\)"
296 "(head/memory.h\t50.1\t "
297 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
298
299 replace =
300 '/* This file was generated by fixincludes */
301 \#ifndef __memory_h__
302 \#define __memory_h__
303
304 \#ifdef __STDC__
305 extern void *memccpy();
306 extern void *memchr();
307 extern void *memcpy();
308 extern void *memset();
309 \#else
310 extern char *memccpy();
311 extern char *memchr();
312 extern char *memcpy();
313 extern char *memset();
314 \#endif /* __STDC__ */
315
316 extern int memcmp();
317
318 \#endif /* __memory_h__ */
319 ';
320
321 };
322
323
324 /*
325 * Completely replace <sys/byteorder.h>; with a file that implements gcc's
326 * optimized byteswapping. Restricted to "SVR4" machines until either
327 * it is shown to be safe to replace this file always, or we get bolder ;-)
328 */
329 fix = {
330 hackname = AAB_svr4_replace_byteorder;
331 #ifndef SVR5
332 mach = "*-*-sysv4*";
333 mach = "i[34567]86-*-sysv5*";
334 mach = "i[34567]86-*-udk*";
335 mach = "i[34567]86-*-solaris2.[0-4]";
336 mach = "powerpcle-*-solaris2.[0-4]";
337 mach = "sparc-*-solaris2.[0-4]";
338 #endif /* SVR5 */
339 files = sys/byteorder.h;
340 replace = '#ifndef _SYS_BYTEORDER_H
341 \#define _SYS_BYTEORDER_H
342
343 /* Functions to convert `short\' and `long\' quantities from host byte order
344 to (internet) network byte order (i.e. big-endian).
345
346 Written by Ron Guilmette (rfg@ncd.com).
347
348 This isn\'t actually used by GCC. It is installed by fixinc.svr4.
349
350 For big-endian machines these functions are essentially no-ops.
351
352 For little-endian machines, we define the functions using specialized
353 asm sequences in cases where doing so yields better code (e.g. i386). */
354
355 \#if !defined (__GNUC__) && !defined (__GNUG__)
356 \#error You lose! This file is only useful with GNU compilers.
357 \#endif
358
359 \#ifndef __BYTE_ORDER__
360 /* Byte order defines. These are as defined on UnixWare 1.1, but with
361 double underscores added at the front and back. */
362 \#define __LITTLE_ENDIAN__ 1234
363 \#define __BIG_ENDIAN__ 4321
364 \#define __PDP_ENDIAN__ 3412
365 \#endif
366
367 \#ifdef __STDC__
368 static __inline__ unsigned long htonl (unsigned long);
369 static __inline__ unsigned short htons (unsigned int);
370 static __inline__ unsigned long ntohl (unsigned long);
371 static __inline__ unsigned short ntohs (unsigned int);
372 \#endif /* defined (__STDC__) */
373
374 \#if defined (__i386__)
375
376 \#ifndef __BYTE_ORDER__
377 \#define __BYTE_ORDER__ __LITTLE_ENDIAN__
378 \#endif
379
380 /* Convert a host long to a network long. */
381
382 /* We must use a new-style function definition, so that this will also
383 be valid for C++. */
384 static __inline__ unsigned long
385 htonl (unsigned long __arg)
386 {
387 register unsigned long __result;
388
389 __asm__ ("xchg%B0 %b0,%h0
390 ror%L0 $16,%0
391 xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
392 return __result;
393 }
394
395 /* Convert a host short to a network short. */
396
397 static __inline__ unsigned short
398 htons (unsigned int __arg)
399 {
400 register unsigned short __result;
401
402 __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
403 return __result;
404 }
405
406 \#elif ((defined (__i860__) && !defined (__i860_big_endian__)) \\
407 || defined (__ns32k__) || defined (__vax__) \\
408 || defined (__spur__) || defined (__arm__))
409
410 \#ifndef __BYTE_ORDER__
411 \#define __BYTE_ORDER__ __LITTLE_ENDIAN__
412 \#endif
413
414 /* For other little-endian machines, using C code is just as efficient as
415 using assembly code. */
416
417 /* Convert a host long to a network long. */
418
419 static __inline__ unsigned long
420 htonl (unsigned long __arg)
421 {
422 register unsigned long __result;
423
424 __result = (__arg >> 24) & 0x000000ff;
425 __result |= (__arg >> 8) & 0x0000ff00;
426 __result |= (__arg << 8) & 0x00ff0000;
427 __result |= (__arg << 24) & 0xff000000;
428 return __result;
429 }
430
431 /* Convert a host short to a network short. */
432
433 static __inline__ unsigned short
434 htons (unsigned int __arg)
435 {
436 register unsigned short __result;
437
438 __result = (__arg << 8) & 0xff00;
439 __result |= (__arg >> 8) & 0x00ff;
440 return __result;
441 }
442
443 \#else /* must be a big-endian machine */
444
445 \#ifndef __BYTE_ORDER__
446 \#define __BYTE_ORDER__ __BIG_ENDIAN__
447 \#endif
448
449 /* Convert a host long to a network long. */
450
451 static __inline__ unsigned long
452 htonl (unsigned long __arg)
453 {
454 return __arg;
455 }
456
457 /* Convert a host short to a network short. */
458
459 static __inline__ unsigned short
460 htons (unsigned int __arg)
461 {
462 return __arg;
463 }
464
465 \#endif /* big-endian */
466
467 /* Convert a network long to a host long. */
468
469 static __inline__ unsigned long
470 ntohl (unsigned long __arg)
471 {
472 return htonl (__arg);
473 }
474
475 /* Convert a network short to a host short. */
476
477 static __inline__ unsigned short
478 ntohs (unsigned int __arg)
479 {
480 return htons (__arg);
481 }
482 \#endif
483 ';
484 };
485
486
487 /*
488 * Completely replace <sys/varargs.h> with a file that includes gcc's
489 * stdarg.h or varargs.h files as appropriate.
490 */
491 #ifdef SVR4
492 fix = {
493 hackname = AAB_svr4_no_varargs;
494 files = sys/varargs.h;
495 replace = "/* This file was generated by fixincludes. */\n"
496 "#ifndef _SYS_VARARGS_H\n"
497 "#define _SYS_VARARGS_H\n\n"
498
499 "#ifdef __STDC__\n"
500 "#include <stdarg.h>\n"
501 "#else\n"
502 "#include <varargs.h>\n"
503 "#endif\n\n"
504
505 "#endif /* _SYS_VARARGS_H */\n";
506 };
507 #endif
508
509
510 /*
511 * Cancel out ansi_compat.h on Ultrix. Replace it with an empty file.
512 */
513 fix = {
514 hackname = AAB_ultrix_ansi_compat;
515 files = ansi_compat.h;
516 select = ULTRIX;
517 replace = "/* This file intentionally left blank. */\n";
518 };
519
520
521 /*
522 * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
523 * of struct rusage, so the prototype (added by fixproto) causes havoc.
524 */
525 fix = {
526 hackname = aix_syswait;
527 files = sys/wait.h;
528 select = "bos325,";
529 sed = "/^extern pid_t wait3();$/i\\\n"
530 "struct rusage;\n";
531 };
532
533
534 /*
535 * sys/signal.h on some versions of AIX uses volatile in the typedef of
536 * sig_atomic_t, which causes gcc to generate a warning about duplicate
537 * volatile when a sig_atomic_t variable is declared volatile, as
538 * required by ANSI C.
539 */
540 fix = {
541 hackname = aix_volatile;
542 files = sys/signal.h;
543 select = "typedef volatile int sig_atomic_t";
544 sed = "s/typedef volatile int sig_atomic_t"
545 "/typedef int sig_atomic_t/";
546 };
547
548
549 /*
550 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
551 */
552 fix = {
553 hackname = alpha_getopt;
554 files = "stdio.h";
555 files = "stdlib.h";
556 select = 'getopt\(int, char \*\[';
557 sed = 's/getopt(int, char \*\[\],[ ]*char \*)/'
558 'getopt(int, char *const[], const char *)/';
559 };
560
561
562 /*
563 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
564 */
565 fix = {
566 hackname = alpha_parens;
567 files = sym.h;
568 select = '#ifndef\(__mips64\)';
569 sed = "s/#ifndef(__mips64)/#ifndef __mips64/";
570 };
571
572
573 /*
574 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
575 */
576 fix = {
577 hackname = alpha_sbrk;
578 files = unistd.h;
579 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
580 sed = "s/char\\([ \t]*\\*[\t ]*sbrk[ \t]*(\\)/void\\1/";
581 };
582
583
584 /*
585 * Fix this ARM/RISCiX file where ___type is a Compiler
586 * hint that is specific to the Norcroft compiler.
587 */
588 fix = {
589 hackname = arm_norcroft_hint;
590 select = "___type p_type";
591 files = "X11/Intrinsic.h";
592 sed = "s/___type p_type/p_type/";
593 };
594
595
596 /*
597 * Fix this ARM/RISCiX file to avoid interfering
598 * with the use of __wchar_t in cc1plus.
599 */
600 fix = {
601 hackname = arm_wchar;
602 files = stdlib.h;
603 select = "#[ \t]*define[ \t]*__wchar_t";
604 sed = "s/\\(#[ \t]*ifndef[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
605 sed = "s/\\(#[ \t]*define[ \t]*\\)__wchar_t/\\1_GCC_WCHAR_T/";
606 };
607
608
609 /*
610 * This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89;
611 * gcc doesn't understand it.
612 */
613 fix = {
614 hackname = aux_asm;
615 files = sys/param.h;
616 select = "#ifndef NOINLINE";
617 sed = "s|#ifndef NOINLINE"
618 "|#if !defined(NOINLINE) \\&\\& !defined(__GNUC__)|";
619 };
620
621
622 /*
623 * For C++, avoid any typedef or macro definition of bool,
624 * and use the built in type instead.
625 * HP/UX 10.20 also has it in curses_colr/curses.h.
626 */
627 fix = {
628 hackname = avoid_bool;
629 files = curses.h;
630 files = curses_colr/curses.h;
631 files = term.h;
632 files = tinfo.h;
633
634 select = "char[ \t]+bool|bool[ \t]+char";
635 bypass = "we must use the C\\+\\+ compiler's type";
636
637 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
638 "#ifndef __cplusplus\n";
639
640 sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/a\\\n"
641 "#endif\n";
642
643 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/i\\\n"
644 "#ifndef __cplusplus\n";
645
646 sed = "/^typedef[ \t][ \t]*char[ \t][ \t]*bool[ \t]*;/a\\\n"
647 "#endif\n";
648
649 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/i\\\n"
650 "#ifndef __cplusplus\n";
651
652 sed = "/^[ ]*typedef[ \t][ \t]*unsigned char[ \t][ \t]*bool[ \t]*;/a\\\n"
653 "#endif\n";
654
655 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/i\\\n"
656 "#ifndef __cplusplus\n";
657
658 sed = "/^typedef[ \t][ \t]*int[ \t][ \t]*bool[ \t]*;/a\\\n"
659 "#endif\n";
660
661 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/i\\\n"
662 "#ifndef __cplusplus\n";
663
664 sed = "/^[ ]*typedef[ \t][ \t]*unsigned int[ \t][ \t]*bool[ \t]*;/a\\\n"
665 "#endif\n";
666 };
667
668
669 /*
670 * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
671 */
672 fix = {
673 hackname = bad_struct_term;
674 files = curses.h;
675 select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
676 sed = "s/^[ \t]*typedef[ \t][ \t]*"
677 "\\(struct[ \t][ \t]*term[ \t]*;[ \t]*\\)$/\\1/";
678 };
679
680
681 /*
682 * Fix one other error in this file:
683 * a mismatched quote not inside a C comment.
684 */
685 fix = {
686 hackname = badquote;
687 files = sundev/vuid_event.h;
688 sed = "s/doesn't/does not/";
689 };
690
691
692 /*
693 * Fix #defines under Alpha OSF/1:
694 * The following files contain '#pragma extern_prefix "_FOO"' followed by
695 * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
696 * statements is to reduce namespace pollution. While these macros work
697 * properly in most cases, they don't allow you to take a pointer to the
698 * "something" being modified. To get around this limitation, change these
699 * statements to be of the form '#define something _FOOsomething'.
700 */
701 fix = {
702 hackname = bad_lval;
703
704 select = "^[ \t]*#[ \t]*pragma[ \t][ \t]*extern_prefix";
705
706 files = libgen.h;
707 files = dirent.h;
708 files = ftw.h;
709 files = grp.h;
710 files = ndbm.h;
711 files = pthread.h;
712 files = pwd.h;
713 files = signal.h;
714 files = standards.h;
715 files = stdlib.h;
716 files = string.h;
717 files = stropts.h;
718 files = time.h;
719 files = unistd.h;
720 sed =
721 "s/^[ \t]*#[ \t]*define[ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
722 "\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
723 };
724
725
726 /*
727 * check for broken assert.h that needs stdio.h
728 */
729 fix = {
730 hackname = broken_assert_stdio;
731 files = assert.h;
732 select = stderr;
733 bypass = "include.*stdio.h";
734 sed = "1i\\\n"
735 "#include <stdio.h>\n";
736 };
737
738
739 /*
740 * check for broken assert.h that needs stdlib.h
741 */
742 fix = {
743 hackname = broken_assert_stdlib;
744 files = assert.h;
745 select = 'exit *\(|abort *\(';
746 bypass = "include.*stdlib.h";
747 sed = "1i\\\n"
748 "#ifdef __cplusplus\\\n"
749 "#include <stdlib.h>\\\n"
750 "#endif\n";
751 };
752
753
754 /*
755 * Fix <c_asm.h> on Digital UNIX V4.0:
756 * It contains a prototype for a DEC C internal asm() function,
757 * clashing with gcc's asm keyword. So protect this with __DECC.
758 */
759 fix = {
760 hackname = dec_intern_asm;
761 files = c_asm.h;
762 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
763 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
764 "#endif\n";
765 };
766
767
768 #ifdef OLD_CPP
769 /*
770 * Remove the double-slash comments. The "double_slash" test will
771 * try to ignore C++ headers by checking for "CC/", "xx/" and "++/"
772 * in the file name. There are still the occasional C++ headers
773 * that have their comments stripped. Too bad.
774 */
775 fix = {
776 hackname = no_double_slash;
777 c_test = "double_slash";
778 c_fix = "no_double_slash";
779 };
780 #endif
781
782
783 /*
784 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
785 */
786 fix = {
787 hackname = ecd_cursor;
788 files = "sunwindow/win_lock.h";
789 files = "sunwindow/win_cursor.h";
790 sed = "s/ecd.cursor/ecd_cursor/";
791 };
792
793
794 /*
795 * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
796 * tiny static wrappers that aren't C++ safe.
797 */
798 fix = {
799 hackname = sco5_stat_wrappers;
800 mach = "i*86-*-sco3.2v5*";
801 files = "sys/stat.h";
802
803 sed = "/^static int[ \t]*[a-z]*stat(/i\\\n"
804 "#ifdef __cplusplus\\\n"
805 "extern \"C\"\\\n"
806 "{\\\n"
807 "#endif\\\n";
808
809 sed = "/^}$/a\\\n"
810 "#ifdef __cplusplus\\\n"
811 "}\\\n"
812 "#endif \/* __cplusplus *\/\\\n";
813 };
814
815
816 #ifdef OLD_CPP
817 /*
818 * Fix else and endif directives that contain non-commentary text
819 */
820 fix = {
821 hackname = end_else_label;
822
823 /*
824 * Select files that contain '#endif' or '#else' directives with
825 * some sort of following junk.
826 */
827 c_test = "else_endif_label";
828 c_fix = "else_endif_label";
829 };
830 #endif
831
832
833 /*
834 * Fix HP's use of ../machine/inline.h to refer to
835 * /usr/include/machine/inline.h
836 */
837 fix = {
838 hackname = hp_inline;
839 files = sys/spinlock.h;
840 select = 'include.*"\.\./machine/';
841 sed = "s,\"../machine/inline.h\",<machine/inline.h>,";
842 sed = "s,\"../machine/psl.h\",<machine/psl.h>,";
843 };
844
845
846 /*
847 * Check for (...) in C++ code in HP/UX sys/file.h.
848 */
849 fix = {
850 hackname = hp_sysfile;
851 files = sys/file.h;
852 select = "HPUX_SOURCE";
853 sed = 's/(\.\.\.)/(struct file *, ...)/';
854 };
855
856
857 /*
858 * sys/mman.h on HP/UX is not C++ ready,
859 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
860 *
861 * rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
862 * is defined for the alpha. The problem is the declaration of malloc.
863 */
864 fix = {
865 hackname = cxx_unready;
866 files = sys/mman.h;
867 files = rpc/types.h;
868 select = '[^#]+malloc.*;'; /* Should catch any form of a declaration
869 but not mention within a macro. */
870 bypass = '"C"|__BEGIN_DECLS';
871
872 sed = "1i\\\n"
873 "#ifdef __cplusplus\\\n"
874 "extern \"C\" {\\\n"
875 "#endif\\\n\n";
876 sed = "$a\\\n"
877 "#ifdef __cplusplus\\\n"
878 "}\\\n"
879 "#endif\n";
880 };
881
882
883 /*
884 * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
885 */
886 fix = {
887 hackname = hpux_maxint;
888 files = sys/param.h;
889 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/i\\\n"
890 "#ifndef MAXINT\n";
891
892 sed = "/^#[ \t]*define[ \t]*MAXINT[ \t]/a\\\n"
893 "#endif\n";
894 };
895
896
897 /*
898 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
899 */
900 fix = {
901 hackname = hpux_systime;
902 files = sys/time.h;
903 select = "^extern struct sigevent;";
904 sed = "s/^extern struct sigevent;/struct sigevent;/";
905 };
906
907 /*
908 * get rid of bogus inline definitions in HP-UX 8.0
909 */
910 fix = {
911 hackname = hpux8_bogus_inlines;
912 files = math.h;
913 select = inline;
914 sed = "s@inline int abs(int [a-z][a-z]*) {.*}@extern \"C\" int abs(int);@";
915 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
916 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
917 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
918 };
919
920
921 /*
922 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
923 * of UINT32_C has undefined behavior according to ISO/ANSI:
924 * the arguments to __CONCAT__ are not macro expanded before the
925 * concatination happens so the trailing ')' in the first argument
926 * is concatinated with the 'l' in the second argument creating an
927 * invalid pp token. The behavior of invalid pp tokens is undefined.
928 * GCC does not handle these invalid tokens the way the HP compiler does.
929 * This problem will potentially occur anytime macros are used in the
930 * arguments to __CONCAT__. A general solution to this problem would be to
931 * insert another layer of macro between __CONCAT__ and its use
932 * in UINT32_C. An example of this solution can be found in the C standard.
933 * A more specific solution, the one used here, is to change the UINT32_C
934 * macro to not used macros in the arguments to __CONCAT__.
935 */
936
937 fix = {
938 hackname = hpux11_uint32_c;
939 files = inttypes.h;
940 select = "^#define UINT32_C\\(__c\\)[ \t]*__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
941 sed = "s/^#define UINT32_C(__c)\\([ \t]*\\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\\1__CONCAT__(__c,ul)/";
942 };
943
944 /*
945 * On Interactive Unix 2.2, certain traditional Unix definitions
946 * (notably getc and putc in stdio.h) are omitted if __STDC__ is
947 * defined, not just if _POSIX_SOURCE is defined. This makes it
948 * impossible to compile any nontrivial program except with -posix.
949 */
950 fix = {
951 hackname = isc_omits_with_stdc;
952
953 files = "stdio.h";
954 files = "math.h";
955 files = "ctype.h";
956 files = "sys/limits.h";
957 files = "sys/fcntl.h";
958 files = "sys/dirent.h";
959
960 select = "defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)";
961
962 sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/"
963 "!defined(_POSIX_SOURCE)/";
964 };
965
966 /*
967 * Fix various macros used to define ioctl numbers. The traditional
968 * syntax was
969 * #define _IO(n, x) (('n'<<8)+x)
970 * #define TIOCFOO _IO(T, 1)
971 * but this does not work with the C standard, which disallows macro
972 * expansion inside strings. We have to rewrite it thus:
973 * #define _IO(n, x) ((n<<8)+x)
974 * #define TIOCFOO _IO('T', 1)
975 * The select expressions match too much, but the c_fix code is cautious.
976 *
977 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
978 */
979 fix = {
980 hackname = io_use_quotes;
981 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*\\( *[^,']";
982 c_fix = IO_use;
983 };
984
985 fix = {
986 hackname = io_def_quotes;
987 select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\1'";
988 c_fix = IO_defn;
989 };
990
991
992 /*
993 * Same deal for CTRL() macros.
994 * CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
995 */
996 fix = {
997 hackname = ctrl_use_quotes;
998 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
999 c_fix = CTRL_use;
1000 };
1001
1002 fix = {
1003 hackname = ctrl_def_quotes;
1004 select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'";
1005 c_fix = CTRL_defn;
1006 };
1007
1008
1009 /*
1010 * Check for missing ';' in struct
1011 */
1012 fix = {
1013 hackname = ip_missing_semi;
1014 files = netinet/ip.h;
1015 select = "}$";
1016 sed = "/^struct/,/^};/s/}$/};/";
1017 };
1018
1019
1020 /*
1021 * Some IRIX header files contain the string "//"
1022 */
1023 fix = {
1024 hackname = irix_multiline_cmnt;
1025 files = sys/types.h;
1026
1027 sed = "s@type of the result@type of the result */@";
1028 sed = "s@of the sizeof@/* of the sizeof@";
1029 };
1030
1031
1032 /*
1033 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
1034 * in prototype without previous definition.
1035 */
1036 fix = {
1037 hackname = irix_sockaddr;
1038 files = rpc/auth.h;
1039 select = "authdes_create.*struct sockaddr";
1040 bypass = "<sys/socket\.h>";
1041 sed = "/authdes_create.*struct sockaddr/i\\\n"
1042 "struct sockaddr;\n";
1043 };
1044
1045
1046 /*
1047 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
1048 * in prototype without previous definition.
1049 */
1050 fix = {
1051 hackname = irix_struct__file;
1052 files = rpc/xdr.h;
1053 sed = "/xdrstdio_create.*struct __file_s/i\\\n"
1054 "struct __file_s;\n";
1055 };
1056
1057
1058 /*
1059 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
1060 * that causes the assembly preprocessor to complain about an
1061 * unterminated character constant.
1062 */
1063 fix = {
1064 hackname = irix_asm_apostrophe;
1065 files = sys/asm.h;
1066
1067 select = "^[ \t]*#.*[Ww]e're";
1068 sed = "/^[ \t]*#/s/\\([Ww]e\\)'re/\\1 are/";
1069 };
1070
1071
1072 /*
1073 * Fixing ISC fmod declaration
1074 */
1075 fix = {
1076 hackname = isc_fmod;
1077 files = math.h;
1078 select = 'fmod\(double\)';
1079 sed = "s/fmod(double)/fmod(double, double)/";
1080 };
1081
1082
1083 /*
1084 * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
1085 */
1086 fix = {
1087 hackname = motorola_nested;
1088 mach = "m68k-motorola-sysv*";
1089 files = limits.h;
1090 files = sys/limits.h;
1091 sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
1092 "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
1093 sed = "s@\\(/\\*#define\tHUGE_VAL\t3.40282346638528860e+38 \\)"
1094 "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
1095 };
1096
1097
1098 /*
1099 * Fixing nested comments in ISC <sys/limits.h>
1100 */
1101 fix = {
1102 hackname = isc_sys_limits;
1103 files = sys/limits.h;
1104 select = CHILD_MAX;
1105 sed = "/CHILD_MAX/s,/\\* Max, Max,";
1106 sed = "/OPEN_MAX/s,/\\* Max, Max,";
1107 };
1108
1109
1110 /*
1111 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
1112 * use / * * / to concatenate tokens.
1113 */
1114 fix = {
1115 hackname = kandr_concat;
1116 files = "sparc/asm_linkage.h";
1117 files = "sun3/asm_linkage.h";
1118 files = "sun3x/asm_linkage.h";
1119 files = "sun4/asm_linkage.h";
1120 files = "sun4c/asm_linkage.h";
1121 files = "sun4m/asm_linkage.h";
1122 files = "sun4c/debug/asm_linkage.h";
1123 files = "sun4m/debug/asm_linkage.h";
1124 files = "arm/as_support.h";
1125 files = "arm/mc_type.h";
1126 files = "arm/xcb.h";
1127 files = "dev/chardefmac.h";
1128 files = "dev/ps_irq.h";
1129 files = "dev/screen.h";
1130 files = "dev/scsi.h";
1131 files = "sys/tty.h";
1132 files = "Xm.acorn/XmP.h";
1133 files = bsd43/bsd43_.h;
1134 select = '/\*\*/';
1135 sed = 's|/\*\*/|##|g';
1136 };
1137
1138
1139 /*
1140 * In limits.h, put #ifndefs around things that are supposed to be defined
1141 * in float.h to avoid redefinition errors if float.h is included first.
1142 * On HP/UX this patch does not work, because on HP/UX limits.h uses
1143 * multi line comments and the inserted #endif winds up inside the
1144 * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1145 * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1146 * are there, and we do not add them ourselves.
1147 * Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1
1148 */
1149 fix = {
1150 hackname = limits_ifndefs;
1151 files = "limits.h";
1152 files = "sys/limits.h";
1153 bypass = "ifndef[ \t]+FLT_MIN";
1154
1155 sed = "/[ \t]FLT_MIN[ \t]/i\\\n#ifndef FLT_MIN\n";
1156 sed = "/[ \t]FLT_MIN[ \t]/a\\\n#endif\n";
1157 sed = "/[ \t]FLT_MAX[ \t]/i\\\n#ifndef FLT_MAX\n";
1158 sed = "/[ \t]FLT_MAX[ \t]/a\\\n#endif\n";
1159 sed = "/[ \t]FLT_DIG[ \t]/i\\\n#ifndef FLT_DIG\n";
1160 sed = "/[ \t]FLT_DIG[ \t]/a\\\n#endif\n";
1161 sed = "/[ \t]DBL_MIN[ \t]/i\\\n#ifndef DBL_MIN\n";
1162 sed = "/[ \t]DBL_MIN[ \t]/a\\\n#endif\n";
1163 sed = "/[ \t]DBL_MAX[ \t]/i\\\n#ifndef DBL_MAX\n";
1164 sed = "/[ \t]DBL_MAX[ \t]/a\\\n#endif\n";
1165 sed = "/[ \t]DBL_DIG[ \t]/i\\\n#ifndef DBL_DIG\n";
1166 sed = "/[ \t]DBL_DIG[ \t]/a\\\n#endif\n";
1167 sed = "/^\\(\\/\\*#define\tHUGE_VAL\t3\\.[0-9e+]* *\\)\\/\\*/s//\\1/";
1168 };
1169
1170
1171 /*
1172 * Delete the '#define void int' line from curses.h on Lynx
1173 */
1174 fix = {
1175 hackname = lynx_void_int;
1176 files = curses.h;
1177 select = "#[ \t]*define[ \t]+void[ \t]+int";
1178 sed = "/#[ \t]*define[ \t][ \t]*void[ \t]int/d";
1179 };
1180
1181
1182 /*
1183 * Fix fcntl prototype in fcntl.h on LynxOS.
1184 */
1185 fix = {
1186 hackname = lynxos_fcntl_proto;
1187 files = fcntl.h;
1188 select = 'fcntl.*\(int, int, int\)';
1189 sed = 's/\(fcntl.*(int, int, \)int)/\1...)/';
1190 };
1191
1192
1193 /*
1194 * libm.a on m88k-motorola-sysv3 contains a stupid optimization for
1195 * function hypot(), which returns the second argument without even
1196 * looking at its value, if the other is 0.0. Another drawback is
1197 * that fix-header doesn't fix fabs' prototype, and I have no idea why.
1198 */
1199 fix = {
1200 hackname = m88k_bad_hypot_opt;
1201 mach = "m88k-motorola-sysv3*";
1202 files = "math.h";
1203
1204 sed = "s/extern double floor(), ceil(), fmod(), fabs();/"
1205 "extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/";
1206
1207 sed = "/^extern double hypot();$/a\\\n"
1208 "\\/* Workaround a stupid Motorola optimization if one\\\n"
1209 " of x or y is 0.0 and the other is negative! *\\/\\\n"
1210 "#ifdef __STDC__\\\n"
1211 "static __inline__ double fake_hypot (double x, double y)\\\n"
1212 "#else\\\n"
1213 "static __inline__ double fake_hypot (x, y)\\\n"
1214 "\tdouble x, y;\\\n"
1215 "#endif\\\n"
1216 "{\\\n"
1217 "\treturn fabs (hypot (x, y));\\\n"
1218 "}\\\n"
1219 "#define hypot\tfake_hypot\n";
1220 };
1221
1222
1223 /*
1224 * Fix incorrect S_IF* definitions on m88k-sysv3.
1225 */
1226 fix = {
1227 hackname = m88k_bad_s_if;
1228 mach = "m88k-*-sysv3*";
1229 files = sys/stat.h;
1230 select = "#define[ \t]+S_IS[A-Z]*(m)[ \t]";
1231
1232 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
1233 "(m[ \t]*&[ \t]*\\(S_IF[A-Z][A-Z][A-Z][A-Z]*\\)[ \t]*)/"
1234 "\\1 (((m)\\&S_IFMT)==\\2)/";
1235
1236 sed = "s/^\\(#define[ \t]*S_IS[A-Z]*(m)\\)[ \t]*"
1237 "(m[ \t]*&[ \t]*\\(0[0-9]*\\)[ \t]*)/"
1238 "\\1 (((m)\\&S_IFMT)==\\2)/";
1239 };
1240
1241
1242 /*
1243 * Put cpp wrappers around these include files to avoid redeclaration
1244 * errors during multiple inclusion on m88k-tektronix-sysv3.
1245 */
1246 fix = {
1247 hackname = m88k_multi_incl;
1248 mach = "m88k-tektronix-sysv3*";
1249 files = "time.h";
1250 bypass = "#ifndef";
1251 shell =
1252 "echo Fixing $file, to protect against multiple inclusion. >&2
1253 cpp_wrapper=`echo $file | sed -e 's,\\.,_,g' -e 's,/,_,g'`
1254 echo \"#ifndef __GCC_GOT_${cpp_wrapper}_\"
1255 echo \"#define __GCC_GOT_${cpp_wrapper}_\"
1256 cat
1257 echo \"#endif /* ! __GCC_GOT_${cpp_wrapper}_ */\"";
1258 };
1259
1260
1261 /*
1262 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
1263 */
1264 fix = {
1265 hackname = machine_ansi_h_va_list;
1266 files = machine/ansi.h;
1267 select = '_BSD_VA_LIST_';
1268 bypass = '__builtin_va_list';
1269
1270 sed = "s/\\(_BSD_VA_LIST_[ \t][ \t]*\\).*$/\\1__builtin_va_list/";
1271 };
1272
1273
1274 /*
1275 * Fix non-ansi machine name defines
1276 */
1277 fix = {
1278 hackname = machine_name;
1279 c_test = machine_name;
1280 c_fix = machine_name;
1281 };
1282
1283
1284 /*
1285 * Some math.h files define struct exception, which conflicts with
1286 * the class exception defined in the C++ file std/stdexcept.h. We
1287 * redefine it to __math_exception. This is not a great fix, but I
1288 * haven't been able to think of anything better.
1289 * Note that we have to put the #ifdef/#endif blocks at beginning
1290 * and end of file, because fixproto runs after us and may insert
1291 * additional references to struct exception.
1292 */
1293 fix = {
1294 hackname = math_exception;
1295 files = math.h;
1296 select = "struct exception";
1297 bypass = "We have a problem when using C\\+\\+";
1298 sed = "1i\\\n"
1299 "#ifdef __cplusplus\\\n"
1300 "#define exception __math_exception\\\n"
1301 "#endif\n";
1302 sed = "$a\\\n"
1303 "#ifdef __cplusplus\\\n"
1304 "#undef exception\\\n"
1305 "#endif\n";
1306 };
1307
1308 fix = {
1309 hackname = math_huge_val_from_dbl_max;
1310 files = math.h;
1311 /*
1312 * IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined
1313 * in math.h, this fix applies.
1314 */
1315 select = "define[ \t]*HUGE_VAL[ \t]*DBL_MAX";
1316 bypass = "define[ \t]*DBL_MAX";
1317
1318 shell =
1319 /*
1320 * See if we have a definition for DBL_MAX in float.h.
1321 * If we do, we will replace the one in math.h with that one.
1322 */
1323
1324 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
1325 "2>/dev/null`\n\n"
1326
1327 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
1328 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
1329 "s/DBL_MAX/'\"$dbl_max_def/\"\n"
1330 "\telse cat\n"
1331 "\tfi";
1332 };
1333
1334 /*
1335 * In any case, put #ifndef .. #endif around #define HUGE_VAL in math.h.
1336 */
1337 fix = {
1338 hackname = math_huge_val_ifndef;
1339 files = math/math.h;
1340 select = "define[ \t]*HUGE_VAL";
1341
1342 sed = "/define[ \t]HUGE_VAL[ \t]/i\\\n#ifndef HUGE_VAL\n";
1343 sed = "/define[ \t]HUGE_VAL[ \t]/a\\\n#endif\n";
1344 };
1345
1346 /*
1347 * nested comment
1348 */
1349 fix = {
1350 hackname = nested_comment;
1351 files = rpc/rpc.h;
1352 sed = 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@';
1353 };
1354
1355
1356 /*
1357 * fix bogus recursive stdlib.h in NEWS-OS 4.0C
1358 */
1359 fix = {
1360 hackname = news_os_recursion;
1361 files = stdlib.h;
1362 select = "#include <stdlib.h>";
1363 sed = "/^#include <stdlib.h>/i\\\n"
1364 "#ifdef BOGUS_RECURSION\n";
1365 sed = "/^#include <stdlib.h>/a\\\n"
1366 "#endif\n";
1367 };
1368
1369
1370 /*
1371 * NeXT 3.2 adds const prefix to some math functions.
1372 * These conflict with the built-in functions.
1373 */
1374 fix = {
1375 hackname = next_math_prefix;
1376 files = ansi/math.h;
1377 select = "^extern.*double.*__const__.*";
1378
1379 sed = "/^extern.*double.*__const__.*sqrt(/s/__const__//";
1380 sed = "/^extern.*double.*__const__.*fabs(/s/__const__//";
1381 sed = "/^extern.*double.*__const__.*cos(/s/__const__//";
1382 sed = "/^extern.*double.*__const__.*hypot(/s/__const__//";
1383 sed = "/^extern.*double.*__const__.*sin(/s/__const__//";
1384 };
1385
1386
1387 /*
1388 * NeXT 3.2 uses the word "template" as a parameter for some
1389 * functions. GCC reports an invalid use of a reserved key word
1390 * with the built-in functions. NeXT 3.2 includes the keyword
1391 * volatile in the prototype for abort(). This conflicts with
1392 * the built-in definition.
1393 */
1394 fix = {
1395 hackname = next_template;
1396 files = bsd/libc.h;
1397 select = template;
1398
1399 sed = '/\(.*template\)/s/template//';
1400 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1401 };
1402
1403
1404 /*
1405 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
1406 * function prototypes. That conflicts with the built-in functions.
1407 */
1408 fix = {
1409 hackname = next_volitile;
1410 files = ansi/stdlib.h;
1411 select = volatile;
1412
1413 sed = "/extern.*volatile.*void.*exit/s/volatile//";
1414 sed = "/extern.*volatile.*void.*abort/s/volatile//";
1415 };
1416
1417
1418 /*
1419 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1420 * Note that version 3 of the NeXT system has wait.h in a different directory,
1421 * so that this code won't do anything. But wait.h in version 3 has a
1422 * conditional, so it doesn't need this fix. So everything is okay.
1423 */
1424 fix = {
1425 hackname = next_wait_union;
1426 files = sys/wait.h;
1427
1428 select = 'wait\(union wait';
1429
1430 sed = "s@wait(union wait@wait(void@";
1431 };
1432
1433
1434 /*
1435 * a missing semi-colon at the end of the nodeent structure definition.
1436 */
1437 fix = {
1438 hackname = nodeent_syntax;
1439 files = netdnet/dnetdb.h;
1440 sed = "s/char.*na_addr *$/char *na_addr;/";
1441 };
1442
1443
1444 /*
1445 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
1446 * defining regex.h related types. This causes libg++ build and usage
1447 * failures. Fixing this correctly requires checking and modifying 3 files.
1448 */
1449 fix = {
1450 hackname = osf_namespace_a;
1451 files = reg_types.h;
1452 files = sys/lc_core.h;
1453 test = " -r reg_types.h";
1454 test = " -r sys/lc_core.h";
1455 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1456 test = " -z \"`grep __regex_t regex.h`\"";
1457
1458 sed = "s/regex_t/__regex_t/g";
1459 sed = "s/regoff_t/__regoff_t/g";
1460 sed = "s/regmatch_t/__regmatch_t/g";
1461 };
1462
1463 fix = {
1464 hackname = osf_namespace_b;
1465 files = regex.h;
1466 test = " -r reg_types.h";
1467 test = " -r sys/lc_core.h";
1468 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
1469 test = " -z \"`grep __regex_t regex.h`\"";
1470
1471 sed = "/#include <reg_types.h>/a\\\n"
1472 "typedef __regex_t\tregex_t;\\\n"
1473 "typedef __regoff_t\tregoff_t;\\\n"
1474 "typedef __regmatch_t\tregmatch_t;\n";
1475 };
1476
1477
1478 /*
1479 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
1480 * The original ones fail if uninitialized externs are not common.
1481 * This is the default for all ANSI standard C++ compilers.
1482 */
1483 fix = {
1484 hackname = pthread_page_size;
1485 files = pthread.h;
1486 select = "^int __page_size";
1487 sed = "s/^int __page_size/extern int __page_size/";
1488 };
1489
1490
1491 /*
1492 * Fix return type of fread and fwrite on sysV68
1493 */
1494 fix = {
1495 hackname = read_ret_type;
1496 files = stdio.h;
1497 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
1498 sed = "s/^\\(extern int\tfclose(), fflush()\\), "
1499 "\\(fread(), fwrite()\\)\\(.*\\)$"
1500 "/extern unsigned int\t\\2;\\\n\\1\\3/";
1501 };
1502
1503
1504 /*
1505 * function class(double x) conflicts with C++ keyword on rs/6000
1506 */
1507 fix = {
1508 hackname = rs6000_double;
1509 files = math.h;
1510 select = '[^a-zA-Z_]class\(';
1511
1512 sed = "/class[(]/i\\\n#ifndef __cplusplus\n";
1513 sed = "/class[(]/a\\\n#endif\n";
1514 };
1515
1516
1517 /*
1518 * Wrong fchmod prototype on RS/6000.
1519 */
1520 fix = {
1521 hackname = rs6000_fchmod;
1522 files = sys/stat.h;
1523 select = 'fchmod\(char';
1524 sed = 's/fchmod(char \*/fchmod(int/';
1525 };
1526
1527
1528 /*
1529 * parameters conflict with C++ new on rs/6000
1530 */
1531 fix = {
1532 hackname = rs6000_param;
1533 files = "stdio.h";
1534 files = "unistd.h";
1535 select = 'const char new';
1536
1537 sed = 's@rename(const char \*old, const char \*new)@'
1538 'rename(const char *_old, const char *_new)@';
1539 };
1540
1541
1542 /*
1543 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1544 */
1545 #ifdef SONY
1546 fix = {
1547 hackname = sony_ctype;
1548 files = ctype.h;
1549 test = " -x /bin/sony";
1550 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1551 sed = "s/__ctype/_ctype/g";
1552 };
1553 #endif
1554
1555 /*
1556 * Incorrect #include in Sony News-OS 3.2.
1557 */
1558 fix = {
1559 hackname = sony_include;
1560 files = machine/machparam.h;
1561 select = '"\.\./machine/endian.h"';
1562 sed = 's@"../machine/endian.h"@<machine/endian.h>@';
1563 };
1564
1565
1566 /*
1567 * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1568 */
1569 #ifdef SONY
1570 fix = {
1571 hackname = sony_stdio;
1572 files = stdio.h;
1573 test = " -x /bin/sony";
1574 test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
1575 sed = "s/__filbuf/_filbuf/g\n"
1576 "s/__flsbuf/_flsbuf/g\n"
1577 "s/__iob/_iob/g";
1578 };
1579 #endif
1580
1581 /*
1582 * Add a `static' declaration of `getrnge' into <regexp.h>.
1583 *
1584 * Don't do this if there is already a `static void getrnge' declaration
1585 * present, since this would cause a redeclaration error. Solaris 2.x has
1586 * such a declaration.
1587 */
1588 #ifdef SVR4
1589 fix = {
1590 hackname = static_getrnge;
1591 files = regexp.h;
1592 bypass = "static void getrnge";
1593 sed = "/^static int[ \t]*size;/c\\\n"
1594 "static int size ;\\\n\\\n"
1595 "static int getrnge ();";
1596 };
1597 #endif
1598
1599
1600 /*
1601 * a missing semi-colon at the end of the statsswtch structure definition.
1602 */
1603 fix = {
1604 hackname = statsswtch;
1605 files = rpcsvc/rstat.h;
1606 select = "boottime$";
1607 sed = "s/boottime$/boottime;/";
1608 };
1609
1610
1611 /*
1612 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
1613 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
1614 * OK too.
1615 */
1616 fix = {
1617 hackname = stdio_stdarg_h;
1618 files = stdio.h;
1619 bypass = "include.*(stdarg\.h|machine/ansi\.h)";
1620
1621 sed = '1i\\
1622 \#define __need___va_list\\
1623 \#include <stdarg.h>
1624 ';
1625
1626 };
1627
1628
1629 /*
1630 * Don't use or define the name va_list in stdio.h.
1631 * This is for ANSI and also to interoperate properly with gcc's varargs.h.
1632 * Note _BSD_VA_LIST_ is dealt with elsewhere.
1633 */
1634 fix = {
1635 hackname = stdio_va_list;
1636 files = stdio.h;
1637 bypass = '__gnuc_va_list|_BSD_VA_LIST_';
1638
1639 /*
1640 * Use __gnuc_va_list in arg types in place of va_list.
1641 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1642 * trailing parentheses and semicolon save all other systems from this.
1643 * Define __not_va_list__ (something harmless and unused)
1644 * instead of va_list.
1645 * Don't claim to have defined va_list.
1646 */
1647 sed = "s@ va_list @ __gnuc_va_list @\n"
1648 "s@ va_list)@ __gnuc_va_list)@\n"
1649 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
1650 "s@ va_list@ __not_va_list__@\n"
1651 "s@\\*va_list@*__not_va_list__@\n"
1652 "s@ __va_list)@ __gnuc_va_list)@\n"
1653 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
1654 "@typedef \\1 __not_va_list__;@\n"
1655 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
1656 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
1657 "s@VA_LIST@DUMMY_VA_LIST@\n"
1658 "s@_Va_LIST@_VA_LIST@";
1659 };
1660
1661
1662 /*
1663 * Check for strict ansi compliance
1664 */
1665 #ifdef STRICT_ANSI
1666 fix = {
1667 hackname = strict_ansi;
1668 select = "__STDC__[ \t]*[=!]=[ \t]*[01]";
1669 sed = "s/__STDC__[ \t]*==[ \t]*0/!defined (__STRICT_ANSI__)/g";
1670 sed = "s/__STDC__[ \t]*!=[ \t]*0/defined (__STRICT_ANSI__)/g";
1671 sed = "s/__STDC__[ \t]*==[ \t]*1/defined (__STRICT_ANSI__)/g";
1672 sed = "s/__STDC__[ \t]*!=[ \t]*1/!defined (__STRICT_ANSI__)/g";
1673 };
1674 #endif
1675
1676 /*
1677 * Fix bogus #ifdef on SunOS 4.1.
1678 */
1679 fix = {
1680 hackname = sun_bogus_ifdef;
1681 files = "hsfs/hsfs_spec.h";
1682 files = "hsfs/iso_spec.h";
1683 select = '#ifdef __i386__ || __vax__';
1684 sed = "s/\\#ifdef __i386__ || __vax__/\\#if __i386__ || __vax__/g";
1685 };
1686
1687
1688 /*
1689 * Fix bogus #ifdef on SunOS 4.1.
1690 */
1691 fix = {
1692 hackname = sun_bogus_ifdef_sun4c;
1693 files = "hsfs/hsnode.h";
1694 select = '#ifdef __i386__ || __sun4c__';
1695 sed = "s/\\#ifdef __i386__ || __sun4c__/\\#if __i386__ || __sun4c__/g";
1696 };
1697
1698
1699 /*
1700 * Fix the CAT macro in SunOS memvar.h.
1701 */
1702 fix = {
1703 hackname = sun_catmacro;
1704 files = pixrect/memvar.h;
1705 select = "^#define[ \t]+CAT\\(a,b\\)";
1706 sed = "/^#define[ \t]CAT(a,b)/ i\\\n"
1707 "#ifdef __STDC__ \\\n"
1708 "#define CAT(a,b) a##b\\\n"
1709 "#else\n";
1710
1711 sed = "/^#define[ \t]CAT(a,b)/ a\\\n"
1712 "#endif\n";
1713 };
1714
1715
1716 /*
1717 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1718 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1719 */
1720 fix = {
1721 hackname = sun_malloc;
1722 files = malloc.h;
1723
1724 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
1725 sed = "s/int[ \t][ \t]*free/void\tfree/g";
1726 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
1727 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
1728 };
1729
1730
1731 /*
1732 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
1733 */
1734 fix = {
1735 hackname = sun_rusers_semi;
1736 files = rpcsvc/rusers.h;
1737 select = "_cnt$";
1738 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
1739 };
1740
1741
1742 /*
1743 * signal.h on SunOS defines signal using (),
1744 * which causes trouble when compiling with g++ -pedantic.
1745 */
1746 fix = {
1747 hackname = sun_signal;
1748 files = sys/signal.h;
1749 files = signal.h;
1750 select = "^void\t" '\(\*signal\(\)\)\(\);';
1751
1752 sed = "/^void\t" '(\*signal())();$/i' "\\\n"
1753 "#ifdef __cplusplus" "\\\n"
1754 "void\t(*signal(...))(...);" "\\\n"
1755 "#else" "\n";
1756
1757 sed = "/^void\t" '(\*signal())();$/a' "\\\n"
1758 '#endif' "\n";
1759 };
1760
1761
1762 /*
1763 * Apply fix this to all OSs since this problem seems to effect
1764 * more than just SunOS. In general, fixes which are triggered
1765 * by a specific target are bad.
1766 */
1767 fix = {
1768 hackname = sun_auth_proto;
1769 files = rpc/auth.h;
1770 files = rpc/clnt.h;
1771 files = rpc/svc.h;
1772 files = rpc/xdr.h;
1773 /*
1774 * Select those files containing '(*name)()'.
1775 */
1776 select = '\(\*[a-z][a-z_]*\)\(\)';
1777 sed = 's'
1778 '/^\(.*(\*[a-z][a-z_]*)(\)' '\();.*\)'
1779 "/\\\n"
1780 "#ifdef __cplusplus\\\n"
1781 '\1...\2' "\\\n"
1782 "#else\\\n"
1783 '\1\2' "\\\n"
1784 "#endif"
1785 "/";
1786 };
1787
1788
1789 /*
1790 * math.h on SunOS 4 puts the declaration of matherr before the definition
1791 * of struct exception, so the prototype (added by fixproto) causes havoc.
1792 */
1793 fix = {
1794 hackname = sunos_matherr_decl;
1795 files = math.h;
1796 /* If matherr has a prototype already, the header needs no fix. */
1797 bypass = 'matherr.*struct exception';
1798 /*
1799 * Once a declaration for 'struct exception' is found,
1800 * stop trying to insert a forward reference for it.
1801 */
1802 sed = "/^struct exception/,$b";
1803 sed = "/matherr/i\\\nstruct exception;\n";
1804 };
1805
1806
1807 /*
1808 * Correct the return type for strlen in strings.h in SunOS 4.
1809 */
1810 fix = {
1811 hackname = sunos_strlen;
1812 files = strings.h;
1813 select = "int[ \t]*strlen";
1814 sed = "s/int[ \t]*strlen();/__SIZE_TYPE__ strlen();/";
1815 };
1816
1817
1818 /*
1819 * Solaris math.h and floatingpoint.h define __P without protection,
1820 * which conflicts with the fixproto definition. The fixproto
1821 * definition and the Solaris definition are used the same way.
1822 */
1823 #ifdef SVR4
1824 fix = {
1825 hackname = svr4__p;
1826 files = math.h;
1827 files = floatingpoint.h;
1828 select = "^#define[ \t]*__P";
1829 sed = "/^#define[ \t]*__P/i\\\n#ifndef __P\n";
1830 sed = "/^#define[ \t]*__P/a\\\n#endif\n";
1831 };
1832 #endif
1833
1834 /*
1835 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
1836 * that is visible to any ANSI compiler using this include. Simply
1837 * delete the lines that #define some string functions to internal forms.
1838 */
1839 #ifdef SVR4
1840 fix = {
1841 hackname = svr4_disable_opt;
1842 files = string.h;
1843 select = '#define.*__std_hdr_';
1844 sed = '/#define.*__std_hdr_/d';
1845 };
1846 #endif
1847
1848
1849 /*
1850 * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
1851 * On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
1852 * but we still "hijack" it and redirect it to the GNU byteorder.h..
1853 *
1854 *
1855 */
1856 #ifdef SVR5
1857 fix = {
1858 hackname = svr4_endian;
1859 files = sys/endian.h;
1860 #ifdef LATER
1861 /*
1862 * since we emit our own sys/byteorder.h,
1863 * this fix can never be applied to that file.
1864 */
1865 files = sys/byteorder.h;
1866 #endif
1867 bypass = '__GNUC__';
1868
1869 sed = "/#\tifdef\t__STDC__/i\\\n"
1870 "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
1871
1872 sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
1873
1874 sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
1875 "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
1876 };
1877 #endif /* SVR5 */
1878
1879
1880 /*
1881 * Remove useless extern keyword from struct forward declarations
1882 * in <sys/stream.h> and <sys/strsubr.h>
1883 */
1884 #ifdef SVR4
1885 fix = {
1886 hackname = svr4_extern_struct;
1887 files = sys/stream.h;
1888 files = sys/strsubr.h;
1889 select = 'extern struct [a-z_]*;';
1890 sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
1891 };
1892 #endif
1893
1894 /*
1895 * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
1896 * systems the file <ftw.h> contains extern declarations of these
1897 * functions followed by explicitly `static' definitions of these
1898 * functions... and that's not allowed according to ANSI C. (Note
1899 * however that on Solaris, this header file glitch has been pre-fixed by
1900 * Sun. In the Solaris version of <ftw.h> there are no static
1901 * definitions of any function so we don't need to do any of this stuff
1902 * when on Solaris.
1903 */
1904 #ifdef SVR4
1905 #ifndef SOLARIS
1906 fix = {
1907 hackname = svr4_ftw;
1908 files = ftw.h;
1909 select = '^extern int ftw\(const';
1910
1911 sed = '/^extern int ftw(const/i' "\\\n"
1912 "#if !defined(_STYPES)\\\n"
1913 "static\\\n"
1914 "#else\\\n"
1915 "extern\\\n"
1916 "#endif";
1917 sed = 's/extern \(int ftw(const.*\)$/\1/';
1918 sed = "/^extern int nftw/i\\\n"
1919 "#if defined(_STYPES)\\\n"
1920 "static\\\n"
1921 "#else\\\n"
1922 "extern\\\n"
1923 "#endif";
1924 sed = 's/extern \(int nftw.*\)$/\1/';
1925 sed = "/^extern int ftw(),/c\\\n"
1926 "#if !defined(_STYPES)\\\n"
1927 "static\\\n"
1928 "#else\\\n"
1929 "extern\\\n"
1930 "#endif\\\n"
1931 " int ftw();\\\n"
1932 "#if defined(_STYPES)\\\n"
1933 "static\\\n"
1934 "#else\\\n"
1935 "extern\\\n"
1936 "#endif\\\n"
1937 " int nftw();";
1938 };
1939 #endif
1940 #endif
1941
1942
1943 /*
1944 * Fix broken decl of getcwd present on some svr4 systems.
1945 */
1946 #ifdef SVR4
1947 fix = {
1948 hackname = svr4_getcwd;
1949 files = stdlib.h;
1950 files = unistd.h;
1951 select = 'getcwd\(char \*, int\)';
1952
1953 sed = 's/getcwd(char \*, int)/getcwd(char *, size_t)/';
1954 };
1955 #endif
1956
1957 /*
1958 * set ifdef _KERNEL
1959 */
1960 #ifdef SVR4
1961 fix = {
1962 hackname = svr4_kernel;
1963 files = fs/rfs/rf_cache.h;
1964 files = sys/erec.h;
1965 files = sys/err.h;
1966 files = sys/char.h;
1967 files = sys/getpages.h;
1968 files = sys/map.h;
1969 files = sys/cmn_err.h;
1970 files = sys/kdebugger.h;
1971 bypass = '_KERNEL';
1972 sed = "1i\\\n#ifdef _KERNEL";
1973 sed = "$a\\\n#endif /* _KERNEL */";
1974 };
1975 #endif
1976
1977 /*
1978 * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
1979 * tend to conflict with the compiler's own definition of this symbol. (We
1980 * will use the compiler's definition.)
1981 * Likewise __sparc, for Solaris, and __i860, and a few others
1982 * (guessing it is necessary for all of them).
1983 */
1984 #ifdef SVR4
1985 fix = {
1986 hackname = svr4_mach_defines;
1987 files = ieeefp.h;
1988 select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
1989 sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
1990 };
1991 #endif
1992
1993
1994 /*
1995 * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
1996 * They are declared as non-static then immediately redeclared as static.
1997 */
1998 #ifdef SVR5
1999 fix = {
2000 hackname = svr4_mkdev;
2001 files = sys/mkdev.h;
2002 select = '^static';
2003
2004 sed = "/^dev_t makedev(/s/^/static /";
2005 sed = "/^major_t major(/s/^/static /";
2006 sed = "/^minor_t minor(/s/^/static /";
2007 };
2008 #endif /* SVR5 */
2009
2010
2011 /*
2012 * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
2013 * Also fix types of array initializers.
2014 */
2015 #ifdef SVR4
2016 fix = {
2017 hackname = svr4_netcspace;
2018 files = sys/netcspace.h;
2019 select = 'NC_NPI_RAW';
2020 sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
2021 sed = 's/NC_/(unsigned long) NC_/';
2022 };
2023 #endif
2024
2025 /*
2026 * Fix reference to NMSZ in <sys/adv.h>.
2027 */
2028 #ifdef SVR4
2029 fix = {
2030 hackname = svr4_nmsz;
2031 files = sys/adv.h;
2032 select = '\[NMSZ\]';
2033 sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
2034 };
2035 #endif
2036
2037 /*
2038 * Fix broken decl of profil present on some svr4 systems.
2039 */
2040 #ifdef SVR4
2041 fix = {
2042 hackname = svr4_profil;
2043 files = stdlib.h;
2044 files = unistd.h;
2045
2046 sed = 's/profil(unsigned short \*, unsigned int, '
2047 'unsigned int, unsigned int)'
2048 '/profil(unsigned short *, size_t, int, unsigned)/';
2049 };
2050 #endif
2051
2052 /*
2053 * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
2054 */
2055 #ifdef SVR4
2056 fix = {
2057 hackname = svr4_proto_form;
2058 files = sys/stat.h;
2059 select = 'const extern';
2060
2061 sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
2062 "s/(.*)\\n/( /\n"
2063 "s/;\\n/, /\n"
2064 "s/;$/)/\n" "}";
2065
2066 sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
2067 "s/(.*)\\n/( /\n"
2068 "s/;\\n/, /\n"
2069 "s/;$/)/\n" "}";
2070
2071 sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
2072 "s/(.*)\\n/( /\n"
2073 "s/;\\n/, /\n"
2074 "s/;$/)/\n" "}";
2075
2076 sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
2077 "s/(.*)\\n/( /\n"
2078 "s/;\\n/, /g\n"
2079 "s/;$/)/\n" "}";
2080
2081 sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
2082 sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
2083 sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
2084 sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
2085 sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
2086 sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
2087 };
2088 #endif
2089
2090 /*
2091 * Add a prototyped declaration of mmap to <sys/mman.h>.
2092 */
2093 #ifdef SVR4
2094 fix = {
2095 hackname = svr4_proto_mmap;
2096 files = sys/mman.h;
2097 select = '^extern caddr_t mmap();$';
2098 sed = '/^extern caddr_t mmap();$/c' "\\\n"
2099 "#ifdef __STDC__\\\n"
2100 "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
2101 "#else /* !defined(__STDC__) */\\\n"
2102 "extern caddr_t mmap ();\\\n"
2103 "#endif /* !defined(__STDC__) */\\\n";
2104 };
2105 #endif
2106
2107 /*
2108 * Add a #define of _SIGACTION_ into <sys/signal.h>.
2109 */
2110 #ifdef SVR4
2111 fix = {
2112 hackname = svr4_sigaction;
2113 files = sys/signal.h;
2114 sed = "/^struct sigaction {/i\\\n"
2115 "#define _SIGACTION_";
2116 sed = 's/(void *(\*)())/(void (*)(int))/';
2117 };
2118 #endif
2119
2120 /*
2121 * Put storage class at start of decl, to avoid warning.
2122 */
2123 #ifdef SVR4
2124 fix = {
2125 hackname = svr4_storage_class;
2126 files = rpc/types.h;
2127 select = 'const extern';
2128 sed = 's/const extern/extern const/g';
2129 };
2130 #endif
2131
2132
2133 /*
2134 * Like svr4_mach_defines, but with newfangled syntax.
2135 * Source lines are of #define __i386 #machine(i386). Delete them.
2136 */
2137 #ifdef SVR5
2138 fix = {
2139 hackname = svr5_mach_defines;
2140 files = ieeefp.h;
2141 select = "#define[ \t]*__i386.*\(i386\)";
2142 sed = "/#define[ \t]*__i386.*/d";
2143 };
2144 #endif /* SVR5 */
2145
2146 /* Fix these files to use the same types that we think they should.
2147 * XXX - extremely dubious changes here.
2148 */
2149 fix = {
2150 hackname = systypes;
2151 files = "sys/types.h";
2152 files = "stdlib.h";
2153 files = "sys/stdtypes.h";
2154 files = "stddef.h";
2155 files = "memory.h";
2156 files = "unistd.h";
2157 select = "typedef[ \t]+[a-z_][ \ta-z_]*[ \t]"
2158 "(size|ptrdiff|wchar)_t";
2159
2160 sed = "/^[ \t]*\\*[ \t]*typedef unsigned int size_t;/N";
2161
2162 sed = "s/^\\([ \t]*\\*[ \t]*typedef unsigned int size_t;\\n"
2163 "[ \t]*\\*\\/\\)/\\1\\\n"
2164 "#ifndef __SIZE_TYPE__\\\n"
2165 "#define __SIZE_TYPE__ long unsigned int\\\n"
2166 "#endif\\\n"
2167 "typedef __SIZE_TYPE__ size_t;\\\n/";
2168
2169 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/i\\\n"
2170 "#ifndef __SIZE_TYPE__\\\n"
2171 "#define __SIZE_TYPE__ long unsigned int\\\n"
2172 "#endif\n";
2173
2174 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]size_t/"
2175 "typedef __SIZE_TYPE__ size_t/";
2176
2177 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/i\\\n"
2178 "#ifndef __PTRDIFF_TYPE__\\\n"
2179 "#define __PTRDIFF_TYPE__ long int\\\n"
2180 "#endif\n";
2181
2182 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]ptrdiff_t/"
2183 "typedef __PTRDIFF_TYPE__ ptrdiff_t/";
2184
2185 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/i\\\n"
2186 "#ifndef __WCHAR_TYPE__\\\n"
2187 "#define __WCHAR_TYPE__ int\\\n"
2188 "#endif\\\n"
2189 "#ifndef __cplusplus\n";
2190
2191 sed = "/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/a\\\n"
2192 "#endif\n";
2193
2194 sed = "s/typedef[ \t][ \t]*[a-z_][ \ta-z_]*[ \t]wchar_t/"
2195 "typedef __WCHAR_TYPE__ wchar_t/";
2196 };
2197
2198
2199 /*
2200 * Fix files that may contain a stray definition of size_t. Take care
2201 * not to match ssize_t or mere uses of size_t.
2202 */
2203 fix = {
2204 hackname = systypes_stdlib_size_t;
2205 files = sys/types.h;
2206 files = stdlib.h;
2207 select = "typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t";
2208 bypass = "_(GCC|BSD)_SIZE_T";
2209
2210 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/i\\\n"
2211 "#ifndef _GCC_SIZE_T\\\n"
2212 "#define _GCC_SIZE_T\n";
2213
2214 sed = "/typedef[ \t][ \t]*[A-Za-z_][ \tA-Za-z_]*[ \t]size_t/a\\\n"
2215 "#endif\n";
2216 };
2217
2218
2219 /*
2220 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
2221 * in string.h on sysV68
2222 * Correct the return type for strlen in string.h on Lynx.
2223 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
2224 * Add missing const for strdup on OSF/1 V3.0.
2225 * On sysV88 layout is slightly different.
2226 */
2227 fix = {
2228 hackname = sysv68_string;
2229 files = string.h;
2230
2231 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
2232 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
2233 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
2234 sed = "/^extern char$/N";
2235 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
2236 sed = "/^\tstrncmp(),$/N";
2237 sed = "s/^\\(\tstrncmp()\\),\\n\\(\tstrlen(),\\)$/\\1;\\\n"
2238 "extern unsigned int\\\n\\2/";
2239 sed = "/^extern int$/N";
2240 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
2241 };
2242
2243
2244 /*
2245 * Fix return type of exit and abort in <stdlib.h>
2246 */
2247 fix = {
2248 hackname = sysz_stdlib_for_sun;
2249 files = stdlib.h;
2250
2251 sed = "s/int\tabort/void\tabort/g";
2252 sed = "s/int\tfree/void\tfree/g";
2253 sed = "s/char[ \t]*\\*[ \t]*calloc/void \\*\tcalloc/g";
2254 sed = "s/char[ \t]*\\*[ \t]*malloc/void \\*\tmalloc/g";
2255 sed = "s/char[ \t]*\\*[ \t]*realloc/void \\*\trealloc/g";
2256 sed = "s/char[ \t]*\\*[ \t]*bsearch/void \\*\tbsearch/g";
2257 sed = "s/int[ \t][ \t]*exit/void\texit/g";
2258 };
2259
2260
2261 /*
2262 * Fix this Sun file to avoid interfering with stddef.h.
2263 * We use a funny name to ensure it follows 'systypes' fix.
2264 */
2265 fix = {
2266 hackname = sysz_stdtypes_for_sun;
2267 files = sys/stdtypes.h;
2268 sed = "/[\t ]size_t.*;/i\\\n"
2269 "#ifndef _GCC_SIZE_T\\\n"
2270 "#define _GCC_SIZE_T\n";
2271
2272 sed = "/[\t ]size_t.*;/a\\\n"
2273 "#endif\n";
2274
2275 sed = "/[\t ]ptrdiff_t.*;/i\\\n"
2276 "#ifndef _GCC_PTRDIFF_T\\\n"
2277 "#define _GCC_PTRDIFF_T\n";
2278
2279 sed = "/[\t ]ptrdiff_t.*;/a\\\n"
2280 "#endif\n";
2281
2282 sed = "/[\t ]wchar_t.*;/i\\\n"
2283 "#ifndef _GCC_WCHAR_T\\\n"
2284 "#define _GCC_WCHAR_T\n";
2285
2286 sed = "/[\t ]wchar_t.*;/a\\\n"
2287 "#endif\n";
2288 };
2289
2290
2291 /*
2292 * if the #if says _cplusplus, not the double underscore __cplusplus
2293 * that it should be
2294 */
2295 fix = {
2296 hackname = tinfo_cplusplus;
2297 files = tinfo.h;
2298 select = "[ \t]_cplusplus";
2299 sed = "s/[ \t]_cplusplus/ __cplusplus/";
2300 };
2301
2302
2303 /*
2304 * Ultrix V4.[35] puts the declaration of uname before the definition
2305 * of struct utsname, so the prototype (added by fixproto) causes havoc.
2306 */
2307 fix = {
2308 hackname = ultrix_fix_fixproto;
2309 files = sys/utsname.h;
2310 select = ULTRIX;
2311 sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
2312 "struct utsname;\n";
2313 };
2314
2315
2316 /*
2317 * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
2318 */
2319 fix = {
2320 hackname = ultrix_atof_param;
2321 files = math.h;
2322 select = "atof\\([ \t]*char";
2323
2324 sed = "s@atof(\\([ \t]*char[ \t]*\\*[^)]*\\))@atof(const \\1)@";
2325 };
2326
2327
2328 /*
2329 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
2330 */
2331 fix = {
2332 hackname = ultrix_const;
2333 files = stdio.h;
2334
2335 sed = 's@perror( char \*__s );@perror( const char *__s );@';
2336 sed = 's@fputs( char \*__s,@fputs( const char *__s,@';
2337 sed = 's@fopen( char \*__filename, char \*__type );@'
2338 'fopen( const char *__filename, const char *__type );@';
2339 sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@';
2340 sed = 's@fscanf( FILE \*__stream, char \*__format,@'
2341 'fscanf( FILE *__stream, const char *__format,@';
2342 sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
2343 sed = 's@sscanf( char \*__s, char \*__format,@'
2344 'sscanf( const char *__s, const char *__format,@';
2345 sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
2346 sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
2347 };
2348
2349
2350 /*
2351 * Check for bad #ifdef line (in Ultrix 4.1)
2352 */
2353 fix = {
2354 hackname = ultrix_ifdef;
2355 select = "#ifdef KERNEL[ \t]*[^ \t]";
2356 files = sys/file.h;
2357 sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
2358 };
2359
2360
2361 /*
2362 * Avoid nested comments on Ultrix 4.3.
2363 */
2364 fix = {
2365 hackname = ultrix_nested_cmnt;
2366 files = rpc/svc.h;
2367 sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
2368 };
2369
2370
2371 /*
2372 * Check for superfluous `static' (in Ultrix 4.2)
2373 * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
2374 */
2375 fix = {
2376 hackname = ultrix_static;
2377 files = machine/cpu.h;
2378 select = '#include "r[34]_cpu';
2379 sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
2380 sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
2381 sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
2382 };
2383
2384
2385 /*
2386 * Fix multiple defines for NULL
2387 */
2388 fix = {
2389 hackname = undefine_null;
2390 select = "^#[ \t]*define[ \t]*[ \t]NULL[ \t\r]";
2391 bypass = "#[ \t]*(ifn|un)def[ \t]*[ \t]NULL($|[ \t\r])";
2392 sed = "/^#[ \t]*define[ \t][ \t]*NULL[ \t\r]/i\\\n"
2393 "#undef NULL\n";
2394 };
2395
2396
2397 /*
2398 * If arpa/inet.h prototypes are incompatible with the ones we just
2399 * installed in <sys/byteorder.h>, just remove the protos.
2400 * Because of this close association, this patch must be applied only
2401 * on those systems where the replacement byteorder header is installed.
2402 */
2403 fix = {
2404 hackname = unixware7_byteorder_fix;
2405 files = arpa/inet.h;
2406 select = "in_port_t";
2407 #ifndef SVR5
2408 mach = "*-*-sysv4*";
2409 mach = "i[34567]86-*-sysv5*";
2410 mach = "i[34567]86-*-udk*";
2411 mach = "i[34567]86-*-solaris2.[0-4]";
2412 mach = "powerpcle-*-solaris2.[0-4]";
2413 mach = "sparc-*-solaris2.[0-4]";
2414 #endif /* SVR5 */
2415 sed = '/^extern.*htons.*(in_port_t)/d';
2416 sed = '/^extern.*ntohs.*(in_port_t)/d';
2417 };
2418
2419
2420 /*
2421 * Fix definitions of macros used by va-i960.h in VxWorks header file.
2422 */
2423 fix = {
2424 hackname = va_i960_macro;
2425 files = arch/i960/archI960.h;
2426 select = "__(vsiz|vali|vpad|alignof__)";
2427 sed = "s/__vsiz/__vxvsiz/";
2428 sed = "s/__vali/__vxvali/";
2429 sed = "s/__vpad/__vxvpad/";
2430 sed = "s/__alignof__/__vxalignof__/";
2431 };
2432
2433
2434 /*
2435 * AIX headers define NULL to be cast to a void pointer,
2436 * which is illegal in ANSI C++.
2437 */
2438 fix = {
2439 hackname = void_null;
2440 files = curses.h;
2441 files = dbm.h;
2442 files = locale.h;
2443 files = stdio.h;
2444 files = stdlib.h;
2445 files = string.h;
2446 files = time.h;
2447 files = unistd.h;
2448 files = sys/dir.h;
2449 files = sys/param.h;
2450 files = sys/types.h;
2451 select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void";
2452 sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)"
2453 "/#define NULL 0/";
2454 };
2455
2456
2457 /*
2458 * Make VxWorks header which is almost gcc ready fully gcc ready.
2459 */
2460 fix = {
2461 hackname = vxworks_gcc_problem;
2462 files = types/vxTypesBase.h;
2463 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
2464
2465 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
2466 "#if 1/";
2467
2468 sed = "/[ \t]size_t/i\\\n"
2469 "#ifndef _GCC_SIZE_T\\\n"
2470 "#define _GCC_SIZE_T\n";
2471
2472 sed = "/[ \t]size_t/a\\\n"
2473 "#endif\n";
2474
2475 sed = "/[ \t]ptrdiff_t/i\\\n"
2476 "#ifndef _GCC_PTRDIFF_T\\\n"
2477 "#define _GCC_PTRDIFF_T\n";
2478
2479 sed = "/[ \t]ptrdiff_t/a\\\n"
2480 "#endif\n";
2481
2482 sed = "/[ \t]wchar_t/i\\\n"
2483 "#ifndef _GCC_WCHAR_T\\\n"
2484 "#define _GCC_WCHAR_T\n";
2485
2486 sed = "/[ \t]wchar_t/a\\\n"
2487 "#endif\n";
2488 };
2489
2490
2491 /*
2492 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
2493 */
2494 fix = {
2495 hackname = vxworks_needs_vxtypes;
2496 files = time.h;
2497 select = "uint_t[ \t][ \t]*_clocks_per_sec";
2498 sed = "s/uint_t/unsigned int/";
2499 };
2500
2501
2502 /*
2503 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2504 */
2505 fix = {
2506 hackname = vxworks_needs_vxworks;
2507 files = sys/stat.h;
2508 test = " -r types/vxTypesOld.h";
2509 test = " -n \"`egrep '#include' $file`\"";
2510 test = " -n \"`egrep ULONG $file`\"";
2511 select = "#[ \t]define[ \t][ \t]*__INCstath";
2512
2513 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
2514 "#include <types/vxTypesOld.h>\n";
2515 };
2516
2517
2518 /*
2519 * Another bad dependency in VxWorks 5.2 <time.h>.
2520 */
2521 fix = {
2522 hackname = vxworks_time;
2523 files = time.h;
2524 select = "VOIDFUNCPTR";
2525 test = " -r vxWorks.h";
2526 sed = "/VOIDFUNCPTR/i\\\n"
2527 "#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
2528 "#ifdef __cplusplus\\\n"
2529 "typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
2530 "#else\\\n"
2531 "typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
2532 "#endif\\\n"
2533 "#define __gcc_VOIDFUNCPTR_defined\\\n"
2534 "#endif\n";
2535
2536 sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g";
2537 };
2538
2539
2540 /*
2541 * There are several name conflicts with C++ reserved words in X11 header
2542 * files. These are fixed in some versions, so don't do the fixes if
2543 * we find __cplusplus in the file. These were found on the RS/6000.
2544 */
2545 fix = {
2546 hackname = x11_class;
2547 files = X11/ShellP.h;
2548 bypass = __cplusplus;
2549 sed = "/char \\*class;/i\\\n"
2550 "#ifdef __cplusplus\\\n"
2551 "\tchar *c_class;\\\n"
2552 "#else\n";
2553 sed = "/char \\*class;/a\\\n"
2554 "#endif\n";
2555 };
2556
2557
2558 /*
2559 * class in Xm/BaseClassI.h
2560 */
2561 fix = {
2562 hackname = x11_class_usage;
2563 files = Xm/BaseClassI.h;
2564 bypass = "__cplusplus";
2565 sed = "s/ class[)]/ c_class)/g";
2566 };
2567
2568
2569 /*
2570 * new in Xm/Traversal.h
2571 */
2572 fix = {
2573 hackname = x11_new;
2574 files = Xm/Traversal.h;
2575 bypass = __cplusplus;
2576
2577 sed = "/Widget\told, new;/i\\\n"
2578 "#ifdef __cplusplus\\\n"
2579 "\tWidget\told, c_new;\\\n"
2580 "#else\n";
2581
2582 sed = "/Widget\told, new;/a\\\n"
2583 "#endif\n";
2584
2585 sed = "s/Widget new,/Widget c_new,/g";
2586 };
2587
2588
2589 /*
2590 * Incorrect sprintf declaration in X11/Xmu.h
2591 */
2592 fix = {
2593 hackname = x11_sprintf;
2594 files = X11/Xmu.h;
2595 files = X11/Xmu/Xmu.h;
2596 select = 'sprintf\(\)';
2597
2598 sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
2599 "extern char *\tsprintf();\\\n"
2600 "#endif /* !defined __STDC__ */,";
2601 };
2602
2603 /*EOF*/
This page took 0.156091 seconds and 5 git commands to generate.