* config/sh/t-sh: Use $(gcc_compile) instead of $(compile).
[official-gcc.git] / fixincludes / inclhack.def
blob7445d99f00b981ce85d56b337419a00214f5e02d
1 /* -*- Mode: C -*- */
3 autogen definitions fixincl;
5 /* Define all the fixes we know about for repairing damaged headers.
6 Please see the README before adding or changing entries in this file.
8 This is the sort command:
10 blocksort output=inclhack.sorted \
11 pattern='^/\*$' \
12 trailer='^/\*EOF\*[/]' \
13 input=inclhack.def \
14 key='hackname[ ]*=[ ]*(.*);'
16 Set up a debug test so we can make the templates emit special
17 code while debugging these fixes: */
19 #ifdef DEBUG
20 FIXINC_DEBUG = yes;
21 #endif
23 /* On AIX when _LARGE_FILES is defined stdio.h defines fopen to
24 * fopen64 etc. and this causes problems when building with g++
25 * because cstdio udefs everything from stdio.h, leaving us with
26 * ::fopen has not been declared errors. This fixes stdio.h to
27 * undef those defines and use __asm__ to alias the symbols if
28 * building with g++ and -D_LARGE_FILES
30 fix = {
31 hackname = AAB_aix_stdio;
32 files = stdio.h;
33 select = "define fopen fopen64";
34 mach = "*-*-aix*";
35 test-text = ''; /* no way to test */
37 c_fix = wrap;
39 c_fix_arg = "";
41 c_fix_arg = <<- _EOArg_
43 #if defined __GNUG__ && defined _LARGE_FILES && defined __cplusplus
44 #define __need__aix_stdio_h_fix
45 #ifdef __need__aix_stdio_h_fix
46 #undef fseeko
47 #undef ftello
48 #undef fgetpos
49 #undef fsetpos
50 #undef fopen
51 #undef freopen
52 /* Alias the symbols using asm */
53 extern "C" {
54 extern int fgetpos(FILE *, fpos64_t *) __asm__("fgetpos64");
55 extern FILE *fopen(const char *, const char *) __asm__("fopen64");
56 extern FILE *freopen(const char *, const char *, FILE *) __asm__("freopen64");
57 extern int fseeko(FILE *, off64_t, int) __asm__("fseeko64");
58 extern int fsetpos(FILE *, const fpos64_t *) __asm__("fsetpos64");
59 extern off64_t ftello(FILE *) __asm__("ftello64");
61 #endif
62 #endif
64 _EOArg_;
69 * On Mac OS 10.3.9, the 'long double' functions are available in
70 * libSystem, but are not prototyped in math.h.
72 fix = {
73 hackname = AAB_darwin7_9_long_double_funcs;
74 mach = "*-*-darwin7.9*";
75 files = architecture/ppc/math.h;
76 bypass = "powl";
77 replace = <<- _EndOfHeader_
78 /* This file prototypes the long double functions available on Mac OS
79 10.3.9. */
80 #ifndef __MATH__
81 # undef __APPLE_CC__
82 # define __APPLE_CC__ 1345
83 # include_next <architecture/ppc/math.h>
84 # undef __APPLE_CC__
85 # define __APPLE_CC__ 1
86 # ifndef __LIBMLDBL_COMPAT
87 # ifdef __LONG_DOUBLE_128__
88 # define __LIBMLDBL_COMPAT(sym) __asm("_" #sym "$LDBL128")
89 # else
90 # define __LIBMLDBL_COMPAT(sym)
91 # endif /* __LONG_DOUBLE_128__ */
92 # endif /* __LIBMLDBL_COMPAT */
93 # ifdef __cplusplus
94 extern "C" {
95 # endif
96 extern long double acosl( long double ) __LIBMLDBL_COMPAT(acosl);
97 extern long double asinl( long double ) __LIBMLDBL_COMPAT(asinl);
98 extern long double atanl( long double ) __LIBMLDBL_COMPAT(atanl);
99 extern long double atan2l( long double, long double ) __LIBMLDBL_COMPAT(atan2l);
100 extern long double cosl( long double ) __LIBMLDBL_COMPAT(cosl);
101 extern long double sinl( long double ) __LIBMLDBL_COMPAT(sinl);
102 extern long double tanl( long double ) __LIBMLDBL_COMPAT(tanl);
103 extern long double acoshl( long double ) __LIBMLDBL_COMPAT(acoshl);
104 extern long double asinhl( long double ) __LIBMLDBL_COMPAT(asinhl);
105 extern long double atanhl( long double ) __LIBMLDBL_COMPAT(atanhl);
106 extern long double coshl( long double ) __LIBMLDBL_COMPAT(coshl);
107 extern long double sinhl( long double ) __LIBMLDBL_COMPAT(sinhl);
108 extern long double tanhl( long double ) __LIBMLDBL_COMPAT(tanhl);
109 extern long double expl( long double ) __LIBMLDBL_COMPAT(expl);
110 extern long double exp2l( long double ) __LIBMLDBL_COMPAT(exp2l);
111 extern long double expm1l( long double ) __LIBMLDBL_COMPAT(expm1l);
112 extern long double logl( long double ) __LIBMLDBL_COMPAT(logl);
113 extern long double log10l( long double ) __LIBMLDBL_COMPAT(log10l);
114 extern long double log2l( long double ) __LIBMLDBL_COMPAT(log2l);
115 extern long double log1pl( long double ) __LIBMLDBL_COMPAT(log1pl);
116 extern long double logbl( long double ) __LIBMLDBL_COMPAT(logbl);
117 extern long double modfl( long double, long double * ) __LIBMLDBL_COMPAT(modfl);
118 extern long double ldexpl( long double, int ) __LIBMLDBL_COMPAT(ldexpl);
119 extern long double frexpl( long double, int * ) __LIBMLDBL_COMPAT(frexpl);
120 extern int ilogbl( long double ) __LIBMLDBL_COMPAT(ilogbl);
121 extern long double scalbnl( long double, int ) __LIBMLDBL_COMPAT(scalbnl);
122 extern long double scalblnl( long double, long int ) __LIBMLDBL_COMPAT(scalblnl);
123 extern long double fabsl( long double ) __LIBMLDBL_COMPAT(fabsl);
124 extern long double cbrtl( long double ) __LIBMLDBL_COMPAT(cbrtl);
125 extern long double hypotl( long double, long double ) __LIBMLDBL_COMPAT(hypotl);
126 extern long double powl( long double, long double ) __LIBMLDBL_COMPAT(powl);
127 extern long double sqrtl( long double ) __LIBMLDBL_COMPAT(sqrtl);
128 extern long double erfl( long double ) __LIBMLDBL_COMPAT(erfl);
129 extern long double erfcl( long double ) __LIBMLDBL_COMPAT(erfcl);
130 extern long double lgammal( long double ) __LIBMLDBL_COMPAT(lgammal);
131 extern long double tgammal( long double ) __LIBMLDBL_COMPAT(tgammal);
132 extern long double ceill( long double ) __LIBMLDBL_COMPAT(ceill);
133 extern long double floorl( long double ) __LIBMLDBL_COMPAT(floorl);
134 extern long double nearbyintl( long double ) __LIBMLDBL_COMPAT(nearbyintl);
135 extern long double rintl( long double ) __LIBMLDBL_COMPAT(rintl);
136 extern long int lrintl( long double ) __LIBMLDBL_COMPAT(lrintl);
137 extern long long int llrintl( long double ) __LIBMLDBL_COMPAT(llrintl);
138 extern long double roundl( long double ) __LIBMLDBL_COMPAT(roundl);
139 extern long int lroundl( long double ) __LIBMLDBL_COMPAT(lroundl);
140 extern long long int llroundl( long double ) __LIBMLDBL_COMPAT(llroundl);
141 extern long double truncl( long double ) __LIBMLDBL_COMPAT(truncl);
142 extern long double fmodl( long double, long double) __LIBMLDBL_COMPAT(fmodl);
143 extern long double remainderl( long double, long double ) __LIBMLDBL_COMPAT(remainderl);
144 extern long double remquol( long double, long double, int * ) __LIBMLDBL_COMPAT(remquol);
145 extern long double copysignl( long double, long double ) __LIBMLDBL_COMPAT(copysignl);
146 extern long double nanl( const char * ) __LIBMLDBL_COMPAT(nanl);
147 extern long double nextafterl( long double, long double ) __LIBMLDBL_COMPAT(nextafterl);
148 extern long double nexttowardl( long double, long double ) __LIBMLDBL_COMPAT(nexttowardl);
149 extern long double fdiml( long double, long double ) __LIBMLDBL_COMPAT(fdiml);
150 extern long double fmaxl( long double, long double ) __LIBMLDBL_COMPAT(fmaxl);
151 extern long double fminl( long double, long double ) __LIBMLDBL_COMPAT(fminl);
152 extern long double fmal( long double, long double, long double ) __LIBMLDBL_COMPAT(fmal);
153 # ifdef __cplusplus
155 # endif
156 #endif /* __MATH__ */
157 _EndOfHeader_;
162 * ... and for the previous fix to be useful, you have to not use ""
163 * includes.
165 fix = {
166 hackname = AAB_darwin7_9_long_double_funcs_2;
167 mach = "*-*-darwin7.9*";
168 files = math.h;
169 select = '#include[ \t]+\"';
170 c_fix = format;
171 c_fix_arg = "%1<%2.h>";
173 c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
175 test_text = '#include "architecture/ppc/math.h"';
180 * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
182 fix = {
183 hackname = AAB_fd_zero_asm_posix_types_h;
184 files = asm/posix_types.h;
185 mach = 'i[34567]86-*-linux*';
186 bypass = '} while';
187 bypass = 'x86_64';
188 bypass = 'posix_types_64';
191 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
192 * the start, so that if #include_next gets another instance of
193 * the wrapper, this will follow the #include_next chain until
194 * we arrive at the real <asm/posix_types.h>.
196 replace = <<- _EndOfHeader_
197 /* This file fixes a bug in the __FD_ZERO macro
198 for older versions of the Linux kernel. */
199 #ifndef _POSIX_TYPES_H_WRAPPER
200 #include <features.h>
201 #include_next <asm/posix_types.h>
203 #if defined(__FD_ZERO) && !defined(__GLIBC__)
204 #undef __FD_ZERO
205 #define __FD_ZERO(fdsetp) \
206 do { \
207 int __d0, __d1; \
208 __asm__ __volatile__("cld ; rep ; stosl" \
209 : "=&c" (__d0), "=&D" (__d1) \
210 : "a" (0), "0" (__FDSET_LONGS), \
211 "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \
212 } while (0)
213 #endif
215 #define _POSIX_TYPES_H_WRAPPER
216 #endif /* _POSIX_TYPES_H_WRAPPER */
217 _EndOfHeader_;
222 * This fixes __FD_ZERO bug for glibc-1.x
224 fix = {
225 hackname = AAB_fd_zero_gnu_types_h;
226 files = gnu/types.h;
227 mach = 'i[34567]86-*-linux*';
230 * Define _TYPES_H_WRAPPER at the end of the wrapper, not
231 * the start, so that if #include_next gets another instance of
232 * the wrapper, this will follow the #include_next chain until
233 * we arrive at the real <gnu/types.h>.
235 replace = <<- _EndOfHeader_
236 /* This file fixes a bug in the __FD_ZERO macro present in glibc 1.x. */
237 #ifndef _TYPES_H_WRAPPER
238 #include <features.h>
239 #include_next <gnu/types.h>
241 #if defined(__FD_ZERO) && !defined(__GLIBC__)
242 #undef __FD_ZERO
243 # define __FD_ZERO(fdsetp) \
244 do { \
245 int __d0, __d1; \
246 __asm__ __volatile__("cld ; rep ; stosl" \
247 : "=&c" (__d0), "=&D" (__d1) \
248 : "a" (0), "0" (__FDSET_LONGS), \
249 "1" ((__fd_set *) (fdsetp)) :"memory"); \
250 } while (0)
251 #endif
253 #define _TYPES_H_WRAPPER
254 #endif /* _TYPES_H_WRAPPER */
255 _EndOfHeader_;
260 * This fixes __FD_ZERO bug for glibc-2.0.x
262 fix = {
263 hackname = AAB_fd_zero_selectbits_h;
264 files = selectbits.h;
265 mach = 'i[34567]86-*-linux*';
268 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not
269 * the start, so that if #include_next gets another instance of
270 * the wrapper, this will follow the #include_next chain until
271 * we arrive at the real <selectbits.h>.
273 replace = <<- _EndOfHeader_
274 /* This file fixes a bug in the __FD_ZERO macro present in glibc 2.0.x. */
275 #ifndef _SELECTBITS_H_WRAPPER
276 #include <features.h>
277 #include_next <selectbits.h>
279 #if defined(__FD_ZERO) && defined(__GLIBC__) \\
280 && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 \\
281 && __GLIBC_MINOR__ == 0
282 #undef __FD_ZERO
283 #define __FD_ZERO(fdsetp) \\
284 do { \\
285 int __d0, __d1; \\
286 __asm__ __volatile__ ("cld; rep; stosl" \\
287 : "=&c" (__d0), "=&D" (__d1) \\
288 : "a" (0), "0" (sizeof (__fd_set) \\
289 / sizeof (__fd_mask)), \\
290 "1" ((__fd_mask *) (fdsetp)) \\
291 : "memory"); \\
292 } while (0)
293 #endif
295 #define _SELECTBITS_H_WRAPPER
296 #endif /* _SELECTBITS_H_WRAPPER */
297 _EndOfHeader_;
302 * Solaris <sys/varargs.h> is a DDK (aka kernel-land) header providing
303 * the same interface as <stdarg.h>. No idea why they couldn't have just
304 * used the standard header.
306 fix = {
307 hackname = AAB_solaris_sys_varargs_h;
308 files = "sys/varargs.h";
309 mach = '*-*-solaris*';
310 replace = <<- _EndOfHeader_
311 #ifdef __STDC__
312 #include <stdarg.h>
313 #else
314 #include <varargs.h>
315 #endif
316 _EndOfHeader_;
321 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
322 * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
323 * many other systems have similar text but correct versions of the file.
324 * To ensure only Sun's is fixed, we grep for a likely unique string.
325 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
327 fix = {
328 hackname = AAB_sun_memcpy;
329 files = memory.h;
330 select = "/\\*\t@\\(#\\)"
331 "(head/memory.h\t50.1\t "
332 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
334 replace = <<- _EndOfHeader_
335 /* This file was generated by fixincludes */
336 #ifndef __memory_h__
337 #define __memory_h__
339 #ifdef __STDC__
340 extern void *memccpy();
341 extern void *memchr();
342 extern void *memcpy();
343 extern void *memset();
344 #else
345 extern char *memccpy();
346 extern char *memchr();
347 extern char *memcpy();
348 extern char *memset();
349 #endif /* __STDC__ */
351 extern int memcmp();
353 #endif /* __memory_h__ */
354 _EndOfHeader_;
359 * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
360 * which only is provided by AIX xlc C99.
362 fix = {
363 hackname = aix_complex;
364 mach = "*-*-aix*";
365 files = complex.h;
366 select = "#define[ \t]_Complex_I[ \t]__I";
367 c_fix = format;
368 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
369 test_text = "#define _Complex_I __I\n";
373 * net/if_arp.h defines a variable fc_softc instead of adding a
374 * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
376 fix = {
377 hackname = aix_net_if_arp;
378 mach = "*-*-aix*";
379 files = "net/if_arp.h";
380 select = "^struct fc_softc \\{";
381 c_fix = format;
382 c_fix_arg = "typedef struct _fc_softc {";
383 test_text = "struct fc_softc {\n int a;\n};";
387 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
388 * which violates a requirement of ISO C.
390 fix = {
391 hackname = aix_pthread;
392 files = "pthread.h";
393 select = "(#define [A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
394 c_fix = format;
395 c_fix_arg = "%1 %2";
396 test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
397 "{...init stuff...}";
402 * AIX stdint.h fixes.
404 fix = {
405 hackname = aix_stdint_1;
406 mach = "*-*-aix*";
407 files = stdint-aix.h, stdint.h;
408 select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
409 "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
410 c_fix = format;
411 c_fix_arg = "#define UINT8_MAX (255)\n"
412 "#define UINT16_MAX (65535)";
413 test_text = "#define UINT8_MAX (255U)\n"
414 "#define UINT16_MAX (65535U)";
418 fix = {
419 hackname = aix_stdint_2;
420 mach = "*-*-aix*";
421 files = stdint-aix.h, stdint.h;
422 select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
423 "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
424 "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
425 "#else\n"
426 "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
427 "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
428 "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
429 c_fix = format;
430 c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
431 "#define INTPTR_MAX 9223372036854775807L\n"
432 "#define UINTPTR_MAX 18446744073709551615UL\n"
433 "#else\n"
434 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
435 "#define INTPTR_MAX 2147483647L\n"
436 "#define UINTPTR_MAX 4294967295UL";
437 test_text = "#define INTPTR_MIN INT64_MIN\n"
438 "#define INTPTR_MAX INT64_MAX\n"
439 "#define UINTPTR_MAX UINT64_MAX\n"
440 "#else\n"
441 "#define INTPTR_MIN INT32_MIN\n"
442 "#define INTPTR_MAX INT32_MAX\n"
443 "#define UINTPTR_MAX UINT32_MAX";
447 fix = {
448 hackname = aix_stdint_3;
449 mach = "*-*-aix*";
450 files = stdint-aix.h, stdint.h;
451 select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
452 "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
453 "#else\n"
454 "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
455 "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
456 c_fix = format;
457 c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
458 "#define PTRDIFF_MAX 9223372036854775807L\n"
459 "#else\n"
460 "#define PTRDIFF_MIN (-2147483647L - 1)\n"
461 "#define PTRDIFF_MAX 2147483647L";
462 test_text = "#define PTRDIFF_MIN INT64_MIN\n"
463 "#define PTRDIFF_MAX INT64_MAX\n"
464 "#else\n"
465 "#define PTRDIFF_MIN INT32_MIN\n"
466 "#define PTRDIFF_MAX INT32_MAX";
470 fix = {
471 hackname = aix_stdint_4;
472 mach = "*-*-aix*";
473 files = stdint-aix.h, stdint.h;
474 select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
475 "#else\n"
476 "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
477 c_fix = format;
478 c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
479 "#else\n"
480 "#define SIZE_MAX 4294967295UL";
481 test_text = "#define SIZE_MAX UINT64_MAX\n"
482 "#else\n"
483 "#define SIZE_MAX UINT32_MAX";
487 fix = {
488 hackname = aix_stdint_5;
489 mach = "*-*-aix*";
490 files = stdint-aix.h, stdint.h;
491 select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
492 "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
493 c_fix = format;
494 c_fix_arg = "#define UINT8_C(c) c\n"
495 "#define UINT16_C(c) c";
496 test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
497 "#define UINT16_C(c) __CONCAT__(c,U)";
502 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
503 * in an otherwise harmless (and #ifed out) macro definition
505 fix = {
506 hackname = aix_sysmachine;
507 files = sys/machine.h;
508 select = "\\\\ +\n";
509 c_fix = format;
510 c_fix_arg = "\\\n";
511 test_text = "#define FOO \\\n"
512 " bar \\ \n baz \\ \n bat";
517 * sys/wait.h on AIX 5.2 defines macros that have both signed and
518 * unsigned types in conditional expressions.
520 fix = {
521 hackname = aix_syswait_2;
522 files = sys/wait.h;
523 select = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)';
524 c_fix = format;
525 c_fix_arg = "? (int)%1";
526 test_text = "#define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
531 * sys/signal.h on some versions of AIX uses volatile in the typedef of
532 * sig_atomic_t, which causes gcc to generate a warning about duplicate
533 * volatile when a sig_atomic_t variable is declared volatile, as
534 * required by ANSI C.
536 fix = {
537 hackname = aix_volatile;
538 files = sys/signal.h;
539 select = "typedef volatile int sig_atomic_t";
540 c_fix = format;
541 c_fix_arg = "typedef int sig_atomic_t";
542 test_text = "typedef volatile int sig_atomic_t;";
547 * Fix __assert declaration in assert.h on Alpha OSF/1.
549 fix = {
550 hackname = alpha___assert;
551 files = "assert.h";
552 select = '__assert\(char \*, char \*, int\)';
553 c_fix = format;
554 c_fix_arg = "__assert(const char *, const char *, int)";
555 test_text = 'extern void __assert(char *, char *, int);';
560 * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 headers.
562 fix = {
563 hackname = alpha___extern_prefix;
564 select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n"
565 "(#[ \t]*pragma[ \t]*extern_prefix.*)";
567 mach = "alpha*-dec-osf*";
568 c_fix = format;
569 c_fix_arg = "%1 (defined(__DECC) || defined(__PRAGMA_EXTERN_PREFIX))\n%3";
571 test_text = "#ifdef __DECC\n"
572 "#pragma extern_prefix \"_P\"\n"
573 "# if defined(__DECC)\n"
574 "# pragma extern_prefix \"_E\"\n"
575 "# if !defined(_LIBC_POLLUTION_H_) && defined(__DECC)\n"
576 "# pragma extern_prefix \"\"";
581 * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 <standards.h>.
583 fix = {
584 hackname = alpha___extern_prefix_standards;
585 files = standards.h;
586 select = ".*!defined\\(_LIBC_POLLUTION_H_\\) && !defined\\(__DECC\\)";
588 mach = "alpha*-dec-osf*";
589 c_fix = format;
590 c_fix_arg = "%0 && !defined(__PRAGMA_EXTERN_PREFIX)";
592 test_text = "#if (_ISO_C_SOURCE>=19990L) "
593 "&& !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
598 * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/mount.h> and
599 * <sys/stat.h>. The tests for __DECC are special in various ways, so
600 * alpha__extern_prefix cannot be used.
602 fix = {
603 hackname = alpha___extern_prefix_sys_stat;
604 files = sys/stat.h;
605 files = sys/mount.h;
606 select = "#[ \t]*if[ \t]*defined\\(__DECC\\)";
608 mach = "alpha*-dec-osf5*";
609 c_fix = format;
610 c_fix_arg = "%0 || defined(__PRAGMA_EXTERN_PREFIX)";
612 test_text = "# if defined(__DECC)";
617 * Fix assert macro in assert.h on Alpha OSF/1.
618 * The superfluous int cast breaks C++.
620 fix = {
621 hackname = alpha_assert;
622 files = "assert.h";
623 select = "(#[ \t]*" 'define assert\(EX\).*)\(\(int\) \(EX\)\)';
624 c_fix = format;
625 c_fix_arg = "%1(EX)";
626 test_text = '#define assert(EX) (((int) (EX)) ? (void)0 '
627 ': __assert(#EX, __FILE__, __LINE__))';
632 * Fix #defines under Alpha OSF/1:
633 * The following files contain '#pragma extern_prefix "_FOO"' followed by
634 * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
635 * statements is to reduce namespace pollution. While these macros work
636 * properly in most cases, they don't allow you to take a pointer to the
637 * "something" being modified. To get around this limitation, change these
638 * statements to be of the form '#define something _FOOsomething'.
640 * sed ain't egrep, lesson 2463: sed can use self-referential
641 * regular expressions. In the substitute expression below,
642 * "\\1" and "\\2" refer to subexpressions found earlier in the
643 * same match. So, we continue to use sed. "extern_prefix" will
644 * be a rare match anyway...
646 fix = {
647 hackname = alpha_bad_lval;
649 select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
650 mach = "alpha*-dec-osf*";
652 sed =
653 "s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
654 "\\(_.*\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
656 test_text = '#pragma extern_prefix "_FOO"'"\n"
657 "#define something(x,y,z) _FOOsomething(x,y,z)\n"
658 "#define mumble _FOOmumble";
663 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
665 fix = {
666 hackname = alpha_getopt;
667 files = "stdio.h";
668 files = "stdlib.h";
669 select = 'getopt\(int, char \*\[\], *char \*\)';
670 c_fix = format;
671 c_fix_arg = "getopt(int, char *const[], const char *)";
672 test_text = 'extern int getopt(int, char *[], char *);';
677 * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
679 fix = {
680 hackname = alpha_if_semicolon;
681 files = net/if.h;
682 select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
683 c_fix = format;
684 c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
685 test_text = ' struct sockaddr vmif_paddr /* protocol address */';
690 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
692 fix = {
693 hackname = alpha_parens;
694 files = sym.h;
695 select = '#ifndef\(__mips64\)';
696 c_fix = format;
697 c_fix_arg = "#ifndef __mips64";
698 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
703 * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX <pthread.h>.
705 fix = {
706 hackname = alpha_pthread;
707 files = pthread.h;
708 select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)"
709 "|def _PTHREAD_ENV_DECC)(.*))\n"
710 "(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
712 mach = "alpha*-dec-osf*";
713 c_fix = format;
714 c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 "
715 "|| defined (__PRAGMA_EXTERN_PREFIX)\n%5";
717 test_text = "# if defined (_PTHREAD_ENV_DECC) "
718 "|| defined (_PTHREAD_ENV_EPCC)\n"
719 "# define _PTHREAD_USE_PTDNAM_\n"
720 "# endif\n"
721 "# ifdef _PTHREAD_ENV_DECC\n"
722 "# define _PTHREAD_USE_PTDNAM_\n"
723 "# endif";
728 * Recognize GCC in Tru64 UNIX V5.1B <pthread.h>.
730 fix = {
731 hackname = alpha_pthread_gcc;
732 files = pthread.h;
733 select = "#else\n# error <pthread.h>: unrecognized compiler.";
735 mach = "alpha*-dec-osf*";
736 c_fix = format;
737 c_fix_arg = "#elif defined (__GNUC__)\n"
738 "# define _PTHREAD_ENV_GCC\n"
739 "%0";
741 test_text = "# define _PTHREAD_ENV_INTELC\n"
742 "#else\n"
743 "# error <pthread.h>: unrecognized compiler.\n"
744 "#endif";
749 * Compaq Tru64 v5.1 defines all of its PTHREAD_*_INITIALIZER macros
750 * incorrectly, specifying less fields in the initializers than are
751 * defined in the corresponding structure types. Use of these macros
752 * in user code results in spurious warnings.
754 fix = {
755 hackname = alpha_pthread_init;
756 files = pthread.h;
757 select = ' \* @\(#\).RCSfile: pthread\.h,v \$'
758 ' .Revision: 1\.1\.33\.21 \$ \(DEC\)'
759 ' .Date: 2000/08/15 15:30:13 \$';
760 mach = "alpha*-dec-osf*";
761 sed = "s@MVALID\\(.*\\)A}@MVALID\\1A, 0, 0, 0, 0, 0, 0 }@\n"
762 "s@MVALID\\(.*\\)_}@MVALID\\1_, 0, 0, 0, 0 }@\n"
763 "s@CVALID\\(.*\\)A}@CVALID\\1A, 0, 0, 0, 0 }@\n"
764 "s@CVALID\\(.*\\)_}@CVALID\\1_, 0, 0 }@\n"
765 "s@WVALID\\(.*\\)A}@WVALID\\1A, 0, 0, 0, 0, 0, 0, 0, 0, 0 }@\n"
766 "s@WVALID\\(.*\\)_}@WVALID\\1_, 0, 0, 0, 0, 0, 0, 0 }@\n";
767 test_text = <<- _EOText_
769 * @(#)_RCSfile: pthread.h,v $ _Revision: 1.1.33.21 $ (DEC) _Date: 2000/08/15 15:30:13 $
771 #ifndef _PTHREAD_NOMETER_STATIC
772 # define PTHREAD_MUTEX_INITIALIZER \
773 {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA}
774 # define PTHREAD_COND_INITIALIZER \
775 {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA}
776 # define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \
777 {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}
778 # define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \
779 {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}
780 #else
781 # define PTHREAD_MUTEX_INITIALIZER {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA}
782 # define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \
783 {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}
784 # define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \
785 {0, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}
786 #endif
788 #define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA}
789 #define PTHREAD_RWLOCK_INITWITHNAME_NP(_n_,_a_) \
790 {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA, _n_, _a_}
791 _EOText_;
796 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
797 * And OpenBSD.
799 fix = {
800 hackname = alpha_sbrk;
801 files = unistd.h;
802 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
803 c_fix = format;
804 c_fix_arg = "void *sbrk(";
805 test_text = "extern char* sbrk(ptrdiff_t increment);";
810 * For C++, avoid any typedef or macro definition of bool,
811 * and use the built in type instead.
812 * HP/UX 10.20 also has it in curses_colr/curses.h.
814 fix = {
815 hackname = avoid_bool_define;
816 files = curses.h;
817 files = curses_colr/curses.h;
818 files = term.h;
819 files = tinfo.h;
821 select = "#[ \t]*define[ \t]+bool[ \t]";
822 bypass = "__cplusplus";
824 c_fix = format;
825 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
826 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
828 test_text = "# define bool\t char \n";
832 fix = {
833 hackname = avoid_bool_type;
834 files = curses.h;
835 files = curses_colr/curses.h;
836 files = term.h;
837 files = tinfo.h;
839 select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
840 bypass = "__cplusplus";
842 c_fix = format;
843 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
845 test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
850 * For C++, avoid any typedef definition of wchar_t,
851 * and use the built in type instead.
852 * Don't do this for headers that are smart enough to do the right
853 * thing (recent [n]curses.h and Xlib.h).
854 * Don't do it for <linux/nls.h> which is never used from C++ anyway,
855 * and will be broken by the edit.
858 fix = {
859 hackname = avoid_wchar_t_type;
861 select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
862 bypass = "__cplusplus";
863 bypass = "_LINUX_NLS_H";
864 bypass = "XFree86: xc/lib/X11/Xlib\\.h";
866 c_fix = format;
867 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
869 test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
874 * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
876 fix = {
877 hackname = bad_struct_term;
878 files = curses.h;
879 select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
880 c_fix = format;
881 c_fix_arg = "struct term;";
883 test_text = 'typedef struct term;';
888 * Fix one other error in this file:
889 * a mismatched quote not inside a C comment.
891 fix = {
892 hackname = badquote;
893 files = sundev/vuid_event.h;
894 select = "doesn't";
895 c_fix = format;
896 c_fix_arg = "does not";
898 test_text = "/* doesn't have matched single quotes */";
903 * check for broken assert.h that needs stdio.h
905 fix = {
906 hackname = broken_assert_stdio;
907 files = assert.h;
908 select = stderr;
909 bypass = "include.*stdio\\.h";
910 c_fix = wrap;
911 c_fix_arg = "#include <stdio.h>\n";
912 test_text = "extern FILE* stderr;";
917 * check for broken assert.h that needs stdlib.h
919 fix = {
920 hackname = broken_assert_stdlib;
921 files = assert.h;
922 select = 'exit *\(|abort *\(';
923 bypass = "include.*stdlib\\.h";
924 c_fix = wrap;
925 c_fix_arg = "#ifdef __cplusplus\n"
926 "#include <stdlib.h>\n"
927 "#endif\n";
928 test_text = "extern void exit ( int );";
933 * Remove `extern double cabs' declarations from math.h.
934 * This conflicts with C99. Discovered on AIX.
935 * IRIX 5 and IRIX 6 before 6.5.18 (where C99 support was introduced)
936 * declares cabs() to take a struct __cabs_s argument.
937 * SunOS4 has its cabs() declaration followed by a comment which
938 * terminates on the following line.
939 * Darwin hides its broken cabs in architecture-specific subdirs.
941 fix = {
942 hackname = broken_cabs;
943 files = math.h, "architecture/*/math.h";
944 select = "^extern[ \t]+double[ \t]+cabs";
946 sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
947 sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
949 test_text = "#ifdef __STDC__\n"
950 "extern double cabs(struct dbl_hypot);\n"
951 "#else\n"
952 "extern double cabs();\n"
953 "#endif\n"
954 "extern double cabs ( _Complex z );\n"
955 "extern double cabs(); /* This is a comment\n"
956 " and it ends here. */\n"
957 "extern double cabs(struct __cabs_s);\n"
958 "extern long double cabsl( struct __cabsl_s );";
963 * Fixup Darwin's broken check for __builtin_nanf.
965 fix = {
966 hackname = broken_nan;
968 * It is tempting to omit the first "files" entry. Do not.
969 * The testing machinery will take the first "files" entry as the name
970 * of a test file to play with. It would be a nuisance to have a directory
971 * with the name "*".
973 files = "architecture/ppc/math.h";
974 files = "architecture/*/math.h";
975 select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
976 bypass = "powl";
977 c_fix = format;
978 c_fix_arg = "#if 1";
979 test_text = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
984 * Various systems derived from BSD4.4 contain a macro definition
985 * for vfscanf that interacts badly with requirements of builtin-attrs.def.
986 * Known to be fixed in FreeBSD 5 system headers.
988 fix = {
989 hackname = bsd_stdio_attrs_conflict;
990 mach = "*-*-*bsd*";
991 mach = "*-*-*darwin*";
992 files = stdio.h;
993 select = "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
994 c_fix = format;
995 c_fix_arg = '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n"
996 '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n"
997 'int vfscanf(FILE *, const char *, __builtin_va_list) '
998 '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");';
999 test_text = '#define vfscanf __svfscanf';
1004 * Fix various macros used to define ioctl numbers.
1005 * The traditional syntax was:
1007 * #define _CTRL(n, x) (('n'<<8)+x)
1008 * #define TCTRLCFOO _CTRL(T, 1)
1010 * but this does not work with the C standard, which disallows macro
1011 * expansion inside strings. We have to rewrite it thus:
1013 * #define _CTRL(n, x) ((n<<8)+x)
1014 * #define TCTRLCFOO _CTRL('T', 1)
1016 * The select expressions match too much, but the c_fix code is cautious.
1018 * CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
1020 fix = {
1021 hackname = ctrl_quotes_def;
1022 select = "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
1023 c_fix = char_macro_def;
1024 c_fix_arg = "CTRL";
1027 * This is two tests in order to ensure that the "CTRL(c)" can
1028 * be selected in isolation from the multi-arg format
1030 test_text = "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n";
1031 test_text = "#define _CTRL(c) ('c'&037)";
1034 fix = {
1035 hackname = ctrl_quotes_use;
1036 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1037 c_fix = char_macro_use;
1038 c_fix_arg = "CTRL";
1039 test_text = "#define TCTRLFOO BSD43_CTRL(T, 1)";
1044 * sys/mman.h on HP/UX is not C++ ready,
1045 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
1047 * rpc/types.h on OSF1/2.0 is not C++ ready,
1048 * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
1050 * The problem is the declaration of malloc.
1052 fix = {
1053 hackname = cxx_unready;
1054 files = sys/mman.h;
1055 files = rpc/types.h;
1056 select = '[^#]+malloc.*;'; /* Catch any form of declaration
1057 not within a macro. */
1058 bypass = '"C"|__BEGIN_DECLS';
1060 c_fix = wrap;
1061 c_fix_arg = "#ifdef __cplusplus\n"
1062 "extern \"C\" {\n"
1063 "#endif\n";
1064 c_fix_arg = "#ifdef __cplusplus\n"
1065 "}\n"
1066 "#endif\n";
1067 test_text = "extern void* malloc( size_t );";
1072 * On darwin8 and earlier, mach-o/swap.h isn't properly guarded
1073 * by 'extern "C"'. On darwin7 some mach/ headers aren't properly guarded.
1075 fix = {
1076 hackname = darwin_externc;
1077 mach = "*-*-darwin*";
1078 files = mach-o/swap.h;
1079 files = mach/mach_time.h;
1080 files = mach/mach_traps.h;
1081 files = mach/message.h;
1082 files = mach/mig.h;
1083 files = mach/semaphore.h;
1084 bypass = "extern \"C\"";
1085 bypass = "__BEGIN_DECLS";
1086 c_fix = wrap;
1087 c_fix_arg = "#ifdef __cplusplus\n"
1088 "extern \"C\" {\n"
1089 "#endif\n";
1090 c_fix_arg = "#ifdef __cplusplus\n"
1091 "}\n"
1092 "#endif\n";
1093 test_text = "extern void swap_fat_header();\n";
1098 * AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of
1099 * bad __GNUC__ tests.
1102 fix = {
1103 hackname = darwin_gcc4_breakage;
1104 mach = "*-*-darwin*";
1105 files = AvailabilityMacros.h;
1106 select = "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
1107 c_fix = format;
1108 c_fix_arg = "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
1109 test_text = "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
1110 "(__GNUC_MINOR__ >= 1)\n";
1115 * __private_extern__ doesn't exist in FSF GCC. Even if it did,
1116 * why would you ever put it in a system header file?
1118 fix = {
1119 hackname = darwin_private_extern;
1120 mach = "*-*-darwin*";
1121 files = mach-o/dyld.h;
1122 select = "__private_extern__ [a-z_]+ _dyld_";
1123 c_fix = format;
1124 c_fix_arg = "extern";
1125 c_fix_arg = "__private_extern__";
1126 test_text = "__private_extern__ int _dyld_func_lookup(\n"
1127 "const char *dyld_func_name,\n"
1128 "unsigned long *address);\n";
1133 * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
1134 * unsigned constants.
1136 fix = {
1137 hackname = darwin_stdint_1;
1138 mach = "*-*-darwin*";
1139 files = stdint-darwin.h, stdint.h;
1140 c_fix = format;
1141 c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
1142 select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
1143 "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
1144 test_text = "#define UINT8_C(v) (v ## U)\n"
1145 "#define UINT16_C(v) (v ## U)";
1150 * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
1151 * with wrong types.
1153 fix = {
1154 hackname = darwin_stdint_2;
1155 mach = "*-*-darwin*";
1156 files = stdint-darwin.h, stdint.h;
1157 c_fix = format;
1158 c_fix_arg = "#if __WORDSIZE == 64\n"
1159 "#define INTPTR_MAX 9223372036854775807L\n"
1160 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1161 "#else\n"
1162 "#define INTPTR_MAX 2147483647L\n"
1163 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1164 "#endif";
1165 select = "#if __WORDSIZE == 64\n"
1166 "#define INTPTR_MIN[ \t]+INT64_MIN\n"
1167 "#define INTPTR_MAX[ \t]+INT64_MAX\n"
1168 "#else\n"
1169 "#define INTPTR_MIN[ \t]+INT32_MIN\n"
1170 "#define INTPTR_MAX[ \t]+INT32_MAX\n"
1171 "#endif";
1172 test_text = "#if __WORDSIZE == 64\n"
1173 "#define INTPTR_MIN INT64_MIN\n"
1174 "#define INTPTR_MAX INT64_MAX\n"
1175 "#else\n"
1176 "#define INTPTR_MIN INT32_MIN\n"
1177 "#define INTPTR_MAX INT32_MAX\n"
1178 "#endif";
1183 * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
1185 fix = {
1186 hackname = darwin_stdint_3;
1187 mach = "*-*-darwin*";
1188 files = stdint-darwin.h, stdint.h;
1189 c_fix = format;
1190 c_fix_arg = "#if __WORDSIZE == 64\n"
1191 "#define UINTPTR_MAX 18446744073709551615UL\n"
1192 "#else\n"
1193 "#define UINTPTR_MAX 4294967295UL\n"
1194 "#endif";
1195 select = "#if __WORDSIZE == 64\n"
1196 "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
1197 "#else\n"
1198 "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
1199 "#endif";
1200 test_text = "#if __WORDSIZE == 64\n"
1201 "#define UINTPTR_MAX UINT64_MAX\n"
1202 "#else\n"
1203 "#define UINTPTR_MAX UINT32_MAX\n"
1204 "#endif";
1209 * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
1211 fix = {
1212 hackname = darwin_stdint_4;
1213 mach = "*-*-darwin*";
1214 files = stdint-darwin.h, stdint.h;
1215 c_fix = format;
1216 c_fix_arg = "#if __WORDSIZE == 64\n"
1217 "#define SIZE_MAX 18446744073709551615UL\n"
1218 "#else\n"
1219 "#define SIZE_MAX 4294967295UL\n"
1220 "#endif";
1221 select = "#if __WORDSIZE == 64\n"
1222 "#define SIZE_MAX[ \t]+UINT64_MAX\n"
1223 "#else\n"
1224 "#define SIZE_MAX[ \t]+UINT32_MAX\n"
1225 "#endif";
1226 test_text = "#if __WORDSIZE == 64\n"
1227 "#define SIZE_MAX UINT64_MAX\n"
1228 "#else\n"
1229 "#define SIZE_MAX UINT32_MAX\n"
1230 "#endif";
1235 * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
1236 * with a wrong type.
1238 fix = {
1239 hackname = darwin_stdint_5;
1240 mach = "*-*-darwin*";
1241 files = stdint-darwin.h, stdint.h;
1242 c_fix = format;
1243 c_fix_arg = "#if __WORDSIZE == 64\n"
1244 "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
1245 "#define INTMAX_MAX 9223372036854775807L\n"
1246 "#define UINTMAX_MAX 18446744073709551615UL\n"
1247 "#else\n"
1248 "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
1249 "#define INTMAX_MAX 9223372036854775807LL\n"
1250 "#define UINTMAX_MAX 18446744073709551615ULL\n"
1251 "#endif";
1252 select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
1253 "#define INTMAX_MAX[ \t]+INT64_MAX\n"
1254 "\n"
1255 "#define UINTMAX_MAX[ \t]+UINT64_MAX";
1256 test_text = "#define INTMAX_MIN INT64_MIN\n"
1257 "#define INTMAX_MAX INT64_MAX\n"
1258 "\n"
1259 "#define UINTMAX_MAX UINT64_MAX";
1264 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1265 * with a wrong type.
1267 fix = {
1268 hackname = darwin_stdint_6;
1269 mach = "*-*-darwin*";
1270 files = stdint-darwin.h, stdint.h;
1271 c_fix = format;
1272 c_fix_arg = "#if __WORDSIZE == 64\n"
1273 "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
1274 "#define PTRDIFF_MAX 9223372036854775807L\n"
1275 "#else\n"
1276 "#define PTRDIFF_MIN (-2147483647 - 1)\n"
1277 "#define PTRDIFF_MAX 2147483647\n"
1278 "#endif";
1279 select = "#if __WORDSIZE == 64\n"
1280 "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
1281 "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
1282 "#else\n"
1283 "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
1284 "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
1285 "#endif";
1286 test_text = "#if __WORDSIZE == 64\n"
1287 "#define PTRDIFF_MIN INT64_MIN\n"
1288 "#define PTRDIFF_MAX INT64_MAX\n"
1289 "#else\n"
1290 "#define PTRDIFF_MIN INT32_MIN\n"
1291 "#define PTRDIFF_MAX INT32_MAX\n"
1292 "#endif";
1297 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1298 * with a wrong type.
1300 fix = {
1301 hackname = darwin_stdint_7;
1302 mach = "*-*-darwin*";
1303 files = stdint-darwin.h, stdint.h;
1304 c_fix = format;
1305 c_fix_arg = "#if __WORDSIZE == 64\n"
1306 "#define INTMAX_C(v) (v ## L)\n"
1307 "#define UINTMAX_C(v) (v ## UL)\n"
1308 "#else\n"
1309 "#define INTMAX_C(v) (v ## LL)\n"
1310 "#define UINTMAX_C(v) (v ## ULL)\n"
1311 "#endif";
1312 select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
1313 "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
1314 test_text = "#define INTMAX_C(v) (v ## LL)\n"
1315 "#define UINTMAX_C(v) (v ## ULL)";
1320 * Fix <c_asm.h> on Digital UNIX V4.0:
1321 * It contains a prototype for a DEC C internal asm() function,
1322 * clashing with gcc's asm keyword. So protect this with __DECC.
1324 fix = {
1325 hackname = dec_intern_asm;
1326 files = c_asm.h;
1327 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1328 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
1329 "#endif\n";
1330 test_text =
1331 "float fasm {\n"
1332 " ... asm stuff ...\n"
1333 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
1338 * Fix typo in <wchar.h> on DJGPP 2.03.
1340 fix = {
1341 hackname = djgpp_wchar_h;
1342 file = wchar.h;
1343 select = "__DJ_wint_t";
1344 bypass = "sys/djtypes.h";
1345 c_fix = format;
1346 c_fix_arg = "%0\n#include <sys/djtypes.h>";
1347 c_fix_arg = "#include <stddef.h>";
1348 test_text = "#include <stddef.h>\n"
1349 "extern __DJ_wint_t x;\n";
1354 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1356 fix = {
1357 hackname = ecd_cursor;
1358 files = "sunwindow/win_lock.h";
1359 files = "sunwindow/win_cursor.h";
1360 select = 'ecd\.cursor';
1361 c_fix = format;
1362 c_fix_arg = 'ecd_cursor';
1364 test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1369 * Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume
1370 * neither the existence of GCC 3 nor its exact feature set yet break
1371 * (by design?) when __GNUC__ is set beyond 2.
1373 fix = {
1374 hackname = freebsd_gcc3_breakage;
1375 mach = "*-*-freebsd*";
1376 files = sys/cdefs.h;
1377 select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
1378 bypass = '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
1379 c_fix = format;
1380 c_fix_arg = '%0 || __GNUC__ >= 3';
1381 test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
1386 * Some releases of FreeBSD 4 and FreeBSD 5.0 and 5.1 system headers presume
1387 * neither the existence of GCC 4 nor its exact feature set yet break
1388 * (by design?) when __GNUC__ is set beyond 3.
1390 fix = {
1391 hackname = freebsd_gcc4_breakage;
1392 mach = "*-*-freebsd*";
1393 files = sys/cdefs.h;
1394 select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
1395 c_fix = format;
1396 c_fix_arg = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
1397 test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
1402 * Some versions of glibc don't expect the C99 inline semantics.
1404 fix = {
1405 hackname = glibc_c99_inline_1;
1406 files = features.h, '*/features.h';
1407 select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
1408 c_fix = format;
1409 c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
1410 test_text = <<-EOT
1411 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
1412 && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
1413 # define __USE_EXTERN_INLINES 1
1414 #endif
1415 EOT;
1420 * Similar, but a version that didn't have __NO_INLINE__
1422 fix = {
1423 hackname = glibc_c99_inline_1a;
1424 files = features.h, '*/features.h';
1425 select = "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
1426 "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
1427 c_fix = format;
1428 c_fix_arg = "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
1429 test_text = <<-EOT
1430 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
1431 # define __USE_EXTERN_INLINES 1
1432 #endif
1433 EOT;
1438 * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
1439 * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
1440 * The remaining glibc_c99_inline_* fixes deal with some of those headers.
1442 fix = {
1443 hackname = glibc_c99_inline_2;
1444 files = sys/stat.h, '*/sys/stat.h';
1445 select = "extern __inline__ int";
1446 sed = "s/extern int \\(stat\\)/"
1447 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1448 "__inline__ int \\1/";
1449 sed = "s/extern int \\([lf]stat\\)/"
1450 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1451 "__inline__ int \\1/";
1452 sed = "s/extern int \\(mknod\\)/"
1453 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1454 "__inline__ int \\1/";
1455 sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
1456 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1457 "__inline__ int __REDIRECT\\1 (\\2/";
1458 sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
1459 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1460 "__inline__ int __REDIRECT\\1 (\\2/";
1461 sed = "s/^extern __inline__ int/"
1462 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1463 "__inline__ int/";
1464 test_text = <<-EOT
1465 extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
1466 extern __inline__ int
1467 __NTH (fstat64 (int __fd, struct stat64 *__statbuf))
1469 EOT;
1473 fix = {
1474 hackname = glibc_c99_inline_3;
1475 files = bits/string2.h, '*/bits/string2.h';
1476 select = "extern __inline";
1477 bypass = "__extern_inline|__GNU_STDC_INLINE__";
1478 c_fix = format;
1479 c_fix_arg = "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
1480 c_fix_arg = "^# ifdef __cplusplus$";
1481 test_text = <<-EOT
1482 # ifdef __cplusplus
1483 # define __STRING_INLINE inline
1484 # else
1485 # define __STRING_INLINE extern __inline
1486 # endif
1487 EOT;
1491 fix = {
1492 hackname = glibc_c99_inline_4;
1493 files = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h';
1494 bypass = "__extern_inline|__gnu_inline__";
1495 select = "(^| )extern __inline";
1496 c_fix = format;
1497 c_fix_arg = "%0 __attribute__ ((__gnu_inline__))";
1498 test_text = <<-EOT
1499 __extension__ extern __inline unsigned int
1500 extern __inline unsigned int
1501 EOT;
1505 /* glibc-2.3.5 defines pthread mutex initializers incorrectly,
1506 * so we replace them with versions that correspond to the
1507 * definition.
1509 fix = {
1510 hackname = glibc_mutex_init;
1511 files = pthread.h;
1512 select = '\{ *\{ *0, *\} *\}';
1513 sed = "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
1514 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
1515 sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1516 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
1517 sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1518 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
1519 sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1520 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
1521 sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1522 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1523 sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1524 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
1525 sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1526 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1527 sed = "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
1528 "N;s/^[ \t]*#[ \t]*"
1529 "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
1530 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
1531 "# \\1\\\n"
1532 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1533 "# else\\\n"
1534 "# \\1\\\n"
1535 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1536 "# endif/";
1537 sed = "s/{ \\(0, 0, 0, 0, 0, 0, "
1538 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
1539 sed = "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
1540 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
1542 test_text = <<- _EOText_
1543 #define PTHREAD_MUTEX_INITIALIZER \\
1544 { { 0, } }
1545 #ifdef __USE_GNU
1546 # if __WORDSIZE == 64
1547 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \\
1548 { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
1549 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \\
1550 { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
1551 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \\
1552 { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
1553 # else
1554 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \\
1555 { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
1556 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \\
1557 { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
1558 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \\
1559 { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
1560 # endif
1561 #endif
1562 # define PTHREAD_RWLOCK_INITIALIZER \\
1563 { { 0, } }
1564 # ifdef __USE_GNU
1565 # if __WORDSIZE == 64
1566 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \\
1567 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\
1568 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
1569 # else
1570 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \\
1571 { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
1572 # endif
1573 # endif
1574 #define PTHREAD_COND_INITIALIZER { { 0, } }
1575 _EOText_;
1579 /* glibc versions before 2.5 have a version of stdint.h that defines
1580 UINT8_C and UINT16_C to produce unsigned constants, as do uClibc
1581 versions with stdint.h based on those glibc versions. */
1582 fix = {
1583 hackname = glibc_stdint;
1584 files = stdint.h;
1585 select = "GNU C Library";
1586 c_fix = format;
1587 c_fix_arg = "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
1588 c_fix_arg = "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
1589 test_text = "/* This file is part of the GNU C Library. */\n# define UINT8_C(c)\tc ## U\n# define UINT16_C(c)\tc ## U";
1593 /* Some versions of glibc have a version of bits/string2.h that
1594 produces "value computed is not used" warnings from strncpy; fix
1595 this definition by using __builtin_strncpy instead as in newer
1596 versions. */
1597 fix = {
1598 hackname = glibc_strncpy;
1599 files = bits/string2.h;
1600 bypass = "__builtin_strncpy";
1601 c_fix = format;
1602 c_fix_arg = "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
1603 c_fix_arg = "# define strncpy([^\n]*\\\\\n)*[^\n]*";
1604 test_text = <<-EOT
1605 # define strncpy(dest, src, n) \
1606 (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \\
1607 ? (strlen (src) + 1 >= ((size_t) (n)) \\
1608 ? (char *) memcpy (dest, src, n) \\
1609 : strncpy (dest, src, n)) \\
1610 : strncpy (dest, src, n)))
1611 EOT;
1615 /* glibc's tgmath.h relies on an expression that is not an integer
1616 constant expression being treated as it was by GCC 4.4 and
1617 earlier. */
1618 fix = {
1619 hackname = glibc_tgmath;
1620 files = tgmath.h;
1621 select = '\(\(\(type\) 0.25\) && \(\(type\) 0.25 - 1\)\)';
1622 bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
1623 c_fix = format;
1624 c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || (__builtin_classify_type ((type) 0) == 9 && __builtin_classify_type (__real__ ((type) 0)) == 8))";
1625 test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
1629 * Fix these files to use the types we think they should for
1630 * ptrdiff_t, size_t, and wchar_t.
1632 * This defines the types in terms of macros predefined by our 'cpp'.
1633 * This is supposedly necessary for glibc's handling of these types.
1634 * It's probably not necessary for anyone else, but it doesn't hurt.
1636 fix = {
1637 hackname = gnu_types;
1638 files = "sys/types.h";
1639 files = "stdlib.h";
1640 files = "sys/stdtypes.h";
1641 files = "stddef.h";
1642 files = "memory.h";
1643 files = "unistd.h";
1644 bypass = '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
1645 select = "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
1646 c_fix = gnu_type;
1647 /* The Solaris 10 headers already define these types correctly. */
1648 mach = '*-*-solaris2.1[0-9]*';
1649 not_machine = true;
1651 test_text = "typedef long int ptrdiff_t; /* long int */\n"
1652 "typedef uint_t size_t; /* uint_t */\n"
1653 "typedef ushort_t wchar_t; /* ushort_t */";
1658 * Fix HP & Sony's use of "../machine/xxx.h"
1659 * to refer to: <machine/xxx.h>
1661 fix = {
1662 hackname = hp_inline;
1663 files = sys/spinlock.h;
1664 files = machine/machparam.h;
1665 select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
1667 c_fix = format;
1668 c_fix_arg = "%1<machine/%2.h>";
1670 c_fix_arg = "([ \t]*#[ \t]*include[ \t]+)" '"\.\./machine/'
1671 '([a-z]+)\.h"';
1673 test_text = ' # include "../machine/mumble.h"';
1678 * Check for (...) in C++ code in HP/UX sys/file.h.
1680 fix = {
1681 hackname = hp_sysfile;
1682 files = sys/file.h;
1683 select = "HPUX_SOURCE";
1685 c_fix = format;
1686 c_fix_arg = "(struct file *, ...)";
1687 c_fix_arg = '\(\.\.\.\)';
1689 test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
1694 * Un-Hide a series of five FP defines from post-1999 compliance GCC:
1695 * FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
1697 fix = {
1698 hackname = hppa_hpux_fp_macros;
1699 mach = "hppa*-hp-hpux11*";
1700 files = math.h;
1701 select = "#[ \t]*define[ \t]*FP_NORMAL.*\n"
1702 "#[ \t]*define[ \t]*FP_ZERO.*\n"
1703 "#[ \t]*define[ \t]*FP_INFINITE.*\n"
1704 "#[ \t]*define[ \t]*FP_SUBNORMAL.*\n"
1705 "#[ \t]*define[ \t]*FP_NAN.*\n";
1706 c_fix = format;
1707 c_fix_arg = <<- _EOFix_
1708 #endif /* _INCLUDE_HPUX_SOURCE */
1710 #if defined(_INCLUDE_HPUX_SOURCE) || \
1711 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
1712 %0#endif
1714 #ifdef _INCLUDE_HPUX_SOURCE
1716 _EOFix_;
1718 test_text =
1719 "# define FP_NORMAL 0\n"
1720 "# define FP_ZERO 1\n"
1721 "# define FP_INFINITE 2\n"
1722 "# define FP_SUBNORMAL 3\n"
1723 "# define FP_NAN 4\n";
1728 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
1729 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
1731 fix = {
1732 hackname = hpux10_cpp_pow_inline;
1733 files = fixinc-test-limits.h, math.h;
1734 select = <<- END_POW_INLINE
1735 ^# +ifdef +__cplusplus
1737 +inline +double +pow\(double +__d,int +__expon\) +\{
1738 [ ]+return +pow\(__d,\(double\)__expon\);
1740 +extern +"C" +\{
1741 #else
1742 # +endif
1743 END_POW_INLINE;
1745 c_fix = format;
1746 c_fix_arg = "";
1748 test_text =
1749 "# ifdef __cplusplus\n"
1750 " }\n"
1751 " inline double pow(double __d,int __expon) {\n"
1752 "\t return pow(__d,(double)__expon);\n"
1753 " }\n"
1754 ' extern "C"' " {\n"
1755 "#else\n"
1756 "# endif";
1759 fix = {
1760 hackname = hpux11_cpp_pow_inline;
1761 files = math.h;
1762 select = " +inline double pow\\(double d,int expon\\) \\{\n"
1763 " +return pow\\(d, \\(double\\)expon\\);\n"
1764 " +\\}\n";
1765 c_fix = format;
1766 c_fix_arg = "";
1768 test_text =
1769 " inline double pow(double d,int expon) {\n"
1770 " return pow(d, (double)expon);\n"
1771 " }\n";
1776 * Fix hpux 10.X missing ctype declarations 1
1778 fix = {
1779 hackname = hpux10_ctype_declarations1;
1780 files = ctype.h;
1781 select = "^#[ \t]*define _toupper\\(__c\\)[ \t]*__toupper\\(__c\\)";
1782 bypass = "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\(";
1783 c_fix = format;
1784 c_fix_arg = "#ifdef _PROTOTYPES\n"
1785 "extern int __tolower(int);\n"
1786 "extern int __toupper(int);\n"
1787 "#else /* NOT _PROTOTYPES */\n"
1788 "extern int __tolower();\n"
1789 "extern int __toupper();\n"
1790 "#endif /* _PROTOTYPES */\n\n"
1791 "%0\n";
1793 test_text = "# define _toupper(__c) __toupper(__c)\n";
1798 * Fix hpux 10.X missing ctype declarations 2
1800 fix = {
1801 hackname = hpux10_ctype_declarations2;
1802 files = ctype.h;
1803 select = "^# if defined\\(_SB_CTYPE_MACROS\\) && \\!defined\\(__lint\\)";
1804 bypass = "^[ \t]*extern[ \t]*int[ \t]*_isalnum[ \t]*\\(";
1805 c_fix = format;
1806 c_fix_arg = "%0\n\n"
1807 "#ifdef _PROTOTYPES\n"
1808 " extern int _isalnum(int);\n"
1809 " extern int _isalpha(int);\n"
1810 " extern int _iscntrl(int);\n"
1811 " extern int _isdigit(int);\n"
1812 " extern int _isgraph(int);\n"
1813 " extern int _islower(int);\n"
1814 " extern int _isprint(int);\n"
1815 " extern int _ispunct(int);\n"
1816 " extern int _isspace(int);\n"
1817 " extern int _isupper(int);\n"
1818 " extern int _isxdigit(int);\n"
1819 "# else /* not _PROTOTYPES */\n"
1820 " extern int _isalnum();\n"
1821 " extern int _isalpha();\n"
1822 " extern int _iscntrl();\n"
1823 " extern int _isdigit();\n"
1824 " extern int _isgraph();\n"
1825 " extern int _islower();\n"
1826 " extern int _isprint();\n"
1827 " extern int _ispunct();\n"
1828 " extern int _isspace();\n"
1829 " extern int _isupper();\n"
1830 " extern int _isxdigit();\n"
1831 "#endif /* _PROTOTYPES */\n";
1833 test_text = "# if defined(_SB_CTYPE_MACROS) && !defined(__lint)\n"
1834 " extern unsigned int *__SB_masks;\n";
1839 * Fix hpux 10.X missing stdio declarations
1841 fix = {
1842 hackname = hpux10_stdio_declarations;
1843 files = stdio.h;
1844 select = "^#[ \t]*define _iob[ \t]*__iob";
1845 bypass = "^[ \t]*extern[ \t]*int[ \t]*vsnprintf[ \t]*\\(";
1846 c_fix = format;
1847 c_fix_arg = "%0\n\n"
1848 "# if defined(__STDC__) || defined(__cplusplus)\n"
1849 " extern int snprintf(char *, size_t, const char *, ...);\n"
1850 " extern int vsnprintf(char *, size_t, const char *, __va_list);\n"
1851 "# else /* not __STDC__) || __cplusplus */\n"
1852 " extern int snprintf();\n"
1853 " extern int vsnprintf();\n"
1854 "# endif /* __STDC__) || __cplusplus */\n";
1856 test_text = "# define _iob __iob\n";
1861 * Make sure hpux defines abs in header.
1863 fix = {
1864 hackname = hpux11_abs;
1865 mach = "*-hp-hpux11*";
1866 files = stdlib.h;
1867 select = "ifndef _MATH_INCLUDED";
1868 c_fix = format;
1869 c_fix_arg = "if !defined(_MATH_INCLUDED) || defined(__GNUG__)";
1870 test_text = "#ifndef _MATH_INCLUDED";
1875 * Keep HP-UX 11 from stomping on C++ math namespace
1876 * with defines for fabsf.
1878 fix = {
1879 hackname = hpux11_fabsf;
1880 files = math.h;
1881 select = "^[ \t]*#[ \t]*define[ \t]+fabsf\\(.*";
1882 bypass = "__cplusplus";
1884 c_fix = format;
1885 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1887 test_text =
1888 "#ifdef _PA_RISC\n"
1889 "# define fabsf(x) ((float)fabs((double)(float)(x)))\n"
1890 "#endif";
1895 * Fix C99 constant in __POINTER_SET define.
1897 fix = {
1898 hackname = hpux11_pthread_const;
1899 mach = "*-hp-hpux11.[0-3]*";
1900 files = sys/pthread.h;
1901 select = "^#define[ \t]*__POINTER_SET[ \t]*\\(\\(void \\*\\) 1LL\\)";
1903 c_fix = format;
1904 c_fix_arg = "#define __POINTER_SET\t\t((void *) 1L)";
1905 test_text = "#define __POINTER_SET\t\t((void *) 1LL)";
1910 * Prevent HP-UX 11 from defining __size_t and preventing size_t from
1911 * being defined by having it define _hpux_size_t instead.
1913 fix = {
1914 hackname = hpux11_size_t;
1915 mach = "*-hp-hpux11*";
1916 select = "__size_t";
1918 c_fix = format;
1919 c_fix_arg = "_hpux_size_t";
1921 test_text =
1922 "#define __size_t size_t\n"
1923 " extern int getpwuid_r( char *, __size_t, struct passwd **);\n";
1928 * Fix hpux 11.00 broken snprintf declaration
1929 * (third argument is char *, needs to be const char * to prevent
1930 * spurious warnings with -Wwrite-strings or in C++).
1932 fix = {
1933 hackname = hpux11_snprintf;
1934 files = stdio.h;
1935 select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
1936 ' *(char *\*, *\.\.\.\);)';
1937 c_fix = format;
1938 c_fix_arg = '%1 const %3';
1940 test_text = "extern int snprintf(char *, size_t, char *, ...);\n"
1941 "extern int snprintf(char *, __size_t, char *, ...);\n"
1942 "extern int snprintf(char *, _hpux_size_t, char *, ...);";
1946 * Fix hpux 11.00 broken vsnprintf declaration
1948 fix = {
1949 hackname = hpux11_vsnprintf;
1950 files = stdio.h;
1951 select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
1952 'const char \*,) __va__list\);';
1953 c_fix = format;
1954 c_fix_arg = "%1 __va_list);";
1956 test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
1957 ' __va__list);';
1962 * get rid of bogus inline definitions in HP-UX 8.0
1964 fix = {
1965 hackname = hpux8_bogus_inlines;
1966 files = math.h;
1967 select = inline;
1968 bypass = "__GNUG__";
1969 sed = "s@inline int abs(int [a-z][a-z]*) {.*}"
1970 "@extern \"C\" int abs(int);@";
1971 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
1972 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
1973 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
1974 test_text = "inline int abs(int v) { return (v>=0)?v:-v; }\n"
1975 "inline double sqr(double v) { return v**0.5; }";
1980 * Fix hpux broken ctype macros
1982 fix = {
1983 hackname = hpux_ctype_macros;
1984 files = ctype.h;
1985 select = '((: |\()__SB_masks \? )'
1986 '(__SB_masks\[__(alnum|c)\] & _IS)';
1987 c_fix = format;
1988 c_fix_arg = "%1(int)%3";
1990 test_text = ": __SB_masks ? __SB_masks[__alnum] & _ISCNTRL\n"
1991 "# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n";
1996 * Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
1998 fix = {
1999 hackname = hpux_htonl;
2000 files = netinet/in.h;
2001 select = "#ifndef _XOPEN_SOURCE_EXTENDED[ \t]*\n"
2002 "(/\\*\n"
2003 " \\* Macros for number representation conversion\\.\n"
2004 " \\*/\n"
2005 "#ifndef ntohl)";
2006 c_fix = format;
2007 c_fix_arg = "#if 1\n%1";
2009 test_text = "#ifndef _XOPEN_SOURCE_EXTENDED\n"
2010 "/*\n"
2011 " * Macros for number representation conversion.\n"
2012 " */\n"
2013 "#ifndef ntohl\n"
2014 "#define ntohl(x) (x)\n"
2015 "#define ntohs(x) (x)\n"
2016 "#define htonl(x) (x)\n"
2017 "#define htons(x) (x)\n"
2018 "#endif\n"
2019 "#endif /* ! _XOPEN_SOURCE_EXTENDED */";
2024 * HP-UX long_double
2026 fix = {
2027 hackname = hpux_long_double;
2028 mach = "*-*-hpux10*";
2029 mach = "*-*-hpux11.[012]*";
2030 files = stdlib.h;
2031 select = "extern[ \t]long_double[ \t]strtold";
2032 bypass = "long_double_t";
2033 sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
2034 sed = "s/long_double/long double/g";
2036 test_text = "# ifndef _LONG_DOUBLE\n"
2037 "# define _LONG_DOUBLE\n"
2038 " typedef struct {\n"
2039 " unsigned int word1, word2, word3, word4;\n"
2040 " } long_double;\n"
2041 "# endif /* _LONG_DOUBLE */\n"
2042 "extern long_double strtold(const char *, char **);\n";
2046 * We cannot use the above rule on 11.31 because it removes the strtold
2047 * definition. ia64 is OK with no hack, PA needs some help.
2049 fix = {
2050 hackname = hpux_long_double_2;
2051 mach = "hppa*-*-hpux11.3*";
2052 files = stdlib.h;
2053 select = "#[ \t]*if[ \t]*!defined\\(__ia64\\) \\|\\| defined\\(_PROTOTYPES\\) \\|\\| defined\\(_LONG_DOUBLE_STRUCT\\)";
2054 c_fix = format;
2055 c_fix_arg = "# if !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)";
2057 test_text = "# if !defined(__ia64) || !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)\n";
2061 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2063 fix = {
2064 hackname = hpux_systime;
2065 files = sys/time.h;
2066 select = "^extern struct sigevent;";
2068 c_fix = format;
2069 c_fix_arg = "struct sigevent;";
2071 test_text = 'extern struct sigevent;';
2076 * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
2077 * type and mpinfou is only defined when _KERNEL is set.
2079 fix = {
2080 hackname = hpux_spu_info;
2081 mach = "*-hp-hpux*";
2083 * It is tempting to omit the first "files" entry. Do not.
2084 * The testing machinery will take the first "files" entry as the name
2085 * of a test file to play with. It would be a nuisance to have a directory
2086 * with the name "*".
2088 files = "ia64/sys/getppdp.h";
2089 files = "*/sys/getppdp.h";
2090 select = "^.*extern.*spu_info.*";
2092 c_fix = format;
2093 c_fix_arg = "#ifdef _KERNEL\n%0\n#endif";
2095 test_text = "extern union mpinfou spu_info[];";
2098 fix = {
2099 hackname = hpux11_extern_sendfile;
2100 mach = "*-hp-hpux11.[12]*";
2101 files = sys/socket.h;
2102 select = "^[ \t]*extern sbsize_t sendfile.*\n.*, int\\)\\);\n";
2103 c_fix = format;
2104 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
2105 test_text = " extern sbsize_t sendfile __((int, int, off_t, bsize_t,\n const struct iovec *, int));\n";
2108 fix = {
2109 hackname = hpux11_extern_sendpath;
2110 mach = "*-hp-hpux11.[12]*";
2111 files = sys/socket.h;
2112 select = "^[ \t]*extern sbsize_t sendpath.*\n.*, int\\)\\);\n";
2113 c_fix = format;
2114 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
2115 test_text = " extern sbsize_t sendpath __((int, int, off_t, bsize_t,\n const struct iovec *, int));\n";
2118 fix = {
2119 hackname = hpux_extern_errno;
2120 mach = "*-hp-hpux10.*";
2121 mach = "*-hp-hpux11.[0-2]*";
2122 files = errno.h;
2123 select = "^[ \t]*extern int errno;$";
2124 c_fix = format;
2125 c_fix_arg = "#ifdef __cplusplus\nextern \"C\" {\n#endif\n%0\n#ifdef __cplusplus\n}\n#endif";
2126 test_text = " extern int errno;\n";
2131 * Add missing braces to pthread initializer defines.
2133 fix = {
2134 hackname = hpux_pthread_initializers;
2135 mach = "*-hp-hpux11.[0-3]*";
2136 files = sys/pthread.h;
2137 sed = "s@^[ \t]*1, 1, 1, 1,[ \t]*\\\\"
2138 "@\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@";
2139 sed = "s@^[ \t]*1,[ \t]*\\\\"
2140 "@\t{ 1, 0 }@";
2141 sed = "/^[ \t]*0$/d";
2142 sed = "s@__PTHREAD_MUTEX_VALID, 0"
2143 "@{ __PTHREAD_MUTEX_VALID, 0 }@";
2144 sed = "s@^[ \t]*0, 0, -1, 0,[ \t]*\\\\"
2145 "@\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@";
2146 sed = "s@0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,[ \t]*\\\\"
2147 "@{ 0, __LWP_MTX_VALID }, { 0, 1, 1, 1, 1 },\t\t\t\\\\@";
2148 sed = "s@^[ \t]*__LWP_MTX_VALID, 0, 1, 1, 1, 1,[ \t]*\\\\"
2149 "@\t{ 0, __LWP_MTX_VALID }, { 0, 1, 1, 1, 1 },\t\t\t\\\\@";
2150 sed = "s@^[ \t]*0, 0[ \t]*\\\\"
2151 "@\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@";
2152 sed = "s@__PTHREAD_COND_VALID, 0"
2153 "@{ __PTHREAD_COND_VALID, 0 }@";
2154 sed = "s@__LWP_COND_VALID, 0,[ \t]*\\\\"
2155 "@{ __LWP_COND_VALID, 0 },\t\t\t\t\t\\\\@";
2156 sed = "s@__PTHREAD_RWLOCK_VALID, 0"
2157 "@{ __PTHREAD_RWLOCK_VALID, 0 }@";
2158 sed = "s@__LWP_RWLOCK_VALID, 0,[ \t]*\\\\"
2159 "@{ __LWP_RWLOCK_VALID, 0 },\t\t\t\t\t\\\\@";
2160 sed = "s@^[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
2161 "@\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@";
2162 test_text = "#define PTHREAD_MUTEX_INITIALIZER {\t\t\t\t\t\\\\\n"
2163 "\t__PTHREAD_MUTEX_VALID, 0,\t\t\t\t\t\\\\\n"
2164 "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE),\t\t\\\\\n"
2165 "\t__SPNLCK_INITIALIZER,\t\t\t\t\t\t\\\\\n"
2166 "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
2167 "\t0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
2168 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
2169 "}\n";
2172 fix = {
2173 hackname = hpux_c99_intptr;
2174 mach = "*-hp-hpux11.3*";
2175 files = stdint-hpux11.h, stdint.h;
2176 sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
2177 sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
2178 sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
2179 sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
2180 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
2181 sed = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
2182 test_text = "#define PTRDIFF_MAX INT32_MAX\n"
2183 "#define PTRDIFF_MIN INT32_MIN\n"
2184 "#define INTPTR_MAX INT32_MAX\n"
2185 "#define INTPTR_MIN INT32_MIN\n"
2186 "#define UINTPTR_MAX UINT32_MAX\n"
2187 "#define SIZE_MAX UINT32_MAX\n";
2191 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2194 fix = {
2195 hackname = hpux_c99_inttypes;
2196 mach = "*-hp-hpux11.[23]*";
2197 files = inttypes.h;
2198 files = stdint-hpux11.h, stdint.h;
2199 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@";
2200 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@";
2201 sed = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@";
2202 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@#define UINT32_C(__c) __CONCAT__(__c,u)@";
2203 test_text = "#define UINT8_C(__c) __CONCAT_U__(__c)\n"
2204 "#define UINT16_C(__c) __CONCAT_U__(__c)\n"
2205 "#define INT32_C(__c) __CONCAT__(__c,l)\n"
2206 "#define UINT32_C(__c) __CONCAT__(__c,ul)\n";
2209 fix = {
2210 hackname = hpux_c99_inttypes2;
2211 mach = "*-hp-hpux11.2*";
2212 files = stdint-hpux11.h, stdint.h;
2213 sed = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@";
2214 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@";
2215 sed = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@";
2216 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@";
2217 test_text = "# define INT8_C(__c) ((signed char)(__c))\n"
2218 "# define UINT8_C(__c) ((unsigned char)(__c))\n"
2219 "# define INT16_C(__c) ((short)(__c))\n"
2220 "# define UINT16_C(__c) ((unsigned short)(__c))\n";
2223 fix = {
2224 hackname = hpux_stdint_least_fast;
2225 mach = "*-hp-hpux11.2*";
2226 files = stdint-hpux11.h, stdint.h;
2227 select =
2228 "^[ \t]*#[ \t]*define[ \t]+UINT_(LEAST|FAST)64_MAX[ \t]+ULLONG_MAX";
2229 c_fix = format;
2230 c-fix-arg = "# define UINT_%164_MAX __UINT64_MAX__";
2231 test-text = "# define UINT_FAST64_MAX ULLONG_MAX\n"
2232 "# define UINT_LEAST64_MAX ULLONG_MAX\n";
2233 _EOFix_;
2236 fix = {
2237 hackname = hpux_inttype_int8_t;
2238 mach = "*-hp-hpux1[01].*";
2239 files = sys/_inttypes.h;
2240 select = "^[ \t]*typedef[ \t]*char[ \t]*int(_least){0,1}8_t.*";
2241 c_fix = format;
2242 c_fix_arg = "typedef signed char int%18_t;";
2243 test_text = "typedef char int_least8_t;\n"
2244 "typedef char int8_t;\n";
2247 fix = {
2248 hackname = hpux_imaginary_i;
2249 mach = "ia64-hp-hpux11.*";
2250 files = complex.h;
2251 select = "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*";
2252 c_fix = format;
2253 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
2254 test_text = "#define _Complex_I (0.f+_Imaginary_I)\n";
2258 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
2260 fix = {
2261 hackname = huge_val_hex;
2262 files = bits/huge_val.h;
2263 select = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
2264 bypass = "__builtin_huge_val";
2266 c_fix = format;
2267 c_fix_arg = "#define HUGE_VAL (__builtin_huge_val())\n";
2269 test_text = "# define HUGE_VAL\t(__extension__ 0x1.0p2047)";
2274 * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
2276 fix = {
2277 hackname = huge_valf_hex;
2278 files = bits/huge_val.h;
2279 select = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
2280 bypass = "__builtin_huge_valf";
2282 c_fix = format;
2283 c_fix_arg = "#define HUGE_VALF (__builtin_huge_valf())\n";
2285 test_text = "# define HUGE_VALF (__extension__ 0x1.0p255f)";
2290 * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
2292 fix = {
2293 hackname = huge_vall_hex;
2294 files = bits/huge_val.h;
2295 select = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
2296 bypass = "__builtin_huge_vall";
2298 c_fix = format;
2299 c_fix_arg = "#define HUGE_VALL (__builtin_huge_vall())\n";
2301 test_text = "# define HUGE_VALL (__extension__ 0x1.0p32767L)";
2306 * Fix return type of abort and free
2308 fix = {
2309 hackname = int_abort_free_and_exit;
2310 files = stdlib.h;
2311 select = "int[ \t]+(abort|free|exit)[ \t]*\\(";
2312 bypass = "_CLASSIC_ANSI_TYPES";
2314 c_fix = format;
2315 c_fix_arg = "void\t%1(";
2317 test_text = "extern int abort(int);\n"
2318 "extern int free(void*);\n"
2319 "extern int exit(void*);";
2324 * Fix various macros used to define ioctl numbers.
2325 * The traditional syntax was:
2327 * #define _IO(n, x) (('n'<<8)+x)
2328 * #define TIOCFOO _IO(T, 1)
2330 * but this does not work with the C standard, which disallows macro
2331 * expansion inside strings. We have to rewrite it thus:
2333 * #define _IO(n, x) ((n<<8)+x)
2334 * #define TIOCFOO _IO('T', 1)
2336 * The select expressions match too much, but the c_fix code is cautious.
2338 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
2340 fix = {
2341 hackname = io_quotes_def;
2342 select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\([a-zA-Z][,)]";
2343 c_fix = char_macro_def;
2344 c_fix_arg = "IO";
2345 test_text =
2346 "#define BSD43__IOWR(n, x) (('n'<<8)+x)\n"
2347 "#define _IOWN(x,y,t) (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)\n"
2348 "#define _IO(x,y) ('x'<<8|y)";
2349 test_text =
2350 "#define XX_IO(x) ('x'<<8|256)";
2353 fix = {
2354 hackname = io_quotes_use;
2355 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*"
2356 "\\( *[^,']";
2357 c_fix = char_macro_use;
2358 c_fix_arg = "IO";
2359 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
2360 "#define TIOCFOO \\\\\n"
2361 "BSD43__IOWR(T, 1) /* Some are multi-line */";
2366 * Check for missing ';' in struct
2368 fix = {
2369 hackname = ip_missing_semi;
2370 files = netinet/ip.h;
2371 select = "}$";
2372 sed = "/^struct/,/^};/s/}$/};/";
2373 test_text=
2374 "struct mumble {\n"
2375 " union {\n"
2376 " int x;\n"
2377 " }\n"
2378 "}; /* mumbled struct */\n";
2383 * IRIX 6.5.1[89] <internal/sgimacros.h> unconditionally defines
2384 * __restrict as restrict iff __c99. This is wrong for C++, which
2385 * needs many C99 features, but only supports __restrict.
2387 fix = {
2388 hackname = irix___restrict;
2389 files = internal/sgimacros.h;
2390 select = "(#ifdef __c99\n)(#[ \t]*define __restrict restrict)";
2392 mach = "mips-sgi-irix6.5";
2393 c_fix = format;
2394 c_fix_arg = "%1"
2395 "# ifndef __cplusplus\n%2\n# endif";
2397 test_text = "#ifdef __c99\n# define __restrict restrict";
2401 * IRIX 6.5.22 <internal/math_core.h> uses the SGI c99 __generic() intrinsic
2402 * to define the fpclasify, isfinite, isinf, isnan, isnormal and signbit
2403 * functions.
2405 * This was probably introduced around IRIX 6.5.18
2407 fix = {
2408 hackname = irix___generic1;
2409 files = internal/math_core.h;
2410 mach = "mips-sgi-irix6.5";
2411 select = "#define ([a-z]+)\\(x\\) *__generic.*";
2413 c_fix = format;
2414 c_fix_arg = "extern int %1(double);\n"
2415 "extern int %1f(float);\n"
2416 "extern int %1l(long double);\n"
2417 "#define %1(x) (sizeof(x) == sizeof(double) ? _%1(x) \\\n"
2418 " : sizeof(x) == sizeof(float) ? _%1f(x) \\\n"
2419 " : _%1l(x))\n";
2421 test_text =
2422 "#define isnan(x) __generic(x,,, _isnan, _isnanf, _isnanl,,,)(x)\n";
2426 /* Likewise <internal/math_core.h> on IRIX 6.5.19 and later uses the SGI
2427 compiler's __generic intrinsic to define isgreater, isgreaterequal,
2428 isless, islessequal, islessgreater and isunordered functions. */
2429 fix = {
2430 hackname = irix___generic2;
2431 files = internal/math_core.h;
2432 mach = "mips-sgi-irix6.5";
2433 select = "#define ([a-z]+)\\(x,y\\) *__generic.*";
2435 c_fix = format;
2436 c_fix_arg = "#define %1(x,y) \\\n"
2437 " ((sizeof(x)<=4 && sizeof(y)<=4) ? _%1f(x,y) \\\n"
2438 " : (sizeof(x)<=8 && sizeof(y)<=8) ? _%1(x,y) \\\n"
2439 " : _%1l(x,y))\n";
2441 test_text =
2442 "#define isless(x,y) __generic(x,y,, _isless, _islessf, _islessl,,,)(x,y)";
2447 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
2448 * that causes the assembly preprocessor to complain about an
2449 * unterminated character constant.
2451 fix = {
2452 hackname = irix_asm_apostrophe;
2453 files = sys/asm.h;
2455 select = "^[ \t]*#.*[Ww]e're";
2456 c_fix = format;
2457 c_fix_arg = "%1 are";
2458 c_fix_arg = "^([ \t]*#.*[Ww]e)'re";
2459 test_text = "\t# and we're on vacation";
2464 * IRIX 6.5 complex.h defines _Complex_I and _Imaginary_I in terms of __I__,
2465 * which is a MIPSpro compiler builtin. Remove _Imaginary_I and imaginary
2466 * definitions which are not supported by GCC.
2468 fix = {
2469 hackname = irix_complex;
2470 mach = "mips-sgi-irix6.5";
2471 files = complex.h;
2472 select = "#define[ \t]_Complex_I[ \t]\\(\\(float[ \t]_Complex\\)[ \t]\\(__I__\\)\\)";
2473 sed = "s/#define[ \t]_Complex_I[ \t]((float[ \t]_Complex)[ \t](__I__))/"
2474 "#define _Complex_I (__extension__ 1.0iF)/";
2475 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
2476 sed = "/#define[ \t]_Imaginary_I/d";
2477 sed = "s/#define[ \t]I[ \t]_Imaginary_I/#define I _Complex_I/";
2478 test_text = "#define _Complex_I ((float _Complex) (__I__))\n"
2479 "#define imaginary _Imaginary\n"
2480 "// #define _Imaginary_I ((float _Imaginary) 1)\n"
2481 "#define _Imaginary_I __I__\n"
2482 "#define I _Imaginary_I";
2487 * Non-traditional "const" declaration in Irix's limits.h.
2489 fix = {
2490 hackname = irix_limits_const;
2491 files = fixinc-test-limits.h, limits.h;
2492 select = "^extern const ";
2493 c_fix = format;
2494 c_fix_arg = "extern __const ";
2495 test_text = "extern const char limit; /* test limits */";
2500 * IRIX 6.5 PTHREAD_*_INITIALIZER need an additional level of braces in
2501 * <pthread.h>.
2503 fix = {
2504 hackname = irix_pthread_init;
2505 files = pthread.h;
2506 select = "^(#define[ \t]+PTHREAD_.*_INITIALIZER[ \t]+)(\\{ 0 \\})";
2508 mach = "mips-sgi-irix6.5";
2509 c_fix = format;
2510 c_fix_arg = "%1{ %2 }";
2511 test_text = "#define PTHREAD_MUTEX_INITIALIZER { 0 }\n"
2512 "#define PTHREAD_COND_INITIALIZER { 0 }\n"
2513 "#define PTHREAD_RWLOCK_INITIALIZER { 0 }";
2518 * IRIX 6.5.1[78] <sys/socket.h> has a broken definition of socklen_t.
2519 * Various socket function prototypes use different types instead,
2520 * depending on the API in use (BSD, XPG4/5), but the socklen_t
2521 * definition doesn't reflect this (SGI Bug Id 864477, fixed in
2522 * IRIX 6.5.19).
2524 fix = {
2525 hackname = irix_socklen_t;
2526 files = sys/socket.h;
2527 select = "(#define _SOCKLEN_T\n)(typedef u_int32_t socklen_t;)";
2529 mach = "mips-sgi-irix6.5";
2530 c_fix = format;
2531 c_fix_arg = "%1"
2532 "#if _NO_XOPEN4 && _NO_XOPEN5\n"
2533 "typedef int socklen_t;\n"
2534 "#else\n"
2535 "%2\n"
2536 "#endif /* _NO_XOPEN4 && _NO_XOPEN5 */";
2538 test_text = "#define _SOCKLEN_T\ntypedef u_int32_t socklen_t;";
2542 * IRIX 6.5 <stdint.h> only works with ISO C99 and errors out
2543 * otherwise.
2545 fix = {
2546 hackname = irix_stdint_c99_mode;
2547 files = stdint.h;
2548 select = "(#ifndef __c99\n)(#error This header file is to be used only for c99 mode compilations)";
2550 mach = "mips-sgi-irix6.5";
2551 c_fix = format;
2552 c_fix_arg = "#if 0\n"
2553 "%2";
2554 test_text =
2555 "#ifndef __c99\n#error This header file is to be used only for c99 mode compilations\n#else";
2560 * IRIX 6.5 <stdint.h> has some *_MIN/MAX constants whose types don't
2561 * match the corresponding types, as required by ISO C99.
2563 fix = {
2564 hackname = irix_stdint_c99_types;
2565 files = stdint-irix65.h, stdint.h;
2566 mach = "mips-sgi-irix6.5";
2567 sed = "s@^#define INT64_MIN.*(-0x7fffffffffffffff - 1)$@"
2568 "#define INT64_MIN (-0x7fffffffffffffffLL - 1)@";
2569 sed = "s@^#define INT64_MAX.*0x7fffffffffffffff$@"
2570 "#define INT64_MAX 0x7fffffffffffffffLL@";
2571 sed = "s@^#define UINT32_MAX.*0xffffffff$@"
2572 "#define UINT32_MAX 0xffffffffU@";
2573 sed = "s@^#define UINT64_MAX.*0xffffffffffffffff$@"
2574 "#define UINT64_MAX 0xffffffffffffffffULL@";
2575 sed = "s@^#define INTPTR_MIN.*INT32_MIN$@"
2576 "#define INTPTR_MIN (-0x7fffffffL - 1)@";
2577 sed = "s@^#define INTPTR_MAX.*INT32_MAX$@"
2578 "#define INTPTR_MAX 0x7fffffffL@";
2579 sed = "s@^#define UINTPTR_MAX.*UINT32_MAX$@"
2580 "#define UINTPTR_MAX 0xffffffffUL@";
2581 sed = "s@^#define INTPTR_MIN.*INT64_MIN@"
2582 "#define INTPTR_MIN (-0x7fffffffffffffffL - 1)@";
2583 sed = "s@^#define INTPTR_MAX.*INT64_MAX$@"
2584 "#define INTPTR_MAX 0x7fffffffffffffffL@";
2585 sed = "s@^#define UINTPTR_MAX.*UINT64_MAX$@"
2586 "#define UINTPTR_MAX 0xffffffffffffffffUL@";
2587 sed = "s@^#define PTRDIFF_MIN.*INT64_MIN$@"
2588 "#define PTRDIFF_MIN (-0x7fffffffffffffffL - 1)@";
2589 sed = "s@^#define PTRDIFF_MAX.*INT64_MAX$@"
2590 "#define PTRDIFF_MAX 0x7fffffffffffffffL@";
2591 sed = "s@^#define SIZE_MAX.*UINT64_MAX$@"
2592 "#define SIZE_MAX 0xffffffffffffffffUL@";
2593 test_text = "#define INT64_MIN (-0x7fffffffffffffff - 1)\n"
2594 "#define INT64_MAX 0x7fffffffffffffff\n"
2595 "#define UINT32_MAX 0xffffffff\n"
2596 "#define UINT64_MAX 0xffffffffffffffff\n"
2597 "#define INTPTR_MIN INT32_MIN\n"
2598 "#define INTPTR_MAX INT32_MAX\n"
2599 "#define UINTPTR_MAX UINT32_MAX\n"
2600 "#define INTPTR_MIN INT64_MIN\n"
2601 "#define INTPTR_MAX INT64_MAX\n"
2602 "#define UINTPTR_MAX UINT64_MAX\n"
2603 "#define PTRDIFF_MIN INT64_MIN\n"
2604 "#define PTRDIFF_MAX INT64_MAX\n"
2605 "#define SIZE_MAX UINT64_MAX";
2610 * IRIX 6.5 <stdint.h> uses casts in some macros which cannot thus be used
2611 * in preprocessor tests, although ISO C99 requires this.
2613 fix = {
2614 hackname = irix_stdint_c99_macros;
2615 files = stdint-irix65.h, stdint.h;
2616 mach = "mips-sgi-irix6.5";
2617 sed = "s@^#define INT8_C(x).*int.*_t.*$@#define INT8_C(x) (x)@";
2618 sed = "s@^#define INT16_C(x).*int.*_t.*$@#define INT16_C(x) (x)@";
2619 sed = "s@^#define INT32_C(x).*int.*_t.*$@#define INT32_C(x) (x)@";
2620 sed = "s@^#define INT64_C(x).*int.*_t.*$@#define INT64_C(x) (x ## LL)@";
2621 sed = "s@^#define UINT8_C(x).*int.*_t.*$@#define UINT8_C(x) (x)@";
2622 sed = "s@^#define UINT16_C(x).*int.*_t.*$@#define UINT16_C(x) (x)@";
2623 sed = "s@^#define UINT32_C(x).*int.*_t.*$@#define UINT32_C(x) (x ## U)@";
2624 sed = "s@^#define UINT64_C(x).*int.*_t.*$@#define UINT64_C(x) (x ## ULL)@";
2625 sed = "s@^#define INTMAX_C(x).*int.*_t.*$@#define INTMAX_C(x) (x ## LL)@";
2626 sed = "s@^#define UINTMAX_C(x).*int.*_t.*$@#define UINTMAX_C(x) (x ## ULL)@";
2627 test_text = "#define INT8_C(x) (int_least8_t)(x)\n"
2628 "#define INT16_C(x) (int_least16_t)(x)\n"
2629 "#define INT32_C(x) (int_least32_t)(x)\n"
2630 "#define INT64_C(x) (int_least64_t)(x)\n"
2631 "#define UINT8_C(x) (uint_least8_t)(x)\n"
2632 "#define UINT16_C(x) (uint_least16_t)(x)\n"
2633 "#define UINT32_C(x) (uint_least32_t)(x)\n"
2634 "#define UINT64_C(x) (uint_least64_t)(x)\n"
2635 "#define INTMAX_C(x) (intmax_t)(x)\n"
2636 "#define UINTMAX_C(x) (uintmax_t)(x)";
2641 * IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
2642 * some functions that take a va_list as
2643 * taking char *. However, GCC uses void * for va_list, so
2644 * calling vfprintf with a va_list fails in C++. */
2645 fix = {
2646 hackname = irix_stdio_va_list;
2647 files = stdio.h;
2648 files = internal/stdio_core.h;
2650 select = '/\* va_list \*/ char \*';
2651 c_fix = format;
2652 c_fix_arg = "__gnuc_va_list";
2653 test_text =
2654 "extern int printf( const char *, /* va_list */ char * );";
2659 * IRIX 6.5.19 <internal/wchar_core.h> provides the XPG4 variant of
2660 * wcsftime by default. ISO C99 requires the XPG5 variant instead.
2662 fix = {
2663 hackname = irix_wcsftime;
2664 files = internal/wchar_core.h;
2665 select = "#if _NO_XOPEN5\n(extern size_t[ \t]+wcsftime.*const char \*.*)";
2667 mach = "mips-sgi-irix6.5";
2668 c_fix = format;
2669 c_fix_arg = "#if _NO_XOPEN5 && !defined(__c99)\n%1";
2671 test_text = "#if _NO_XOPEN5\n"
2672 "extern size_t wcsftime(wchar_t *, "
2673 "__SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, "
2674 "const struct tm *);";
2679 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
2680 * use / * * / to concatenate tokens.
2682 fix = {
2683 hackname = kandr_concat;
2684 files = "sparc/asm_linkage.h";
2685 files = "sun*/asm_linkage.h";
2686 files = "arm/as_support.h";
2687 files = "arm/mc_type.h";
2688 files = "arm/xcb.h";
2689 files = "dev/chardefmac.h";
2690 files = "dev/ps_irq.h";
2691 files = "dev/screen.h";
2692 files = "dev/scsi.h";
2693 files = "sys/tty.h";
2694 files = "Xm.acorn/XmP.h";
2695 files = bsd43/bsd43_.h;
2696 select = '/\*\*/';
2697 c_fix = format;
2698 c_fix_arg = '##';
2699 test_text = "#define __CONCAT__(a,b) a/**/b";
2703 /* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
2704 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
2705 * constant on recent versions of g++.
2707 fix = {
2708 hackname = linux_ia64_ucontext;
2709 files = "sys/ucontext.h";
2710 mach = "ia64-*-linux*";
2711 select = '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
2712 '->sc_gr\[0\]\) - \(char \*\) 0\)';
2713 c_fix = format;
2714 c_fix_arg = "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
2715 test_text = "# define _SC_GR0_OFFSET\t\\\\\n"
2716 "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
2721 * Remove header file warning from sys/time.h. Autoconf's
2722 * AC_HEADER_TIME recommends to include both sys/time.h and time.h
2723 * which causes warning on LynxOS. Remove the warning.
2725 fix = {
2726 hackname = lynxos_no_warning_in_sys_time_h;
2727 files = sys/time.h;
2728 select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
2729 c_fix = format;
2730 c_fix_arg = "";
2731 test_text = "#warning Using <time.h> instead of <sys/time.h>";
2736 * Add missing declaration for putenv.
2738 fix = {
2739 hackname = lynxos_missing_putenv;
2740 mach = '*-*-lynxos*';
2741 files = stdlib.h;
2742 bypass = 'putenv[ \t]*\\(';
2743 select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2744 c_fix = format;
2745 c_fix_arg = "%0\n"
2746 "extern int putenv _AP((char *));";
2747 c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2748 test_text = "extern char *getenv _AP((const char *));";
2753 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
2755 * On NetBSD, machine is a symbolic link to an architecture specific
2756 * directory name, so we can't match a specific file name here.
2758 fix = {
2759 hackname = machine_ansi_h_va_list;
2760 select = "define[ \t]+_BSD_VA_LIST_[ \t]";
2761 bypass = '__builtin_va_list';
2763 c_fix = format;
2764 c_fix_arg = "%1__builtin_va_list";
2765 c_fix_arg = "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
2767 test_text = " # define _BSD_VA_LIST_\tchar**";
2772 * Fix non-ansi machine name defines
2774 fix = {
2775 hackname = machine_name;
2776 c_test = machine_name;
2777 c_fix = machine_name;
2779 test_text = "/* MACH_DIFF: */\n"
2780 "#if defined( i386 ) || defined( sparc ) || defined( vax )"
2781 "\n/* no uniform test, so be careful :-) */";
2786 * Some math.h files define struct exception (it's in the System V
2787 * Interface Definition), which conflicts with the class exception defined
2788 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
2789 * This is not a great fix, but I haven't been able to think of anything
2790 * better.
2792 fix = {
2793 hackname = math_exception;
2794 files = math.h;
2795 select = "struct exception";
2797 * This should be bypassed on __cplusplus, but some supposedly C++ C++
2798 * aware headers, such as Solaris 8 and 9, don't wrap their struct
2799 * exception either. So currently we bypass only for glibc, based on a
2800 * comment in the fixed glibc header. Ick.
2802 bypass = 'We have a problem when using C\+\+|for C\+\+, '
2803 '_[a-z0-9A-Z_]+_exception; for C, exception';
2804 c_fix = wrap;
2806 c_fix_arg = "#ifdef __cplusplus\n"
2807 "#define exception __math_exception\n"
2808 "#endif\n";
2810 c_fix_arg = "#ifdef __cplusplus\n"
2811 "#undef exception\n"
2812 "#endif\n";
2814 test_text = "typedef struct exception t_math_exception;";
2819 * This looks pretty broken to me. ``dbl_max_def'' will contain
2820 * "define DBL_MAX " at the start, when what we really want is just
2821 * the value portion. Can't figure out how to write a test case
2822 * for this either :-(
2824 fix = {
2825 hackname = math_huge_val_from_dbl_max;
2826 files = math.h;
2829 * IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined
2830 * in math.h, this fix applies.
2832 select = "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
2833 bypass = "define[ \t]+DBL_MAX";
2835 shell =
2837 * See if we have a definition for DBL_MAX in float.h.
2838 * If we do, we will replace the one in math.h with that one.
2841 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
2842 "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
2844 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
2845 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
2846 "s@DBL_MAX@'\"$dbl_max_def@\"\n"
2847 "\telse cat\n"
2848 "\tfi";
2850 test_text =
2851 "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
2852 "#define HUGE_VAL DBL_MAX";
2857 * nested comment
2859 fix = {
2860 hackname = nested_auth_des;
2861 files = rpc/rpc.h;
2862 select = '(/\*.*rpc/auth_des\.h>.*)/\*';
2863 c_fix = format;
2864 c_fix_arg = "%1*/ /*";
2865 test_text = "/*#include <rpc/auth_des.h> /* skip this */";
2870 * Some versions of NetBSD don't expect the C99 inline semantics.
2872 fix = {
2873 hackname = netbsd_c99_inline_1;
2874 mach = "*-*-netbsd*";
2875 files = signal.h;
2876 select = "extern __inline int";
2878 c_fix = format;
2879 c_fix_arg = "extern\n"
2880 "#ifdef __GNUC_STDC_INLINE__\n"
2881 "__attribute__((__gnu_inline__))\n"
2882 "#endif\n"
2883 "__inline int";
2885 test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
2889 fix = {
2890 hackname = netbsd_c99_inline_2;
2891 mach = "*-*-netbsd*";
2892 files = signal.h;
2893 select = "#define _SIGINLINE extern __inline";
2895 c_fix = format;
2896 c_fix_arg = <<- _EOArg_
2897 #ifdef __GNUC_STDC_INLINE__
2898 #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
2899 #else
2901 #endif
2902 _EOArg_;
2904 test_text = "#define _SIGINLINE extern __inline";
2909 * NetBSD has a semicolon after the ending '}' for some extern "C".
2911 fix = {
2912 hackname = netbsd_extra_semicolon;
2913 mach = "*-*-netbsd*";
2914 files = sys/cdefs.h;
2915 select = "#define[ \t]*__END_DECLS[ \t]*};";
2917 c_fix = format;
2918 c_fix_arg = "#define __END_DECLS }";
2920 test_text = "#define __END_DECLS };";
2924 /* newlib's stdint.h has several failures to conform to C99. The fix
2925 for these removed a comment that can be matched to identify unfixed
2926 versions. */
2927 fix = {
2928 hackname = newlib_stdint_1;
2929 files = stdint-newlib.h, stdint.h;
2930 select = "@todo - Add support for wint_t types";
2931 sed = "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
2932 sed = "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
2933 sed = "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
2934 sed = "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
2935 sed = "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
2936 sed = "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
2937 sed = 's@#define INT_FAST\([0-9]*\)_MIN.*@#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
2938 sed = 's@#define INT_FAST\([0-9]*\)_MAX.*@#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
2939 sed = 's@#define UINT_FAST\([0-9]*\)_MAX.*@#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
2940 sed = "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
2941 sed = "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
2942 sed = "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
2943 sed = "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
2944 sed = "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
2945 test_text = "/* @todo - Add support for wint_t types. */\n"
2946 "#define INT32_MIN (-2147483647-1)\n"
2947 "#define INT32_MAX 2147483647\n"
2948 "#define UINT32_MAX 4294967295U\n"
2949 "#define INT_LEAST32_MIN (-2147483647-1)\n"
2950 "#define INT_LEAST32_MAX 2147483647\n"
2951 "#define UINT_LEAST32_MAX 4294967295U\n"
2952 "#define INT_FAST8_MIN INT8_MIN\n"
2953 "#define INT_FAST8_MAX INT8_MAX\n"
2954 "#define UINT_FAST8_MAX UINT8_MAX\n"
2955 "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
2956 "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
2957 "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
2958 "#define UINT8_C(x) x##U\n"
2959 "#define UINT16_C(x) x##U";
2963 fix = {
2964 hackname = newlib_stdint_2;
2965 files = stdint-newlib.h, stdint.h;
2966 select = "@todo - Add support for wint_t types";
2967 c_fix = format;
2968 c_fix_arg = "#define INTMAX_MAX __INTMAX_MAX__\n"
2969 "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
2970 "#define UINTMAX_MAX __UINTMAX_MAX__\n"
2971 "#define WCHAR_MAX __WCHAR_MAX__\n"
2972 "#define WCHAR_MIN __WCHAR_MIN__\n"
2973 "#define WINT_MAX __WINT_MAX__\n"
2974 "#define WINT_MIN __WINT_MIN__\n\n"
2975 "%0";
2976 c_fix_arg = '/\*\* Macros for minimum-width integer constant expressions \*/';
2977 test_text = "/* @todo - Add support for wint_t types. */\n"
2978 "/** Macros for minimum-width integer constant expressions */";
2983 * NeXT 3.2 adds const prefix to some math functions.
2984 * These conflict with the built-in functions.
2986 fix = {
2987 hackname = next_math_prefix;
2988 files = ansi/math.h;
2989 select = "^extern[ \t]+double[ \t]+__const__[ \t]";
2991 c_fix = format;
2992 c_fix_arg = "extern double %1(";
2993 c_fix_arg = "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
2995 test_text = "extern\tdouble\t__const__\tmumble();";
3000 * NeXT 3.2 uses the word "template" as a parameter for some
3001 * functions. GCC reports an invalid use of a reserved key word
3002 * with the built-in functions.
3004 fix = {
3005 hackname = next_template;
3006 files = bsd/libc.h;
3007 select = "[ \t]template\\)";
3009 c_fix = format;
3010 c_fix_arg = "(%1)";
3011 c_fix_arg = "\\(([^)]*)[ \t]template\\)";
3012 test_text = "extern mumble( char * template); /* fix */";
3017 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
3018 * function prototypes. That conflicts with the built-in functions.
3020 fix = {
3021 hackname = next_volitile;
3022 files = ansi/stdlib.h;
3023 select = "^extern[ \t]+volatile[ \t]+void[ \t]";
3025 c_fix = format;
3026 c_fix_arg = "extern void %1(";
3027 c_fix_arg = "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
3029 test_text = "extern\tvolatile\tvoid\tabort();";
3034 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
3035 * Note that version 3 of the NeXT system has wait.h in a different directory,
3036 * so that this code won't do anything. But wait.h in version 3 has a
3037 * conditional, so it doesn't need this fix. So everything is okay.
3039 fix = {
3040 hackname = next_wait_union;
3041 files = sys/wait.h;
3043 select = 'wait\(union wait';
3044 c_fix = format;
3045 c_fix_arg = "wait(void";
3046 test_text = "extern pid_d wait(union wait*);";
3051 * a missing semi-colon at the end of the nodeent structure definition.
3053 fix = {
3054 hackname = nodeent_syntax;
3055 files = netdnet/dnetdb.h;
3056 select = "char[ \t]*\\*na_addr[ \t]*$";
3057 c_fix = format;
3058 c_fix_arg = "%0;";
3059 test_text = "char *na_addr\t";
3063 * Fix OpenBSD's NULL definition.
3065 fix = {
3066 hackname = openbsd_null_definition;
3067 mach = "*-*-openbsd*";
3068 files = locale.h, stddef.h, stdio.h, string.h,
3069 time.h, unistd.h, wchar.h, sys/param.h;
3070 select = "__GNUG__";
3071 c_fix = format;
3072 c_fix_arg = "#ifndef NULL\n"
3073 "#ifdef __cplusplus\n"
3074 "#ifdef __GNUG__\n"
3075 "#define NULL\t__null\n"
3076 "#else\t /* ! __GNUG__ */\n"
3077 "#define NULL\t0L\n"
3078 "#endif\t /* __GNUG__ */\n"
3079 "#else\t /* ! __cplusplus */\n"
3080 "#define NULL\t((void *)0)\n"
3081 "#endif\t /* __cplusplus */\n"
3082 "#endif\t /* !NULL */";
3084 c_fix_arg = "^#ifndef[ \t]*NULL\n"
3085 "^#ifdef[ \t]*__GNUG__\n"
3086 "^#define[ \t]*NULL[ \t]*__null\n"
3087 "^#else\n"
3088 "^#define[ \t]*NULL[ \t]*0L\n"
3089 "^#endif\n"
3090 "^#endif";
3091 test_text =
3092 "#ifndef NULL\n"
3093 "#ifdef __GNUG__\n"
3094 "#define NULL __null\n"
3095 "#else\n"
3096 "#define NULL 0L\n"
3097 "#endif\n"
3098 "#endif\n";
3102 * obstack.h used casts as lvalues.
3104 * We need to change postincrements of casted pointers (which are
3105 * then dereferenced and assigned into) of the form
3107 * *((TYPE*)PTRVAR)++ = (VALUE)
3109 * into expressions like
3111 * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
3113 * which is correct for the cases used in obstack.h since PTRVAR is
3114 * of type char * and the value of the expression is not used.
3116 fix = {
3117 hackname = obstack_lvalue_cast;
3118 files = obstack.h;
3119 select = '\*\(\(([^()]*)\*\)(.*)\)\+\+ = \(([^()]*)\)';
3120 c_fix = format;
3121 c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
3122 test_text = "*((void **) (h)->next_free)++ = (aptr)";
3126 * Fix OpenBSD's va_start define.
3128 fix = {
3129 hackname = openbsd_va_start;
3130 mach = "*-*-openbsd*";
3131 files = stdarg.h;
3132 select = '__builtin_stdarg_start';
3133 c_fix = format;
3134 c_fix_arg = __builtin_va_start;
3136 test_text = "#define va_start(v,l) __builtin_stdarg_start((v),l)";
3140 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
3141 * defining regex.h related types. This causes libg++ build and usage
3142 * failures. Fixing this correctly requires checking and modifying 3 files.
3144 fix = {
3145 hackname = osf_namespace_a;
3146 files = reg_types.h;
3147 files = sys/lc_core.h;
3148 test = " -r reg_types.h";
3149 test = " -r sys/lc_core.h";
3150 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
3151 test = " -z \"`grep __regex_t regex.h`\"";
3153 c_fix = format;
3154 c_fix_arg = "__%0";
3155 c_fix_arg = "reg(ex|off|match)_t";
3157 test_text = "`touch sys/lc_core.h`"
3158 "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
3159 "extern regex_t re;\n"
3160 "extern regoff_t ro;\n"
3161 "extern regmatch_t rm;\n";
3164 fix = {
3165 hackname = osf_namespace_c;
3166 files = regex.h;
3167 test = " -r reg_types.h";
3168 test = " -r sys/lc_core.h";
3169 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
3170 test = " -z \"`grep __regex_t regex.h`\"";
3172 select = "#include <reg_types\.h>.*";
3173 c_fix = format;
3174 c_fix_arg = "%0\n"
3175 "typedef __regex_t\tregex_t;\n"
3176 "typedef __regoff_t\tregoff_t;\n"
3177 "typedef __regmatch_t\tregmatch_t;";
3179 test_text = "#include <reg_types.h>";
3184 * On broken glibc-2.3.3 systems an array of incomplete structures is
3185 * passed to __sigsetjmp. Fix that to take a pointer instead.
3187 fix = {
3188 hackname = pthread_incomplete_struct_argument;
3189 files = pthread.h;
3190 select = "struct __jmp_buf_tag";
3191 c_fix = format;
3192 c_fix_arg = "%1 *%2%3";
3193 c_fix_arg = "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) (__env)\\[1\\](.*)$";
3194 test_text = "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask);";
3198 * Fix return type of fread and fwrite on sysV68
3200 fix = {
3201 hackname = read_ret_type;
3202 files = stdio.h;
3203 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
3204 c_fix = format;
3205 c_fix_arg = "extern unsigned int fread(), fwrite();\n%1%2";
3206 c_fix_arg = "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
3208 test_text = "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
3213 * Fix casts as lvalues in glibc's <rpc/xdr.h>.
3215 fix = {
3216 hackname = rpc_xdr_lvalue_cast_a;
3217 files = rpc/xdr.h;
3218 select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
3219 c_fix = format;
3220 c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
3221 test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
3222 "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
3226 fix = {
3227 hackname = rpc_xdr_lvalue_cast_b;
3228 files = rpc/xdr.h;
3229 select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
3230 c_fix = format;
3231 c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
3232 test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
3233 "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
3238 * function class(double x) conflicts with C++ keyword on rs/6000
3240 fix = {
3241 hackname = rs6000_double;
3242 files = math.h;
3243 select = '[^a-zA-Z_]class\(';
3245 c_fix = format;
3246 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
3247 c_fix_arg = '^.*[^a-zA-Z_]class\(.*';
3249 test_text = "extern int class();";
3254 * Wrong fchmod prototype on RS/6000.
3256 fix = {
3257 hackname = rs6000_fchmod;
3258 files = sys/stat.h;
3259 select = 'fchmod\(char \*';
3260 c_fix = format;
3261 c_fix_arg = "fchmod(int";
3262 test_text = "extern int fchmod(char *, mode_t);";
3267 * parameters conflict with C++ new on rs/6000
3269 fix = {
3270 hackname = rs6000_param;
3271 files = "stdio.h";
3272 files = "unistd.h";
3274 select = 'rename\(const char \*old, const char \*new\)';
3275 c_fix = format;
3276 c_fix_arg = 'rename(const char *_old, const char *_new)';
3278 test_text = 'extern int rename(const char *old, const char *new);';
3283 * Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
3284 * for C99. This is wrong for C++, which needs many C99 features, but
3285 * only supports __restrict.
3287 fix = {
3288 hackname = solaris___restrict;
3289 files = sys/feature_tests.h;
3290 select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
3291 mach = "*-*-solaris2*";
3292 c_fix = format;
3293 c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
3294 "#else\n%0\n#endif";
3295 test_text = "#define _RESTRICT_KYWD restrict";
3300 * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
3301 * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
3302 * and imaginary definitions which are not supported by GCC.
3304 fix = {
3305 hackname = solaris_complex;
3306 mach = "*-*-solaris2.*";
3307 files = complex.h;
3308 select = "#define[ \t]_Complex_I[ \t]_Complex_I";
3309 sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
3310 "#define\t_Complex_I\t(__extension__ 1.0iF)/";
3311 sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
3312 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
3313 sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
3314 test_text = "#define _Complex_I _Complex_I\n"
3315 "#define complex _Complex\n"
3316 "#define _Imaginary_I _Imaginary_I\n"
3317 "#define imaginary _Imaginary\n"
3318 "#undef I\n"
3319 "#define I _Imaginary_I";
3324 * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
3325 * extern "C" instead so libstdc++ can use it.
3327 fix = {
3328 hackname = solaris_complex_cxx;
3329 mach = "*-*-solaris2.*";
3330 files = complex.h;
3331 sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
3332 "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
3333 sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
3334 "#ifdef\t__cplusplus\\\n}\\\n#endif";
3335 test_text = "#if !defined(__cplusplus)\n"
3336 "#endif /* !defined(__cplusplus) */";
3341 * Solaris 8 PTHREAD_COND_INITIALIZER lacks the __pthread_cond_magic field.
3342 * COND_MAGIC is only defined in <synch.h> and pollutes the namespace, so
3343 * use the value literally instead.
3345 fix = {
3346 hackname = solaris_cond_init;
3347 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3348 files = pthread.h;
3349 mach = '*-*-solaris2.8';
3350 c_fix = format;
3351 c_fix_arg = "%1, 0x4356%2";
3352 c_fix_arg = "^(#define[ \t]+PTHREAD_COND_INITIALIZER[ \t]+"
3353 "\\{.*0)(\\},[ \t]*0\\}.*)$";
3354 test_text =
3355 '#pragma ident "@(#)pthread.h 1.29 01/07/07 SMI"'"\n"
3356 '#define PTHREAD_COND_INITIALIZER {{{0}, 0}, 0} /* = DEFAULTCV */';
3361 * g++ rejects functions declared with both C and C++ linkage.
3363 fix = {
3364 hackname = solaris_cxx_linkage;
3365 mach = '*-*-solaris2*';
3366 files = "iso/stdlib_iso.h";
3367 select = "(#if __cplusplus >= 199711L)\n"
3368 "(extern \"C\\+\\+\" \\{\n)"
3369 "(.*(bsearch|qsort).*)";
3370 c_fix = format;
3371 c_fix_arg = "%1 && !__GNUG__\n%2%3";
3373 test_text =
3374 "#if __cplusplus >= 199711L\n"
3375 "extern \"C++\" {\n"
3376 " void *bsearch(const void *, const void *, size_t, size_t,";
3381 * Solaris <iso/stdio_iso.h> doesn't declare getc for C++ with
3382 * _STRICT_STDC, but uses it.
3384 fix = {
3385 hackname = solaris_getc_strict_stdc;
3386 mach = "*-*-solaris2*";
3387 files = "iso/stdio_iso.h";
3388 select = "(.*&& )!defined\\(_STRICT_STDC\\)(.*)";
3389 c_fix = format;
3390 c_fix_arg = "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2";
3392 test_text =
3393 "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
3398 * Before Solaris 10, <iso/setjmp_iso.h> doesn't mark longjump noreturn.
3400 fix = {
3401 hackname = solaris_longjmp_noreturn;
3402 mach = "*-*-solaris2*";
3403 files = "iso/setjmp_iso.h";
3404 bypass = "__NORETURN";
3405 select = "(.*longjmp\\(jmp_buf.*[^)]+\\));";
3406 c_fix = format;
3407 c_fix_arg = "%1 __attribute__ ((__noreturn__));";
3409 test_text = "extern void longjmp(jmp_buf, int);";
3414 * Sun Solaris 10 defines several C99 math macros in terms of
3415 * builtins specific to the Studio compiler, in particular not
3416 * compatible with the GNU compiler.
3418 fix = {
3419 hackname = solaris_math_1;
3420 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3421 bypass = "__GNUC__";
3422 files = iso/math_c99.h;
3423 c_fix = format;
3424 c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
3425 c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
3426 test_text =
3427 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3428 "#undef HUGE_VAL\n"
3429 "#define HUGE_VAL __builtin_huge_val\n"
3430 "#undef HUGE_VALF\n"
3431 "#define HUGE_VALF __builtin_huge_valf\n"
3432 "#undef HUGE_VALL\n"
3433 "#define HUGE_VALL __builtin_huge_vall";
3436 fix = {
3437 hackname = solaris_math_2;
3438 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3439 bypass = "__GNUC__";
3440 files = iso/math_c99.h;
3441 c_fix = format;
3442 c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
3443 c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
3444 test_text =
3445 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3446 "#undef INFINITY\n"
3447 "#define INFINITY __builtin_infinity";
3450 fix = {
3451 hackname = solaris_math_3;
3452 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3453 bypass = "__GNUC__";
3454 files = iso/math_c99.h;
3455 c_fix = format;
3456 c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
3457 c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
3458 test_text =
3459 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3460 "#undef NAN\n"
3461 "#define NAN __builtin_nan";
3464 fix = {
3465 hackname = solaris_math_4;
3466 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3467 bypass = "__GNUC__";
3468 files = iso/math_c99.h;
3469 c_fix = format;
3470 c_fix_arg = "#define\tfpclassify(x) \\\n"
3471 " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, (x))";
3472 c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
3473 test_text =
3474 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3475 "#undef fpclassify\n"
3476 "#define fpclassify(x) __builtin_fpclassify(x)";
3479 fix = {
3480 hackname = solaris_math_8;
3481 select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
3482 bypass = "__GNUC__";
3483 files = iso/math_c99.h;
3484 c_fix = format;
3485 c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
3486 "\t\t\t ? __builtin_signbitf(x) \\\n"
3487 "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
3488 "\t\t\t ? __builtin_signbitl(x) \\\n"
3489 "\t\t\t : __builtin_signbit(x))";
3490 c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
3491 test_text = <<- _EOText_
3492 #ident "@(#)math_c99.h 1.9 04/11/01 SMI"
3493 #undef signbit
3494 #define signbit(x) __builtin_signbit(x)
3495 _EOText_;
3498 fix = {
3499 hackname = solaris_math_9;
3500 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3501 bypass = "__GNUC__";
3502 files = iso/math_c99.h;
3503 c_fix = format;
3504 c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
3505 c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)";
3506 test_text =
3507 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3508 "#undef isgreater\n"
3509 "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
3510 "#undef isgreaterequal\n"
3511 "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
3512 "#undef isless\n"
3513 "#define isless(x, y) ((x) __builtin_isless(y))\n"
3514 "#undef islessequal\n"
3515 "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
3516 "#undef islessgreater\n"
3517 "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
3518 "#undef isunordered\n"
3519 "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
3523 * On Solaris 11, if you do isinf(NaN) you'll get a floating point
3524 * exception. Provide an alternative using GCC's builtin.
3527 fix = {
3528 hackname = solaris_math_10;
3529 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3530 files = iso/math_c99.h;
3531 c_fix = format;
3532 c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
3533 c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
3534 "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);[ \t]*\\\\\n"
3535 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
3536 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*\\(-INFINITY\\);[ \t]*\\}\\)";
3537 test_text =
3538 '#pragma ident "@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
3539 "#undef isinf\n"
3540 "#define isinf(x) __extension__( \\\\\n"
3541 " { __typeof(x) __x_i = (x); \\\\\n"
3542 " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
3543 " __x_i == (__typeof(__x_i)) (-INFINITY); })";
3547 * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
3548 * "0" for the last field of the pthread_mutex_t structure, which is
3549 * of type upad64_t, which itself is typedef'd to int64_t, but with
3550 * __STDC__ defined (e.g. by -ansi) it is a union. So change the
3551 * initializer to "{0}" instead
3553 fix = {
3554 hackname = solaris_mutex_init_2;
3555 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3556 files = pthread.h;
3558 * On Solaris 10, this fix is unnecessary because upad64_t is
3559 * always defined correctly regardless of the definition of the
3560 * __STDC__ macro. The first "mach" pattern matches up to
3561 * solaris9. The second "mach" pattern will not match any two (or
3562 * more) digit solaris version, but it will match e.g. 2.5.1.
3564 mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
3565 c_fix = format;
3566 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3567 "%0\n"
3568 "#else\n"
3569 "%1, {0}}%4\n"
3570 "#endif";
3571 c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+"
3572 "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
3573 ",[ \t]*0\\}" "(|[ \t].*)$";
3574 test_text =
3575 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3576 "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
3577 "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
3578 "#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \\\\\n"
3579 " {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}\n"
3580 "#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \\\\\n"
3581 " {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}";
3586 * The pow overloads with int were removed in C++ 2011.
3588 fix = {
3589 hackname = solaris_pow_int_overload;
3590 mach = '*-*-solaris2*';
3591 files = "iso/math_iso.h";
3592 select = "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)"
3593 " *\\{[^{}]*\n[^{}]*\\}";
3594 c_fix = format;
3595 c_fix_arg = "#ifndef __GXX_EXPERIMENTAL_CXX0X__\n%0\n#endif";
3597 test_text =
3598 " inline long double pow(long double __X, int __Y) { return\n"
3599 " __powl(__X, (long double) (__Y)); }";
3604 * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some
3605 * fields of the pthread_rwlock_t structure, which are of type
3606 * upad64_t, which itself is typedef'd to int64_t, but with __STDC__
3607 * defined (e.g. by -ansi) it is a union. So change the initializer
3608 * to "{0}" instead.
3610 fix = {
3611 hackname = solaris_rwlock_init_1;
3612 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3613 files = pthread.h;
3614 mach = '*-*-solaris*';
3615 c_fix = format;
3616 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3617 "%0\n"
3618 "#else\n"
3619 "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
3620 "#endif";
3621 c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
3622 "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
3624 test_text =
3625 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3626 "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
3631 * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
3632 * structure. As such, it need two levels of brackets, but only
3633 * contains one. Wrap the macro definition in an extra layer.
3635 fix = {
3636 hackname = solaris_once_init_1;
3637 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3638 files = pthread.h;
3639 mach = '*-*-solaris*';
3640 c_fix = format;
3641 c_fix_arg = "%1{%2}%3";
3642 c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
3643 test_text =
3644 '#pragma ident "@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
3645 "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
3650 * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
3651 * fields of the pthread_once_t structure, which are of type
3652 * upad64_t, which itself is typedef'd to int64_t, but with __STDC__
3653 * defined (e.g. by -ansi) it is a union. So change the initializer
3654 * to "{0}" instead. This test relies on solaris_once_init_1.
3656 fix = {
3657 hackname = solaris_once_init_2;
3658 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3659 files = pthread.h;
3661 * On Solaris 10, this fix is unnecessary because upad64_t is
3662 * always defined correctly regardless of the definition of the
3663 * __STDC__ macro. The first "mach" pattern matches up to
3664 * solaris9. The second "mach" pattern will not match any two (or
3665 * more) digit solaris version, but it will match e.g. 2.5.1.
3667 mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
3668 c_fix = format;
3669 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3670 "%0\n"
3671 "#else\n"
3672 "%1{0}, {0}, {0}, {%3}%4\n"
3673 "#endif";
3674 c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{\\{)"
3675 "(0, 0, 0, )(PTHREAD_[A-Z_]+)(\\}\\})[ \t]*$";
3676 test_text =
3677 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3678 "#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n";
3683 * Sun Solaris 2 has a version of sys/int_const.h that defines
3684 * UINT8_C and UINT16_C to unsigned constants.
3686 fix = {
3687 hackname = solaris_int_const;
3688 files = sys/int_const.h;
3689 mach = '*-*-solaris2*';
3690 c_fix = format;
3691 c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
3692 "%1\n"
3693 "#define\tUINT16_C(c)\t(c)";
3694 select = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
3695 "(/\*.*\*/)\n"
3696 "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
3697 test_text =
3698 "#define UINT8_C(c) __CONCAT__(c,u)\n"
3699 "/* CSTYLED */\n"
3700 "#define UINT16_C(c) __CONCAT__(c,u)";
3705 * Sun Solaris 2 has a version of sys/int_limits.h that defines
3706 * UINT8_MAX and UINT16_MAX to unsigned constants.
3708 fix = {
3709 hackname = solaris_int_limits_1;
3710 files = sys/int_limits.h;
3711 mach = '*-*-solaris2*';
3712 c_fix = format;
3713 c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
3714 "#define\tUINT16_MAX\t(65535)";
3715 select = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
3716 "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
3717 test_text =
3718 "#define UINT8_MAX (255U)\n"
3719 "#define UINT16_MAX (65535U)";
3724 * Sun Solaris 2 has a version of sys/int_limits.h that defines
3725 * INT_FAST16 limits to wrong values for sys/int_types.h.
3727 fix = {
3728 hackname = solaris_int_limits_2;
3729 files = sys/int_limits.h;
3730 mach = '*-*-solaris2*';
3731 c_fix = format;
3732 c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
3733 select = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
3734 test_text =
3735 "#define INT_FAST16_MAX INT16_MAX\n"
3736 "#define UINT_FAST16_MAX UINT16_MAX\n"
3737 "#define INT_FAST16_MIN INT16_MIN";
3742 * Sun Solaris 2 has a version of sys/int_limits.h that defines
3743 * SIZE_MAX as unsigned long.
3745 fix = {
3746 hackname = solaris_int_limits_3;
3747 files = sys/int_limits.h;
3748 mach = '*-*-solaris2*';
3749 c_fix = format;
3750 c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
3751 select = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
3752 test_text =
3753 "#define SIZE_MAX 4294967295UL";
3758 * Sun Solaris up to 9 has a version of sys/int_types.h that forbids use
3759 * of Standard C99 64-bit types in 32-bit mode.
3761 fix = {
3762 hackname = solaris_int_types;
3763 select = "__STDC__ - 0 == 0";
3764 bypass = "_LONGLONG_TYPE";
3765 files = sys/int_types.h;
3766 c_fix = format;
3767 c_fix_arg =
3768 "(defined(_STDC_C99) || !defined(_STRICT_STDC) || defined(__GNUC__))";
3769 test_text =
3770 "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3771 "typedef long long int64_t;\n"
3772 "#endif\n\n"
3773 "#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))\n"
3774 "typedef int64_t intmax_t;\n"
3775 "#endif";
3780 * Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the
3781 * posix_spawn declarations, which doesn't work with C++.
3783 fix = {
3784 hackname = solaris_posix_spawn_restrict;
3785 files = spawn.h;
3786 mach = '*-*-solaris2*';
3787 c_fix = format;
3788 c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
3789 select = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
3790 test_text =
3791 "char *const argv[_RESTRICT_KYWD],\n"
3792 "char *const envp[_RESTRICT_KYWD]);";
3797 * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
3798 * std::__flsbuf, but <iso/stdio_iso.h> uses them.
3800 fix = {
3801 hackname = solaris_std___filbuf;
3802 files = stdio.h;
3803 mach = '*-*-solaris2*';
3804 bypass = "using std::__filbuf";
3805 select = "(using std::perror;\n)(#endif)";
3806 c_fix = format;
3807 c_fix_arg = "%1#ifndef _LP64\n"
3808 "using std::__filbuf;\n"
3809 "using std::__flsbuf;\n"
3810 "#endif\n%2";
3812 test_text = "using std::perror;\n"
3813 "#endif";
3818 * Sun Solaris 8 has what appears to be some gross workaround for
3819 * some old version of their c++ compiler. G++ doesn't want it
3820 * either, but doesn't want to be tied to SunPRO version numbers.
3822 fix = {
3823 hackname = solaris_stdio_tag;
3824 files = stdio_tag.h;
3826 select = '__cplusplus < 54321L';
3827 /* In Solaris 10, the code in stdio_tag.h is conditionalized on
3828 "!defined(__GNUC__)" so we no longer need to fix it. */
3829 bypass = '__GNUC__';
3830 sed = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
3832 test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
3837 * On Solaris 8 and 9, __va_list needs to become a typedef for
3838 * __builtin_va_list to make -Wmissing-format-attribute work.
3840 fix = {
3841 hackname = solaris_sys_va_list;
3842 files = sys/va_list.h;
3843 mach = '*-*-solaris2.[89]';
3844 select = "#if.*__STDC__.*\n"
3845 "typedef void \\*__va_list;\n"
3846 "#else\n"
3847 "typedef char \\*__va_list;\n"
3848 "#endif";
3850 c_fix = format;
3851 c_fix_arg = "#ifdef __GNUC__\n"
3852 "typedef __builtin_va_list __va_list;\n"
3853 "#else\n"
3854 "%0\n"
3855 "#endif";
3856 test_text = "#if defined(__STDC__) && !defined(__ia64)\n"
3857 "typedef void *__va_list;\n"
3858 "#else\n"
3859 "typedef char *__va_list;\n"
3860 "#endif";
3865 * a missing semi-colon at the end of the statsswtch structure definition.
3867 fix = {
3868 hackname = statsswtch;
3869 files = rpcsvc/rstat.h;
3870 select = "boottime$";
3871 c_fix = format;
3872 c_fix_arg = "boottime;";
3873 test_text = "struct statswtch {\n int boottime\n};";
3878 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
3879 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
3880 * OK too.
3882 fix = {
3883 hackname = stdio_stdarg_h;
3884 files = stdio.h;
3885 bypass = "include.*(stdarg\.h|machine/ansi\.h)";
3887 * On Solaris 10, this fix is unncessary; <stdio.h> includes
3888 * <iso/stdio_iso.h>, which includes <sys/va_list.h>.
3890 mach = '*-*-solaris2.1[0-9]*';
3891 not_machine = true;
3893 c_fix = wrap;
3895 c_fix_arg = "#define __need___va_list\n#include <stdarg.h>\n";
3897 test_text = "";
3902 * Don't use or define the name va_list in stdio.h. This is for
3903 * ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
3904 * of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
3905 * indicate that the header knows what it's doing -- under SUSv2,
3906 * stdio.h is required to define va_list, and we shouldn't break
3907 * that. On IRIX 6.5, internal/wchar_core.h used to get its
3908 * definition of va_list from stdio.h. Since this doesn't happen any
3909 * longer, use __gnuc_va_list there, too.
3911 fix = {
3912 hackname = stdio_va_list;
3913 files = stdio.h;
3914 files = internal/stdio_core.h;
3915 files = internal/wchar_core.h;
3916 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
3918 * On Solaris 10, the definition in
3919 * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
3920 * there is therefore no need for this fix there.
3922 mach = '*-*-solaris2.1[0-9]*';
3923 not_machine = true;
3926 * Use __gnuc_va_list in arg types in place of va_list.
3927 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3928 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3929 * trailing parentheses and semicolon save all other systems from this.
3930 * Define __not_va_list__ (something harmless and unused)
3931 * instead of va_list.
3932 * Don't claim to have defined va_list.
3934 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3935 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3936 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3937 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3938 "s@ va_list@ __not_va_list__@\n"
3939 "s@\\*va_list@*__not_va_list__@\n"
3940 "s@ __va_list)@ __gnuc_va_list)@\n"
3941 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3942 "@typedef \\1 __not_va_list__;@\n"
3943 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3944 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3945 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3946 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3947 "s@VA_LIST@DUMMY_VA_LIST@\n"
3948 "s@_Va_LIST@_VA_LIST@";
3949 test_text = "extern void mumble( va_list);";
3954 * Fix headers that use va_list from stdio.h to use the updated
3955 * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
3956 * dealt with elsewhere. The presence of __gnuc_va_list,
3957 * __DJ_va_list, or _G_va_list is taken to indicate that the header
3958 * knows what it's doing.
3960 fix = {
3961 hackname = stdio_va_list_clients;
3962 files = com_err.h;
3963 files = cps.h;
3964 files = curses.h;
3965 files = krb5.h;
3966 files = lc_core.h;
3967 files = pfmt.h;
3968 files = wchar.h;
3969 files = curses_colr/curses.h;
3970 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
3971 /* Don't fix, if we use va_list from stdarg.h, or if the use is
3972 otherwise protected. */
3973 bypass = 'include <stdarg\.h>|#ifdef va_start';
3976 * Use __gnuc_va_list in arg types in place of va_list.
3977 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3978 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3979 * trailing parentheses and semicolon save all other systems from this.
3980 * Define __not_va_list__ (something harmless and unused)
3981 * instead of va_list.
3982 * Don't claim to have defined va_list.
3984 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3985 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3986 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3987 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3988 "s@ va_list@ __not_va_list__@\n"
3989 "s@\\*va_list@*__not_va_list__@\n"
3990 "s@ __va_list)@ __gnuc_va_list)@\n"
3991 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3992 "@typedef \\1 __not_va_list__;@\n"
3993 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3994 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3995 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3996 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3997 "s@VA_LIST@DUMMY_VA_LIST@\n"
3998 "s@_Va_LIST@_VA_LIST@";
3999 test_text = "extern void mumble( va_list);";
4004 * "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
4005 * is "!defined( __STRICT_ANSI__ )"
4007 fix = {
4008 hackname = strict_ansi_not;
4009 select = "^([ \t]*#[ \t]*if.*)"
4010 "(!__STDC__"
4011 "|__STDC__[ \t]*==[ \t]*0"
4012 "|__STDC__[ \t]*!=[ \t]*1"
4013 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
4014 /* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
4015 bypass = 'GNU and MIPS C compilers define __STDC__ differently';
4016 /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
4017 is not defined by GCC, so it is safe. */
4018 bypass = '__SCO_VERSION__.*__STDC__ != 1';
4019 c_test = stdc_0_in_system_headers;
4021 c_fix = format;
4022 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
4024 test_text = "#if !__STDC__ \n"
4025 "#if __STDC__ == 0\n"
4026 "#if __STDC__ != 1\n"
4027 "#if __STDC__ - 0 == 0"
4028 "/* not std C */\nint foo;\n"
4029 "\n#end-end-end-end-if :-)";
4033 * "__STDC__-0==0"
4034 * is "!defined( __STRICT_ANSI__ )" on continued #if-s
4036 fix = {
4037 hackname = strict_ansi_not_ctd;
4038 files = math.h, limits.h, stdio.h, signal.h,
4039 stdlib.h, sys/signal.h, time.h;
4041 * Starting at the beginning of a line, skip white space and
4042 * a leading "(" or "&&" or "||". One of those must be found.
4043 * Then, zero, one or more copies of a "defined(_FOO_BAR_) &&"
4044 * expression. If these are nested, then they must accumulate
4045 * because we won't match any closing parentheses. Finally,
4046 * after skipping over all that, we must then match our suspect
4047 * phrase: "__STDC__-0==0" with or without white space.
4049 select = "^([ \t]*" '(\(|&&|\|\|)'
4050 "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
4051 "[ \t(]*)"
4052 "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
4053 c_test = stdc_0_in_system_headers;
4055 c_fix = format;
4056 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
4058 test_text = "#if 1 && \\\\\n"
4059 "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
4060 "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
4061 "|| __STDC__ - 0 == 0 ) /* not std C */\n"
4062 "int foo;\n#endif";
4067 * "__STDC__!=0" or "__STDC__==1" or "__STDC__-0==1"
4068 * is "defined( __STRICT_ANSI__ )"
4070 fix = {
4071 hackname = strict_ansi_only;
4072 select = "^([ \t]*#[ \t]*if.*)"
4073 "(__STDC__[ \t]*!=[ \t]*0"
4074 "|__STDC__[ \t]*==[ \t]*1"
4075 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
4076 "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
4077 c_test = stdc_0_in_system_headers;
4079 c_fix = format;
4080 c_fix_arg = "%1 defined(__STRICT_ANSI__)";
4082 test_text = "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
4087 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
4088 * in prototype without previous definition.
4090 fix = {
4091 hackname = struct_file;
4092 files = rpc/xdr.h;
4093 select = '^.*xdrstdio_create.*struct __file_s';
4094 c_fix = format;
4095 c_fix_arg = "struct __file_s;\n%0";
4096 test_text = "extern void xdrstdio_create( struct __file_s* );";
4101 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
4102 * in prototype without previous definition.
4104 * Don't fix OpenBSD, which uses struct sockaddr_in prototyping the same
4105 * function, and does define it.
4107 fix = {
4108 hackname = struct_sockaddr;
4109 files = rpc/auth.h;
4110 select = "^.*authdes_create.*struct sockaddr[^_]";
4111 bypass = "<sys/socket\.h>";
4112 bypass = "struct sockaddr;\n";
4113 c_fix = format;
4114 c_fix_arg = "struct sockaddr;\n%0";
4115 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
4120 * Apply fix this to all OSs since this problem seems to effect
4121 * more than just SunOS.
4123 fix = {
4124 hackname = sun_auth_proto;
4125 files = rpc/auth.h;
4126 files = rpc/clnt.h;
4127 files = rpc/svc.h;
4128 files = rpc/xdr.h;
4129 bypass = "__cplusplus";
4131 * Select those files containing '(*name)()'.
4133 select = '\(\*[a-z][a-z_]*\)\(\)';
4135 c_fix = format;
4136 c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n"
4137 "#else\n%1();%2\n#endif";
4138 c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
4140 test_text =
4141 "struct auth_t {\n"
4142 " int (*name)(); /* C++ bad */\n"
4143 "};";
4148 * Fix bogus #ifdef on SunOS 4.1.
4150 fix = {
4151 hackname = sun_bogus_ifdef;
4152 files = "hsfs/hsfs_spec.h";
4153 files = "hsfs/iso_spec.h";
4154 select = '#ifdef(.*\|\|.*)';
4155 c_fix = format;
4156 c_fix_arg = "#if%1";
4158 test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
4163 * Fix the CAT macro in SunOS memvar.h.
4165 fix = {
4166 hackname = sun_catmacro;
4167 files = pixrect/memvar.h;
4168 select = "^#define[ \t]+CAT\\(a,b\\).*";
4169 c_fix = format;
4171 c_fix_arg =
4172 "#ifdef __STDC__\n"
4173 "# define CAT(a,b) a##b\n"
4174 "#else\n%0\n#endif";
4176 test_text =
4177 "#define CAT(a,b)\ta/**/b";
4182 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
4183 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
4185 fix = {
4186 hackname = sun_malloc;
4187 files = malloc.h;
4188 bypass = "_CLASSIC_ANSI_TYPES";
4190 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
4191 sed = "s/int[ \t][ \t]*free/void\tfree/g";
4192 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
4193 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
4194 sed = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
4196 test_text =
4197 "typedef char *\tmalloc_t;\n"
4198 "int \tfree();\n"
4199 "char*\tmalloc();\n"
4200 "char*\tcalloc();\n"
4201 "char*\trealloc();";
4206 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
4208 fix = {
4209 hackname = sun_rusers_semi;
4210 files = rpcsvc/rusers.h;
4211 select = "_cnt$";
4212 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
4213 test_text = "struct mumble\n int _cnt\n};";
4218 * signal.h on SunOS defines signal using (),
4219 * which causes trouble when compiling with g++ -pedantic.
4221 fix = {
4222 hackname = sun_signal;
4223 files = sys/signal.h;
4224 files = signal.h;
4225 select = "^void\t" '\(\*signal\(\)\)\(\);.*';
4227 c_fix = format;
4228 c_fix_arg =
4229 "#ifdef __cplusplus\n"
4230 "void\t(*signal(...))(...);\n"
4231 "#else\n%0\n#endif";
4233 test_text = "void\t(*signal())();";
4238 * Correct the return type for strlen in strings.h in SunOS 4.
4240 fix = {
4241 hackname = sunos_strlen;
4242 files = strings.h;
4243 select = "int[ \t]*strlen\\(\\);(.*)";
4244 c_fix = format;
4245 c_fix_arg = "__SIZE_TYPE__ strlen();%1";
4246 test_text = " int\tstrlen(); /* string length */";
4251 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
4252 * that is visible to any ANSI compiler using this include. Simply
4253 * delete the lines that #define some string functions to internal forms.
4255 fix = {
4256 hackname = svr4_disable_opt;
4257 files = string.h;
4258 select = '#define.*__std_hdr_';
4259 sed = '/#define.*__std_hdr_/d';
4260 test_text = "#define strlen __std_hdr_strlen\n";
4265 * Fix broken decl of getcwd present on some svr4 systems.
4267 fix = {
4268 hackname = svr4_getcwd;
4269 files = stdlib.h;
4270 files = unistd.h;
4271 files = prototypes.h;
4272 select = 'getcwd\(char \*, int\)';
4274 c_fix = format;
4275 c_fix_arg = "getcwd(char *, size_t)";
4277 test_text = "extern char* getcwd(char *, int);";
4282 * Fix broken decl of profil present on some svr4 systems.
4284 fix = {
4285 hackname = svr4_profil;
4286 files = stdlib.h;
4287 files = unistd.h;
4289 select =
4290 'profil\(unsigned short \*, unsigned int, unsigned int, unsigned int\)';
4291 /* The fix is wrong on IRIX 5/6 and creates a conflict with another
4292 prototype in <sys/profil.h>. */
4293 bypass = 'Silicon Graphics';
4294 c_fix = format;
4295 c_fix_arg = 'profil(unsigned short *, size_t, int, unsigned int)';
4297 test_text =
4298 'profil(unsigned short *, unsigned int, unsigned int, unsigned int);';
4303 * Correct types for signal handler constants like SIG_DFL; they might be
4304 * void (*) (), and should be void (*) (int). C++ doesn't like the
4305 * old style.
4307 fix = {
4308 hackname = svr4_sighandler_type;
4309 files = sys/signal.h;
4310 select = 'void *\(\*\)\(\)';
4311 c_fix = format;
4312 c_fix_arg = "void (*)(int)";
4313 test_text = "#define SIG_DFL (void(*)())0\n"
4314 "#define SIG_IGN (void (*)())0\n";
4319 * Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local
4320 * function 'getrnge' in <regexp.h> before they declare it. For these
4321 * systems add a 'static int' declaration of 'getrnge' into <regexp.h>
4322 * early on.
4324 * 'getrnge' traditionally manipulates a file-scope global called 'size',
4325 * so put the declaration right after the declaration of 'size'.
4327 * Don't do this if there is already a `static void getrnge' declaration
4328 * present, since this would cause a redeclaration error. Solaris 2.x has
4329 * such a declaration.
4331 fix = {
4332 hackname = svr4_undeclared_getrnge;
4333 files = regexp.h;
4334 select = "getrnge";
4335 bypass = "static void getrnge";
4336 c_fix = format;
4337 c_fix_arg = "%0\n"
4338 "static int getrnge ();";
4339 c_fix_arg = "^static int[ \t]+size;";
4340 test_text = "static int size;\n"
4341 "/* stuff which calls getrnge() */\n"
4342 "static getrnge()\n"
4343 "{}";
4348 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
4349 * in string.h on sysV68
4350 * Correct the return type for strlen in string.h on Lynx.
4351 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
4352 * Add missing const for strdup on OSF/1 V3.0.
4353 * On sysV88 layout is slightly different.
4355 fix = {
4356 hackname = sysv68_string;
4357 files = testing.h;
4358 files = string.h;
4359 bypass = "_CLASSIC_ANSI_TYPES";
4361 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
4362 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
4363 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
4365 sed = "/^extern char$/N";
4366 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
4368 sed = "/^extern int$/N";
4369 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
4371 sed = "/^\tstrncmp(),$/N";
4372 sed = 's/^\(' "\t" 'strncmp()\),\n\(' "\t" 'strlen(),\)$/'
4373 '\1;' "\\\nextern unsigned int\\\n\\2/";
4375 test_text =
4376 "extern int strlen();\n"
4378 "extern int ffs(long);\n"
4380 "extern char\n"
4381 "\t*memccpy(),\n"
4382 "\tmemcpy();\n"
4384 "extern int\n"
4385 "\tstrcmp(),\n"
4386 "\tstrncmp(),\n"
4387 "\tstrlen(),\n"
4388 "\tstrspn();\n"
4390 "extern int\n"
4391 "\tstrlen(), strspn();";
4396 * Fix return type of calloc, malloc, realloc, bsearch and exit
4398 fix = {
4399 hackname = sysz_stdlib_for_sun;
4400 files = stdlib.h;
4401 bypass = "_CLASSIC_ANSI_TYPES";
4403 select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
4404 c_fix = format;
4405 c_fix_arg = "void *\t%1(";
4407 test_text =
4408 "extern char*\tcalloc(size_t);\n"
4409 "extern char*\tmalloc(size_t);\n"
4410 "extern char*\trealloc(void*,size_t);\n"
4411 "extern char*\tbsearch(void*,size_t,size_t);\n";
4416 * __thread is now a keyword.
4418 fix = {
4419 hackname = thread_keyword;
4420 files = "pthread.h";
4421 files = "bits/sigthread.h";
4422 select = "([* ])__thread([,)])";
4423 c_fix = format;
4424 c_fix_arg = "%1__thr%2";
4426 test_text =
4427 "extern int pthread_create (pthread_t *__restrict __thread,\n"
4428 "extern int pthread_kill (pthread_t __thread, int __signo);\n"
4429 "extern int pthread_cancel (pthread_t __thread);";
4433 * if the #if says _cplusplus, not the double underscore __cplusplus
4434 * that it should be
4436 fix = {
4437 hackname = tinfo_cplusplus;
4438 files = tinfo.h;
4439 select = "[ \t]_cplusplus";
4441 c_fix = format;
4442 c_fix_arg = " __cplusplus";
4443 test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
4448 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4450 fix = {
4451 hackname = ultrix_const;
4452 files = stdio.h;
4453 select = 'perror\( char \*';
4455 c_fix = format;
4456 c_fix_arg = "%1 const %3 *__";
4457 c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
4458 "[ \t]+(char|void) \\*__";
4460 test_text =
4461 "extern void perror( char *__s );\n"
4462 "extern int fputs( char *__s, FILE *);\n"
4463 "extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
4464 "extern int fscanf( FILE *__stream, char *__format, ...);\n"
4465 "extern int scanf( char *__format, ...);\n";
4470 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4472 fix = {
4473 hackname = ultrix_const2;
4474 files = stdio.h;
4476 select = '\*fopen\( char \*';
4477 c_fix = format;
4478 c_fix_arg = "%1( const char *%3, const char *";
4479 c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
4480 "[ \t]*char[ \t]*\\*([^,]*),"
4481 "[ \t]*char[ \t]*\\*[ \t]*";
4483 test_text =
4484 "extern FILE *fopen( char *__filename, char *__type );\n"
4485 "extern int sscanf( char *__s, char *__format, ...);\n"
4486 "extern FILE *popen(char *, char *);\n"
4487 "extern char *tempnam(char*,char*);\n";
4492 * Fix definitions of macros used by va-i960.h in VxWorks header file.
4494 fix = {
4495 hackname = va_i960_macro;
4496 files = arch/i960/archI960.h;
4497 select = "__(vsiz|vali|vpad|alignof__)";
4499 c_fix = format;
4500 c_fix_arg = "__vx%1";
4502 test_text =
4503 "extern int __vsiz vsiz;\n"
4504 "extern int __vali vali;\n"
4505 "extern int __vpad vpad;\n"
4506 "#define __alignof__(x) ...";
4511 * Define __CAN_USE_EXTERN_PREFIX on vms.
4513 fix = {
4514 hackname = vms_define_can_use_extern_prefix;
4515 files = "rtldef/decc$types.h";
4516 select = "#[ \t]*else\n"
4517 "#[ \t]*if defined\\(__DECCXX\\)\n"
4518 "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n";
4519 mach = "*-*-*vms*";
4520 c_fix = format;
4522 c_fix_arg = "%0"
4523 "# elif defined (__GNUC__)\n"
4524 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n";
4526 test_text = "# else\n"
4527 "# if defined(__DECCXX)\n"
4528 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"
4529 "# endif\n"
4530 "# endif\n";
4534 * On VMS, use pragma extern_model instead of VAX-C keywords.
4536 fix = {
4537 hackname = vms_use_pragma_extern_model;
4538 select = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n"
4539 "# pragma extern_model __save\n";
4540 mach = "*-*-*vms*";
4541 c_fix = format;
4543 c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n"
4544 "# pragma extern_model __save\n";
4546 test_text = "#if defined(__DECC) || defined(__DECCXX)\n"
4547 "# pragma extern_model __save\n"
4548 "# pragma extern_model strict_refdef\n"
4549 " extern struct x zz$yy;\n"
4550 "# pragma extern_model __restore\n"
4551 "#endif\n";
4555 * On VMS, disable the use of dec-c string builtins
4557 fix = {
4558 hackname = vms_disable_decc_string_builtins;
4559 select = "#if !defined\\(__VAX\\)\n";
4560 mach = "*-*-*vms*";
4561 files = "rtldef/string.h";
4562 c_fix = format;
4564 c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n";
4566 test_text = "#if !defined(__VAX)\n";
4570 * AIX and Interix headers define NULL to be cast to a void pointer,
4571 * which is illegal in ANSI C++.
4573 fix = {
4574 hackname = void_null;
4575 files = curses.h;
4576 files = dbm.h;
4577 files = locale.h;
4578 files = stdio.h;
4579 files = stdlib.h;
4580 files = string.h;
4581 files = time.h;
4582 files = unistd.h;
4583 files = sys/dir.h;
4584 files = sys/param.h;
4585 files = sys/types.h;
4586 /* avoid changing C++ friendly NULL */
4587 bypass = __cplusplus;
4588 bypass = __null;
4589 select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
4590 c_fix = format;
4591 c_fix_arg = "#define NULL 0";
4592 test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
4597 * Make VxWorks header which is almost gcc ready fully gcc ready.
4599 fix = {
4600 hackname = vxworks_gcc_problem;
4601 files = types/vxTypesBase.h;
4602 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
4604 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
4605 "#if 1/";
4607 sed = "/[ \t]size_t/i\\\n"
4608 "#ifndef _GCC_SIZE_T\\\n"
4609 "#define _GCC_SIZE_T\n";
4611 sed = "/[ \t]size_t/a\\\n"
4612 "#endif\n";
4614 sed = "/[ \t]ptrdiff_t/i\\\n"
4615 "#ifndef _GCC_PTRDIFF_T\\\n"
4616 "#define _GCC_PTRDIFF_T\n";
4618 sed = "/[ \t]ptrdiff_t/a\\\n"
4619 "#endif\n";
4621 sed = "/[ \t]wchar_t/i\\\n"
4622 "#ifndef _GCC_WCHAR_T\\\n"
4623 "#define _GCC_WCHAR_T\n";
4625 sed = "/[ \t]wchar_t/a\\\n"
4626 "#endif\n";
4628 test_text =
4629 "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
4630 "typedef unsigned int size_t;\n"
4631 "typedef long ptrdiff_t;\n"
4632 "typedef unsigned short wchar_t;\n"
4633 "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
4638 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
4640 fix = {
4641 hackname = vxworks_needs_vxtypes;
4642 files = time.h;
4643 select = "uint_t([ \t]+_clocks_per_sec)";
4644 c_fix = format;
4645 c_fix_arg = "unsigned int%1";
4646 test_text = "uint_t\t_clocks_per_sec;";
4651 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
4653 fix = {
4654 hackname = vxworks_needs_vxworks;
4655 files = sys/stat.h;
4656 test = " -r types/vxTypesOld.h";
4657 test = " -n \"`egrep '#include' $file`\"";
4658 test = " -n \"`egrep ULONG $file`\"";
4659 select = "#[ \t]define[ \t]+__INCstath";
4661 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
4662 "#include <types/vxTypesOld.h>\n";
4664 test_text = "`touch types/vxTypesOld.h`"
4665 "#include </dev/null> /* ULONG */\n"
4666 "# define\t__INCstath <sys/stat.h>";
4671 * Another bad dependency in VxWorks 5.2 <time.h>.
4673 fix = {
4674 hackname = vxworks_time;
4675 files = time.h;
4676 test = " -r vxWorks.h";
4678 select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
4679 c_fix = format;
4681 c_fix_arg =
4682 "#ifndef __gcc_VOIDFUNCPTR_defined\n"
4683 "#ifdef __cplusplus\n"
4684 "typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
4685 "#else\n"
4686 "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
4687 "#endif\n"
4688 "#define __gcc_VOIDFUNCPTR_defined\n"
4689 "#endif\n"
4690 "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
4692 test_text = "`touch vxWorks.h`"
4693 "#define VOIDFUNCPTR (void(*)())";
4698 * There are several name conflicts with C++ reserved words in X11 header
4699 * files. These are fixed in some versions, so don't do the fixes if
4700 * we find __cplusplus in the file. These were found on the RS/6000.
4702 fix = {
4703 hackname = x11_class;
4704 files = X11/ShellP.h;
4705 bypass = __cplusplus;
4706 select = "^([ \t]*char \\*)class;(.*)";
4707 c_fix = format;
4708 c_fix_arg = "#ifdef __cplusplus\n%1c_class;%2\n"
4709 "#else\n%1class;%2\n#endif";
4710 test_text =
4711 "struct {\n"
4712 " char *class;\n"
4713 "} mumble;\n";
4718 * class in Xm/BaseClassI.h
4720 fix = {
4721 hackname = x11_class_usage;
4722 files = Xm/BaseClassI.h;
4723 bypass = "__cplusplus";
4725 select = " class\\)";
4726 c_fix = format;
4727 c_fix_arg = " c_class)";
4729 test_text = "extern mumble (int class);\n";
4734 * new in Xm/Traversal.h
4736 fix = {
4737 hackname = x11_new;
4738 files = Xm/Traversal.h;
4739 bypass = __cplusplus;
4741 sed = "/Widget\told, new;/i\\\n"
4742 "#ifdef __cplusplus\\\n"
4743 "\\\tWidget\told, c_new;\\\n"
4744 "#else\n";
4746 sed = "/Widget\told, new;/a\\\n"
4747 "#endif\n";
4749 sed = "s/Widget new,/Widget c_new,/g";
4750 test_text =
4751 "struct wedge {\n"
4752 " Widget\told, new;\n"
4753 "};\nextern Wedged( Widget new, Widget old );";
4758 * Incorrect sprintf declaration in X11/Xmu.h
4760 fix = {
4761 hackname = x11_sprintf;
4762 files = X11/Xmu.h;
4763 files = X11/Xmu/Xmu.h;
4764 select = "^extern char \\*\tsprintf\\(\\);$";
4766 c_fix = format;
4767 c_fix_arg = "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
4769 test_text = "extern char *\tsprintf();";
4772 /*EOF*/