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 \
12 trailer
='^/\*EOF\*[/]' \
14 key
='hackname[ ]*=[ ]*(.*);'
16 Set up a debug test so we can make the templates emit special
17 code while debugging these fixes
: */
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
31 hackname
= AAB_aix_stdio
;
33 select
= "define fopen fopen64";
35 test
-text
= ''; /* no way to test
*/
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
52 /* Alias the symbols using asm
*/
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");
68 /* On AIX when _LARGE_FILES is defined fcntl.h defines open to
69 * open64 and creat to creat64. This fixes fcntl.h to
70 * undef those defines and use __asm__ to alias the symbols if
71 * building with g
++ and
-D_LARGE_FILES
74 hackname
= AAB_aix_fcntl
;
76 select
= "define open[ \t]open64";
78 test
-text
= ''; /* no way to test
*/
84 c_fix_arg
= <<- _EOArg_
86 #if defined __GNUG__
&& defined _LARGE_FILES
&& defined __cplusplus
87 #define __need__aix_fcntl_h_fix
88 #ifdef __need__aix_fcntl_h_fix
92 /* Alias the symbols using asm
*/
94 extern int
open(const char
*, int
, ...
) __asm__("open64");
95 extern int
creat(const char
*, mode_t
) __asm__("creat64");
96 #
if (_XOPEN_SOURCE
>= 700)
97 extern int
openat(int
, const char
*, int
, ...
) __asm__("open64at");
108 * On Mac OS
10.3.9, the
'long double' functions are available in
109 * libSystem
, but are not prototyped in math.h.
112 hackname
= AAB_darwin7_9_long_double_funcs
;
113 mach
= "*-*-darwin7.9*";
114 files
= architecture
/ppc
/math.h
;
116 replace
= <<- _EndOfHeader_
117 /* This file prototypes the long double functions available on Mac OS
121 # define __APPLE_CC__
1345
122 # include_next
<architecture
/ppc
/math.h
>
124 # define __APPLE_CC__
1
125 # ifndef __LIBMLDBL_COMPAT
126 # ifdef __LONG_DOUBLE_128__
127 # define
__LIBMLDBL_COMPAT(sym
) __asm("_" #sym
"$LDBL128")
129 # define
__LIBMLDBL_COMPAT(sym
)
130 # endif
/* __LONG_DOUBLE_128__
*/
131 # endif
/* __LIBMLDBL_COMPAT
*/
135 extern long double
acosl( long double
) __LIBMLDBL_COMPAT(acosl
);
136 extern long double
asinl( long double
) __LIBMLDBL_COMPAT(asinl
);
137 extern long double
atanl( long double
) __LIBMLDBL_COMPAT(atanl
);
138 extern long double
atan2l( long double
, long double
) __LIBMLDBL_COMPAT(atan2l
);
139 extern long double
cosl( long double
) __LIBMLDBL_COMPAT(cosl
);
140 extern long double
sinl( long double
) __LIBMLDBL_COMPAT(sinl
);
141 extern long double
tanl( long double
) __LIBMLDBL_COMPAT(tanl
);
142 extern long double
acoshl( long double
) __LIBMLDBL_COMPAT(acoshl
);
143 extern long double
asinhl( long double
) __LIBMLDBL_COMPAT(asinhl
);
144 extern long double
atanhl( long double
) __LIBMLDBL_COMPAT(atanhl
);
145 extern long double
coshl( long double
) __LIBMLDBL_COMPAT(coshl
);
146 extern long double
sinhl( long double
) __LIBMLDBL_COMPAT(sinhl
);
147 extern long double
tanhl( long double
) __LIBMLDBL_COMPAT(tanhl
);
148 extern long double
expl( long double
) __LIBMLDBL_COMPAT(expl
);
149 extern long double
exp2l( long double
) __LIBMLDBL_COMPAT(exp2l
);
150 extern long double
expm1l( long double
) __LIBMLDBL_COMPAT(expm1l
);
151 extern long double
logl( long double
) __LIBMLDBL_COMPAT(logl
);
152 extern long double
log10l( long double
) __LIBMLDBL_COMPAT(log10l
);
153 extern long double
log2l( long double
) __LIBMLDBL_COMPAT(log2l
);
154 extern long double
log1pl( long double
) __LIBMLDBL_COMPAT(log1pl
);
155 extern long double
logbl( long double
) __LIBMLDBL_COMPAT(logbl
);
156 extern long double
modfl( long double
, long double
* ) __LIBMLDBL_COMPAT(modfl
);
157 extern long double
ldexpl( long double
, int
) __LIBMLDBL_COMPAT(ldexpl
);
158 extern long double
frexpl( long double
, int
* ) __LIBMLDBL_COMPAT(frexpl
);
159 extern int
ilogbl( long double
) __LIBMLDBL_COMPAT(ilogbl
);
160 extern long double
scalbnl( long double
, int
) __LIBMLDBL_COMPAT(scalbnl
);
161 extern long double
scalblnl( long double
, long int
) __LIBMLDBL_COMPAT(scalblnl
);
162 extern long double
fabsl( long double
) __LIBMLDBL_COMPAT(fabsl
);
163 extern long double
cbrtl( long double
) __LIBMLDBL_COMPAT(cbrtl
);
164 extern long double
hypotl( long double
, long double
) __LIBMLDBL_COMPAT(hypotl
);
165 extern long double
powl( long double
, long double
) __LIBMLDBL_COMPAT(powl
);
166 extern long double
sqrtl( long double
) __LIBMLDBL_COMPAT(sqrtl
);
167 extern long double
erfl( long double
) __LIBMLDBL_COMPAT(erfl
);
168 extern long double
erfcl( long double
) __LIBMLDBL_COMPAT(erfcl
);
169 extern long double
lgammal( long double
) __LIBMLDBL_COMPAT(lgammal
);
170 extern long double
tgammal( long double
) __LIBMLDBL_COMPAT(tgammal
);
171 extern long double
ceill( long double
) __LIBMLDBL_COMPAT(ceill
);
172 extern long double
floorl( long double
) __LIBMLDBL_COMPAT(floorl
);
173 extern long double
nearbyintl( long double
) __LIBMLDBL_COMPAT(nearbyintl
);
174 extern long double
rintl( long double
) __LIBMLDBL_COMPAT(rintl
);
175 extern long int
lrintl( long double
) __LIBMLDBL_COMPAT(lrintl
);
176 extern long long int
llrintl( long double
) __LIBMLDBL_COMPAT(llrintl
);
177 extern long double
roundl( long double
) __LIBMLDBL_COMPAT(roundl
);
178 extern long int
lroundl( long double
) __LIBMLDBL_COMPAT(lroundl
);
179 extern long long int
llroundl( long double
) __LIBMLDBL_COMPAT(llroundl
);
180 extern long double
truncl( long double
) __LIBMLDBL_COMPAT(truncl
);
181 extern long double
fmodl( long double
, long double
) __LIBMLDBL_COMPAT(fmodl
);
182 extern long double
remainderl( long double
, long double
) __LIBMLDBL_COMPAT(remainderl
);
183 extern long double
remquol( long double
, long double
, int
* ) __LIBMLDBL_COMPAT(remquol
);
184 extern long double
copysignl( long double
, long double
) __LIBMLDBL_COMPAT(copysignl
);
185 extern long double
nanl( const char
* ) __LIBMLDBL_COMPAT(nanl
);
186 extern long double
nextafterl( long double
, long double
) __LIBMLDBL_COMPAT(nextafterl
);
187 extern long double
nexttowardl( long double
, long double
) __LIBMLDBL_COMPAT(nexttowardl
);
188 extern long double
fdiml( long double
, long double
) __LIBMLDBL_COMPAT(fdiml
);
189 extern long double
fmaxl( long double
, long double
) __LIBMLDBL_COMPAT(fmaxl
);
190 extern long double
fminl( long double
, long double
) __LIBMLDBL_COMPAT(fminl
);
191 extern long double
fmal( long double
, long double
, long double
) __LIBMLDBL_COMPAT(fmal
);
195 #endif
/* __MATH__
*/
200 * This fixes __FD_ZERO bug for linux
2.x.
y (x
<= 2 && y
<= some n
)
203 hackname
= AAB_fd_zero_asm_posix_types_h
;
204 files
= asm
/posix_types.h
;
205 mach
= 'i[34567]86-*-linux*';
208 bypass
= 'posix_types_64';
211 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper
, not
212 * the start
, so that if #include_next gets another instance of
213 * the wrapper
, this will follow the #include_next chain until
214 * we arrive at the real
<asm
/posix_types.h
>.
216 replace
= <<- _EndOfHeader_
217 /* This file fixes a bug in the __FD_ZERO macro
218 for older versions of the Linux kernel.
*/
219 #ifndef _POSIX_TYPES_H_WRAPPER
220 #include
<features.h
>
221 #include_next
<asm
/posix_types.h
>
223 #if
defined(__FD_ZERO
) && !defined(__GLIBC__
)
225 #define
__FD_ZERO(fdsetp
) \
228 __asm__
__volatile__("cld ; rep ; stosl" \
229 : "=&c" (__d0
), "=&D" (__d1
) \
230 : "a" (0), "0" (__FDSET_LONGS
), \
231 "1" ((__kernel_fd_set *)
(fdsetp
)) :"memory"); \
235 #define _POSIX_TYPES_H_WRAPPER
236 #endif
/* _POSIX_TYPES_H_WRAPPER
*/
242 * This fixes __FD_ZERO bug for glibc
-1.x
245 hackname
= AAB_fd_zero_gnu_types_h
;
247 mach
= 'i[34567]86-*-linux*';
250 * Define _TYPES_H_WRAPPER at the end of the wrapper
, not
251 * the start
, so that if #include_next gets another instance of
252 * the wrapper
, this will follow the #include_next chain until
253 * we arrive at the real
<gnu
/types.h
>.
255 replace
= <<- _EndOfHeader_
256 /* This file fixes a bug in the __FD_ZERO macro present in glibc
1.x.
*/
257 #ifndef _TYPES_H_WRAPPER
258 #include
<features.h
>
259 #include_next
<gnu
/types.h
>
261 #if
defined(__FD_ZERO
) && !defined(__GLIBC__
)
263 # define
__FD_ZERO(fdsetp
) \
266 __asm__
__volatile__("cld ; rep ; stosl" \
267 : "=&c" (__d0
), "=&D" (__d1
) \
268 : "a" (0), "0" (__FDSET_LONGS
), \
269 "1" ((__fd_set *)
(fdsetp
)) :"memory"); \
273 #define _TYPES_H_WRAPPER
274 #endif
/* _TYPES_H_WRAPPER
*/
280 * This fixes __FD_ZERO bug for glibc
-2.0.x
283 hackname
= AAB_fd_zero_selectbits_h
;
284 files
= selectbits.h
;
285 mach
= 'i[34567]86-*-linux*';
288 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper
, not
289 * the start
, so that if #include_next gets another instance of
290 * the wrapper
, this will follow the #include_next chain until
291 * we arrive at the real
<selectbits.h
>.
293 replace
= <<- _EndOfHeader_
294 /* This file fixes a bug in the __FD_ZERO macro present in glibc
2.0.x.
*/
295 #ifndef _SELECTBITS_H_WRAPPER
296 #include
<features.h
>
297 #include_next
<selectbits.h
>
299 #if
defined(__FD_ZERO
) && defined(__GLIBC__
) \\
300 && defined(__GLIBC_MINOR__
) && __GLIBC__
== 2 \\
301 && __GLIBC_MINOR__
== 0
303 #define
__FD_ZERO(fdsetp
) \\
306 __asm__
__volatile__ ("cld; rep; stosl" \\
307 : "=&c" (__d0
), "=&D" (__d1
) \\
308 : "a" (0), "0" (sizeof (__fd_set
) \\
309 / sizeof (__fd_mask
)), \\
310 "1" ((__fd_mask *)
(fdsetp
)) \\
315 #define _SELECTBITS_H_WRAPPER
316 #endif
/* _SELECTBITS_H_WRAPPER
*/
322 * Solaris
<sys
/varargs.h
> is a
DDK (aka kernel
-land
) header providing
323 * the same interface as
<stdarg.h
>. No idea why they couldn
't have just
324 * used the standard header.
327 hackname = AAB_solaris_sys_varargs_h;
328 files = "sys/varargs.h";
329 mach = '*-*-solaris
*';
330 replace = <<- _EndOfHeader_
341 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
342 * declaration on Sun OS
4.x. We must only fix this on Sun OS
4.x
, because
343 * many other systems have similar text but correct versions of the file.
344 * To ensure only Sun
's is fixed, we grep for a likely unique string.
345 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
348 hackname = AAB_sun_memcpy;
350 select = "/\\*\t@\\(#\\)"
351 "(head/memory.h\t50.1\t "
352 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
354 replace = <<- _EndOfHeader_
355 /* This file was generated by fixincludes */
360 extern void *memccpy();
361 extern void *memchr();
362 extern void *memcpy();
363 extern void *memset();
365 extern char *memccpy();
366 extern char *memchr();
367 extern char *memcpy();
368 extern char *memset();
369 #endif /* __STDC__ */
373 #endif /* __memory_h__ */
378 * Fix assert.h on VxWorks:
381 hackname = AAB_vxworks_assert;
383 mach = "*-*-vxworks*";
385 replace = <<- _EndOfHeader_
393 #if defined(__STDC__) || defined(__cplusplus)
394 extern void __assert (const char*);
396 extern void __assert ();
400 #define assert(ign) ((void)0)
403 #define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str)
404 #define ASSERT_STRINGIFY_HELPER(str) #str
406 #define assert(test) ((void) \
407 ((test) ? ((void)0) : \
408 __assert("Assertion failed: " ASSERT_STRINGIFY(test) ", file " \
409 __FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
418 * Add needed include to regs.h (NOT the gcc header) on VxWorks
422 hackname = AAB_vxworks_regs_vxtypes;
424 mach = "*-*-vxworks*";
426 replace = <<- _EndOfHeader_
429 #include <types/vxTypesOld.h>
430 #include_next <arch/../regs.h>
436 * Make VxWorks stdint.h a bit more compliant - add typedefs
439 hackname = AAB_vxworks_stdint;
441 mach = "*-*-vxworks*";
443 replace = <<- _EndOfHeader_
446 /* get int*_t, uint*_t */
447 #include <types/vxTypes.h>
449 /* get legacy vxworks types for compatibility */
450 #include <types/vxTypesOld.h>
452 typedef long intptr_t;
453 typedef unsigned long uintptr_t;
455 typedef int64_t intmax_t;
456 typedef uint64_t uintmax_t;
458 typedef int8_t int_least8_t;
459 typedef int16_t int_least16_t;
460 typedef int32_t int_least32_t;
461 typedef int64_t int_least64_t;
463 typedef uint8_t uint_least8_t;
464 typedef uint16_t uint_least16_t;
465 typedef uint32_t uint_least32_t;
466 typedef uint64_t uint_least64_t;
468 typedef int8_t int_fast8_t;
469 typedef int int_fast16_t;
470 typedef int32_t int_fast32_t;
471 typedef int64_t int_fast64_t;
473 typedef uint8_t uint_fast8_t;
474 typedef unsigned int uint_fast16_t;
475 typedef uint32_t uint_fast32_t;
476 typedef uint64_t uint_fast64_t;
479 #define UINT8_MAX (~(uint8_t)0)
481 #define UINT16_MAX (~(uint16_t)0)
483 #define UINT32_MAX (~(uint32_t)0)
485 #define UINT64_MAX (~(uint64_t)0)
488 #define UINTPTR_MAX (~(uintptr_t)0)
489 #define UINTPTR_MIN 0
491 /* Need to do int_fast16_t as well, as type
492 size may be architecture dependent */
493 #define UINT_FAST16_MAX (~(uint_fast16_t)0)
494 #define UINT_FAST16_MAX 0
496 #define INT8_MAX (UINT8_MAX>>1)
497 #define INT8_MIN (INT8_MAX+1)
498 #define INT16_MAX (UINT16_MAX>>1)
499 #define INT16_MIN (INT16_MAX+1)
500 #define INT32_MAX (UINT32_MAX>>1)
501 #define INT32_MIN (INT32_MAX+1)
502 #define INT64_MAX (UINT64_MAX>>1)
503 #define INT64_MIN (INT64_MAX+1)
505 #define INTPTR_MAX (UINTPTR_MAX>>1)
506 #define INTPTR_MIN (INTPTR_MAX+1)
508 #define INT_FAST16_MAX (UINT_FAST16_MAX>>1)
509 #define INT_FAST16_MIN (INT_FAST16_MAX+1)
511 /* now define equiv. constants */
512 #define UINT_FAST8_MAX UINT8_MAX
513 #define UINT_FAST8_MIN UINT_FAST8_MIN
514 #define INT_FAST8_MAX INT8_MAX
515 #define INT_FAST8_MIN INT8_MIN
516 #define UINT_FAST32_MAX UINT32_MAX
517 #define UINT_FAST32_MIN UINT32_MIN
518 #define INT_FAST32_MAX INT32_MAX
519 #define INT_FAST32_MIN INT32_MIN
520 #define UINT_FAST64_MAX UINT64_MAX
521 #define UINT_FAST64_MIN UINT64_MIN
522 #define INT_FAST64_MAX INT64_MAX
523 #define INT_FAST64_MIN INT64_MIN
525 #define UINT_LEAST8_MAX UINT8_MAX
526 #define UINT_LEAST8_MIN UINT8_MIN
527 #define INT_LEAST8_MAX INT8_MAX
528 #define INT_LEAST8_MIN INT8_MIN
529 #define UINT_LEAST16_MAX UINT16_MAX
530 #define UINT_LEAST16_MIN UINT16_MIN
531 #define INT_LEAST16_MAX INT16_MAX
532 #define INT_LEAST16_MIN INT16_MIN
533 #define UINT_LEAST32_MAX UINT32_MAX
534 #define UINT_LEAST32_MIN UINT32_MIN
535 #define INT_LEAST32_MAX INT32_MAX
536 #define INT_LEAST32_MIN INT32_MIN
537 #define UINT_LEAST64_MAX UINT64_MAX
538 #define UINT_LEAST64_MIN UINT64_MIN
539 #define INT_LEAST64_MAX INT64_MAX
540 #define INT_LEAST64_MIN INT64_MIN
542 #define UINTMAX_MAX UINT64_MAX
543 #define UINTMAX_MIN UINT64_MIN
544 #define INTMAX_MAX INT64_MAX
545 #define INTMAX_MIN INT64_MIN
552 * This hack makes makes unistd.h more POSIX-compliant on VxWorks
555 hackname = AAB_vxworks_unistd;
557 mach = "*-*-vxworks*";
559 replace = <<- _EndOfHeader_
562 #include_next <unistd.h>
565 #define STDIN_FILENO 0
567 #ifndef STDOUT_FILENO
568 #define STDOUT_FILENO 1
570 #ifndef STDERR_FILENO
571 #define STDERR_FILENO 2
573 #endif /* _UNISTD_H */
579 * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
580 * which only is provided by AIX xlc C99.
583 hackname = aix_complex;
586 select = "#define[ \t]_Complex_I[ \t]__I";
588 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
589 test_text = "#define _Complex_I __I\n";
593 * malloc.h on AIX6 uses XLC++ specific builtin syntax
596 hackname = aix_malloc;
599 select = "#ifdef __cplusplus";
601 c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
602 test_text = "#ifdef __cplusplus";
606 * net/if_arp.h defines a variable fc_softc instead of adding a
607 * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
610 hackname = aix_net_if_arp;
612 files = "net/if_arp.h";
613 select = "^struct fc_softc \\{";
615 c_fix_arg = "typedef struct _fc_softc {";
616 test_text = "struct fc_softc {\n int a;\n};";
620 * Fix AIX definition of NULL for G++.
625 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
626 time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h;
628 select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*";
630 c_fix_arg = <<- _EOFix_
635 #else /* ! __GNUG__ */
637 #endif /* __GNUG__ */
638 #else /* ! __cplusplus */
639 #define NULL ((void *)0)
640 #endif /* __cplusplus */
643 test_text = "# define\tNULL \t(0L) /* typed NULL */";
647 * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER,
648 * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough
652 hackname = aix_once_init_1;
655 select = "#define[ \t]PTHREAD_ONCE_INIT \\\\\n"
658 c_fix_arg = "#define PTHREAD_ONCE_INIT \\\n"
660 test_text = "#define PTHREAD_ONCE_INIT \\\\\n"
665 hackname = aix_once_init_2;
668 select = "[ \t]0 \\\\\n"
671 c_fix_arg = " 0 \\\n"
673 test_text = " 0 \\\\\n"
678 hackname = aix_mutex_initializer_1;
681 select = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n"
684 c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n"
686 test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
691 hackname = aix_cond_initializer_1;
694 select = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n"
697 c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n"
699 test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n"
704 hackname = aix_rwlock_initializer_1;
707 select = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n"
710 c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n"
712 test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
717 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
718 * which violates a requirement of ISO C.
721 hackname = aix_pthread;
723 select = "(#define [A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
726 test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
727 "{...init stuff...}";
732 * AIX stdint.h fixes.
735 hackname = aix_stdint_1;
737 files = stdint-aix.h, stdint.h;
738 select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
739 "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
741 c_fix_arg = "#define UINT8_MAX (255)\n"
742 "#define UINT16_MAX (65535)";
743 test_text = "#define UINT8_MAX (255U)\n"
744 "#define UINT16_MAX (65535U)";
749 hackname = aix_stdint_2;
751 files = stdint-aix.h, stdint.h;
752 select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
753 "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
754 "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
756 "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
757 "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
758 "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
760 c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
761 "#define INTPTR_MAX 9223372036854775807L\n"
762 "#define UINTPTR_MAX 18446744073709551615UL\n"
764 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
765 "#define INTPTR_MAX 2147483647L\n"
766 "#define UINTPTR_MAX 4294967295UL";
767 test_text = "#define INTPTR_MIN INT64_MIN\n"
768 "#define INTPTR_MAX INT64_MAX\n"
769 "#define UINTPTR_MAX UINT64_MAX\n"
771 "#define INTPTR_MIN INT32_MIN\n"
772 "#define INTPTR_MAX INT32_MAX\n"
773 "#define UINTPTR_MAX UINT32_MAX";
778 hackname = aix_stdint_3;
780 files = stdint-aix.h, stdint.h;
781 select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
782 "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
784 "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
785 "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
787 c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
788 "#define PTRDIFF_MAX 9223372036854775807L\n"
790 "#define PTRDIFF_MIN (-2147483647L - 1)\n"
791 "#define PTRDIFF_MAX 2147483647L";
792 test_text = "#define PTRDIFF_MIN INT64_MIN\n"
793 "#define PTRDIFF_MAX INT64_MAX\n"
795 "#define PTRDIFF_MIN INT32_MIN\n"
796 "#define PTRDIFF_MAX INT32_MAX";
801 hackname = aix_stdint_4;
803 files = stdint-aix.h, stdint.h;
804 select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
806 "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
808 c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
810 "#define SIZE_MAX 4294967295UL";
811 test_text = "#define SIZE_MAX UINT64_MAX\n"
813 "#define SIZE_MAX UINT32_MAX";
818 hackname = aix_stdint_5;
820 files = stdint-aix.h, stdint.h;
821 select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
822 "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
824 c_fix_arg = "#define UINT8_C(c) c\n"
825 "#define UINT16_C(c) c";
826 test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
827 "#define UINT16_C(c) __CONCAT__(c,U)";
832 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
833 * in an otherwise harmless (and #ifed out) macro definition
836 hackname = aix_sysmachine;
837 files = sys/machine.h;
841 test_text = "#define FOO \\\n"
842 " bar \\ \n baz \\ \n bat";
847 * sys/wait.h on AIX 5.2 defines macros that have both signed and
848 * unsigned types in conditional expressions.
851 hackname = aix_syswait_2;
853 select = '\? (\
(\
(\
(\
(unsigned
[^
)]*\
)[^
)]*\
) >> [^
)]*\
) \
& 0xff\
) : -1)';
855 c_fix_arg = "? (int)%1";
856 test_text = "#define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
861 * sys/signal.h on some versions of AIX uses volatile in the typedef of
862 * sig_atomic_t, which causes gcc to generate a warning about duplicate
863 * volatile when a sig_atomic_t variable is declared volatile, as
864 * required by ANSI C.
867 hackname = aix_volatile;
868 files = sys/signal.h;
869 select = "typedef volatile int sig_atomic_t";
871 c_fix_arg = "typedef int sig_atomic_t";
872 test_text = "typedef volatile int sig_atomic_t;";
877 * Fix __assert declaration in assert.h on Alpha OSF/1.
880 hackname = alpha___assert;
882 select = '__assert\
(char \
*, char \
*, int\
)';
884 c_fix_arg = "__assert(const char *, const char *, int)";
885 test_text = 'extern void
__assert(char
*, char
*, int
);';
890 * Fix assert macro in assert.h on Alpha OSF/1.
891 * The superfluous int cast breaks C++.
894 hackname = alpha_assert;
896 select = "(#[ \t]*" 'define assert\
(EX\
).*)\
(\
(int\
) \
(EX\
)\
)';
898 c_fix_arg = "%1(EX)";
899 test_text = '#define
assert(EX
) (((int
) (EX
)) ?
(void
)0 '
900 ': __assert(#EX
, __FILE__
, __LINE__
))';
905 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
908 hackname = alpha_getopt;
911 select = 'getopt\
(int
, char \
*\
[\
], *char \
*\
)';
913 c_fix_arg = "getopt(int, char *const[], const char *)";
914 test_text = 'extern int
getopt(int
, char
*[], char *)
;';
919 * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
922 hackname = alpha_if_semicolon;
924 select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
926 c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
927 test_text = ' struct sockaddr vmif_paddr
/* protocol address
*/';
932 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
935 hackname = alpha_parens;
937 select = '#ifndef\
(__mips64\
)';
939 c_fix_arg = "#ifndef __mips64";
940 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
945 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
949 hackname = alpha_sbrk;
951 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
953 c_fix_arg = "void *sbrk(";
954 test_text = "extern char* sbrk(ptrdiff_t increment);";
959 * For C++, avoid any typedef or macro definition of bool,
960 * and use the built in type instead.
961 * HP/UX 10.20 also has it in curses_colr/curses.h.
964 hackname = avoid_bool_define;
966 files = curses_colr/curses.h;
970 select = "#[ \t]*define[ \t]+bool[ \t]";
971 bypass = "__cplusplus";
974 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
975 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
977 test_text = "# define bool\t char \n";
982 hackname = avoid_bool_type;
984 files = curses_colr/curses.h;
988 select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
989 bypass = "__cplusplus";
992 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
994 test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
999 * For C++, avoid any typedef definition of wchar_t,
1000 * and use the built in type instead.
1001 * Don't do this for headers that are smart enough to do the right
1002 * thing (recent
[n
]curses.h and Xlib.h
).
1003 * Don
't do it for <linux/nls.h> which is never used from C++ anyway,
1004 * and will be broken by the edit.
1008 hackname = avoid_wchar_t_type;
1010 select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
1011 bypass = "__cplusplus";
1012 bypass = "_LINUX_NLS_H";
1013 bypass = "XFree86: xc/lib/X11/Xlib\\.h";
1016 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1018 test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
1023 * Fix `typedef struct term;' on hppa1.1
-hp
-hpux9.
1026 hackname
= bad_struct_term
;
1028 select
= "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
1030 c_fix_arg
= "struct term;";
1032 test_text
= 'typedef struct term;';
1037 * Fix one other error in this file
:
1038 * a mismatched quote not inside a C comment.
1041 hackname
= badquote
;
1042 files
= sundev
/vuid_event.h
;
1045 c_fix_arg
= "does not";
1047 test_text
= "/* doesn't have matched single quotes */";
1052 * check for broken assert.h that needs stdio.h
1055 hackname
= broken_assert_stdio
;
1058 bypass
= "include.*stdio\\.h";
1060 c_fix_arg
= "#include <stdio.h>\n";
1061 test_text
= "extern FILE* stderr;";
1066 * check for broken assert.h that needs stdlib.h
1069 hackname
= broken_assert_stdlib
;
1071 select
= 'exit *\(|abort *\(';
1072 bypass
= "include.*stdlib\\.h";
1074 c_fix_arg
= "#ifdef __cplusplus\n"
1075 "#include <stdlib.h>\n"
1077 test_text
= "extern void exit ( int );";
1081 * Remove `extern double cabs
' declarations from math.h.
1082 * This conflicts with C99. Discovered on AIX.
1083 * Darwin hides its broken cabs in architecture-specific subdirs.
1086 hackname = broken_cabs;
1087 files = math.h, "architecture/*/math.h";
1088 select = "^extern[ \t]+double[ \t]+cabs";
1090 sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
1091 sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
1093 test_text = "#ifdef __STDC__\n"
1094 "extern double cabs(struct dbl_hypot);\n"
1096 "extern double cabs();\n"
1098 "extern double cabs ( _Complex z );";
1103 * Fixup Darwin's broken check for __builtin_nanf.
1106 hackname
= broken_nan
;
1108 * It is tempting to omit the first
"files" entry. Do not.
1109 * The testing machinery will take the first
"files" entry as the name
1110 * of a test file to play with. It would be a nuisance to have a directory
1111 * with the name
"*".
1113 files
= "architecture/ppc/math.h";
1114 files
= "architecture/*/math.h";
1115 select
= '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)';
1118 c_fix_arg
= "#if 1";
1119 test_text
= "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
1124 * Various systems derived from BSD4.4 contain a macro definition
1125 * for vfscanf that interacts badly with requirements of builtin
-attrs.def.
1126 * Known to be fixed in FreeBSD
5 system headers.
1129 hackname
= bsd_stdio_attrs_conflict
;
1131 mach
= "*-*-*darwin*";
1133 select
= "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
1135 c_fix_arg
= '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n"
1136 '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n"
1137 'int vfscanf(FILE *, const char *, __builtin_va_list) '
1138 '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");';
1139 test_text
= '#define vfscanf __svfscanf';
1143 * 'g++ -std=c++11' defines __cplusplus to
201103L, which suggests
1144 * that it conforms to ISO
/IEC
14882:2011. It currently does
1145 * not support the
[[noreturn
]] procedure attribute.
1146 * When it does
, this hack should be removed.
1147 * SEE
: gcc.gnu.org
/bugzilla
/show_bug.cgi?id
=51776
1150 hackname
= cdef_cplusplus
;
1151 files
= sys
/cdefs.h
;
1152 select
= '\[\[noreturn\]\]';
1154 c_fix_arg
= '__attribute__((__noreturn__))';
1155 test_text
= "#define _Noreturn [[noreturn]]";
1159 * Fix various macros used to define ioctl numbers.
1160 * The traditional syntax was
:
1162 * #define
_CTRL(n
, x
) (('n'<<8)+x
)
1163 * #define TCTRLCFOO
_CTRL(T
, 1)
1165 * but this does not work with the C standard
, which disallows macro
1166 * expansion inside strings. We have to rewrite it thus
:
1168 * #define
_CTRL(n
, x
) ((n
<<8)+x
)
1169 * #define TCTRLCFOO
_CTRL('T', 1)
1171 * The select expressions match too much
, but the c_fix code is cautious.
1173 * CTRL might be
: CTRL _CTRL ISCTRL BSD43_CTRL ...
1176 hackname
= ctrl_quotes_def
;
1177 select
= "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
1178 c_fix
= char_macro_def
;
1182 * This is two tests in order to ensure that the
"CTRL(c)" can
1183 * be selected in isolation from the multi
-arg format
1185 test_text
= "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n";
1186 test_text
= "#define _CTRL(c) ('c'&037)";
1190 * Fix various macros used to define ioctl numbers.
1193 hackname
= ctrl_quotes_use
;
1194 select
= "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1195 c_fix
= char_macro_use
;
1197 test_text
= "#define TCTRLFOO BSD43_CTRL(T, 1)";
1202 * sys
/mman.h on HP
/UX is not C
++ ready
,
1203 * even though NO_IMPLICIT_EXTERN_C is defined on HP
/UX.
1205 * rpc
/types.h on OSF1
/2.0 is not C
++ ready
,
1206 * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
1208 * The problem is the declaration of malloc.
1211 hackname
= cxx_unready
;
1213 files
= rpc
/types.h
;
1214 select
= '[^#]+malloc.*;'; /* Catch any form of declaration
1215 not within a macro.
*/
1216 bypass
= '"C"|__BEGIN_DECLS';
1219 c_fix_arg
= "#ifdef __cplusplus\n"
1222 c_fix_arg
= "#ifdef __cplusplus\n"
1225 test_text
= "extern void* malloc( size_t );";
1229 * For the AAB_darwin7_9_long_double_funcs fix to be useful
,
1230 * you have to not use
"" includes.
1233 hackname
= darwin_9_long_double_funcs_2
;
1234 mach
= "*-*-darwin7.9*";
1236 select
= '#include[ \t]+\"';
1238 c_fix_arg
= "%1<%2.h>";
1240 c_fix_arg
= '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
1242 test_text
= '#include "architecture/ppc/math.h"';
1247 * On darwin8 and earlier
, mach
-o
/swap.h isn
't properly guarded
1248 * by 'extern
"C"'. On darwin7 some mach/ headers aren't properly guarded.
1251 hackname
= darwin_externc
;
1252 mach
= "*-*-darwin*";
1253 files
= mach
-o
/swap.h
;
1254 files
= mach
/mach_time.h
;
1255 files
= mach
/mach_traps.h
;
1256 files
= mach
/message.h
;
1258 files
= mach
/semaphore.h
;
1259 bypass
= "extern \"C\"";
1260 bypass
= "__BEGIN_DECLS";
1262 c_fix_arg
= "#ifdef __cplusplus\n"
1265 c_fix_arg
= "#ifdef __cplusplus\n"
1268 test_text
= "extern void swap_fat_header();\n";
1273 * AvailabilityMacros.h on Darwin breaks with GCC
4.0, because of
1274 * bad __GNUC__ tests.
1278 hackname
= darwin_gcc4_breakage
;
1279 mach
= "*-*-darwin*";
1280 files
= AvailabilityMacros.h
;
1281 select
= "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
1283 c_fix_arg
= "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
1284 test_text
= "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
1285 "(__GNUC_MINOR__ >= 1)\n";
1290 * __private_extern__ doesn
't exist in FSF GCC. Even if it did,
1291 * why would you ever put it in a system header file?
1294 hackname = darwin_private_extern;
1295 mach = "*-*-darwin*";
1296 files = mach-o/dyld.h;
1297 select = "__private_extern__ [a-z_]+ _dyld_";
1299 c_fix_arg = "extern";
1300 c_fix_arg = "__private_extern__";
1301 test_text = "__private_extern__ int _dyld_func_lookup(\n"
1302 "const char *dyld_func_name,\n"
1303 "unsigned long *address);\n";
1308 * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
1309 * unsigned constants.
1312 hackname = darwin_stdint_1;
1313 mach = "*-*-darwin*";
1314 files = stdint-darwin.h, stdint.h;
1316 c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
1317 select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
1318 "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
1319 test_text = "#define UINT8_C(v) (v ## U)\n"
1320 "#define UINT16_C(v) (v ## U)";
1325 * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
1329 hackname = darwin_stdint_2;
1330 mach = "*-*-darwin*";
1331 files = stdint-darwin.h, stdint.h;
1333 c_fix_arg = "#if __WORDSIZE == 64\n"
1334 "#define INTPTR_MAX 9223372036854775807L\n"
1335 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1337 "#define INTPTR_MAX 2147483647L\n"
1338 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1340 select = "#if __WORDSIZE == 64\n"
1341 "#define INTPTR_MIN[ \t]+INT64_MIN\n"
1342 "#define INTPTR_MAX[ \t]+INT64_MAX\n"
1344 "#define INTPTR_MIN[ \t]+INT32_MIN\n"
1345 "#define INTPTR_MAX[ \t]+INT32_MAX\n"
1347 test_text = "#if __WORDSIZE == 64\n"
1348 "#define INTPTR_MIN INT64_MIN\n"
1349 "#define INTPTR_MAX INT64_MAX\n"
1351 "#define INTPTR_MIN INT32_MIN\n"
1352 "#define INTPTR_MAX INT32_MAX\n"
1358 * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
1361 hackname = darwin_stdint_3;
1362 mach = "*-*-darwin*";
1363 files = stdint-darwin.h, stdint.h;
1365 c_fix_arg = "#if __WORDSIZE == 64\n"
1366 "#define UINTPTR_MAX 18446744073709551615UL\n"
1368 "#define UINTPTR_MAX 4294967295UL\n"
1370 select = "#if __WORDSIZE == 64\n"
1371 "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
1373 "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
1375 test_text = "#if __WORDSIZE == 64\n"
1376 "#define UINTPTR_MAX UINT64_MAX\n"
1378 "#define UINTPTR_MAX UINT32_MAX\n"
1384 * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
1387 hackname = darwin_stdint_4;
1388 mach = "*-*-darwin*";
1389 files = stdint-darwin.h, stdint.h;
1391 c_fix_arg = "#if __WORDSIZE == 64\n"
1392 "#define SIZE_MAX 18446744073709551615UL\n"
1394 "#define SIZE_MAX 4294967295UL\n"
1396 select = "#if __WORDSIZE == 64\n"
1397 "#define SIZE_MAX[ \t]+UINT64_MAX\n"
1399 "#define SIZE_MAX[ \t]+UINT32_MAX\n"
1401 test_text = "#if __WORDSIZE == 64\n"
1402 "#define SIZE_MAX UINT64_MAX\n"
1404 "#define SIZE_MAX UINT32_MAX\n"
1410 * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
1411 * with a wrong type.
1414 hackname = darwin_stdint_5;
1415 mach = "*-*-darwin*";
1416 files = stdint-darwin.h, stdint.h;
1418 c_fix_arg = "#if __WORDSIZE == 64\n"
1419 "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
1420 "#define INTMAX_MAX 9223372036854775807L\n"
1421 "#define UINTMAX_MAX 18446744073709551615UL\n"
1423 "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
1424 "#define INTMAX_MAX 9223372036854775807LL\n"
1425 "#define UINTMAX_MAX 18446744073709551615ULL\n"
1427 select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
1428 "#define INTMAX_MAX[ \t]+INT64_MAX\n"
1430 "#define UINTMAX_MAX[ \t]+UINT64_MAX";
1431 test_text = "#define INTMAX_MIN INT64_MIN\n"
1432 "#define INTMAX_MAX INT64_MAX\n"
1434 "#define UINTMAX_MAX UINT64_MAX";
1439 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1440 * with a wrong type.
1443 hackname = darwin_stdint_6;
1444 mach = "*-*-darwin*";
1445 files = stdint-darwin.h, stdint.h;
1447 c_fix_arg = "#if __WORDSIZE == 64\n"
1448 "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
1449 "#define PTRDIFF_MAX 9223372036854775807L\n"
1451 "#define PTRDIFF_MIN (-2147483647 - 1)\n"
1452 "#define PTRDIFF_MAX 2147483647\n"
1454 select = "#if __WORDSIZE == 64\n"
1455 "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
1456 "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
1458 "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
1459 "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
1461 test_text = "#if __WORDSIZE == 64\n"
1462 "#define PTRDIFF_MIN INT64_MIN\n"
1463 "#define PTRDIFF_MAX INT64_MAX\n"
1465 "#define PTRDIFF_MIN INT32_MIN\n"
1466 "#define PTRDIFF_MAX INT32_MAX\n"
1472 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1473 * with a wrong type.
1476 hackname = darwin_stdint_7;
1477 mach = "*-*-darwin*";
1478 files = stdint-darwin.h, stdint.h;
1480 c_fix_arg = "#if __WORDSIZE == 64\n"
1481 "#define INTMAX_C(v) (v ## L)\n"
1482 "#define UINTMAX_C(v) (v ## UL)\n"
1484 "#define INTMAX_C(v) (v ## LL)\n"
1485 "#define UINTMAX_C(v) (v ## ULL)\n"
1487 select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
1488 "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
1489 test_text = "#define INTMAX_C(v) (v ## LL)\n"
1490 "#define UINTMAX_C(v) (v ## ULL)";
1495 * Fix <c_asm.h> on Digital UNIX V4.0:
1496 * It contains a prototype for a DEC C internal asm() function,
1497 * clashing with gcc's asm keyword. So protect this with __DECC.
1500 hackname
= dec_intern_asm
;
1502 sed
= "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1503 sed
= "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
1507 " ... asm stuff ...\n"
1508 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
1513 * Fix typo in
<wchar.h
> on DJGPP
2.03.
1516 hackname
= djgpp_wchar_h
;
1518 select
= "__DJ_wint_t";
1519 bypass
= "sys/djtypes.h";
1521 c_fix_arg
= "%0\n#include <sys/djtypes.h>";
1522 c_fix_arg
= "#include <stddef.h>";
1523 test_text
= "#include <stddef.h>\n"
1524 "extern __DJ_wint_t x;\n";
1529 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1532 hackname
= ecd_cursor
;
1533 files
= "sunwindow/win_lock.h";
1534 files
= "sunwindow/win_cursor.h";
1535 select
= 'ecd\.cursor';
1537 c_fix_arg
= 'ecd_cursor';
1539 test_text
= "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1544 * Between
8/24/1998 and
2/17/2001, FreeBSD system headers presume
1545 * neither the existence of GCC
3 nor its exact feature set yet break
1546 * (by design?
) when __GNUC__ is set beyond
2.
1549 hackname
= freebsd_gcc3_breakage
;
1550 mach
= "*-*-freebsd*";
1551 files
= sys
/cdefs.h
;
1552 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
1553 bypass
= '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
1555 c_fix_arg
= '%0 || __GNUC__ >= 3';
1556 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
1561 * Some releases of FreeBSD
4 and FreeBSD
5.0 and
5.1 system headers presume
1562 * neither the existence of GCC
4 nor its exact feature set yet break
1563 * (by design?
) when __GNUC__ is set beyond
3.
1566 hackname
= freebsd_gcc4_breakage
;
1567 mach
= "*-*-freebsd*";
1568 files
= sys
/cdefs.h
;
1569 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
1571 c_fix_arg
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
1572 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
1577 * Some versions of glibc don
't expect the C99 inline semantics.
1580 hackname = glibc_c99_inline_1;
1581 files = features.h, '*/features.h
';
1582 select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
1584 c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
1586 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
1587 && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
1588 # define __USE_EXTERN_INLINES 1
1595 * Similar, but a version that didn't have __NO_INLINE__
1598 hackname
= glibc_c99_inline_1a
;
1599 files
= features.h
, '*/features.h';
1600 select
= "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
1601 "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
1603 c_fix_arg
= "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
1605 #if
__GNUC_PREREQ (2, 7) && defined __OPTIMIZE__
&& !defined __OPTIMIZE_SIZE__
1606 # define __USE_EXTERN_INLINES
1
1613 * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
1614 * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
1615 * The remaining glibc_c99_inline_
* fixes deal with some of those headers.
1618 hackname
= glibc_c99_inline_2
;
1619 files
= sys
/stat.h
, '*/sys/stat.h';
1620 select
= "extern __inline__ int";
1621 sed
= "s/extern int \\(stat\\)/"
1622 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1623 "__inline__ int \\1/";
1624 sed
= "s/extern int \\([lf]stat\\)/"
1625 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1626 "__inline__ int \\1/";
1627 sed
= "s/extern int \\(mknod\\)/"
1628 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1629 "__inline__ int \\1/";
1630 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
1631 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1632 "__inline__ int __REDIRECT\\1 (\\2/";
1633 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
1634 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1635 "__inline__ int __REDIRECT\\1 (\\2/";
1636 sed
= "s/^extern __inline__ int/"
1637 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1640 extern int
fstat64 (int __fd
, struct stat64
*__buf
) __THROW
__nonnull ((2));
1641 extern __inline__ int
1642 __NTH (fstat64 (int __fd
, struct stat64
*__statbuf
))
1649 hackname
= glibc_c99_inline_3
;
1650 files
= bits
/string2.h
, '*/bits/string2.h';
1651 select
= "extern __inline";
1652 bypass
= "__extern_inline|__GNU_STDC_INLINE__";
1654 c_fix_arg
= "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
1655 c_fix_arg
= "^# ifdef __cplusplus$";
1658 # define __STRING_INLINE inline
1660 # define __STRING_INLINE extern __inline
1667 hackname
= glibc_c99_inline_4
;
1668 files
= sys
/sysmacros.h
, '*/sys/sysmacros.h', wchar.h
, '*/wchar.h';
1669 bypass
= "__extern_inline|__gnu_inline__";
1670 select
= "(^| )extern __inline";
1672 c_fix_arg
= "%0 __attribute__ ((__gnu_inline__))";
1674 __extension__ extern __inline unsigned int
1675 extern __inline unsigned int
1680 /* glibc
-2.3.5 defines pthread mutex initializers incorrectly
,
1681 * so we replace them with versions that correspond to the
1685 hackname
= glibc_mutex_init
;
1687 select
= '\{ *\{ *0, *\} *\}';
1688 sed
= "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
1689 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
1690 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1691 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
1692 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1693 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
1694 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1695 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
1696 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1697 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1698 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1699 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
1700 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1701 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1702 sed
= "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
1703 "N;s/^[ \t]*#[ \t]*"
1704 "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
1705 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
1707 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1710 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1712 sed
= "s/{ \\(0, 0, 0, 0, 0, 0, "
1713 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
1714 sed
= "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
1715 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
1717 test_text
= <<- _EOText_
1718 #define PTHREAD_MUTEX_INITIALIZER
\\
1721 # if __WORDSIZE
== 64
1722 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1723 { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1724 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1725 { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1726 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1727 { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1729 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1730 { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1731 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1732 { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1733 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1734 { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1737 # define PTHREAD_RWLOCK_INITIALIZER
\\
1740 # if __WORDSIZE
== 64
1741 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1742 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\
1743 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1745 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1746 { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1749 #define PTHREAD_COND_INITIALIZER
{ { 0, } }
1754 /* glibc versions before
2.5 have a version of stdint.h that defines
1755 UINT8_C and UINT16_C to produce unsigned constants
, as do uClibc
1756 versions with stdint.h based on those glibc versions.
*/
1758 hackname
= glibc_stdint
;
1760 select
= "GNU C Library";
1762 c_fix_arg
= "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
1763 c_fix_arg
= "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
1764 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";
1768 /* Some versions of glibc have a version of bits
/string2.h that
1769 produces
"value computed is not used" warnings from strncpy
; fix
1770 this definition by using __builtin_strncpy instead as in newer
1773 hackname
= glibc_strncpy
;
1774 files
= bits
/string2.h
;
1775 bypass
= "__builtin_strncpy";
1777 c_fix_arg
= "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
1778 c_fix_arg
= "# define strncpy([^\n]*\\\\\n)*[^\n]*";
1780 # define
strncpy(dest
, src
, n
) \
1781 (__extension__ (__builtin_constant_p (src
) && __builtin_constant_p (n
) \\
1782 ?
(strlen (src
) + 1 >= ((size_t
) (n
)) \\
1783 ?
(char *)
memcpy (dest
, src
, n
) \\
1784 : strncpy (dest
, src
, n
)) \\
1785 : strncpy (dest
, src
, n
)))
1790 /* glibc
's tgmath.h relies on an expression that is not an integer
1791 constant expression being treated as it was by GCC 4.4 and
1794 hackname = glibc_tgmath;
1796 select = '\
(\
(\
(type\
) 0.25\
) && \
(\
(type\
) 0.25 - 1\
)\
)';
1797 bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
1799 c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || (__builtin_classify_type ((type) 0) == 9 && __builtin_classify_type (__real__ ((type) 0)) == 8))";
1800 test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
1804 * Fix these files to use the types we think they should for
1805 * ptrdiff_t, size_t, and wchar_t.
1807 * This defines the types in terms of macros predefined by our 'cpp
'.
1808 * This is supposedly necessary for glibc's handling of these types.
1809 * It
's probably not necessary for anyone else, but it doesn't hurt.
1812 hackname
= gnu_types
;
1813 files
= "sys/types.h";
1815 files
= "sys/stdtypes.h";
1819 bypass
= '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
1820 select
= "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
1822 /* The Solaris
10 headers already define these types correctly.
*/
1823 mach
= '*-*-solaris2.1[0-9]*';
1826 test_text
= "typedef long int ptrdiff_t; /* long int */\n"
1827 "typedef uint_t size_t; /* uint_t */\n"
1828 "typedef ushort_t wchar_t; /* ushort_t */";
1833 * Fix HP
& Sony
's use of "../machine/xxx.h"
1834 * to refer to: <machine/xxx.h>
1837 hackname = hp_inline;
1838 files = sys/spinlock.h;
1839 files = machine/machparam.h;
1840 select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
1843 c_fix_arg = "%1<machine
/%2.h
>";
1845 c_fix_arg = "([ \t]*#
[ \t]*include
[ \t]+)" '"\.\.
/machine
/'
1848 test_text = ' # include "..
/machine
/mumble.h
"';
1853 * Check for (...) in C++ code in HP/UX sys/file.h.
1856 hackname = hp_sysfile;
1858 select = "HPUX_SOURCE
";
1861 c_fix_arg = "(struct file
*, ...
)";
1862 c_fix_arg = '\(\.\.\.\)';
1864 test_text = "extern void
foo(...
); /* HPUX_SOURCE
- bad varargs
*/";
1869 * Un-Hide a series of five FP defines from post-1999 compliance GCC:
1870 * FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
1873 hackname = hppa_hpux_fp_macros;
1874 mach = "hppa
*-hp
-hpux11
*";
1876 select = "#
[ \t]*define
[ \t]*FP_NORMAL.
*\n"
1877 "#
[ \t]*define
[ \t]*FP_ZERO.
*\n"
1878 "#
[ \t]*define
[ \t]*FP_INFINITE.
*\n"
1879 "#
[ \t]*define
[ \t]*FP_SUBNORMAL.
*\n"
1880 "#
[ \t]*define
[ \t]*FP_NAN.
*\n";
1882 c_fix_arg = <<- _EOFix_
1883 #endif /* _INCLUDE_HPUX_SOURCE */
1885 #if defined(_INCLUDE_HPUX_SOURCE) || \
1886 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
1889 #ifdef _INCLUDE_HPUX_SOURCE
1894 "# define FP_NORMAL
0\n"
1895 "# define FP_ZERO
1\n"
1896 "# define FP_INFINITE
2\n"
1897 "# define FP_SUBNORMAL
3\n"
1898 "# define FP_NAN
4\n";
1903 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
1904 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
1907 hackname = hpux10_cpp_pow_inline;
1908 files = fixinc-test-limits.h, math.h;
1909 select = <<- END_POW_INLINE
1910 ^# +ifdef +__cplusplus
1912 +inline +double +pow\(double +__d,int +__expon\) +\{
1913 [ ]+return +pow\(__d,\(double\)__expon\);
1924 "# ifdef __cplusplus
\n"
1926 " inline double
pow(double __d
,int __expon
) {\n"
1927 "\t return
pow(__d
,(double
)__expon
);\n"
1929 ' extern "C
"' " {\n"
1935 hackname = hpux11_cpp_pow_inline;
1937 select = " +inline double pow
\\(double d
,int expon
\\) \\{\n"
1938 " +return pow
\\(d
, \\(double
\\)expon
\\);\n"
1944 " inline double
pow(double d
,int expon
) {\n"
1945 " return
pow(d
, (double
)expon
);\n"
1951 * Fix hpux 10.X missing ctype declarations 1
1954 hackname = hpux10_ctype_declarations1;
1956 select = "^#
[ \t]*define _toupper
\\(__c
\\)[ \t]*__toupper
\\(__c
\\)";
1957 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*__tolower
[ \t]*\\(";
1959 c_fix_arg = "#ifdef _PROTOTYPES
\n"
1960 "extern int
__tolower(int
);\n"
1961 "extern int
__toupper(int
);\n"
1962 "#else
/* NOT _PROTOTYPES
*/\n"
1963 "extern int
__tolower();\n"
1964 "extern int
__toupper();\n"
1965 "#endif
/* _PROTOTYPES
*/\n\n"
1968 test_text = "# define
_toupper(__c
) __toupper(__c
)\n";
1973 * Fix hpux 10.X missing ctype declarations 2
1976 hackname = hpux10_ctype_declarations2;
1978 select = "^# if defined
\\(_SB_CTYPE_MACROS
\\) && \\!defined
\\(__lint
\\)";
1979 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*_isalnum
[ \t]*\\(";
1981 c_fix_arg = "%0\n\n"
1982 "#ifdef _PROTOTYPES
\n"
1983 " extern int
_isalnum(int
);\n"
1984 " extern int
_isalpha(int
);\n"
1985 " extern int
_iscntrl(int
);\n"
1986 " extern int
_isdigit(int
);\n"
1987 " extern int
_isgraph(int
);\n"
1988 " extern int
_islower(int
);\n"
1989 " extern int
_isprint(int
);\n"
1990 " extern int
_ispunct(int
);\n"
1991 " extern int
_isspace(int
);\n"
1992 " extern int
_isupper(int
);\n"
1993 " extern int
_isxdigit(int
);\n"
1994 "# else
/* not _PROTOTYPES
*/\n"
1995 " extern int
_isalnum();\n"
1996 " extern int
_isalpha();\n"
1997 " extern int
_iscntrl();\n"
1998 " extern int
_isdigit();\n"
1999 " extern int
_isgraph();\n"
2000 " extern int
_islower();\n"
2001 " extern int
_isprint();\n"
2002 " extern int
_ispunct();\n"
2003 " extern int
_isspace();\n"
2004 " extern int
_isupper();\n"
2005 " extern int
_isxdigit();\n"
2006 "#endif
/* _PROTOTYPES
*/\n";
2008 test_text = "# if
defined(_SB_CTYPE_MACROS
) && !defined(__lint
)\n"
2009 " extern unsigned int
*__SB_masks
;\n";
2014 * Fix hpux 10.X missing stdio declarations
2017 hackname = hpux10_stdio_declarations;
2019 select = "^#
[ \t]*define _iob
[ \t]*__iob
";
2020 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*vsnprintf
[ \t]*\\(";
2022 c_fix_arg = "%0\n\n"
2023 "# if
defined(__STDC__
) ||
defined(__cplusplus
)\n"
2024 " extern int
snprintf(char
*, size_t
, const char
*, ...
);\n"
2025 " extern int
vsnprintf(char
*, size_t
, const char
*, __va_list
);\n"
2026 "# else
/* not __STDC__
) || __cplusplus
*/\n"
2027 " extern int
snprintf();\n"
2028 " extern int
vsnprintf();\n"
2029 "# endif
/* __STDC__
) || __cplusplus
*/\n";
2031 test_text = "# define _iob __iob
\n";
2036 * Make sure hpux defines abs in header.
2039 hackname = hpux11_abs;
2040 mach = "*-hp
-hpux11
*";
2042 select = "ifndef _MATH_INCLUDED
";
2044 c_fix_arg = "if
!defined(_MATH_INCLUDED
) ||
defined(__GNUG__
)";
2045 test_text = "#ifndef _MATH_INCLUDED
";
2050 * Keep HP-UX 11 from stomping on C++ math namespace
2051 * with defines for fabsf.
2054 hackname = hpux11_fabsf;
2056 select = "^
[ \t]*#
[ \t]*define
[ \t]+fabsf
\\(.
*";
2057 bypass = "__cplusplus
";
2060 c_fix_arg = "#ifndef __cplusplus
\n%0\n#endif
";
2064 "# define
fabsf(x
) ((float
)fabs((double
)(float
)(x
)))\n"
2070 * Fix C99 constant in __POINTER_SET define.
2073 hackname = hpux11_pthread_const;
2074 mach = "*-hp
-hpux11.
[0-3]*";
2075 files = sys/pthread.h;
2076 select = "^#define
[ \t]*__POINTER_SET
[ \t]*\\(\\(void
\\*\\) 1LL\\)";
2079 c_fix_arg = "#define __POINTER_SET
\t\t((void *)
1L)";
2080 test_text = "#define __POINTER_SET
\t\t((void *)
1LL)";
2085 * Prevent HP-UX 11 from defining __size_t and preventing size_t from
2086 * being defined by having it define _hpux_size_t instead.
2089 hackname = hpux11_size_t;
2090 mach = "*-hp
-hpux11
*";
2091 select = "__size_t
";
2094 c_fix_arg = "_hpux_size_t
";
2097 "#define __size_t size_t
\n"
2098 " extern int
getpwuid_r( char
*, __size_t
, struct passwd
**)
;\n";
2103 * Fix hpux 11.00 broken snprintf declaration
2104 * (third argument is char *, needs to be const char * to prevent
2105 * spurious warnings with -Wwrite-strings or in C++).
2108 hackname = hpux11_snprintf;
2110 select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
2111 ' *(char *\*, *\.\.\.\);)';
2113 c_fix_arg = '%1 const %3';
2115 test_text = "extern int
snprintf(char
*, size_t
, char
*, ...
);\n"
2116 "extern int
snprintf(char
*, __size_t
, char
*, ...
);\n"
2117 "extern int
snprintf(char
*, _hpux_size_t
, char
*, ...
);";
2121 * Fix hpux 11.00 broken vsnprintf declaration
2124 hackname = hpux11_vsnprintf;
2126 select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
2127 'const char \*,) __va__list\);';
2129 c_fix_arg = "%1 __va_list
);";
2131 test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
2137 * get rid of bogus inline definitions in HP-UX 8.0
2140 hackname = hpux8_bogus_inlines;
2143 bypass = "__GNUG__
";
2144 sed = "s@inline int
abs(int
[a
-z
][a
-z
]*)
{.
*}"
2145 "@extern
\"C
\" int
abs(int
);@
";
2146 sed = "s@inline double
abs(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2147 sed = "s@inline int
sqr(int
[a
-z
][a
-z
]*)
{.
*}@@
";
2148 sed = "s@inline double
sqr(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2149 test_text = "inline int
abs(int v
) { return (v
>=0)?v
:-v
; }\n"
2150 "inline double
sqr(double v
) { return v
**0.5; }";
2155 * Fix hpux broken ctype macros
2158 hackname = hpux_ctype_macros;
2160 select = '((: |\()__SB_masks \? )'
2161 '(__SB_masks\[__(alnum|c)\] & _IS)';
2163 c_fix_arg = "%1(int
)%3";
2165 test_text = ": __SB_masks ? __SB_masks
[__alnum
] & _ISCNTRL
\n"
2166 "# define
isalpha(__c
) (__SB_masks ? __SB_masks
[__c
] & _IS
\n";
2171 * Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
2174 hackname = hpux_htonl;
2175 files = netinet/in.h;
2176 select = "#ifndef _XOPEN_SOURCE_EXTENDED
[ \t]*\n"
2178 " \\* Macros for number representation conversion
\\.
\n"
2182 c_fix_arg = "#if
1\n%1";
2184 test_text = "#ifndef _XOPEN_SOURCE_EXTENDED
\n"
2186 " * Macros for number representation conversion.
\n"
2189 "#define
ntohl(x
) (x
)\n"
2190 "#define
ntohs(x
) (x
)\n"
2191 "#define
htonl(x
) (x
)\n"
2192 "#define
htons(x
) (x
)\n"
2194 "#endif
/* ! _XOPEN_SOURCE_EXTENDED
*/";
2202 hackname = hpux_long_double;
2203 mach = "*-*-hpux10
*";
2204 mach = "*-*-hpux11.
[012]*";
2206 select = "extern
[ \t]long_double
[ \t]strtold
";
2207 bypass = "long_double_t
";
2208 sed = "/^#
[ \t]*ifndef _LONG_DOUBLE
/,/\\/\\* _LONG_DOUBLE
\\*\\//D
";
2209 sed = "s
/long_double
/long double
/g
";
2211 test_text = "# ifndef _LONG_DOUBLE
\n"
2212 "# define _LONG_DOUBLE
\n"
2213 " typedef struct
{\n"
2214 " unsigned int word1
, word2
, word3
, word4
;\n"
2216 "# endif
/* _LONG_DOUBLE
*/\n"
2217 "extern long_double
strtold(const char
*, char
**)
;\n";
2221 * We cannot use the above rule on 11.31 because it removes the strtold
2222 * definition. ia64 is OK with no hack, PA needs some help.
2225 hackname = hpux_long_double_2;
2226 mach = "hppa
*-*-hpux11.3
*";
2228 select = "#
[ \t]*if
[ \t]*!defined
\\(__ia64
\\) \\|
\\| defined
\\(_PROTOTYPES
\\) \\|
\\| defined
\\(_LONG_DOUBLE_STRUCT
\\)";
2230 c_fix_arg = "# if
!defined(_PROTOTYPES
) ||
defined(_LONG_DOUBLE_STRUCT
)";
2232 test_text = "# if
!defined(__ia64
) ||
!defined(_PROTOTYPES
) ||
defined(_LONG_DOUBLE_STRUCT
)\n";
2236 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2239 hackname = hpux_systime;
2241 select = "^extern struct sigevent
;";
2244 c_fix_arg = "struct sigevent
;";
2246 test_text = 'extern struct sigevent;';
2251 * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
2252 * type and mpinfou is only defined when _KERNEL is set.
2255 hackname = hpux_spu_info;
2256 mach = "*-hp
-hpux
*";
2258 * It is tempting to omit the first "files
" entry. Do not.
2259 * The testing machinery will take the first "files
" entry as the name
2260 * of a test file to play with. It would be a nuisance to have a directory
2261 * with the name "*".
2263 files = "ia64
/sys
/getppdp.h
";
2264 files = "*/sys
/getppdp.h
";
2265 select = "^.
*extern.
*spu_info.
*";
2268 c_fix_arg = "#ifdef _KERNEL
\n%0\n#endif
";
2270 test_text = "extern union mpinfou spu_info
[];";
2274 hackname = hpux11_extern_sendfile;
2275 mach = "*-hp
-hpux11.
[12]*";
2276 files = sys/socket.h;
2277 select = "^
[ \t]*extern sbsize_t sendfile.
*\n.
*, int
\\)\\);\n";
2279 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2280 test_text = " extern sbsize_t sendfile
__((int
, int
, off_t
, bsize_t
,\n const struct iovec
*, int
));\n";
2284 hackname = hpux11_extern_sendpath;
2285 mach = "*-hp
-hpux11.
[12]*";
2286 files = sys/socket.h;
2287 select = "^
[ \t]*extern sbsize_t sendpath.
*\n.
*, int
\\)\\);\n";
2289 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2290 test_text = " extern sbsize_t sendpath
__((int
, int
, off_t
, bsize_t
,\n const struct iovec
*, int
));\n";
2294 hackname = hpux_extern_errno;
2295 mach = "*-hp
-hpux10.
*";
2296 mach = "*-hp
-hpux11.
[0-2]*";
2298 select = "^
[ \t]*extern int errno
;$
";
2300 c_fix_arg = "#ifdef __cplusplus
\nextern
\"C
\" {\n#endif
\n%0\n#ifdef __cplusplus
\n}\n#endif
";
2301 test_text = " extern int errno
;\n";
2306 * Add missing braces to pthread initializer defines.
2309 hackname = hpux_pthread_initializers;
2310 mach = "*-hp
-hpux11.
[0-3]*";
2311 files = sys/pthread.h;
2312 sed = "s@^
[ \t]*1, 1, 1, 1,[ \t]*\\\\"
2313 "@
\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@
";
2314 sed = "s@^
[ \t]*1,[ \t]*\\\\"
2316 sed = "/^
[ \t]*0$
/d
";
2317 sed = "s@__PTHREAD_MUTEX_VALID
, 0"
2318 "@
{ __PTHREAD_MUTEX_VALID
, 0 }@
";
2319 sed = "s@^
[ \t]*0, 0, -1, 0,[ \t]*\\\\"
2320 "@
\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@
";
2321 sed = "s@
0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2322 "@
{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2323 sed = "s@^
[ \t]*__LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2324 "@
\t{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2325 sed = "s@^
[ \t]*0, 0[ \t]*\\\\"
2326 "@
\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@
";
2327 sed = "s@__PTHREAD_COND_VALID
, 0"
2328 "@
{ __PTHREAD_COND_VALID
, 0 }@
";
2329 sed = "s@__LWP_COND_VALID
, 0,[ \t]*\\\\"
2330 "@
{ __LWP_COND_VALID
, 0 },\t\t\t\t\t\\\\@
";
2331 sed = "s@__PTHREAD_RWLOCK_VALID
, 0"
2332 "@
{ __PTHREAD_RWLOCK_VALID
, 0 }@
";
2333 sed = "s@__LWP_RWLOCK_VALID
, 0,[ \t]*\\\\"
2334 "@
{ __LWP_RWLOCK_VALID
, 0 },\t\t\t\t\t\\\\@
";
2335 sed = "s@^
[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
2336 "@
\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@
";
2337 test_text = "#define PTHREAD_MUTEX_INITIALIZER
{\t\t\t\t\t\\\\\n"
2338 "\t__PTHREAD_MUTEX_VALID
, 0,\t\t\t\t\t\\\\\n"
2339 "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE
),\t\t\\\\\n"
2340 "\t__SPNLCK_INITIALIZER
,\t\t\t\t\t\t\\\\\n"
2341 "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
2342 "\t0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
2343 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
2348 hackname = hpux_c99_intptr;
2349 mach = "*-hp
-hpux11.3
*";
2350 files = stdint-hpux11.h, stdint.h;
2351 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MAX
[ \t]*INT32_MAX
[ \t]*$@#define
PTRDIFF_MAX (2147483647l)@
";
2352 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MIN
[ \t]*INT32_MIN
[ \t]*$@#define
PTRDIFF_MIN (-PTRDIFF_MAX
- 1)@
";
2353 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MAX
[ \t]*INT32_MAX
[ \t]*$@#define
INTPTR_MAX (2147483647l)@
";
2354 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MIN
[ \t]*INT32_MIN
[ \t]*$@#define
INTPTR_MIN (-INTPTR_MAX
- 1)@
";
2355 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINTPTR_MAX
[ \t]*UINT32_MAX
[ \t]*$@#define
UINTPTR_MAX (4294967295ul)@
";
2356 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*SIZE_MAX
[ \t]*UINT32_MAX
[ \t]*$@#define
SIZE_MAX (4294967295ul)@
";
2357 test_text = "#define PTRDIFF_MAX INT32_MAX
\n"
2358 "#define PTRDIFF_MIN INT32_MIN
\n"
2359 "#define INTPTR_MAX INT32_MAX
\n"
2360 "#define INTPTR_MIN INT32_MIN
\n"
2361 "#define UINTPTR_MAX UINT32_MAX
\n"
2362 "#define SIZE_MAX UINT32_MAX
\n";
2366 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2370 hackname = hpux_c99_inttypes;
2371 mach = "*-hp
-hpux11.
[23]*";
2373 files = stdint-hpux11.h, stdint.h;
2374 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*__CONCAT_U__(__c
)[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2375 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*__CONCAT_U__(__c
)[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2376 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT32_C(__c
)[ \t]*__CONCAT__(__c
,l
)[ \t]*$@#define
INT32_C(__c
) (__c
)@
";
2377 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT32_C(__c
)[ \t].
*$@#define
UINT32_C(__c
) __CONCAT__(__c
,u
)@
";
2378 test_text = "#define
UINT8_C(__c
) __CONCAT_U__(__c
)\n"
2379 "#define
UINT16_C(__c
) __CONCAT_U__(__c
)\n"
2380 "#define
INT32_C(__c
) __CONCAT__(__c
,l
)\n"
2381 "#define
UINT32_C(__c
) __CONCAT__(__c
,ul
)\n";
2385 hackname = hpux_c99_inttypes2;
2386 mach = "*-hp
-hpux11.2
*";
2387 files = stdint-hpux11.h, stdint.h;
2388 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT8_C(__c
)[ \t]*((signed char
)(__c
))[ \t]*$@#define
INT8_C(__c
) (__c
)@
";
2389 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*((unsigned char
)(__c
))[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2390 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT16_C(__c
)[ \t]*((short
)(__c
))[ \t]*$@#define
INT16_C(__c
) (__c
)@
";
2391 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*((unsigned short
)(__c
))[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2392 test_text = "# define
INT8_C(__c
) ((signed char
)(__c
))\n"
2393 "# define
UINT8_C(__c
) ((unsigned char
)(__c
))\n"
2394 "# define
INT16_C(__c
) ((short
)(__c
))\n"
2395 "# define
UINT16_C(__c
) ((unsigned short
)(__c
))\n";
2399 hackname = hpux_stdint_least_fast;
2400 mach = "*-hp
-hpux11.2
*";
2401 files = stdint-hpux11.h, stdint.h;
2403 "^
[ \t]*#
[ \t]*define
[ \t]+UINT_(LEAST|FAST
)64_MAX
[ \t]+ULLONG_MAX
";
2405 c-fix-arg = "# define UINT_
%164_MAX __UINT64_MAX__
";
2406 test-text = "# define UINT_FAST64_MAX ULLONG_MAX
\n"
2407 "# define UINT_LEAST64_MAX ULLONG_MAX
\n";
2412 hackname = hpux_inttype_int8_t;
2413 mach = "*-hp
-hpux1
[01].
*";
2414 files = sys/_inttypes.h;
2415 select = "^
[ \t]*typedef
[ \t]*char
[ \t]*int(_least
){0,1}8_t.
*";
2417 c_fix_arg = "typedef signed char int
%18_t
;";
2418 test_text = "typedef char int_least8_t
;\n"
2419 "typedef char int8_t
;\n";
2423 hackname = hpux_imaginary_i;
2424 mach = "ia64
-hp
-hpux11.
*";
2426 select = "^
[ \t]*#
[ \t]*define
[ \t]*_Complex_I.
*";
2428 c_fix_arg = "#define
_Complex_I (__extension__
1.0iF
)";
2429 test_text = "#define
_Complex_I (0.f
+_Imaginary_I
)\n";
2433 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
2436 hackname = huge_val_hex;
2437 files = bits/huge_val.h;
2438 select = "^#
[ \t]*define
[ \t]*HUGE_VAL
[ \t].
*0x1\\.0p.
*";
2439 bypass = "__builtin_huge_val
";
2442 c_fix_arg = "#define
HUGE_VAL (__builtin_huge_val())\n";
2444 test_text = "# define HUGE_VAL
\t(__extension__
0x1.0p2047
)";
2449 * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
2452 hackname = huge_valf_hex;
2453 files = bits/huge_val.h;
2454 select = "^#
[ \t]*define
[ \t]*HUGE_VALF
[ \t].
*0x1\\.0p.
*";
2455 bypass = "__builtin_huge_valf
";
2458 c_fix_arg = "#define
HUGE_VALF (__builtin_huge_valf())\n";
2460 test_text = "# define
HUGE_VALF (__extension__
0x1.0p255f
)";
2465 * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
2468 hackname = huge_vall_hex;
2469 files = bits/huge_val.h;
2470 select = "^#
[ \t]*define
[ \t]*HUGE_VALL
[ \t].
*0x1\\.0p.
*";
2471 bypass = "__builtin_huge_vall
";
2474 c_fix_arg = "#define
HUGE_VALL (__builtin_huge_vall())\n";
2476 test_text = "# define
HUGE_VALL (__extension__
0x1.0p32767L
)";
2481 * Fix return type of abort and free
2484 hackname = int_abort_free_and_exit;
2486 select = "int
[ \t]+(abort|free|exit
)[ \t]*\\(";
2487 bypass = "_CLASSIC_ANSI_TYPES
";
2490 c_fix_arg = "void
\t%1(";
2492 test_text = "extern int
abort(int
);\n"
2493 "extern int
free(void*)
;\n"
2494 "extern int
exit(void*)
;";
2499 * Fix various macros used to define ioctl numbers.
2500 * The traditional syntax was:
2502 * #define _IO(n, x) (('n'<<8)+x)
2503 * #define TIOCFOO _IO(T, 1)
2505 * but this does not work with the C standard, which disallows macro
2506 * expansion inside strings. We have to rewrite it thus:
2508 * #define _IO(n, x) ((n<<8)+x)
2509 * #define TIOCFOO _IO('T', 1)
2511 * The select expressions match too much, but the c_fix code is cautious.
2513 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
2516 hackname = io_quotes_def;
2517 select = "define
[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*\\([a
-zA
-Z
][,)]";
2518 c_fix = char_macro_def;
2521 "#define
BSD43__IOWR(n
, x
) (('n'<<8)+x
)\n"
2522 "#define
_IOWN(x
,y
,t
) (_IOC_IN|
(((t
)&_IOCPARM_MASK
)<<16)|
('x'<<8)|y
)\n"
2523 "#define
_IO(x
,y
) ('x'<<8|y
)";
2525 "#define
XX_IO(x
) ('x'<<8|
256)";
2529 * Fix the usage of the ioctl macro numbers.
2532 hackname = io_quotes_use;
2533 select = "define
[ \t]+[A
-Z0
-9_
]+[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*[ \t]*"
2535 c_fix = char_macro_use;
2537 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
2538 "#define TIOCFOO \\\\\n"
2539 "BSD43__IOWR(T, 1) /* Some are multi-line */";
2544 * Check for missing ';' in struct
2547 hackname = ip_missing_semi;
2548 files = netinet/ip.h;
2550 sed = "/^struct/,/^};/s/}$/};/";
2556 "}; /* mumbled struct */\n";
2561 * Non-traditional "const" declaration in Irix's limits.h.
2564 hackname
= irix_limits_const
;
2565 files
= fixinc
-test
-limits.h
, limits.h
;
2566 select
= "^extern const ";
2568 c_fix_arg
= "extern __const ";
2569 test_text
= "extern const char limit; /* test limits */";
2574 * IRIX
5.x
's stdio.h declares some functions that take a va_list as
2575 * taking char *. However, GCC uses void * for va_list, so
2576 * calling vfprintf with a va_list fails in C++. */
2578 hackname = irix_stdio_va_list;
2581 select = '/\
* va_list \
*/ char \
*';
2583 c_fix_arg = "__gnuc_va_list";
2585 "extern int printf( const char *, /* va_list */ char * );";
2590 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
2591 * use / * * / to concatenate tokens.
2594 hackname = kandr_concat;
2595 files = "sparc/asm_linkage.h";
2596 files = "sun*/asm_linkage.h";
2597 files = "arm/as_support.h";
2598 files = "arm/mc_type.h";
2599 files = "arm/xcb.h";
2600 files = "dev/chardefmac.h";
2601 files = "dev/ps_irq.h";
2602 files = "dev/screen.h";
2603 files = "dev/scsi.h";
2604 files = "sys/tty.h";
2605 files = "Xm.acorn/XmP.h";
2606 files = bsd43/bsd43_.h;
2610 test_text = "#define __CONCAT__(a,b) a/**/b";
2614 /* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
2615 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
2616 * constant on recent versions of g
++.
2619 hackname
= linux_ia64_ucontext
;
2620 files
= "sys/ucontext.h";
2621 mach
= "ia64-*-linux*";
2622 select
= '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
2623 '->sc_gr\[0\]\) - \(char \*\) 0\)';
2625 c_fix_arg
= "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
2626 test_text
= "# define _SC_GR0_OFFSET\t\\\\\n"
2627 "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
2632 * Remove header file warning from sys
/time.h. Autoconf
's
2633 * AC_HEADER_TIME recommends to include both sys/time.h and time.h
2634 * which causes warning on LynxOS. Remove the warning.
2637 hackname = lynxos_no_warning_in_sys_time_h;
2639 select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
2642 test_text = "#warning Using <time.h> instead of <sys/time.h>";
2647 * Add missing declaration for putenv.
2650 hackname = lynxos_missing_putenv;
2651 mach = '*-*-lynxos
*';
2653 bypass = 'putenv
[ \t]*\\(';
2654 select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2657 "extern int putenv _AP((char *));";
2658 c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2659 test_text = "extern char *getenv _AP((const char *));";
2664 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
2666 * On NetBSD, machine is a symbolic link to an architecture specific
2667 * directory name, so we can't match a specific file name here.
2670 hackname
= machine_ansi_h_va_list
;
2671 select
= "define[ \t]+_BSD_VA_LIST_[ \t]";
2672 bypass
= '__builtin_va_list';
2675 c_fix_arg
= "%1__builtin_va_list";
2676 c_fix_arg
= "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
2678 test_text
= " # define _BSD_VA_LIST_\tchar**";
2683 * Fix non
-ansi machine name defines
2686 hackname
= machine_name
;
2687 c_test
= machine_name
;
2688 c_fix
= machine_name
;
2690 test_text
= "/* MACH_DIFF: */\n"
2691 "#if defined( i386 ) || defined( sparc ) || defined( vax )"
2692 "\n/* no uniform test, so be careful :-) */";
2697 * Some math.h files define struct
exception (it
's in the System V
2698 * Interface Definition), which conflicts with the class exception defined
2699 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
2700 * This is not a great fix, but I haven't been able to think of anything
2704 hackname
= math_exception
;
2706 select
= "struct exception";
2708 * This should be bypassed on __cplusplus
, but some supposedly C
++
2709 * aware headers
, such as Solaris
8 and
9, don
't wrap their struct
2710 * exception either. So currently we bypass only for glibc, based on a
2711 * comment in the fixed glibc header. Ick.
2713 bypass = 'We have a problem when using C\
+\
+|for C\
+\
+, '
2714 '_
[a
-z0
-9A
-Z_
]+_exception
; for C
, exception
';
2717 c_fix_arg = "#ifdef __cplusplus\n"
2718 "#define exception __math_exception\n"
2721 c_fix_arg = "#ifdef __cplusplus\n"
2722 "#undef exception\n"
2725 test_text = "typedef struct exception t_math_exception;";
2730 * This looks pretty broken to me. ``dbl_max_def'' will contain
2731 * "define DBL_MAX " at the start, when what we really want is just
2732 * the value portion. Can't figure out how to write a test case
2733 * for this either
:-(
2736 hackname
= math_huge_val_from_dbl_max
;
2740 * IF HUGE_VAL is defined to be DBL_MAX
*and
* DBL_MAX is _not_ defined
2741 * in math.h
, this fix applies.
2743 select
= "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
2744 bypass
= "define[ \t]+DBL_MAX";
2748 * See if we have a definition for DBL_MAX in float.h.
2749 * If we do
, we will replace the one in math.h with that one.
2752 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
2753 "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
2755 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
2756 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
2757 "s@DBL_MAX@'\"$dbl_max_def@\"\n"
2762 "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
2763 "#define HUGE_VAL DBL_MAX";
2771 hackname
= nested_auth_des
;
2773 select
= '(/\*.*rpc/auth_des\.h>.*)/\*';
2775 c_fix_arg
= "%1*/ /*";
2776 test_text
= "/*#include <rpc/auth_des.h> /* skip this */";
2781 * Some versions of NetBSD don
't expect the C99 inline semantics.
2784 hackname = netbsd_c99_inline_1;
2785 mach = "*-*-netbsd*";
2787 select = "extern __inline int";
2790 c_fix_arg = "extern\n"
2791 "#ifdef __GNUC_STDC_INLINE__\n"
2792 "__attribute__((__gnu_inline__))\n"
2796 test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
2801 hackname = netbsd_c99_inline_2;
2802 mach = "*-*-netbsd*";
2804 select = "#define _SIGINLINE extern __inline";
2807 c_fix_arg = <<- _EOArg_
2808 #ifdef __GNUC_STDC_INLINE__
2809 #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
2815 test_text = "#define _SIGINLINE extern __inline";
2820 * NetBSD has a semicolon after the ending '}' for some extern "C".
2823 hackname = netbsd_extra_semicolon;
2824 mach = "*-*-netbsd*";
2825 files = sys/cdefs.h;
2826 select = "#define[ \t]*__END_DECLS[ \t]*};";
2829 c_fix_arg = "#define __END_DECLS }";
2831 test_text = "#define __END_DECLS };";
2835 /* newlib's stdint.h has several failures to conform to C99. The fix
2836 for these removed a comment that can be matched to identify unfixed
2839 hackname
= newlib_stdint_1
;
2840 files
= stdint
-newlib.h
, stdint.h
;
2841 select
= "@todo - Add support for wint_t types";
2842 sed
= "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
2843 sed
= "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
2844 sed
= "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
2845 sed
= "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
2846 sed
= "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
2847 sed
= "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
2848 sed
= 's@#define INT_FAST\([0-9]*\)_MIN.*@#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
2849 sed
= 's@#define INT_FAST\([0-9]*\)_MAX.*@#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
2850 sed
= 's@#define UINT_FAST\([0-9]*\)_MAX.*@#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
2851 sed
= "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
2852 sed
= "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
2853 sed
= "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
2854 sed
= "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
2855 sed
= "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
2856 test_text
= "/* @todo - Add support for wint_t types. */\n"
2857 "#define INT32_MIN (-2147483647-1)\n"
2858 "#define INT32_MAX 2147483647\n"
2859 "#define UINT32_MAX 4294967295U\n"
2860 "#define INT_LEAST32_MIN (-2147483647-1)\n"
2861 "#define INT_LEAST32_MAX 2147483647\n"
2862 "#define UINT_LEAST32_MAX 4294967295U\n"
2863 "#define INT_FAST8_MIN INT8_MIN\n"
2864 "#define INT_FAST8_MAX INT8_MAX\n"
2865 "#define UINT_FAST8_MAX UINT8_MAX\n"
2866 "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
2867 "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
2868 "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
2869 "#define UINT8_C(x) x##U\n"
2870 "#define UINT16_C(x) x##U";
2875 hackname
= newlib_stdint_2
;
2876 files
= stdint
-newlib.h
, stdint.h
;
2877 select
= "@todo - Add support for wint_t types";
2879 c_fix_arg
= "#define INTMAX_MAX __INTMAX_MAX__\n"
2880 "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
2881 "#define UINTMAX_MAX __UINTMAX_MAX__\n"
2882 "#define WCHAR_MAX __WCHAR_MAX__\n"
2883 "#define WCHAR_MIN __WCHAR_MIN__\n"
2884 "#define WINT_MAX __WINT_MAX__\n"
2885 "#define WINT_MIN __WINT_MIN__\n\n"
2887 c_fix_arg
= '/\*\* Macros for minimum-width integer constant expressions \*/';
2888 test_text
= "/* @todo - Add support for wint_t types. */\n"
2889 "/** Macros for minimum-width integer constant expressions */";
2894 * NeXT
3.2 adds const prefix to some math functions.
2895 * These conflict with the built
-in functions.
2898 hackname
= next_math_prefix
;
2899 files
= ansi
/math.h
;
2900 select
= "^extern[ \t]+double[ \t]+__const__[ \t]";
2903 c_fix_arg
= "extern double %1(";
2904 c_fix_arg
= "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
2906 test_text
= "extern\tdouble\t__const__\tmumble();";
2911 * NeXT
3.2 uses the word
"template" as a parameter for some
2912 * functions. GCC reports an invalid use of a reserved key word
2913 * with the built
-in functions.
2916 hackname
= next_template
;
2918 select
= "[ \t]template\\)";
2922 c_fix_arg
= "\\(([^)]*)[ \t]template\\)";
2923 test_text
= "extern mumble( char * template); /* fix */";
2928 * NeXT
3.2 includes the keyword volatile in the
abort() and
exit()
2929 * function prototypes. That conflicts with the built
-in functions.
2932 hackname
= next_volitile
;
2933 files
= ansi
/stdlib.h
;
2934 select
= "^extern[ \t]+volatile[ \t]+void[ \t]";
2937 c_fix_arg
= "extern void %1(";
2938 c_fix_arg
= "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
2940 test_text
= "extern\tvolatile\tvoid\tabort();";
2945 * NeXT
2.0 defines
'int wait(union wait*)', which conflicts with Posix
.1.
2946 * Note that version
3 of the NeXT system has wait.h in a different directory
,
2947 * so that this code won
't do anything. But wait.h in version 3 has a
2948 * conditional, so it doesn't need this fix. So everything is okay.
2951 hackname
= next_wait_union
;
2954 select
= 'wait\(union wait';
2956 c_fix_arg
= "wait(void";
2957 test_text
= "extern pid_d wait(union wait*);";
2962 * a missing semi
-colon at the end of the nodeent structure definition.
2965 hackname
= nodeent_syntax
;
2966 files
= netdnet
/dnetdb.h
;
2967 select
= "char[ \t]*\\*na_addr[ \t]*$";
2970 test_text
= "char *na_addr\t";
2974 * Fix OpenBSD
's NULL definition.
2977 hackname = openbsd_null_definition;
2978 mach = "*-*-openbsd*";
2979 files = locale.h, stddef.h, stdio.h, string.h,
2980 time.h, unistd.h, wchar.h, sys/param.h;
2981 select = "__GNUG__";
2983 c_fix_arg = "#ifndef NULL\n"
2984 "#ifdef __cplusplus\n"
2986 "#define NULL\t__null\n"
2987 "#else\t /* ! __GNUG__ */\n"
2988 "#define NULL\t0L\n"
2989 "#endif\t /* __GNUG__ */\n"
2990 "#else\t /* ! __cplusplus */\n"
2991 "#define NULL\t((void *)0)\n"
2992 "#endif\t /* __cplusplus */\n"
2993 "#endif\t /* !NULL */";
2995 c_fix_arg = "^#ifndef[ \t]*NULL\n"
2996 "^#ifdef[ \t]*__GNUG__\n"
2997 "^#define[ \t]*NULL[ \t]*__null\n"
2999 "^#define[ \t]*NULL[ \t]*0L\n"
3005 "#define NULL __null\n"
3013 * obstack.h used casts as lvalues.
3015 * We need to change postincrements of casted pointers (which are
3016 * then dereferenced and assigned into) of the form
3018 * *((TYPE*)PTRVAR)++ = (VALUE)
3020 * into expressions like
3022 * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
3024 * which is correct for the cases used in obstack.h since PTRVAR is
3025 * of type char * and the value of the expression is not used.
3028 hackname = obstack_lvalue_cast;
3030 select = '\
*\
(\
(([^
()]*)\
*\
)(.*)\
)\
+\
+ = \
(([^
()]*)\
)';
3032 c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
3033 test_text = "*((void **) (h)->next_free)++ = (aptr)";
3037 * Fix OpenBSD's va_start define.
3040 hackname
= openbsd_va_start
;
3041 mach
= "*-*-openbsd*";
3043 select
= '__builtin_stdarg_start';
3045 c_fix_arg
= __builtin_va_start
;
3047 test_text
= "#define va_start(v,l) __builtin_stdarg_start((v),l)";
3051 * sys
/lc_core.h on some versions of OSF1
/4.x pollutes the namespace by
3052 * defining regex.h related types. This causes libg
++ build and usage
3053 * failures. Fixing this correctly requires checking and modifying
3 files.
3056 hackname
= osf_namespace_a
;
3057 files
= reg_types.h
;
3058 files
= sys
/lc_core.h
;
3059 test
= " -r reg_types.h";
3060 test
= " -r sys/lc_core.h";
3061 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3062 test
= " -z \"`grep __regex_t regex.h`\"";
3066 c_fix_arg
= "reg(ex|off|match)_t";
3068 test_text
= "`touch sys/lc_core.h`"
3069 "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
3070 "extern regex_t re;\n"
3071 "extern regoff_t ro;\n"
3072 "extern regmatch_t rm;\n";
3076 hackname
= osf_namespace_c
;
3078 test
= " -r reg_types.h";
3079 test
= " -r sys/lc_core.h";
3080 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3081 test
= " -z \"`grep __regex_t regex.h`\"";
3083 select
= "#include <reg_types\.h>.*";
3086 "typedef __regex_t\tregex_t;\n"
3087 "typedef __regoff_t\tregoff_t;\n"
3088 "typedef __regmatch_t\tregmatch_t;";
3090 test_text
= "#include <reg_types.h>";
3095 * On broken glibc
-2.3.3 systems an array of incomplete structures is
3096 * passed to __sigsetjmp. Fix that to take a pointer instead.
3099 hackname
= pthread_incomplete_struct_argument
;
3101 select
= "struct __jmp_buf_tag";
3103 c_fix_arg
= "%1 *%2%3";
3104 c_fix_arg
= "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) (__env)\\[1\\](.*)$";
3105 test_text
= "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask);";
3109 * Fix return type of fread and fwrite on sysV68
3112 hackname
= read_ret_type
;
3114 select
= "extern int\t.*, fread\\(\\), fwrite\\(\\)";
3116 c_fix_arg
= "extern unsigned int fread(), fwrite();\n%1%2";
3117 c_fix_arg
= "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
3119 test_text
= "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
3124 * Fix casts as lvalues in glibc
's <rpc/xdr.h>.
3127 hackname = rpc_xdr_lvalue_cast_a;
3129 select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
3131 c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
3132 test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
3133 "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
3138 hackname = rpc_xdr_lvalue_cast_b;
3140 select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
3142 c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
3143 test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
3144 "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
3149 * function class(double x) conflicts with C++ keyword on rs/6000
3152 hackname = rs6000_double;
3154 select = '[^a
-zA
-Z_
]class\
(';
3157 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
3158 c_fix_arg = '^.
*[^a
-zA
-Z_
]class\
(.
*';
3160 test_text = "extern int class();";
3165 * Wrong fchmod prototype on RS/6000.
3168 hackname = rs6000_fchmod;
3170 select = 'fchmod\
(char \
*';
3172 c_fix_arg = "fchmod(int";
3173 test_text = "extern int fchmod(char *, mode_t);";
3178 * parameters conflict with C++ new on rs/6000
3181 hackname = rs6000_param;
3185 select = 'rename\
(const char \
*old
, const char \
*new\
)';
3187 c_fix_arg = 'rename(const char
*_old
, const char
*_new
)';
3189 test_text = 'extern int
rename(const char
*old
, const char
*new
);';
3194 * Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
3195 * for C99. This is wrong for C++, which needs many C99 features, but
3196 * only supports __restrict.
3199 hackname = solaris___restrict;
3200 files = sys/feature_tests.h;
3201 select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
3202 mach = "*-*-solaris2*";
3204 c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
3205 "#else\n%0\n#endif";
3206 test_text = "#define _RESTRICT_KYWD restrict";
3211 * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
3212 * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
3213 * and imaginary definitions which are not supported by GCC.
3216 hackname = solaris_complex;
3217 mach = "*-*-solaris2.*";
3219 select = "#define[ \t]_Complex_I[ \t]_Complex_I";
3220 sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
3221 "#define\t_Complex_I\t(__extension__ 1.0iF)/";
3222 sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
3223 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
3224 sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
3225 test_text = "#define _Complex_I _Complex_I\n"
3226 "#define complex _Complex\n"
3227 "#define _Imaginary_I _Imaginary_I\n"
3228 "#define imaginary _Imaginary\n"
3230 "#define I _Imaginary_I";
3235 * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
3236 * extern "C" instead so libstdc++ can use it.
3239 hackname = solaris_complex_cxx;
3240 mach = "*-*-solaris2.*";
3242 sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
3243 "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
3244 sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
3245 "#ifdef\t__cplusplus\\\n}\\\n#endif";
3246 test_text = "#if !defined(__cplusplus)\n"
3247 "#endif /* !defined(__cplusplus) */";
3252 * g++ rejects functions declared with both C and C++ linkage.
3255 hackname = solaris_cxx_linkage;
3256 mach = '*-*-solaris2
*';
3257 files = "iso/stdlib_iso.h";
3258 select = "(#if __cplusplus >= 199711L)\n"
3259 "(extern \"C\\+\\+\" \\{\n)"
3260 "(.*(bsearch|qsort).*)";
3262 c_fix_arg = "%1 && !__GNUG__\n%2%3";
3265 "#if __cplusplus >= 199711L\n"
3266 "extern \"C++\" {\n"
3267 " void *bsearch(const void *, const void *, size_t, size_t,";
3272 * Solaris <iso/stdio_iso.h> doesn't declare getc for C
++ with
3273 * _STRICT_STDC
, but uses it.
3276 hackname
= solaris_getc_strict_stdc
;
3277 mach
= "*-*-solaris2*";
3278 files
= "iso/stdio_iso.h";
3279 select
= "(.*&& )!defined\\(_STRICT_STDC\\)(.*)";
3281 c_fix_arg
= "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2";
3284 "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
3289 * Before Solaris
10, <iso
/setjmp_iso.h
> doesn
't mark longjump noreturn.
3292 hackname = solaris_longjmp_noreturn;
3293 mach = "*-*-solaris2*";
3294 files = "iso/setjmp_iso.h";
3295 bypass = "__NORETURN";
3296 select = "(.*longjmp\\(jmp_buf.*[^)]+\\));";
3298 c_fix_arg = "%1 __attribute__ ((__noreturn__));";
3300 test_text = "extern void longjmp(jmp_buf, int);";
3305 * Sun Solaris 10 defines several C99 math macros in terms of
3306 * builtins specific to the Studio compiler, in particular not
3307 * compatible with the GNU compiler.
3310 hackname = solaris_math_1;
3311 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3312 bypass = "__GNUC__";
3313 files = iso/math_c99.h;
3315 c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
3316 c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
3318 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3320 "#define HUGE_VAL __builtin_huge_val\n"
3321 "#undef HUGE_VALF\n"
3322 "#define HUGE_VALF __builtin_huge_valf\n"
3323 "#undef HUGE_VALL\n"
3324 "#define HUGE_VALL __builtin_huge_vall";
3328 hackname = solaris_math_2;
3329 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3330 bypass = "__GNUC__";
3331 files = iso/math_c99.h;
3333 c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
3334 c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
3336 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3338 "#define INFINITY __builtin_infinity";
3342 hackname = solaris_math_3;
3343 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3344 bypass = "__GNUC__";
3345 files = iso/math_c99.h;
3347 c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
3348 c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
3350 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3352 "#define NAN __builtin_nan";
3356 hackname = solaris_math_4;
3357 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3358 bypass = "__GNUC__";
3359 files = iso/math_c99.h;
3361 c_fix_arg = "#define\tfpclassify(x) \\\n"
3362 " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, (x))";
3363 c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
3365 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3366 "#undef fpclassify\n"
3367 "#define fpclassify(x) __builtin_fpclassify(x)";
3371 hackname = solaris_math_8;
3372 select = '@\
(#\
)math_c99\.h
' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
3373 bypass = "__GNUC__";
3374 files = iso/math_c99.h;
3376 c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
3377 "\t\t\t ? __builtin_signbitf(x) \\\n"
3378 "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
3379 "\t\t\t ? __builtin_signbitl(x) \\\n"
3380 "\t\t\t : __builtin_signbit(x))";
3381 c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
3382 test_text = <<- _EOText_
3383 #ident "@(#)math_c99.h 1.9 04/11/01 SMI"
3385 #define signbit(x) __builtin_signbit(x)
3390 hackname = solaris_math_9;
3391 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3392 bypass = "__GNUC__";
3393 files = iso/math_c99.h;
3395 c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
3396 c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)";
3398 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3399 "#undef isgreater\n"
3400 "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
3401 "#undef isgreaterequal\n"
3402 "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
3404 "#define isless(x, y) ((x) __builtin_isless(y))\n"
3405 "#undef islessequal\n"
3406 "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
3407 "#undef islessgreater\n"
3408 "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
3409 "#undef isunordered\n"
3410 "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
3414 * On Solaris 11, if you do isinf(NaN) you'll get a floating point
3415 * exception. Provide an alternative using GCC
's builtin.
3419 hackname = solaris_math_10;
3420 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3421 files = iso/math_c99.h;
3423 c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
3424 c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
3425 "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);[ \t]*\\\\\n"
3426 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
3427 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*\\(-INFINITY\\);[ \t]*\\}\\)";
3429 '#pragma ident
"@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
3431 "#define isinf(x) __extension__( \\\\\n"
3432 " { __typeof(x) __x_i = (x); \\\\\n"
3433 " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
3434 " __x_i == (__typeof(__x_i)) (-INFINITY); })";
3438 * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
3439 * "0" for the last field of the pthread_mutex_t structure, which is
3440 * of type upad64_t, which itself is typedef'd to int64_t
, but with
3441 * __STDC__
defined (e.g. by
-ansi
) it is a union. So change the
3442 * initializer to
"{0}" instead
3445 hackname
= solaris_mutex_init_2
;
3446 select
= '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3449 * On Solaris
10, this fix is unnecessary because upad64_t is
3450 * always defined correctly regardless of the definition of the
3451 * __STDC__ macro. The first
"mach" pattern matches up to
3452 * solaris9. The second
"mach" pattern will not match any
two (or
3453 * more
) digit solaris version
, but it will match e.g.
2.5.1.
3455 mach
= '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
3457 c_fix_arg
= "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3462 c_fix_arg
= "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+"
3463 "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
3464 ",[ \t]*0\\}" "(|[ \t].*)$";
3466 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3467 "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
3468 "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
3469 "#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \\\\\n"
3470 " {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}\n"
3471 "#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \\\\\n"
3472 " {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}";
3477 * The pow overloads with int were removed in C
++ 2011 DR
550.
3480 hackname
= solaris_pow_int_overload
;
3481 mach
= '*-*-solaris2*';
3482 files
= "iso/math_iso.h";
3483 select
= "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)"
3484 " *\\{[^{}]*\n[^{}]*\\}";
3486 c_fix_arg
= "#if __cplusplus < 201103L\n%0\n#endif";
3489 " inline long double pow(long double __X, int __Y) { return\n"
3490 " __powl(__X, (long double) (__Y)); }";
3495 * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a
"0" for some
3496 * fields of the pthread_rwlock_t structure
, which are of type
3497 * upad64_t
, which itself is typedef
'd to int64_t, but with __STDC__
3498 * defined (e.g. by -ansi) it is a union. So change the initializer
3502 hackname = solaris_rwlock_init_1;
3503 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3505 mach = '*-*-solaris
*';
3507 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3510 "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
3512 c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
3513 "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
3516 '#ident
"@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3517 "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
3522 * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
3523 * structure. As such, it need two levels of brackets, but only
3524 * contains one. Wrap the macro definition in an extra layer.
3527 hackname = solaris_once_init_1;
3528 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3530 mach = '*-*-solaris
*';
3532 c_fix_arg = "%1{%2}%3";
3533 c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
3535 '#pragma ident
"@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
3536 "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
3541 * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
3542 * fields of the pthread_once_t structure, which are of type
3543 * upad64_t, which itself is typedef'd to int64_t
, but with __STDC__
3544 * defined (e.g. by
-ansi
) it is a union. So change the initializer
3545 * to
"{0}" instead. This test relies on solaris_once_init_1.
3548 hackname
= solaris_once_init_2
;
3549 select
= '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3552 * On Solaris
10, this fix is unnecessary because upad64_t is
3553 * always defined correctly regardless of the definition of the
3554 * __STDC__ macro. The first
"mach" pattern matches up to
3555 * solaris9. The second
"mach" pattern will not match any
two (or
3556 * more
) digit solaris version
, but it will match e.g.
2.5.1.
3558 mach
= '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
3560 c_fix_arg
= "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3563 "%1{0}, {0}, {0}, {%3}%4\n"
3565 c_fix_arg
= "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{\\{)"
3566 "(0, 0, 0, )(PTHREAD_[A-Z_]+)(\\}\\})[ \t]*$";
3568 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3569 "#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n";
3574 * Sun Solaris
2 has a version of sys
/int_const.h that defines
3575 * UINT8_C and UINT16_C to unsigned constants.
3578 hackname
= solaris_int_const
;
3579 files
= sys
/int_const.h
;
3580 mach
= '*-*-solaris2*';
3582 c_fix_arg
= "#define\tUINT8_C(c)\t(c)\n"
3584 "#define\tUINT16_C(c)\t(c)";
3585 select
= "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
3587 "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
3589 "#define UINT8_C(c) __CONCAT__(c,u)\n"
3591 "#define UINT16_C(c) __CONCAT__(c,u)";
3596 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3597 * UINT8_MAX and UINT16_MAX to unsigned constants.
3600 hackname
= solaris_int_limits_1
;
3601 files
= sys
/int_limits.h
;
3602 mach
= '*-*-solaris2*';
3604 c_fix_arg
= "#define\tUINT8_MAX\t(255)\n"
3605 "#define\tUINT16_MAX\t(65535)";
3606 select
= "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
3607 "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
3609 "#define UINT8_MAX (255U)\n"
3610 "#define UINT16_MAX (65535U)";
3615 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3616 * INT_FAST16 limits to wrong values for sys
/int_types.h.
3619 hackname
= solaris_int_limits_2
;
3620 files
= sys
/int_limits.h
;
3621 mach
= '*-*-solaris2*';
3623 c_fix_arg
= "#define\t%1_FAST16_%2 %132_%2";
3624 select
= "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
3626 "#define INT_FAST16_MAX INT16_MAX\n"
3627 "#define UINT_FAST16_MAX UINT16_MAX\n"
3628 "#define INT_FAST16_MIN INT16_MIN";
3633 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3634 * SIZE_MAX as unsigned long.
3637 hackname
= solaris_int_limits_3
;
3638 files
= sys
/int_limits.h
;
3639 mach
= '*-*-solaris2*';
3641 c_fix_arg
= "#define\tSIZE_MAX\t4294967295U";
3642 select
= "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
3644 "#define SIZE_MAX 4294967295UL";
3649 * Sun Solaris up to
9 has a version of sys
/int_types.h that forbids use
3650 * of Standard C99
64-bit types in
32-bit mode.
3653 hackname
= solaris_int_types
;
3654 select
= "__STDC__ - 0 == 0";
3655 bypass
= "_LONGLONG_TYPE";
3656 files
= sys
/int_types.h
;
3659 "(defined(_STDC_C99) || !defined(_STRICT_STDC) || defined(__GNUC__))";
3661 "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3662 "typedef long long int64_t;\n"
3664 "#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))\n"
3665 "typedef int64_t intmax_t;\n"
3671 * Solaris
10+ <spawn.h
> uses char
*const argv
[_RESTRICT_KYWD
] in the
3672 * posix_spawn declarations
, which doesn
't work with C++.
3675 hackname = solaris_posix_spawn_restrict;
3677 mach = '*-*-solaris2
*';
3679 c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
3680 select = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
3682 "char *const argv[_RESTRICT_KYWD],\n"
3683 "char *const envp[_RESTRICT_KYWD]);";
3688 * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
3689 * std::__flsbuf, but <iso/stdio_iso.h> uses them.
3692 hackname = solaris_std___filbuf;
3694 mach = '*-*-solaris2
*';
3695 bypass = "using std::__filbuf";
3696 select = "(using std::perror;\n)(#endif)";
3698 c_fix_arg = "%1#ifndef _LP64\n"
3699 "using std::__filbuf;\n"
3700 "using std::__flsbuf;\n"
3703 test_text = "using std::perror;\n"
3709 * Sun Solaris 8 has what appears to be some gross workaround for
3710 * some old version of their c++ compiler. G++ doesn't want it
3711 * either
, but doesn
't want to be tied to SunPRO version numbers.
3714 hackname = solaris_stdio_tag;
3715 files = stdio_tag.h;
3717 select = '__cplusplus
< 54321L';
3718 /* In Solaris 10, the code in stdio_tag.h is conditionalized on
3719 "!defined(__GNUC__)" so we no longer need to fix it. */
3720 bypass = '__GNUC__
';
3721 sed = 's
/defined(__cplusplus
) && (__cplusplus
< 54321L)/0/';
3723 test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
3728 * On Solaris 9, __va_list needs to become a typedef for
3729 * __builtin_va_list to make -Wmissing-format-attribute work.
3732 hackname = solaris_sys_va_list;
3733 files = sys/va_list.h;
3734 mach = '*-*-solaris2.9
';
3735 select = "#if.*__STDC__.*\n"
3736 "typedef void \\*__va_list;\n"
3738 "typedef char \\*__va_list;\n"
3742 c_fix_arg = "#ifdef __GNUC__\n"
3743 "typedef __builtin_va_list __va_list;\n"
3747 test_text = "#if defined(__STDC__) && !defined(__ia64)\n"
3748 "typedef void *__va_list;\n"
3750 "typedef char *__va_list;\n"
3756 * a missing semi-colon at the end of the statsswtch structure definition.
3759 hackname = statsswtch;
3760 files = rpcsvc/rstat.h;
3761 select = "boottime$";
3763 c_fix_arg = "boottime;";
3764 test_text = "struct statswtch {\n int boottime\n};";
3769 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
3770 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
3774 hackname
= stdio_stdarg_h
;
3776 bypass
= "include.*(stdarg\.h|machine/ansi\.h)";
3778 * On Solaris
10, this fix is unncessary
; <stdio.h
> includes
3779 * <iso
/stdio_iso.h
>, which includes
<sys
/va_list.h
>.
3781 mach
= '*-*-solaris2.1[0-9]*';
3786 c_fix_arg
= "#define __need___va_list\n#include <stdarg.h>\n";
3793 * Don
't use or define the name va_list in stdio.h. This is for
3794 * ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
3795 * of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
3796 * indicate that the header knows what it's doing
-- under SUSv2
,
3797 * stdio.h is required to define va_list
, and we shouldn
't break
3801 hackname = stdio_va_list;
3803 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list
';
3805 * On Solaris 10, the definition in
3806 * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
3807 * there is therefore no need for this fix there.
3809 mach = '*-*-solaris2.1
[0-9]*';
3813 * Use __gnuc_va_list in arg types in place of va_list.
3814 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3815 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3816 * trailing parentheses and semicolon save all other systems from this.
3817 * Define
__not_va_list__ (something harmless and unused
)
3818 * instead of va_list.
3819 * Don
't claim to have defined va_list.
3821 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3822 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3823 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3824 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3825 "s@ va_list@ __not_va_list__@\n"
3826 "s@\\*va_list@*__not_va_list__@\n"
3827 "s@ __va_list)@ __gnuc_va_list)@\n"
3828 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3829 "@typedef \\1 __not_va_list__;@\n"
3830 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3831 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3832 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3833 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3834 "s@VA_LIST@DUMMY_VA_LIST@\n"
3835 "s@_Va_LIST@_VA_LIST@";
3836 test_text = "extern void mumble( va_list);";
3841 * Fix headers that use va_list from stdio.h to use the updated
3842 * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
3843 * dealt with elsewhere. The presence of __gnuc_va_list,
3844 * __DJ_va_list, or _G_va_list is taken to indicate that the header
3845 * knows what it's doing.
3848 hackname
= stdio_va_list_clients
;
3856 files
= curses_colr
/curses.h
;
3857 bypass
= '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
3858 /* Don
't fix, if we use va_list from stdarg.h, or if the use is
3859 otherwise protected. */
3860 bypass = 'include
<stdarg\.h
>|#ifdef va_start
';
3863 * Use __gnuc_va_list in arg types in place of va_list.
3864 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3865 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3866 * trailing parentheses and semicolon save all other systems from this.
3867 * Define
__not_va_list__ (something harmless and unused
)
3868 * instead of va_list.
3869 * Don
't claim to have defined va_list.
3871 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3872 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3873 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3874 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3875 "s@ va_list@ __not_va_list__@\n"
3876 "s@\\*va_list@*__not_va_list__@\n"
3877 "s@ __va_list)@ __gnuc_va_list)@\n"
3878 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3879 "@typedef \\1 __not_va_list__;@\n"
3880 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3881 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3882 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3883 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3884 "s@VA_LIST@DUMMY_VA_LIST@\n"
3885 "s@_Va_LIST@_VA_LIST@";
3886 test_text = "extern void mumble( va_list);";
3891 * "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
3892 * is "!defined( __STRICT_ANSI__ )"
3895 hackname = strict_ansi_not;
3896 select = "^([ \t]*#[ \t]*if.*)"
3898 "|__STDC__[ \t]*==[ \t]*0"
3899 "|__STDC__[ \t]*!=[ \t]*1"
3900 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
3901 /* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
3902 bypass = 'GNU and MIPS C compilers define __STDC__ differently
';
3903 /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
3904 is not defined by GCC, so it is safe. */
3905 bypass = '__SCO_VERSION__.
*__STDC__
!= 1';
3906 c_test = stdc_0_in_system_headers;
3909 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
3911 test_text = "#if !__STDC__ \n"
3912 "#if __STDC__ == 0\n"
3913 "#if __STDC__ != 1\n"
3914 "#if __STDC__ - 0 == 0"
3915 "/* not std C */\nint foo;\n"
3916 "\n#end-end-end-end-if :-)";
3921 * is "!defined( __STRICT_ANSI__ )" on continued #if-s
3924 hackname = strict_ansi_not_ctd;
3925 files = math.h, limits.h, stdio.h, signal.h,
3926 stdlib.h, sys/signal.h, time.h;
3928 * Starting at the beginning of a line, skip white space and
3929 * a leading "(" or "&&" or "||". One of those must be found.
3930 * Then, zero, one or more copies of a "defined(_FOO_BAR_) &&"
3931 * expression. If these are nested, then they must accumulate
3932 * because we won't match any closing parentheses. Finally
,
3933 * after skipping over all that
, we must then match our suspect
3934 * phrase
: "__STDC__-0==0" with or without white space.
3936 select
= "^([ \t]*" '(\(|&&|\|\|)'
3937 "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
3939 "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
3940 c_test
= stdc_0_in_system_headers
;
3943 c_fix_arg
= "%1 !defined(__STRICT_ANSI__)";
3945 test_text
= "#if 1 && \\\\\n"
3946 "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
3947 "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
3948 "|| __STDC__ - 0 == 0 ) /* not std C */\n"
3954 * "__STDC__!=0" or
"__STDC__==1" or
"__STDC__-0==1"
3955 * is
"defined( __STRICT_ANSI__ )"
3958 hackname
= strict_ansi_only
;
3959 select
= "^([ \t]*#[ \t]*if.*)"
3960 "(__STDC__[ \t]*!=[ \t]*0"
3961 "|__STDC__[ \t]*==[ \t]*1"
3962 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
3963 "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
3964 c_test
= stdc_0_in_system_headers
;
3967 c_fix_arg
= "%1 defined(__STRICT_ANSI__)";
3969 test_text
= "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
3974 * IRIX
4.0.5 <rpc
/xdr.h
> uses struct __file_s
3975 * in prototype without previous definition.
3978 hackname
= struct_file
;
3980 select
= '^.*xdrstdio_create.*struct __file_s';
3982 c_fix_arg
= "struct __file_s;\n%0";
3983 test_text
= "extern void xdrstdio_create( struct __file_s* );";
3988 * IRIX
4.0.5 <rpc
/auth.h
> uses struct sockaddr
3989 * in prototype without previous definition.
3991 * Don
't fix OpenBSD, which uses struct sockaddr_in prototyping the same
3992 * function, and does define it.
3995 hackname = struct_sockaddr;
3997 select = "^.*authdes_create.*struct sockaddr[^_]";
3998 bypass = "<sys/socket\.h>";
3999 bypass = "struct sockaddr;\n";
4001 c_fix_arg = "struct sockaddr;\n%0";
4002 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
4007 * Apply fix this to all OSs since this problem seems to effect
4008 * more than just SunOS.
4011 hackname = sun_auth_proto;
4016 bypass = "__cplusplus";
4018 * Select those files containing '(*name)()'.
4020 select = '\(\*[a-z][a-z_]*\)\(\)';
4023 c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n"
4024 "#else\n%1();%2\n#endif";
4025 c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
4029 " int (*name)(); /* C++ bad */\n"
4035 * Fix bogus #ifdef on SunOS 4.1.
4038 hackname = sun_bogus_ifdef;
4039 files = "hsfs/hsfs_spec.h";
4040 files = "hsfs/iso_spec.h";
4041 select = '#
ifdef(.
*\|\|.*)
';
4043 c_fix_arg = "#if%1";
4045 test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
4050 * Fix the CAT macro in SunOS memvar.h.
4053 hackname = sun_catmacro;
4054 files = pixrect/memvar.h;
4055 select = "^#define[ \t]+CAT\\(a,b\\).*";
4060 "# define CAT(a,b) a##b\n"
4061 "#else\n%0\n#endif";
4064 "#define CAT(a,b)\ta/**/b";
4069 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
4070 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
4073 hackname = sun_malloc;
4075 bypass = "_CLASSIC_ANSI_TYPES";
4077 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
4078 sed = "s/int[ \t][ \t]*free/void\tfree/g";
4079 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
4080 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
4081 sed = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
4084 "typedef char *\tmalloc_t;\n"
4086 "char*\tmalloc();\n"
4087 "char*\tcalloc();\n"
4088 "char*\trealloc();";
4093 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
4096 hackname = sun_rusers_semi;
4097 files = rpcsvc/rusers.h;
4099 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
4100 test_text = "struct mumble\n int _cnt\n};";
4105 * signal.h on SunOS defines signal using (),
4106 * which causes trouble when compiling with g++ -pedantic.
4109 hackname = sun_signal;
4110 files = sys/signal.h;
4112 select = "^void\t" '\
(\
*signal\
(\
)\
)\
(\
);.
*';
4116 "#ifdef __cplusplus\n"
4117 "void\t(*signal(...))(...);\n"
4118 "#else\n%0\n#endif";
4120 test_text = "void\t(*signal())();";
4125 * Correct the return type for strlen in strings.h in SunOS 4.
4128 hackname = sunos_strlen;
4130 select = "int[ \t]*strlen\\(\\);(.*)";
4132 c_fix_arg = "__SIZE_TYPE__ strlen();%1";
4133 test_text = " int\tstrlen(); /* string length */";
4138 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
4139 * that is visible to any ANSI compiler using this include. Simply
4140 * delete the lines that #define some string functions to internal forms.
4143 hackname = svr4_disable_opt;
4145 select = '#define.
*__std_hdr_
';
4146 sed = '/#define.
*__std_hdr_
/d
';
4147 test_text = "#define strlen __std_hdr_strlen\n";
4152 * Fix broken decl of getcwd present on some svr4 systems.
4155 hackname = svr4_getcwd;
4158 files = prototypes.h;
4159 select = 'getcwd\
(char \
*, int\
)';
4162 c_fix_arg = "getcwd(char *, size_t)";
4164 test_text = "extern char* getcwd(char *, int);";
4169 * Fix broken decl of profil present on some svr4 systems.
4172 hackname = svr4_profil;
4177 'profil\
(unsigned short \
*, unsigned int
, unsigned int
, unsigned int\
)';
4179 c_fix_arg = 'profil(unsigned short
*, size_t
, int
, unsigned int
)';
4182 'profil(unsigned short
*, unsigned int
, unsigned int
, unsigned int
);';
4187 * Correct types for signal handler constants like SIG_DFL; they might be
4188 * void (*) (), and should be void (*) (int). C++ doesn't like the
4192 hackname
= svr4_sighandler_type
;
4193 files
= sys
/signal.h
;
4194 select
= 'void *\(\*\)\(\)';
4196 c_fix_arg
= "void (*)(int)";
4197 test_text
= "#define SIG_DFL (void(*)())0\n"
4198 "#define SIG_IGN (void (*)())0\n";
4203 * Some SysV r4 systems
, including Sequent
's DYNIX/ptx, use the local
4204 * function 'getrnge
' in <regexp.h> before they declare it. For these
4205 * systems add a 'static int
' declaration of 'getrnge
' into <regexp.h>
4208 * 'getrnge
' traditionally manipulates a file-scope global called 'size
',
4209 * so put the declaration right after the declaration of 'size
'.
4211 * Don't do this if there is already a `static void getrnge
' declaration
4212 * present, since this would cause a redeclaration error. Solaris 2.x has
4213 * such a declaration.
4216 hackname = svr4_undeclared_getrnge;
4219 bypass = "static void getrnge";
4222 "static int getrnge ();";
4223 c_fix_arg = "^static int[ \t]+size;";
4224 test_text = "static int size;\n"
4225 "/* stuff which calls getrnge() */\n"
4226 "static getrnge()\n"
4232 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
4233 * in string.h on sysV68
4234 * Correct the return type for strlen in string.h on Lynx.
4235 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
4236 * Add missing const for strdup on OSF/1 V3.0.
4237 * On sysV88 layout is slightly different.
4240 hackname = sysv68_string;
4243 bypass = "_CLASSIC_ANSI_TYPES";
4245 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
4246 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
4247 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
4249 sed = "/^extern char$/N";
4250 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
4252 sed = "/^extern int$/N";
4253 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
4255 sed = "/^\tstrncmp(),$/N";
4256 sed = 's
/^\
(' "\t" 'strncmp()\
),\n\
(' "\t" 'strlen(),\
)$
/'
4257 '\
1;' "\\\nextern unsigned int\\\n\\2/";
4260 "extern int strlen();\n"
4262 "extern int ffs(long);\n"
4275 "\tstrlen(), strspn();";
4280 * Fix return type of calloc, malloc, realloc, bsearch and exit
4283 hackname = sysz_stdlib_for_sun;
4285 bypass = "_CLASSIC_ANSI_TYPES";
4287 select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
4289 c_fix_arg = "void *\t%1(";
4292 "extern char*\tcalloc(size_t);\n"
4293 "extern char*\tmalloc(size_t);\n"
4294 "extern char*\trealloc(void*,size_t);\n"
4295 "extern char*\tbsearch(void*,size_t,size_t);\n";
4300 * __thread is now a keyword.
4303 hackname = thread_keyword;
4304 files = "pthread.h";
4305 files = "bits/sigthread.h";
4306 select = "([* ])__thread([,)])";
4308 c_fix_arg = "%1__thr%2";
4311 "extern int pthread_create (pthread_t *__restrict __thread,\n"
4312 "extern int pthread_kill (pthread_t __thread, int __signo);\n"
4313 "extern int pthread_cancel (pthread_t __thread);";
4317 * if the #if says _cplusplus, not the double underscore __cplusplus
4321 hackname = tinfo_cplusplus;
4323 select = "[ \t]_cplusplus";
4326 c_fix_arg = " __cplusplus";
4327 test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
4332 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4335 hackname = ultrix_const;
4337 select = 'perror\
( char \
*';
4340 c_fix_arg = "%1 const %3 *__";
4341 c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
4342 "[ \t]+(char|void) \\*__";
4345 "extern void perror( char *__s );\n"
4346 "extern int fputs( char *__s, FILE *);\n"
4347 "extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
4348 "extern int fscanf( FILE *__stream, char *__format, ...);\n"
4349 "extern int scanf( char *__format, ...);\n";
4354 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4357 hackname = ultrix_const2;
4360 select = '\
*fopen\
( char \
*';
4362 c_fix_arg = "%1( const char *%3, const char *";
4363 c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
4364 "[ \t]*char[ \t]*\\*([^,]*),"
4365 "[ \t]*char[ \t]*\\*[ \t]*";
4368 "extern FILE *fopen( char *__filename, char *__type );\n"
4369 "extern int sscanf( char *__s, char *__format, ...);\n"
4370 "extern FILE *popen(char *, char *);\n"
4371 "extern char *tempnam(char*,char*);\n";
4376 * Fix definitions of macros used by va-i960.h in VxWorks header file.
4379 hackname = va_i960_macro;
4380 files = arch/i960/archI960.h;
4381 select = "__(vsiz|vali|vpad|alignof__)";
4384 c_fix_arg = "__vx%1";
4387 "extern int __vsiz vsiz;\n"
4388 "extern int __vali vali;\n"
4389 "extern int __vpad vpad;\n"
4390 "#define __alignof__(x) ...";
4395 * Define __CAN_USE_EXTERN_PREFIX on vms.
4398 hackname = vms_define_can_use_extern_prefix;
4399 files = "rtldef/decc$types.h";
4400 select = "#[ \t]*else\n"
4401 "#[ \t]*if defined\\(__DECCXX\\)\n"
4402 "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n";
4407 "# elif defined (__GNUC__)\n"
4408 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n";
4410 test_text = "# else\n"
4411 "# if defined(__DECCXX)\n"
4412 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"
4418 * On VMS, use pragma extern_model instead of VAX-C keywords.
4421 hackname = vms_use_pragma_extern_model;
4422 select = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n"
4423 "# pragma extern_model __save\n";
4427 c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n"
4428 "# pragma extern_model __save\n";
4430 test_text = "#if defined(__DECC) || defined(__DECCXX)\n"
4431 "# pragma extern_model __save\n"
4432 "# pragma extern_model strict_refdef\n"
4433 " extern struct x zz$yy;\n"
4434 "# pragma extern_model __restore\n"
4439 * On VMS, disable the use of dec-c string builtins
4442 hackname = vms_disable_decc_string_builtins;
4443 select = "#if !defined\\(__VAX\\)\n";
4445 files = "rtldef/string.h";
4448 c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n";
4450 test_text = "#if !defined(__VAX)\n";
4454 * On VMS, change <resource.h> to <sys/resource.h> to avoid a
4455 * conflict while building gcc. Likewise for <builtins.h>
4458 hackname = vms_use_quoted_include;
4459 select = "(#[ \t]*include[ \t]+)<(resource|builtins)\\.h>";
4461 files = rtldef/wait.h, starlet_c/pthread.h;
4464 c_fix_arg = '%1<sys
/%2.h
>';
4466 test_text = "# include <resource.h>";
4470 * On VMS, add missing braces around sigset_t constants.
4473 hackname = vms_add_missing_braces;
4474 select = "(_SIG_[A-Z]+_SET[ \t]+= \\{)(0x[0F]+, 0x[0F]+)";
4476 files = "rtldef/signal.h";
4479 c_fix_arg = '%1 {%2} ';
4481 test_text = "static const __sigset_t _SIG_EMPTY_SET = "
4482 "{0x00000000, 0x00000000},\n"
4483 " _SIG_FULL_SET = {0xFFFFFFFF, 0xFFFFFFFF};\n";
4487 * On VMS, fix incompatible redeclaration of hostalias.
4490 hackname = vms_do_not_redeclare_hostalias;
4491 select = "(void[ \t]+fp_nquery \\(const u_char \\*, int, FILE \\*\\);)\n"
4492 "(__char_ptr32[ \t]+hostalias \\(const char \\*\\);)";
4494 files = "rtldef/resolv.h";
4500 test_text = "void fp_nquery (const u_char *, int, FILE *);\n"
4501 "__char_ptr32 hostalias (const char *);\n";
4505 * On VMS, some DEC-C builtins are directly used.
4508 hackname = vms_decc_builtin;
4509 select = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY)";
4511 files = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
4513 sed = "s@__MEMSET@memset@";
4514 sed = "s@__MEMMOVE@memmove@";
4515 sed = "s@__MEMCPY@memcpy@";
4516 sed = "s@__STRLEN@strlen@";
4517 sed = "s@__STRCPY@strcpy@";
4519 test_text = "define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p)))\n";
4523 * On VMS, do not declare getopt and al if pointers are 64 bit.
4526 hackname = vms_no_64bit_getopt;
4527 select = "^[ \t]*(extern[ \t]*)?(int[ \t]*(getopt|optind|opterr|optopt)|(char \\*optarg))([ \t]*\\(.*\\))?;\n";
4528 /* select = "^[ \t](extern[ \t))?(int[ \t](getopt|optind|opterr|optopt))|(char *optarg).*;\n"; */
4530 files = rtldef/stdio.h, rtldef/unistd.h;
4533 c_fix_arg = "#if __INITIAL_POINTER_SIZE != 64 /* getopt is short ptr only. */\n"
4537 test_text = "int getopt (int, char * const [], const char *);";
4541 * On VMS, forward declare structure before referencing them in prototypes.
4544 hackname = vms_forward_declare_struct;
4545 select = "(/\\* forward decls for C\\+\\+ \\*/\n)"
4546 "#ifdef __cplusplus\n";
4548 files = rtldef/if.h;
4552 "#if defined (__cplusplus) || defined (__GNUC__)\n";
4554 test_text = "/* forward decls for C++ */\n"
4555 "#ifdef __cplusplus\n"
4561 * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
4562 * which is not yet fully supported by gcc.
4565 hackname = vms_use_fast_setjmp;
4566 select = "(#[ \t]*if[ \t]*defined\\(__FAST_SETJMP\\)[ \t]*\\|\\|)";
4568 files = rtldef/setjmp.h;
4571 c_fix_arg = "%0 defined (__GNUC__) ||";
4573 test_text = "# if defined(__FAST_SETJMP) || defined(__UNIX_SETJMP)";
4577 * AIX and Interix headers define NULL to be cast to a void pointer,
4578 * which is illegal in ANSI C++.
4581 hackname = void_null;
4582 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
4583 time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h;
4584 /* avoid changing C++ friendly NULL */
4585 bypass = __cplusplus;
4587 select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
4589 c_fix_arg = <<- _EOFix_
4594 #else /* ! __GNUG__ */
4596 #endif /* __GNUG__ */
4597 #else /* ! __cplusplus */
4598 #define NULL ((void *)0)
4599 #endif /* __cplusplus */
4602 test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
4607 * Make VxWorks header which is almost gcc ready fully gcc ready.
4610 hackname = vxworks_gcc_problem;
4611 files = types/vxTypesBase.h;
4612 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
4614 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
4617 sed = "/[ \t]size_t/i\\\n"
4618 "#ifndef _GCC_SIZE_T\\\n"
4619 "#define _GCC_SIZE_T\n";
4621 sed = "/[ \t]size_t/a\\\n"
4624 sed = "/[ \t]ptrdiff_t/i\\\n"
4625 "#ifndef _GCC_PTRDIFF_T\\\n"
4626 "#define _GCC_PTRDIFF_T\n";
4628 sed = "/[ \t]ptrdiff_t/a\\\n"
4631 sed = "/[ \t]wchar_t/i\\\n"
4632 "#ifndef _GCC_WCHAR_T\\\n"
4633 "#define _GCC_WCHAR_T\n";
4635 sed = "/[ \t]wchar_t/a\\\n"
4639 "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
4640 "typedef unsigned int size_t;\n"
4641 "typedef long ptrdiff_t;\n"
4642 "typedef unsigned short wchar_t;\n"
4643 "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
4647 * Wrap VxWorks ioctl to keep everything pretty
4650 hackname = vxworks_ioctl_macro;
4652 mach = "*-*-vxworks*";
4656 "#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
4657 c_fix_arg = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
4659 test_text = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
4663 * Wrap VxWorks mkdir to be posix compliant
4666 hackname = vxworks_mkdir_macro;
4668 mach = "*-*-vxworks*";
4672 "#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n";
4673 c_fix_arg = "extern[\t ]+STATUS[\t ]+mkdir[\t ]*"
4674 "\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*" /* arg type */
4675 "(|[_[:alpha:]][_[:alnum:]]*)" /* arg name (optional) */
4678 test_text = "extern STATUS mkdir (const char * _qwerty) ;";
4683 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
4686 hackname = vxworks_needs_vxtypes;
4688 select = "uint_t([ \t]+_clocks_per_sec)";
4690 c_fix_arg = "unsigned int%1";
4691 test_text = "uint_t\t_clocks_per_sec;";
4696 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
4699 hackname = vxworks_needs_vxworks;
4701 test = " -r types/vxTypesOld.h";
4702 test = " -n \"`egrep '#include
' $file`\"";
4703 test = " -n \"`egrep ULONG $file`\"";
4704 select = "#[ \t]define[ \t]+__INCstath";
4706 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
4707 "#include <types/vxTypesOld.h>\n";
4709 test_text = "`touch types/vxTypesOld.h`"
4710 "#include </dev/null> /* ULONG */\n"
4711 "# define\t__INCstath <sys/stat.h>";
4715 * Make it so VxWorks does not include gcc/regs.h accidentally
4718 hackname = vxworks_regs;
4719 mach = "*-*-vxworks*";
4721 select = "#[\t ]*include[\t ]+[<\"]regs.h[>\"]";
4723 c_fix_arg = "#include <arch/../regs.h>";
4725 test_text = "#include <regs.h>\n";
4730 * Another bad dependency in VxWorks 5.2 <time.h>.
4733 hackname = vxworks_time;
4735 test = " -r vxWorks.h";
4737 select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
4741 "#ifndef __gcc_VOIDFUNCPTR_defined\n"
4742 "#ifdef __cplusplus\n"
4743 "typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
4745 "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
4747 "#define __gcc_VOIDFUNCPTR_defined\n"
4749 "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
4751 test_text = "`touch vxWorks.h`"
4752 "#define VOIDFUNCPTR (void(*)())";
4756 * This hack makes write const-correct on VxWorks
4759 hackname = vxworks_write_const;
4761 mach = "*-*-vxworks*";
4764 c_fix_arg = "extern int write (int, const char*, size_t);";
4765 c_fix_arg = "extern[\t ]+int[\t ]+write[\t ]*\\("
4767 "[\t ]*char[\t ]*\\*[\t ]*,"
4768 "[\t ]*size_t[\t ]*\\)[\t ]*;";
4770 test_text = "extern int write ( int , char * , size_t ) ;";
4774 * There are several name conflicts with C++ reserved words in X11 header
4775 * files. These are fixed in some versions, so don't do the fixes if
4776 * we find __cplusplus in the file. These were found on the RS
/6000.
4779 hackname
= x11_class
;
4780 files
= X11
/ShellP.h
;
4781 bypass
= __cplusplus
;
4782 select
= "^([ \t]*char \\*)class;(.*)";
4784 c_fix_arg
= "#ifdef __cplusplus\n%1c_class;%2\n"
4785 "#else\n%1class;%2\n#endif";
4794 * class in Xm
/BaseClassI.h
4797 hackname
= x11_class_usage
;
4798 files
= Xm
/BaseClassI.h
;
4799 bypass
= "__cplusplus";
4801 select
= " class\\)";
4803 c_fix_arg
= " c_class)";
4805 test_text
= "extern mumble (int class);\n";
4810 * new in Xm
/Traversal.h
4814 files
= Xm
/Traversal.h
;
4815 bypass
= __cplusplus
;
4817 sed
= "/Widget\told, new;/i\\\n"
4818 "#ifdef __cplusplus\\\n"
4819 "\\\tWidget\told, c_new;\\\n"
4822 sed
= "/Widget\told, new;/a\\\n"
4825 sed
= "s/Widget new,/Widget c_new,/g";
4828 " Widget\told, new;\n"
4829 "};\nextern Wedged( Widget new, Widget old );";
4834 * Incorrect sprintf declaration in X11
/Xmu.h
4837 hackname
= x11_sprintf
;
4839 files
= X11
/Xmu
/Xmu.h
;
4840 select
= "^extern char \\*\tsprintf\\(\\);$";
4843 c_fix_arg
= "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
4845 test_text
= "extern char *\tsprintf();";
4849 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
4850 * that fails when compiling for SSE
-less
32-bit x86.
4853 hackname
= feraiseexcept_nosse_invalid
;
4854 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
4855 files
= bits
/fenv.h
;
4856 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
4857 ": \"x\" \\(__f\\)\\);$";
4858 bypass
= "\"fdiv .*; fwait\"";
4861 c_fix_arg
= <<- _EOText_
4862 # ifdef __SSE_MATH__
4865 %1__asm__
__volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
4866 %1 : "=t" (__f
) : "0" (__f
));
4870 test_text
= <<- _EOText_
4871 __asm__
__volatile__ ("divss %0, %0" : : "x" (__f
));
4875 hackname
= feraiseexcept_nosse_divbyzero
;
4876 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
4877 files
= bits
/fenv.h
;
4878 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
4879 ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
4880 bypass
= "\"fdivp .*; fwait\"";
4883 c_fix_arg
= <<- _EOText_
4884 # ifdef __SSE_MATH__
4887 %1__asm__
__volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
4888 %1 : "=t" (__f
) : "0" (__f
), "u" (__g
) : "st(1)");
4892 test_text
= <<- _EOText_
4893 __asm__
__volatile__ ("divss %1, %0" : : "x" (__f
), "x" (__g
));
4898 * Old Linux kernel
's <compiler.h> header breaks Traditional CPP
4901 hackname = complier_h_tradcpp;
4902 files = linux/compiler.h;
4904 select = "#define __builtin_warning\\(x, y\\.\\.\\.\\) \\(1\\)";
4906 c_fix_arg = "/* __builtin_warning(x, y...) is obsolete */";
4908 test_text = "#define __builtin_warning(x, y...) (1)";