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 */
578 * assert.h on AIX 7 redefines static_assert as _Static_assert without
582 hackname = aix_assert;
585 select = "#define[ \t]static_assert[ \t]_Static_assert";
587 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
588 test_text = "#define static_assert _Static_assert";
592 * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
593 * which only is provided by AIX xlc C99.
596 hackname = aix_complex;
599 select = "#define[ \t]_Complex_I[ \t]__I";
601 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
602 test_text = "#define _Complex_I __I\n";
606 * malloc.h on AIX6 uses XLC++ specific builtin syntax
609 hackname = aix_malloc;
612 select = "#ifdef __cplusplus";
614 c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
615 test_text = "#ifdef __cplusplus";
619 * net/if_arp.h defines a variable fc_softc instead of adding a
620 * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
623 hackname = aix_net_if_arp;
625 files = "net/if_arp.h";
626 select = "^struct fc_softc \\{";
628 c_fix_arg = "typedef struct _fc_softc {";
629 test_text = "struct fc_softc {\n int a;\n};";
633 * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER,
634 * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough
638 hackname = aix_once_init_1;
641 select = "#define[ \t]PTHREAD_ONCE_INIT \\\\\n"
644 c_fix_arg = "#define PTHREAD_ONCE_INIT \\\n"
646 test_text = "#define PTHREAD_ONCE_INIT \\\\\n"
651 hackname = aix_once_init_2;
654 select = "[ \t]0 \\\\\n"
657 c_fix_arg = " 0 \\\n"
659 test_text = " 0 \\\\\n"
664 hackname = aix_mutex_initializer_1;
667 select = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n"
670 c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n"
672 test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
677 hackname = aix_cond_initializer_1;
680 select = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n"
683 c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n"
685 test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n"
690 hackname = aix_rwlock_initializer_1;
693 select = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n"
696 c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n"
698 test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
703 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
704 * which violates a requirement of ISO C.
707 hackname = aix_pthread;
709 select = "(#define [A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
712 test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
713 "{...init stuff...}";
718 * AIX stdint.h fixes.
721 hackname = aix_stdint_1;
723 files = stdint-aix.h, stdint.h;
724 select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
725 "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
727 c_fix_arg = "#define UINT8_MAX (255)\n"
728 "#define UINT16_MAX (65535)";
729 test_text = "#define UINT8_MAX (255U)\n"
730 "#define UINT16_MAX (65535U)";
735 hackname = aix_stdint_2;
737 files = stdint-aix.h, stdint.h;
738 select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
739 "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
740 "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
742 "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
743 "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
744 "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
746 c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
747 "#define INTPTR_MAX 9223372036854775807L\n"
748 "#define UINTPTR_MAX 18446744073709551615UL\n"
750 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
751 "#define INTPTR_MAX 2147483647L\n"
752 "#define UINTPTR_MAX 4294967295UL";
753 test_text = "#define INTPTR_MIN INT64_MIN\n"
754 "#define INTPTR_MAX INT64_MAX\n"
755 "#define UINTPTR_MAX UINT64_MAX\n"
757 "#define INTPTR_MIN INT32_MIN\n"
758 "#define INTPTR_MAX INT32_MAX\n"
759 "#define UINTPTR_MAX UINT32_MAX";
764 hackname = aix_stdint_3;
766 files = stdint-aix.h, stdint.h;
767 select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
768 "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
770 "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
771 "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
773 c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
774 "#define PTRDIFF_MAX 9223372036854775807L\n"
776 "#define PTRDIFF_MIN (-2147483647L - 1)\n"
777 "#define PTRDIFF_MAX 2147483647L";
778 test_text = "#define PTRDIFF_MIN INT64_MIN\n"
779 "#define PTRDIFF_MAX INT64_MAX\n"
781 "#define PTRDIFF_MIN INT32_MIN\n"
782 "#define PTRDIFF_MAX INT32_MAX";
787 hackname = aix_stdint_4;
789 files = stdint-aix.h, stdint.h;
790 select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
792 "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
794 c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
796 "#define SIZE_MAX 4294967295UL";
797 test_text = "#define SIZE_MAX UINT64_MAX\n"
799 "#define SIZE_MAX UINT32_MAX";
804 hackname = aix_stdint_5;
806 files = stdint-aix.h, stdint.h;
807 select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
808 "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
810 c_fix_arg = "#define UINT8_C(c) c\n"
811 "#define UINT16_C(c) c";
812 test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
813 "#define UINT16_C(c) __CONCAT__(c,U)";
818 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
819 * in an otherwise harmless (and #ifed out) macro definition
822 hackname = aix_sysmachine;
823 files = sys/machine.h;
827 test_text = "#define FOO \\\n"
828 " bar \\ \n baz \\ \n bat";
833 * sys/wait.h on AIX 5.2 defines macros that have both signed and
834 * unsigned types in conditional expressions.
837 hackname = aix_syswait_2;
839 select = '\? (\
(\
(\
(\
(unsigned
[^
)]*\
)[^
)]*\
) >> [^
)]*\
) \
& 0xff\
) : -1)';
841 c_fix_arg = "? (int)%1";
842 test_text = "#define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
847 * sys/signal.h on some versions of AIX uses volatile in the typedef of
848 * sig_atomic_t, which causes gcc to generate a warning about duplicate
849 * volatile when a sig_atomic_t variable is declared volatile, as
850 * required by ANSI C.
853 hackname = aix_volatile;
854 files = sys/signal.h;
855 select = "typedef volatile int sig_atomic_t";
857 c_fix_arg = "typedef int sig_atomic_t";
858 test_text = "typedef volatile int sig_atomic_t;";
863 * Fix __assert declaration in assert.h on Alpha OSF/1.
866 hackname = alpha___assert;
868 select = '__assert\
(char \
*, char \
*, int\
)';
870 c_fix_arg = "__assert(const char *, const char *, int)";
871 test_text = 'extern void
__assert(char
*, char
*, int
);';
876 * Fix assert macro in assert.h on Alpha OSF/1.
877 * The superfluous int cast breaks C++.
880 hackname = alpha_assert;
882 select = "(#[ \t]*" 'define assert\
(EX\
).*)\
(\
(int\
) \
(EX\
)\
)';
884 c_fix_arg = "%1(EX)";
885 test_text = '#define
assert(EX
) (((int
) (EX
)) ?
(void
)0 '
886 ': __assert(#EX
, __FILE__
, __LINE__
))';
891 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
894 hackname = alpha_getopt;
897 select = 'getopt\
(int
, char \
*\
[\
], *char \
*\
)';
899 c_fix_arg = "getopt(int, char *const[], const char *)";
900 test_text = 'extern int
getopt(int
, char
*[], char *)
;';
905 * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
908 hackname = alpha_if_semicolon;
910 select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
912 c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
913 test_text = ' struct sockaddr vmif_paddr
/* protocol address
*/';
918 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
921 hackname = alpha_parens;
923 select = '#ifndef\
(__mips64\
)';
925 c_fix_arg = "#ifndef __mips64";
926 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
931 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
935 hackname = alpha_sbrk;
937 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
939 c_fix_arg = "void *sbrk(";
940 test_text = "extern char* sbrk(ptrdiff_t increment);";
945 * For C++, avoid any typedef or macro definition of bool,
946 * and use the built in type instead.
947 * HP/UX 10.20 also has it in curses_colr/curses.h.
950 hackname = avoid_bool_define;
952 files = curses_colr/curses.h;
956 select = "#[ \t]*define[ \t]+bool[ \t]";
957 bypass = "__cplusplus";
960 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
961 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
963 test_text = "# define bool\t char \n";
968 hackname = avoid_bool_type;
970 files = curses_colr/curses.h;
974 select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
975 bypass = "__cplusplus";
978 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
980 test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
985 * For C++, avoid any typedef definition of wchar_t,
986 * and use the built in type instead.
987 * Don't do this for headers that are smart enough to do the right
988 * thing (recent
[n
]curses.h and Xlib.h
).
989 * Don
't do it for <linux/nls.h> which is never used from C++ anyway,
990 * and will be broken by the edit.
994 hackname = avoid_wchar_t_type;
996 select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
997 bypass = "__cplusplus";
998 bypass = "_LINUX_NLS_H";
999 bypass = "XFree86: xc/lib/X11/Xlib\\.h";
1002 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1004 test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
1009 * Fix `typedef struct term;' on hppa1.1
-hp
-hpux9.
1012 hackname
= bad_struct_term
;
1014 select
= "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
1016 c_fix_arg
= "struct term;";
1018 test_text
= 'typedef struct term;';
1023 * Fix one other error in this file
:
1024 * a mismatched quote not inside a C comment.
1027 hackname
= badquote
;
1028 files
= sundev
/vuid_event.h
;
1031 c_fix_arg
= "does not";
1033 test_text
= "/* doesn't have matched single quotes */";
1038 * check for broken assert.h that needs stdio.h
1041 hackname
= broken_assert_stdio
;
1044 bypass
= "include.*stdio\\.h";
1046 c_fix_arg
= "#include <stdio.h>\n";
1047 test_text
= "extern FILE* stderr;";
1052 * check for broken assert.h that needs stdlib.h
1055 hackname
= broken_assert_stdlib
;
1057 select
= 'exit *\(|abort *\(';
1058 bypass
= "include.*stdlib\\.h";
1060 c_fix_arg
= "#ifdef __cplusplus\n"
1061 "#include <stdlib.h>\n"
1063 test_text
= "extern void exit ( int );";
1067 * Remove `extern double cabs
' declarations from math.h.
1068 * This conflicts with C99. Discovered on AIX.
1069 * Darwin hides its broken cabs in architecture-specific subdirs.
1072 hackname = broken_cabs;
1073 files = math.h, "architecture/*/math.h";
1074 select = "^extern[ \t]+double[ \t]+cabs";
1076 sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
1077 sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
1079 test_text = "#ifdef __STDC__\n"
1080 "extern double cabs(struct dbl_hypot);\n"
1082 "extern double cabs();\n"
1084 "extern double cabs ( _Complex z );";
1089 * Fixup Darwin's broken check for __builtin_nanf.
1092 hackname
= broken_nan
;
1094 * It is tempting to omit the first
"files" entry. Do not.
1095 * The testing machinery will take the first
"files" entry as the name
1096 * of a test file to play with. It would be a nuisance to have a directory
1097 * with the name
"*".
1099 files
= "architecture/ppc/math.h";
1100 files
= "architecture/*/math.h";
1101 select
= '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)';
1104 c_fix_arg
= "#if 1";
1105 test_text
= "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
1110 * Various systems derived from BSD4.4 contain a macro definition
1111 * for vfscanf that interacts badly with requirements of builtin
-attrs.def.
1112 * Known to be fixed in FreeBSD
5 system headers.
1115 hackname
= bsd_stdio_attrs_conflict
;
1117 mach
= "*-*-*darwin*";
1119 select
= "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
1121 c_fix_arg
= '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n"
1122 '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n"
1123 'int vfscanf(FILE *, const char *, __builtin_va_list) '
1124 '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");';
1125 test_text
= '#define vfscanf __svfscanf';
1129 * 'g++ -std=c++11' defines __cplusplus to
201103L, which suggests
1130 * that it conforms to ISO
/IEC
14882:2011. It currently does
1131 * not support the
[[noreturn
]] procedure attribute.
1132 * When it does
, this hack should be removed.
1133 * SEE
: gcc.gnu.org
/bugzilla
/show_bug.cgi?id
=51776
1136 hackname
= cdef_cplusplus
;
1137 files
= sys
/cdefs.h
;
1138 select
= '\[\[noreturn\]\]';
1140 c_fix_arg
= '__attribute__((__noreturn__))';
1141 test_text
= "#define _Noreturn [[noreturn]]";
1145 * Fix various macros used to define ioctl numbers.
1146 * The traditional syntax was
:
1148 * #define
_CTRL(n
, x
) (('n'<<8)+x
)
1149 * #define TCTRLCFOO
_CTRL(T
, 1)
1151 * but this does not work with the C standard
, which disallows macro
1152 * expansion inside strings. We have to rewrite it thus
:
1154 * #define
_CTRL(n
, x
) ((n
<<8)+x
)
1155 * #define TCTRLCFOO
_CTRL('T', 1)
1157 * The select expressions match too much
, but the c_fix code is cautious.
1159 * CTRL might be
: CTRL _CTRL ISCTRL BSD43_CTRL ...
1162 hackname
= ctrl_quotes_def
;
1163 select
= "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
1164 c_fix
= char_macro_def
;
1168 * This is two tests in order to ensure that the
"CTRL(c)" can
1169 * be selected in isolation from the multi
-arg format
1171 test_text
= "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n";
1172 test_text
= "#define _CTRL(c) ('c'&037)";
1176 * Fix various macros used to define ioctl numbers.
1179 hackname
= ctrl_quotes_use
;
1180 select
= "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1181 c_fix
= char_macro_use
;
1183 test_text
= "#define TCTRLFOO BSD43_CTRL(T, 1)";
1188 * sys
/mman.h on HP
/UX is not C
++ ready
,
1189 * even though NO_IMPLICIT_EXTERN_C is defined on HP
/UX.
1191 * rpc
/types.h on OSF1
/2.0 is not C
++ ready
,
1192 * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
1194 * The problem is the declaration of malloc.
1197 hackname
= cxx_unready
;
1199 files
= rpc
/types.h
;
1200 select
= '[^#]+malloc.*;'; /* Catch any form of declaration
1201 not within a macro.
*/
1202 bypass
= '"C"|__BEGIN_DECLS';
1205 c_fix_arg
= "#ifdef __cplusplus\n"
1208 c_fix_arg
= "#ifdef __cplusplus\n"
1211 test_text
= "extern void* malloc( size_t );";
1215 * For the AAB_darwin7_9_long_double_funcs fix to be useful
,
1216 * you have to not use
"" includes.
1219 hackname
= darwin_9_long_double_funcs_2
;
1220 mach
= "*-*-darwin7.9*";
1222 select
= '#include[ \t]+\"';
1224 c_fix_arg
= "%1<%2.h>";
1226 c_fix_arg
= '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
1228 test_text
= '#include "architecture/ppc/math.h"';
1233 * On darwin8 and earlier
, mach
-o
/swap.h isn
't properly guarded
1234 * by 'extern
"C"'. On darwin7 some mach/ headers aren't properly guarded.
1237 hackname
= darwin_externc
;
1238 mach
= "*-*-darwin*";
1239 files
= mach
-o
/swap.h
;
1240 files
= mach
/mach_time.h
;
1241 files
= mach
/mach_traps.h
;
1242 files
= mach
/message.h
;
1244 files
= mach
/semaphore.h
;
1245 bypass
= "extern \"C\"";
1246 bypass
= "__BEGIN_DECLS";
1248 c_fix_arg
= "#ifdef __cplusplus\n"
1251 c_fix_arg
= "#ifdef __cplusplus\n"
1254 test_text
= "extern void swap_fat_header();\n";
1259 * AvailabilityMacros.h on Darwin breaks with GCC
4.0, because of
1260 * bad __GNUC__ tests.
1264 hackname
= darwin_gcc4_breakage
;
1265 mach
= "*-*-darwin*";
1266 files
= AvailabilityMacros.h
;
1267 select
= "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
1269 c_fix_arg
= "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
1270 test_text
= "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
1271 "(__GNUC_MINOR__ >= 1)\n";
1276 * __private_extern__ doesn
't exist in FSF GCC. Even if it did,
1277 * why would you ever put it in a system header file?
1280 hackname = darwin_private_extern;
1281 mach = "*-*-darwin*";
1282 files = mach-o/dyld.h;
1283 select = "__private_extern__ [a-z_]+ _dyld_";
1285 c_fix_arg = "extern";
1286 c_fix_arg = "__private_extern__";
1287 test_text = "__private_extern__ int _dyld_func_lookup(\n"
1288 "const char *dyld_func_name,\n"
1289 "unsigned long *address);\n";
1294 * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
1295 * unsigned constants.
1298 hackname = darwin_stdint_1;
1299 mach = "*-*-darwin*";
1300 files = stdint-darwin.h, stdint.h;
1302 c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
1303 select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
1304 "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
1305 test_text = "#define UINT8_C(v) (v ## U)\n"
1306 "#define UINT16_C(v) (v ## U)";
1311 * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
1315 hackname = darwin_stdint_2;
1316 mach = "*-*-darwin*";
1317 files = stdint-darwin.h, stdint.h;
1319 c_fix_arg = "#if __WORDSIZE == 64\n"
1320 "#define INTPTR_MAX 9223372036854775807L\n"
1321 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1323 "#define INTPTR_MAX 2147483647L\n"
1324 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1326 select = "#if __WORDSIZE == 64\n"
1327 "#define INTPTR_MIN[ \t]+INT64_MIN\n"
1328 "#define INTPTR_MAX[ \t]+INT64_MAX\n"
1330 "#define INTPTR_MIN[ \t]+INT32_MIN\n"
1331 "#define INTPTR_MAX[ \t]+INT32_MAX\n"
1333 test_text = "#if __WORDSIZE == 64\n"
1334 "#define INTPTR_MIN INT64_MIN\n"
1335 "#define INTPTR_MAX INT64_MAX\n"
1337 "#define INTPTR_MIN INT32_MIN\n"
1338 "#define INTPTR_MAX INT32_MAX\n"
1344 * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
1347 hackname = darwin_stdint_3;
1348 mach = "*-*-darwin*";
1349 files = stdint-darwin.h, stdint.h;
1351 c_fix_arg = "#if __WORDSIZE == 64\n"
1352 "#define UINTPTR_MAX 18446744073709551615UL\n"
1354 "#define UINTPTR_MAX 4294967295UL\n"
1356 select = "#if __WORDSIZE == 64\n"
1357 "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
1359 "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
1361 test_text = "#if __WORDSIZE == 64\n"
1362 "#define UINTPTR_MAX UINT64_MAX\n"
1364 "#define UINTPTR_MAX UINT32_MAX\n"
1370 * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
1373 hackname = darwin_stdint_4;
1374 mach = "*-*-darwin*";
1375 files = stdint-darwin.h, stdint.h;
1377 c_fix_arg = "#if __WORDSIZE == 64\n"
1378 "#define SIZE_MAX 18446744073709551615UL\n"
1380 "#define SIZE_MAX 4294967295UL\n"
1382 select = "#if __WORDSIZE == 64\n"
1383 "#define SIZE_MAX[ \t]+UINT64_MAX\n"
1385 "#define SIZE_MAX[ \t]+UINT32_MAX\n"
1387 test_text = "#if __WORDSIZE == 64\n"
1388 "#define SIZE_MAX UINT64_MAX\n"
1390 "#define SIZE_MAX UINT32_MAX\n"
1396 * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
1397 * with a wrong type.
1400 hackname = darwin_stdint_5;
1401 mach = "*-*-darwin*";
1402 files = stdint-darwin.h, stdint.h;
1404 c_fix_arg = "#if __WORDSIZE == 64\n"
1405 "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
1406 "#define INTMAX_MAX 9223372036854775807L\n"
1407 "#define UINTMAX_MAX 18446744073709551615UL\n"
1409 "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
1410 "#define INTMAX_MAX 9223372036854775807LL\n"
1411 "#define UINTMAX_MAX 18446744073709551615ULL\n"
1413 select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
1414 "#define INTMAX_MAX[ \t]+INT64_MAX\n"
1416 "#define UINTMAX_MAX[ \t]+UINT64_MAX";
1417 test_text = "#define INTMAX_MIN INT64_MIN\n"
1418 "#define INTMAX_MAX INT64_MAX\n"
1420 "#define UINTMAX_MAX UINT64_MAX";
1425 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1426 * with a wrong type.
1429 hackname = darwin_stdint_6;
1430 mach = "*-*-darwin*";
1431 files = stdint-darwin.h, stdint.h;
1433 c_fix_arg = "#if __WORDSIZE == 64\n"
1434 "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
1435 "#define PTRDIFF_MAX 9223372036854775807L\n"
1437 "#define PTRDIFF_MIN (-2147483647 - 1)\n"
1438 "#define PTRDIFF_MAX 2147483647\n"
1440 select = "#if __WORDSIZE == 64\n"
1441 "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
1442 "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
1444 "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
1445 "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
1447 test_text = "#if __WORDSIZE == 64\n"
1448 "#define PTRDIFF_MIN INT64_MIN\n"
1449 "#define PTRDIFF_MAX INT64_MAX\n"
1451 "#define PTRDIFF_MIN INT32_MIN\n"
1452 "#define PTRDIFF_MAX INT32_MAX\n"
1458 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1459 * with a wrong type.
1462 hackname = darwin_stdint_7;
1463 mach = "*-*-darwin*";
1464 files = stdint-darwin.h, stdint.h;
1466 c_fix_arg = "#if __WORDSIZE == 64\n"
1467 "#define INTMAX_C(v) (v ## L)\n"
1468 "#define UINTMAX_C(v) (v ## UL)\n"
1470 "#define INTMAX_C(v) (v ## LL)\n"
1471 "#define UINTMAX_C(v) (v ## ULL)\n"
1473 select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
1474 "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
1475 test_text = "#define INTMAX_C(v) (v ## LL)\n"
1476 "#define UINTMAX_C(v) (v ## ULL)";
1481 * Fix <c_asm.h> on Digital UNIX V4.0:
1482 * It contains a prototype for a DEC C internal asm() function,
1483 * clashing with gcc's asm keyword. So protect this with __DECC.
1486 hackname
= dec_intern_asm
;
1488 sed
= "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1489 sed
= "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
1493 " ... asm stuff ...\n"
1494 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
1499 * Fix typo in
<wchar.h
> on DJGPP
2.03.
1502 hackname
= djgpp_wchar_h
;
1504 select
= "__DJ_wint_t";
1505 bypass
= "sys/djtypes.h";
1507 c_fix_arg
= "%0\n#include <sys/djtypes.h>";
1508 c_fix_arg
= "#include <stddef.h>";
1509 test_text
= "#include <stddef.h>\n"
1510 "extern __DJ_wint_t x;\n";
1515 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1518 hackname
= ecd_cursor
;
1519 files
= "sunwindow/win_lock.h";
1520 files
= "sunwindow/win_cursor.h";
1521 select
= 'ecd\.cursor';
1523 c_fix_arg
= 'ecd_cursor';
1525 test_text
= "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1530 * Between
8/24/1998 and
2/17/2001, FreeBSD system headers presume
1531 * neither the existence of GCC
3 nor its exact feature set yet break
1532 * (by design?
) when __GNUC__ is set beyond
2.
1535 hackname
= freebsd_gcc3_breakage
;
1536 mach
= "*-*-freebsd*";
1537 files
= sys
/cdefs.h
;
1538 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
1539 bypass
= '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
1541 c_fix_arg
= '%0 || __GNUC__ >= 3';
1542 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
1547 * Some releases of FreeBSD
4 and FreeBSD
5.0 and
5.1 system headers presume
1548 * neither the existence of GCC
4 nor its exact feature set yet break
1549 * (by design?
) when __GNUC__ is set beyond
3.
1552 hackname
= freebsd_gcc4_breakage
;
1553 mach
= "*-*-freebsd*";
1554 files
= sys
/cdefs.h
;
1555 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
1557 c_fix_arg
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
1558 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
1563 * Some versions of glibc don
't expect the C99 inline semantics.
1566 hackname = glibc_c99_inline_1;
1567 files = features.h, '*/features.h
';
1568 select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
1570 c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
1572 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
1573 && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
1574 # define __USE_EXTERN_INLINES 1
1581 * Similar, but a version that didn't have __NO_INLINE__
1584 hackname
= glibc_c99_inline_1a
;
1585 files
= features.h
, '*/features.h';
1586 select
= "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
1587 "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
1589 c_fix_arg
= "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
1591 #if
__GNUC_PREREQ (2, 7) && defined __OPTIMIZE__
&& !defined __OPTIMIZE_SIZE__
1592 # define __USE_EXTERN_INLINES
1
1599 * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
1600 * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
1601 * The remaining glibc_c99_inline_
* fixes deal with some of those headers.
1604 hackname
= glibc_c99_inline_2
;
1605 files
= sys
/stat.h
, '*/sys/stat.h';
1606 select
= "extern __inline__ int";
1607 sed
= "s/extern int \\(stat\\)/"
1608 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1609 "__inline__ int \\1/";
1610 sed
= "s/extern int \\([lf]stat\\)/"
1611 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1612 "__inline__ int \\1/";
1613 sed
= "s/extern int \\(mknod\\)/"
1614 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1615 "__inline__ int \\1/";
1616 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
1617 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1618 "__inline__ int __REDIRECT\\1 (\\2/";
1619 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
1620 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1621 "__inline__ int __REDIRECT\\1 (\\2/";
1622 sed
= "s/^extern __inline__ int/"
1623 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1626 extern int
fstat64 (int __fd
, struct stat64
*__buf
) __THROW
__nonnull ((2));
1627 extern __inline__ int
1628 __NTH (fstat64 (int __fd
, struct stat64
*__statbuf
))
1635 hackname
= glibc_c99_inline_3
;
1636 files
= bits
/string2.h
, '*/bits/string2.h';
1637 select
= "extern __inline";
1638 bypass
= "__extern_inline|__GNU_STDC_INLINE__";
1640 c_fix_arg
= "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
1641 c_fix_arg
= "^# ifdef __cplusplus$";
1644 # define __STRING_INLINE inline
1646 # define __STRING_INLINE extern __inline
1653 hackname
= glibc_c99_inline_4
;
1654 files
= sys
/sysmacros.h
, '*/sys/sysmacros.h', wchar.h
, '*/wchar.h';
1655 bypass
= "__extern_inline|__gnu_inline__";
1656 select
= "(^| )extern __inline";
1658 c_fix_arg
= "%0 __attribute__ ((__gnu_inline__))";
1660 __extension__ extern __inline unsigned int
1661 extern __inline unsigned int
1666 /* glibc
-2.3.5 defines pthread mutex initializers incorrectly
,
1667 * so we replace them with versions that correspond to the
1671 hackname
= glibc_mutex_init
;
1673 select
= '\{ *\{ *0, *\} *\}';
1674 sed
= "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
1675 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
1676 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1677 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
1678 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1679 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
1680 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1681 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
1682 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1683 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1684 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1685 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
1686 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1687 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1688 sed
= "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
1689 "N;s/^[ \t]*#[ \t]*"
1690 "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
1691 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
1693 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1696 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1698 sed
= "s/{ \\(0, 0, 0, 0, 0, 0, "
1699 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
1700 sed
= "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
1701 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
1703 test_text
= <<- _EOText_
1704 #define PTHREAD_MUTEX_INITIALIZER
\\
1707 # if __WORDSIZE
== 64
1708 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1709 { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1710 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1711 { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1712 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1713 { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1715 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1716 { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1717 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1718 { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1719 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1720 { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1723 # define PTHREAD_RWLOCK_INITIALIZER
\\
1726 # if __WORDSIZE
== 64
1727 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1728 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\
1729 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1731 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1732 { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1735 #define PTHREAD_COND_INITIALIZER
{ { 0, } }
1740 /* glibc versions before
2.5 have a version of stdint.h that defines
1741 UINT8_C and UINT16_C to produce unsigned constants
, as do uClibc
1742 versions with stdint.h based on those glibc versions.
*/
1744 hackname
= glibc_stdint
;
1746 select
= "GNU C Library";
1748 c_fix_arg
= "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
1749 c_fix_arg
= "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
1750 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";
1754 /* Some versions of glibc have a version of bits
/string2.h that
1755 produces
"value computed is not used" warnings from strncpy
; fix
1756 this definition by using __builtin_strncpy instead as in newer
1759 hackname
= glibc_strncpy
;
1760 files
= bits
/string2.h
;
1761 bypass
= "__builtin_strncpy";
1763 c_fix_arg
= "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
1764 c_fix_arg
= "# define strncpy([^\n]*\\\\\n)*[^\n]*";
1766 # define
strncpy(dest
, src
, n
) \
1767 (__extension__ (__builtin_constant_p (src
) && __builtin_constant_p (n
) \\
1768 ?
(strlen (src
) + 1 >= ((size_t
) (n
)) \\
1769 ?
(char *)
memcpy (dest
, src
, n
) \\
1770 : strncpy (dest
, src
, n
)) \\
1771 : strncpy (dest
, src
, n
)))
1776 /* glibc
's tgmath.h relies on an expression that is not an integer
1777 constant expression being treated as it was by GCC 4.4 and
1780 hackname = glibc_tgmath;
1782 select = '\
(\
(\
(type\
) 0.25\
) && \
(\
(type\
) 0.25 - 1\
)\
)';
1783 bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
1785 c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || (__builtin_classify_type ((type) 0) == 9 && __builtin_classify_type (__real__ ((type) 0)) == 8))";
1786 test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
1790 * Fix these files to use the types we think they should for
1791 * ptrdiff_t, size_t, and wchar_t.
1793 * This defines the types in terms of macros predefined by our 'cpp
'.
1794 * This is supposedly necessary for glibc's handling of these types.
1795 * It
's probably not necessary for anyone else, but it doesn't hurt.
1798 hackname
= gnu_types
;
1799 files
= "sys/types.h";
1801 files
= "sys/stdtypes.h";
1805 bypass
= '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
1806 select
= "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
1808 /* The Solaris
10 headers already define these types correctly.
*/
1809 mach
= '*-*-solaris2.1[0-9]*';
1812 test_text
= "typedef long int ptrdiff_t; /* long int */\n"
1813 "typedef uint_t size_t; /* uint_t */\n"
1814 "typedef ushort_t wchar_t; /* ushort_t */";
1819 * Fix HP
& Sony
's use of "../machine/xxx.h"
1820 * to refer to: <machine/xxx.h>
1823 hackname = hp_inline;
1824 files = sys/spinlock.h;
1825 files = machine/machparam.h;
1826 select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
1829 c_fix_arg = "%1<machine
/%2.h
>";
1831 c_fix_arg = "([ \t]*#
[ \t]*include
[ \t]+)" '"\.\.
/machine
/'
1834 test_text = ' # include "..
/machine
/mumble.h
"';
1839 * Check for (...) in C++ code in HP/UX sys/file.h.
1842 hackname = hp_sysfile;
1844 select = "HPUX_SOURCE
";
1847 c_fix_arg = "(struct file
*, ...
)";
1848 c_fix_arg = '\(\.\.\.\)';
1850 test_text = "extern void
foo(...
); /* HPUX_SOURCE
- bad varargs
*/";
1855 * Un-Hide a series of five FP defines from post-1999 compliance GCC:
1856 * FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
1859 hackname = hppa_hpux_fp_macros;
1860 mach = "hppa
*-hp
-hpux11
*";
1862 select = "#
[ \t]*define
[ \t]*FP_NORMAL.
*\n"
1863 "#
[ \t]*define
[ \t]*FP_ZERO.
*\n"
1864 "#
[ \t]*define
[ \t]*FP_INFINITE.
*\n"
1865 "#
[ \t]*define
[ \t]*FP_SUBNORMAL.
*\n"
1866 "#
[ \t]*define
[ \t]*FP_NAN.
*\n";
1868 c_fix_arg = <<- _EOFix_
1869 #endif /* _INCLUDE_HPUX_SOURCE */
1871 #if defined(_INCLUDE_HPUX_SOURCE) || \
1872 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
1875 #ifdef _INCLUDE_HPUX_SOURCE
1880 "# define FP_NORMAL
0\n"
1881 "# define FP_ZERO
1\n"
1882 "# define FP_INFINITE
2\n"
1883 "# define FP_SUBNORMAL
3\n"
1884 "# define FP_NAN
4\n";
1889 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
1890 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
1893 hackname = hpux10_cpp_pow_inline;
1894 files = fixinc-test-limits.h, math.h;
1895 select = <<- END_POW_INLINE
1896 ^# +ifdef +__cplusplus
1898 +inline +double +pow\(double +__d,int +__expon\) +\{
1899 [ ]+return +pow\(__d,\(double\)__expon\);
1910 "# ifdef __cplusplus
\n"
1912 " inline double
pow(double __d
,int __expon
) {\n"
1913 "\t return
pow(__d
,(double
)__expon
);\n"
1915 ' extern "C
"' " {\n"
1921 hackname = hpux11_cpp_pow_inline;
1923 select = " +inline double pow
\\(double d
,int expon
\\) \\{\n"
1924 " +return pow
\\(d
, \\(double
\\)expon
\\);\n"
1930 " inline double
pow(double d
,int expon
) {\n"
1931 " return
pow(d
, (double
)expon
);\n"
1937 * Fix hpux 10.X missing ctype declarations 1
1940 hackname = hpux10_ctype_declarations1;
1942 select = "^#
[ \t]*define _toupper
\\(__c
\\)[ \t]*__toupper
\\(__c
\\)";
1943 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*__tolower
[ \t]*\\(";
1945 c_fix_arg = "#ifdef _PROTOTYPES
\n"
1946 "extern int
__tolower(int
);\n"
1947 "extern int
__toupper(int
);\n"
1948 "#else
/* NOT _PROTOTYPES
*/\n"
1949 "extern int
__tolower();\n"
1950 "extern int
__toupper();\n"
1951 "#endif
/* _PROTOTYPES
*/\n\n"
1954 test_text = "# define
_toupper(__c
) __toupper(__c
)\n";
1959 * Fix hpux 10.X missing ctype declarations 2
1962 hackname = hpux10_ctype_declarations2;
1964 select = "^# if defined
\\(_SB_CTYPE_MACROS
\\) && \\!defined
\\(__lint
\\)";
1965 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*_isalnum
[ \t]*\\(";
1967 c_fix_arg = "%0\n\n"
1968 "#ifdef _PROTOTYPES
\n"
1969 " extern int
_isalnum(int
);\n"
1970 " extern int
_isalpha(int
);\n"
1971 " extern int
_iscntrl(int
);\n"
1972 " extern int
_isdigit(int
);\n"
1973 " extern int
_isgraph(int
);\n"
1974 " extern int
_islower(int
);\n"
1975 " extern int
_isprint(int
);\n"
1976 " extern int
_ispunct(int
);\n"
1977 " extern int
_isspace(int
);\n"
1978 " extern int
_isupper(int
);\n"
1979 " extern int
_isxdigit(int
);\n"
1980 "# else
/* not _PROTOTYPES
*/\n"
1981 " extern int
_isalnum();\n"
1982 " extern int
_isalpha();\n"
1983 " extern int
_iscntrl();\n"
1984 " extern int
_isdigit();\n"
1985 " extern int
_isgraph();\n"
1986 " extern int
_islower();\n"
1987 " extern int
_isprint();\n"
1988 " extern int
_ispunct();\n"
1989 " extern int
_isspace();\n"
1990 " extern int
_isupper();\n"
1991 " extern int
_isxdigit();\n"
1992 "#endif
/* _PROTOTYPES
*/\n";
1994 test_text = "# if
defined(_SB_CTYPE_MACROS
) && !defined(__lint
)\n"
1995 " extern unsigned int
*__SB_masks
;\n";
2000 * Fix hpux 10.X missing stdio declarations
2003 hackname = hpux10_stdio_declarations;
2005 select = "^#
[ \t]*define _iob
[ \t]*__iob
";
2006 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*vsnprintf
[ \t]*\\(";
2008 c_fix_arg = "%0\n\n"
2009 "# if
defined(__STDC__
) ||
defined(__cplusplus
)\n"
2010 " extern int
snprintf(char
*, size_t
, const char
*, ...
);\n"
2011 " extern int
vsnprintf(char
*, size_t
, const char
*, __va_list
);\n"
2012 "# else
/* not __STDC__
) || __cplusplus
*/\n"
2013 " extern int
snprintf();\n"
2014 " extern int
vsnprintf();\n"
2015 "# endif
/* __STDC__
) || __cplusplus
*/\n";
2017 test_text = "# define _iob __iob
\n";
2022 * Make sure hpux defines abs in header.
2025 hackname = hpux11_abs;
2026 mach = "*-hp
-hpux11
*";
2028 select = "ifndef _MATH_INCLUDED
";
2030 c_fix_arg = "if
!defined(_MATH_INCLUDED
) ||
defined(__GNUG__
)";
2031 test_text = "#ifndef _MATH_INCLUDED
";
2036 * Keep HP-UX 11 from stomping on C++ math namespace
2037 * with defines for fabsf.
2040 hackname = hpux11_fabsf;
2042 select = "^
[ \t]*#
[ \t]*define
[ \t]+fabsf
\\(.
*";
2043 bypass = "__cplusplus
";
2046 c_fix_arg = "#ifndef __cplusplus
\n%0\n#endif
";
2050 "# define
fabsf(x
) ((float
)fabs((double
)(float
)(x
)))\n"
2056 * Fix C99 constant in __POINTER_SET define.
2059 hackname = hpux11_pthread_const;
2060 mach = "*-hp
-hpux11.
[0-3]*";
2061 files = sys/pthread.h;
2062 select = "^#define
[ \t]*__POINTER_SET
[ \t]*\\(\\(void
\\*\\) 1LL\\)";
2065 c_fix_arg = "#define __POINTER_SET
\t\t((void *)
1L)";
2066 test_text = "#define __POINTER_SET
\t\t((void *)
1LL)";
2071 * Prevent HP-UX 11 from defining __size_t and preventing size_t from
2072 * being defined by having it define _hpux_size_t instead.
2075 hackname = hpux11_size_t;
2076 mach = "*-hp
-hpux11
*";
2077 select = "__size_t
";
2080 c_fix_arg = "_hpux_size_t
";
2083 "#define __size_t size_t
\n"
2084 " extern int
getpwuid_r( char
*, __size_t
, struct passwd
**)
;\n";
2089 * Fix hpux 11.00 broken snprintf declaration
2090 * (third argument is char *, needs to be const char * to prevent
2091 * spurious warnings with -Wwrite-strings or in C++).
2094 hackname = hpux11_snprintf;
2096 select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
2097 ' *(char *\*, *\.\.\.\);)';
2099 c_fix_arg = '%1 const %3';
2101 test_text = "extern int
snprintf(char
*, size_t
, char
*, ...
);\n"
2102 "extern int
snprintf(char
*, __size_t
, char
*, ...
);\n"
2103 "extern int
snprintf(char
*, _hpux_size_t
, char
*, ...
);";
2107 * Fix hpux 11.00 broken vsnprintf declaration
2110 hackname = hpux11_vsnprintf;
2112 select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
2113 'const char \*,) __va__list\);';
2115 c_fix_arg = "%1 __va_list
);";
2117 test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
2123 * get rid of bogus inline definitions in HP-UX 8.0
2126 hackname = hpux8_bogus_inlines;
2129 bypass = "__GNUG__
";
2130 sed = "s@inline int
abs(int
[a
-z
][a
-z
]*)
{.
*}"
2131 "@extern
\"C
\" int
abs(int
);@
";
2132 sed = "s@inline double
abs(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2133 sed = "s@inline int
sqr(int
[a
-z
][a
-z
]*)
{.
*}@@
";
2134 sed = "s@inline double
sqr(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2135 test_text = "inline int
abs(int v
) { return (v
>=0)?v
:-v
; }\n"
2136 "inline double
sqr(double v
) { return v
**0.5; }";
2141 * Fix hpux broken ctype macros
2144 hackname = hpux_ctype_macros;
2146 select = '((: |\()__SB_masks \? )'
2147 '(__SB_masks\[__(alnum|c)\] & _IS)';
2149 c_fix_arg = "%1(int
)%3";
2151 test_text = ": __SB_masks ? __SB_masks
[__alnum
] & _ISCNTRL
\n"
2152 "# define
isalpha(__c
) (__SB_masks ? __SB_masks
[__c
] & _IS
\n";
2157 * Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
2160 hackname = hpux_htonl;
2161 files = netinet/in.h;
2162 select = "#ifndef _XOPEN_SOURCE_EXTENDED
[ \t]*\n"
2164 " \\* Macros for number representation conversion
\\.
\n"
2168 c_fix_arg = "#if
1\n%1";
2170 test_text = "#ifndef _XOPEN_SOURCE_EXTENDED
\n"
2172 " * Macros for number representation conversion.
\n"
2175 "#define
ntohl(x
) (x
)\n"
2176 "#define
ntohs(x
) (x
)\n"
2177 "#define
htonl(x
) (x
)\n"
2178 "#define
htons(x
) (x
)\n"
2180 "#endif
/* ! _XOPEN_SOURCE_EXTENDED
*/";
2188 hackname = hpux_long_double;
2189 mach = "*-*-hpux10
*";
2190 mach = "*-*-hpux11.
[012]*";
2192 select = "extern
[ \t]long_double
[ \t]strtold
";
2193 bypass = "long_double_t
";
2194 sed = "/^#
[ \t]*ifndef _LONG_DOUBLE
/,/\\/\\* _LONG_DOUBLE
\\*\\//D
";
2195 sed = "s
/long_double
/long double
/g
";
2197 test_text = "# ifndef _LONG_DOUBLE
\n"
2198 "# define _LONG_DOUBLE
\n"
2199 " typedef struct
{\n"
2200 " unsigned int word1
, word2
, word3
, word4
;\n"
2202 "# endif
/* _LONG_DOUBLE
*/\n"
2203 "extern long_double
strtold(const char
*, char
**)
;\n";
2207 * We cannot use the above rule on 11.31 because it removes the strtold
2208 * definition. ia64 is OK with no hack, PA needs some help.
2211 hackname = hpux_long_double_2;
2212 mach = "hppa
*-*-hpux11.3
*";
2214 select = "#
[ \t]*if
[ \t]*!defined
\\(__ia64
\\) \\|
\\| defined
\\(_PROTOTYPES
\\) \\|
\\| defined
\\(_LONG_DOUBLE_STRUCT
\\)";
2216 c_fix_arg = "# if
!defined(_PROTOTYPES
) ||
defined(_LONG_DOUBLE_STRUCT
)";
2218 test_text = "# if
!defined(__ia64
) ||
!defined(_PROTOTYPES
) ||
defined(_LONG_DOUBLE_STRUCT
)\n";
2222 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2225 hackname = hpux_systime;
2227 select = "^extern struct sigevent
;";
2230 c_fix_arg = "struct sigevent
;";
2232 test_text = 'extern struct sigevent;';
2237 * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
2238 * type and mpinfou is only defined when _KERNEL is set.
2241 hackname = hpux_spu_info;
2242 mach = "*-hp
-hpux
*";
2244 * It is tempting to omit the first "files
" entry. Do not.
2245 * The testing machinery will take the first "files
" entry as the name
2246 * of a test file to play with. It would be a nuisance to have a directory
2247 * with the name "*".
2249 files = "ia64
/sys
/getppdp.h
";
2250 files = "*/sys
/getppdp.h
";
2251 select = "^.
*extern.
*spu_info.
*";
2254 c_fix_arg = "#ifdef _KERNEL
\n%0\n#endif
";
2256 test_text = "extern union mpinfou spu_info
[];";
2260 hackname = hpux11_extern_sendfile;
2261 mach = "*-hp
-hpux11.
[12]*";
2262 files = sys/socket.h;
2263 select = "^
[ \t]*extern sbsize_t sendfile.
*\n.
*, int
\\)\\);\n";
2265 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2266 test_text = " extern sbsize_t sendfile
__((int
, int
, off_t
, bsize_t
,\n const struct iovec
*, int
));\n";
2270 hackname = hpux11_extern_sendpath;
2271 mach = "*-hp
-hpux11.
[12]*";
2272 files = sys/socket.h;
2273 select = "^
[ \t]*extern sbsize_t sendpath.
*\n.
*, int
\\)\\);\n";
2275 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2276 test_text = " extern sbsize_t sendpath
__((int
, int
, off_t
, bsize_t
,\n const struct iovec
*, int
));\n";
2280 hackname = hpux_extern_errno;
2281 mach = "*-hp
-hpux10.
*";
2282 mach = "*-hp
-hpux11.
[0-2]*";
2284 select = "^
[ \t]*extern int errno
;$
";
2286 c_fix_arg = "#ifdef __cplusplus
\nextern
\"C
\" {\n#endif
\n%0\n#ifdef __cplusplus
\n}\n#endif
";
2287 test_text = " extern int errno
;\n";
2292 * Add missing braces to pthread initializer defines.
2295 hackname = hpux_pthread_initializers;
2296 mach = "*-hp
-hpux11.
[0-3]*";
2297 files = sys/pthread.h;
2298 sed = "s@^
[ \t]*1, 1, 1, 1,[ \t]*\\\\"
2299 "@
\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@
";
2300 sed = "s@^
[ \t]*1,[ \t]*\\\\"
2302 sed = "/^
[ \t]*0$
/d
";
2303 sed = "s@__PTHREAD_MUTEX_VALID
, 0"
2304 "@
{ __PTHREAD_MUTEX_VALID
, 0 }@
";
2305 sed = "s@^
[ \t]*0, 0, -1, 0,[ \t]*\\\\"
2306 "@
\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@
";
2307 sed = "s@
0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2308 "@
{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2309 sed = "s@^
[ \t]*__LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2310 "@
\t{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2311 sed = "s@^
[ \t]*0, 0[ \t]*\\\\"
2312 "@
\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@
";
2313 sed = "s@__PTHREAD_COND_VALID
, 0"
2314 "@
{ __PTHREAD_COND_VALID
, 0 }@
";
2315 sed = "s@__LWP_COND_VALID
, 0,[ \t]*\\\\"
2316 "@
{ __LWP_COND_VALID
, 0 },\t\t\t\t\t\\\\@
";
2317 sed = "s@__PTHREAD_RWLOCK_VALID
, 0"
2318 "@
{ __PTHREAD_RWLOCK_VALID
, 0 }@
";
2319 sed = "s@__LWP_RWLOCK_VALID
, 0,[ \t]*\\\\"
2320 "@
{ __LWP_RWLOCK_VALID
, 0 },\t\t\t\t\t\\\\@
";
2321 sed = "s@^
[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
2322 "@
\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@
";
2323 test_text = "#define PTHREAD_MUTEX_INITIALIZER
{\t\t\t\t\t\\\\\n"
2324 "\t__PTHREAD_MUTEX_VALID
, 0,\t\t\t\t\t\\\\\n"
2325 "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE
),\t\t\\\\\n"
2326 "\t__SPNLCK_INITIALIZER
,\t\t\t\t\t\t\\\\\n"
2327 "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
2328 "\t0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
2329 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
2334 hackname = hpux_c99_intptr;
2335 mach = "*-hp
-hpux11.3
*";
2336 files = stdint-hpux11.h, stdint.h;
2337 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MAX
[ \t]*INT32_MAX
[ \t]*$@#define
PTRDIFF_MAX (2147483647l)@
";
2338 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MIN
[ \t]*INT32_MIN
[ \t]*$@#define
PTRDIFF_MIN (-PTRDIFF_MAX
- 1)@
";
2339 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MAX
[ \t]*INT32_MAX
[ \t]*$@#define
INTPTR_MAX (2147483647l)@
";
2340 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MIN
[ \t]*INT32_MIN
[ \t]*$@#define
INTPTR_MIN (-INTPTR_MAX
- 1)@
";
2341 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINTPTR_MAX
[ \t]*UINT32_MAX
[ \t]*$@#define
UINTPTR_MAX (4294967295ul)@
";
2342 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*SIZE_MAX
[ \t]*UINT32_MAX
[ \t]*$@#define
SIZE_MAX (4294967295ul)@
";
2343 test_text = "#define PTRDIFF_MAX INT32_MAX
\n"
2344 "#define PTRDIFF_MIN INT32_MIN
\n"
2345 "#define INTPTR_MAX INT32_MAX
\n"
2346 "#define INTPTR_MIN INT32_MIN
\n"
2347 "#define UINTPTR_MAX UINT32_MAX
\n"
2348 "#define SIZE_MAX UINT32_MAX
\n";
2352 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2356 hackname = hpux_c99_inttypes;
2357 mach = "*-hp
-hpux11.
[23]*";
2359 files = stdint-hpux11.h, stdint.h;
2360 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*__CONCAT_U__(__c
)[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2361 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*__CONCAT_U__(__c
)[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2362 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT32_C(__c
)[ \t]*__CONCAT__(__c
,l
)[ \t]*$@#define
INT32_C(__c
) (__c
)@
";
2363 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT32_C(__c
)[ \t].
*$@#define
UINT32_C(__c
) __CONCAT__(__c
,u
)@
";
2364 test_text = "#define
UINT8_C(__c
) __CONCAT_U__(__c
)\n"
2365 "#define
UINT16_C(__c
) __CONCAT_U__(__c
)\n"
2366 "#define
INT32_C(__c
) __CONCAT__(__c
,l
)\n"
2367 "#define
UINT32_C(__c
) __CONCAT__(__c
,ul
)\n";
2371 hackname = hpux_c99_inttypes2;
2372 mach = "*-hp
-hpux11.2
*";
2373 files = stdint-hpux11.h, stdint.h;
2374 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT8_C(__c
)[ \t]*((signed char
)(__c
))[ \t]*$@#define
INT8_C(__c
) (__c
)@
";
2375 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*((unsigned char
)(__c
))[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2376 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT16_C(__c
)[ \t]*((short
)(__c
))[ \t]*$@#define
INT16_C(__c
) (__c
)@
";
2377 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*((unsigned short
)(__c
))[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2378 test_text = "# define
INT8_C(__c
) ((signed char
)(__c
))\n"
2379 "# define
UINT8_C(__c
) ((unsigned char
)(__c
))\n"
2380 "# define
INT16_C(__c
) ((short
)(__c
))\n"
2381 "# define
UINT16_C(__c
) ((unsigned short
)(__c
))\n";
2385 hackname = hpux_stdint_least_fast;
2386 mach = "*-hp
-hpux11.2
*";
2387 files = stdint-hpux11.h, stdint.h;
2389 "^
[ \t]*#
[ \t]*define
[ \t]+UINT_(LEAST|FAST
)64_MAX
[ \t]+ULLONG_MAX
";
2391 c-fix-arg = "# define UINT_
%164_MAX __UINT64_MAX__
";
2392 test-text = "# define UINT_FAST64_MAX ULLONG_MAX
\n"
2393 "# define UINT_LEAST64_MAX ULLONG_MAX
\n";
2398 hackname = hpux_inttype_int8_t;
2399 mach = "*-hp
-hpux1
[01].
*";
2400 files = sys/_inttypes.h;
2401 select = "^
[ \t]*typedef
[ \t]*char
[ \t]*int(_least
){0,1}8_t.
*";
2403 c_fix_arg = "typedef signed char int
%18_t
;";
2404 test_text = "typedef char int_least8_t
;\n"
2405 "typedef char int8_t
;\n";
2409 hackname = hpux_imaginary_i;
2410 mach = "ia64
-hp
-hpux11.
*";
2412 select = "^
[ \t]*#
[ \t]*define
[ \t]*_Complex_I.
*";
2414 c_fix_arg = "#define
_Complex_I (__extension__
1.0iF
)";
2415 test_text = "#define
_Complex_I (0.f
+_Imaginary_I
)\n";
2419 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
2422 hackname = huge_val_hex;
2423 files = bits/huge_val.h;
2424 select = "^#
[ \t]*define
[ \t]*HUGE_VAL
[ \t].
*0x1\\.0p.
*";
2425 bypass = "__builtin_huge_val
";
2428 c_fix_arg = "#define
HUGE_VAL (__builtin_huge_val())\n";
2430 test_text = "# define HUGE_VAL
\t(__extension__
0x1.0p2047
)";
2435 * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
2438 hackname = huge_valf_hex;
2439 files = bits/huge_val.h;
2440 select = "^#
[ \t]*define
[ \t]*HUGE_VALF
[ \t].
*0x1\\.0p.
*";
2441 bypass = "__builtin_huge_valf
";
2444 c_fix_arg = "#define
HUGE_VALF (__builtin_huge_valf())\n";
2446 test_text = "# define
HUGE_VALF (__extension__
0x1.0p255f
)";
2451 * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
2454 hackname = huge_vall_hex;
2455 files = bits/huge_val.h;
2456 select = "^#
[ \t]*define
[ \t]*HUGE_VALL
[ \t].
*0x1\\.0p.
*";
2457 bypass = "__builtin_huge_vall
";
2460 c_fix_arg = "#define
HUGE_VALL (__builtin_huge_vall())\n";
2462 test_text = "# define
HUGE_VALL (__extension__
0x1.0p32767L
)";
2467 * Fix return type of abort and free
2470 hackname = int_abort_free_and_exit;
2472 select = "int
[ \t]+(abort|free|exit
)[ \t]*\\(";
2473 bypass = "_CLASSIC_ANSI_TYPES
";
2476 c_fix_arg = "void
\t%1(";
2478 test_text = "extern int
abort(int
);\n"
2479 "extern int
free(void*)
;\n"
2480 "extern int
exit(void*)
;";
2485 * Fix various macros used to define ioctl numbers.
2486 * The traditional syntax was:
2488 * #define _IO(n, x) (('n'<<8)+x)
2489 * #define TIOCFOO _IO(T, 1)
2491 * but this does not work with the C standard, which disallows macro
2492 * expansion inside strings. We have to rewrite it thus:
2494 * #define _IO(n, x) ((n<<8)+x)
2495 * #define TIOCFOO _IO('T', 1)
2497 * The select expressions match too much, but the c_fix code is cautious.
2499 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
2502 hackname = io_quotes_def;
2503 select = "define
[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*\\([a
-zA
-Z
][,)]";
2504 c_fix = char_macro_def;
2507 "#define
BSD43__IOWR(n
, x
) (('n'<<8)+x
)\n"
2508 "#define
_IOWN(x
,y
,t
) (_IOC_IN|
(((t
)&_IOCPARM_MASK
)<<16)|
('x'<<8)|y
)\n"
2509 "#define
_IO(x
,y
) ('x'<<8|y
)";
2511 "#define
XX_IO(x
) ('x'<<8|
256)";
2515 * Fix the usage of the ioctl macro numbers.
2518 hackname = io_quotes_use;
2519 select = "define
[ \t]+[A
-Z0
-9_
]+[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*[ \t]*"
2521 c_fix = char_macro_use;
2523 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
2524 "#define TIOCFOO \\\\\n"
2525 "BSD43__IOWR(T, 1) /* Some are multi-line */";
2530 * Check for missing ';' in struct
2533 hackname = ip_missing_semi;
2534 files = netinet/ip.h;
2536 sed = "/^struct/,/^};/s/}$/};/";
2542 "}; /* mumbled struct */\n";
2547 * Non-traditional "const" declaration in Irix's limits.h.
2550 hackname
= irix_limits_const
;
2551 files
= fixinc
-test
-limits.h
, limits.h
;
2552 select
= "^extern const ";
2554 c_fix_arg
= "extern __const ";
2555 test_text
= "extern const char limit; /* test limits */";
2560 * IRIX
5.x
's stdio.h declares some functions that take a va_list as
2561 * taking char *. However, GCC uses void * for va_list, so
2562 * calling vfprintf with a va_list fails in C++. */
2564 hackname = irix_stdio_va_list;
2567 select = '/\
* va_list \
*/ char \
*';
2569 c_fix_arg = "__gnuc_va_list";
2571 "extern int printf( const char *, /* va_list */ char * );";
2576 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
2577 * use / * * / to concatenate tokens.
2580 hackname = kandr_concat;
2581 files = "sparc/asm_linkage.h";
2582 files = "sun*/asm_linkage.h";
2583 files = "arm/as_support.h";
2584 files = "arm/mc_type.h";
2585 files = "arm/xcb.h";
2586 files = "dev/chardefmac.h";
2587 files = "dev/ps_irq.h";
2588 files = "dev/screen.h";
2589 files = "dev/scsi.h";
2590 files = "sys/tty.h";
2591 files = "Xm.acorn/XmP.h";
2592 files = bsd43/bsd43_.h;
2596 test_text = "#define __CONCAT__(a,b) a/**/b";
2600 /* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
2601 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
2602 * constant on recent versions of g
++.
2605 hackname
= linux_ia64_ucontext
;
2606 files
= "sys/ucontext.h";
2607 mach
= "ia64-*-linux*";
2608 select
= '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
2609 '->sc_gr\[0\]\) - \(char \*\) 0\)';
2611 c_fix_arg
= "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
2612 test_text
= "# define _SC_GR0_OFFSET\t\\\\\n"
2613 "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
2618 * Remove header file warning from sys
/time.h. Autoconf
's
2619 * AC_HEADER_TIME recommends to include both sys/time.h and time.h
2620 * which causes warning on LynxOS. Remove the warning.
2623 hackname = lynxos_no_warning_in_sys_time_h;
2625 select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
2628 test_text = "#warning Using <time.h> instead of <sys/time.h>";
2633 * Add missing declaration for putenv.
2636 hackname = lynxos_missing_putenv;
2637 mach = '*-*-lynxos
*';
2639 bypass = 'putenv
[ \t]*\\(';
2640 select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2643 "extern int putenv _AP((char *));";
2644 c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2645 test_text = "extern char *getenv _AP((const char *));";
2650 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
2652 * On NetBSD, machine is a symbolic link to an architecture specific
2653 * directory name, so we can't match a specific file name here.
2656 hackname
= machine_ansi_h_va_list
;
2657 select
= "define[ \t]+_BSD_VA_LIST_[ \t]";
2658 bypass
= '__builtin_va_list';
2661 c_fix_arg
= "%1__builtin_va_list";
2662 c_fix_arg
= "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
2664 test_text
= " # define _BSD_VA_LIST_\tchar**";
2669 * Fix non
-ansi machine name defines
2672 hackname
= machine_name
;
2673 c_test
= machine_name
;
2674 c_fix
= machine_name
;
2676 test_text
= "/* MACH_DIFF: */\n"
2677 "#if defined( i386 ) || defined( sparc ) || defined( vax )"
2678 "\n/* no uniform test, so be careful :-) */";
2683 * Some math.h files define struct
exception (it
's in the System V
2684 * Interface Definition), which conflicts with the class exception defined
2685 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
2686 * This is not a great fix, but I haven't been able to think of anything
2690 hackname
= math_exception
;
2692 select
= "struct exception";
2694 * This should be bypassed on __cplusplus
, but some supposedly C
++
2695 * aware headers
, such as Solaris
8 and
9, don
't wrap their struct
2696 * exception either. So currently we bypass only for glibc, based on a
2697 * comment in the fixed glibc header. Ick.
2699 bypass = 'We have a problem when using C\
+\
+|for C\
+\
+, '
2700 '_
[a
-z0
-9A
-Z_
]+_exception
; for C
, exception
';
2703 c_fix_arg = "#ifdef __cplusplus\n"
2704 "#define exception __math_exception\n"
2707 c_fix_arg = "#ifdef __cplusplus\n"
2708 "#undef exception\n"
2711 test_text = "typedef struct exception t_math_exception;";
2716 * This looks pretty broken to me. ``dbl_max_def'' will contain
2717 * "define DBL_MAX " at the start, when what we really want is just
2718 * the value portion. Can't figure out how to write a test case
2719 * for this either
:-(
2722 hackname
= math_huge_val_from_dbl_max
;
2726 * IF HUGE_VAL is defined to be DBL_MAX
*and
* DBL_MAX is _not_ defined
2727 * in math.h
, this fix applies.
2729 select
= "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
2730 bypass
= "define[ \t]+DBL_MAX";
2734 * See if we have a definition for DBL_MAX in float.h.
2735 * If we do
, we will replace the one in math.h with that one.
2738 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
2739 "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
2741 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
2742 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
2743 "s@DBL_MAX@'\"$dbl_max_def@\"\n"
2748 "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
2749 "#define HUGE_VAL DBL_MAX";
2757 hackname
= nested_auth_des
;
2759 select
= '(/\*.*rpc/auth_des\.h>.*)/\*';
2761 c_fix_arg
= "%1*/ /*";
2762 test_text
= "/*#include <rpc/auth_des.h> /* skip this */";
2767 * Some versions of NetBSD don
't expect the C99 inline semantics.
2770 hackname = netbsd_c99_inline_1;
2771 mach = "*-*-netbsd*";
2773 select = "extern __inline int";
2776 c_fix_arg = "extern\n"
2777 "#ifdef __GNUC_STDC_INLINE__\n"
2778 "__attribute__((__gnu_inline__))\n"
2782 test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
2787 hackname = netbsd_c99_inline_2;
2788 mach = "*-*-netbsd*";
2790 select = "#define _SIGINLINE extern __inline";
2793 c_fix_arg = <<- _EOArg_
2794 #ifdef __GNUC_STDC_INLINE__
2795 #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
2801 test_text = "#define _SIGINLINE extern __inline";
2806 * NetBSD has a semicolon after the ending '}' for some extern "C".
2809 hackname = netbsd_extra_semicolon;
2810 mach = "*-*-netbsd*";
2811 files = sys/cdefs.h;
2812 select = "#define[ \t]*__END_DECLS[ \t]*};";
2815 c_fix_arg = "#define __END_DECLS }";
2817 test_text = "#define __END_DECLS };";
2821 /* newlib's stdint.h has several failures to conform to C99. The fix
2822 for these removed a comment that can be matched to identify unfixed
2825 hackname
= newlib_stdint_1
;
2826 files
= stdint
-newlib.h
, stdint.h
;
2827 select
= "@todo - Add support for wint_t types";
2828 sed
= "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
2829 sed
= "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
2830 sed
= "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
2831 sed
= "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
2832 sed
= "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
2833 sed
= "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
2834 sed
= 's@#define INT_FAST\([0-9]*\)_MIN.*@#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
2835 sed
= 's@#define INT_FAST\([0-9]*\)_MAX.*@#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
2836 sed
= 's@#define UINT_FAST\([0-9]*\)_MAX.*@#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
2837 sed
= "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
2838 sed
= "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
2839 sed
= "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
2840 sed
= "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
2841 sed
= "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
2842 test_text
= "/* @todo - Add support for wint_t types. */\n"
2843 "#define INT32_MIN (-2147483647-1)\n"
2844 "#define INT32_MAX 2147483647\n"
2845 "#define UINT32_MAX 4294967295U\n"
2846 "#define INT_LEAST32_MIN (-2147483647-1)\n"
2847 "#define INT_LEAST32_MAX 2147483647\n"
2848 "#define UINT_LEAST32_MAX 4294967295U\n"
2849 "#define INT_FAST8_MIN INT8_MIN\n"
2850 "#define INT_FAST8_MAX INT8_MAX\n"
2851 "#define UINT_FAST8_MAX UINT8_MAX\n"
2852 "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
2853 "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
2854 "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
2855 "#define UINT8_C(x) x##U\n"
2856 "#define UINT16_C(x) x##U";
2861 hackname
= newlib_stdint_2
;
2862 files
= stdint
-newlib.h
, stdint.h
;
2863 select
= "@todo - Add support for wint_t types";
2865 c_fix_arg
= "#define INTMAX_MAX __INTMAX_MAX__\n"
2866 "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
2867 "#define UINTMAX_MAX __UINTMAX_MAX__\n"
2868 "#define WCHAR_MAX __WCHAR_MAX__\n"
2869 "#define WCHAR_MIN __WCHAR_MIN__\n"
2870 "#define WINT_MAX __WINT_MAX__\n"
2871 "#define WINT_MIN __WINT_MIN__\n\n"
2873 c_fix_arg
= '/\*\* Macros for minimum-width integer constant expressions \*/';
2874 test_text
= "/* @todo - Add support for wint_t types. */\n"
2875 "/** Macros for minimum-width integer constant expressions */";
2880 * NeXT
3.2 adds const prefix to some math functions.
2881 * These conflict with the built
-in functions.
2884 hackname
= next_math_prefix
;
2885 files
= ansi
/math.h
;
2886 select
= "^extern[ \t]+double[ \t]+__const__[ \t]";
2889 c_fix_arg
= "extern double %1(";
2890 c_fix_arg
= "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
2892 test_text
= "extern\tdouble\t__const__\tmumble();";
2897 * NeXT
3.2 uses the word
"template" as a parameter for some
2898 * functions. GCC reports an invalid use of a reserved key word
2899 * with the built
-in functions.
2902 hackname
= next_template
;
2904 select
= "[ \t]template\\)";
2908 c_fix_arg
= "\\(([^)]*)[ \t]template\\)";
2909 test_text
= "extern mumble( char * template); /* fix */";
2914 * NeXT
3.2 includes the keyword volatile in the
abort() and
exit()
2915 * function prototypes. That conflicts with the built
-in functions.
2918 hackname
= next_volitile
;
2919 files
= ansi
/stdlib.h
;
2920 select
= "^extern[ \t]+volatile[ \t]+void[ \t]";
2923 c_fix_arg
= "extern void %1(";
2924 c_fix_arg
= "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
2926 test_text
= "extern\tvolatile\tvoid\tabort();";
2931 * NeXT
2.0 defines
'int wait(union wait*)', which conflicts with Posix
.1.
2932 * Note that version
3 of the NeXT system has wait.h in a different directory
,
2933 * so that this code won
't do anything. But wait.h in version 3 has a
2934 * conditional, so it doesn't need this fix. So everything is okay.
2937 hackname
= next_wait_union
;
2940 select
= 'wait\(union wait';
2942 c_fix_arg
= "wait(void";
2943 test_text
= "extern pid_d wait(union wait*);";
2948 * a missing semi
-colon at the end of the nodeent structure definition.
2951 hackname
= nodeent_syntax
;
2952 files
= netdnet
/dnetdb.h
;
2953 select
= "char[ \t]*\\*na_addr[ \t]*$";
2956 test_text
= "char *na_addr\t";
2960 * Fix OpenBSD
's NULL definition.
2963 hackname = openbsd_null_definition;
2964 mach = "*-*-openbsd*";
2965 files = locale.h, stddef.h, stdio.h, string.h,
2966 time.h, unistd.h, wchar.h, sys/param.h;
2967 select = "__GNUG__";
2969 c_fix_arg = "#ifndef NULL\n"
2970 "#ifdef __cplusplus\n"
2972 "#define NULL\t__null\n"
2973 "#else\t /* ! __GNUG__ */\n"
2974 "#define NULL\t0L\n"
2975 "#endif\t /* __GNUG__ */\n"
2976 "#else\t /* ! __cplusplus */\n"
2977 "#define NULL\t((void *)0)\n"
2978 "#endif\t /* __cplusplus */\n"
2979 "#endif\t /* !NULL */";
2981 c_fix_arg = "^#ifndef[ \t]*NULL\n"
2982 "^#ifdef[ \t]*__GNUG__\n"
2983 "^#define[ \t]*NULL[ \t]*__null\n"
2985 "^#define[ \t]*NULL[ \t]*0L\n"
2991 "#define NULL __null\n"
2999 * obstack.h used casts as lvalues.
3001 * We need to change postincrements of casted pointers (which are
3002 * then dereferenced and assigned into) of the form
3004 * *((TYPE*)PTRVAR)++ = (VALUE)
3006 * into expressions like
3008 * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
3010 * which is correct for the cases used in obstack.h since PTRVAR is
3011 * of type char * and the value of the expression is not used.
3014 hackname = obstack_lvalue_cast;
3016 select = '\
*\
(\
(([^
()]*)\
*\
)(.*)\
)\
+\
+ = \
(([^
()]*)\
)';
3018 c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
3019 test_text = "*((void **) (h)->next_free)++ = (aptr)";
3023 * Fix OpenBSD's va_start define.
3026 hackname
= openbsd_va_start
;
3027 mach
= "*-*-openbsd*";
3029 select
= '__builtin_stdarg_start';
3031 c_fix_arg
= __builtin_va_start
;
3033 test_text
= "#define va_start(v,l) __builtin_stdarg_start((v),l)";
3037 * sys
/lc_core.h on some versions of OSF1
/4.x pollutes the namespace by
3038 * defining regex.h related types. This causes libg
++ build and usage
3039 * failures. Fixing this correctly requires checking and modifying
3 files.
3042 hackname
= osf_namespace_a
;
3043 files
= reg_types.h
;
3044 files
= sys
/lc_core.h
;
3045 test
= " -r reg_types.h";
3046 test
= " -r sys/lc_core.h";
3047 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3048 test
= " -z \"`grep __regex_t regex.h`\"";
3052 c_fix_arg
= "reg(ex|off|match)_t";
3054 test_text
= "`touch sys/lc_core.h`"
3055 "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
3056 "extern regex_t re;\n"
3057 "extern regoff_t ro;\n"
3058 "extern regmatch_t rm;\n";
3062 hackname
= osf_namespace_c
;
3064 test
= " -r reg_types.h";
3065 test
= " -r sys/lc_core.h";
3066 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3067 test
= " -z \"`grep __regex_t regex.h`\"";
3069 select
= "#include <reg_types\.h>.*";
3072 "typedef __regex_t\tregex_t;\n"
3073 "typedef __regoff_t\tregoff_t;\n"
3074 "typedef __regmatch_t\tregmatch_t;";
3076 test_text
= "#include <reg_types.h>";
3081 * On broken glibc
-2.3.3 systems an array of incomplete structures is
3082 * passed to __sigsetjmp. Fix that to take a pointer instead.
3085 hackname
= pthread_incomplete_struct_argument
;
3087 select
= "struct __jmp_buf_tag";
3089 c_fix_arg
= "%1 *%2%3";
3090 c_fix_arg
= "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) (__env)\\[1\\](.*)$";
3091 test_text
= "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask);";
3095 * Fix return type of fread and fwrite on sysV68
3098 hackname
= read_ret_type
;
3100 select
= "extern int\t.*, fread\\(\\), fwrite\\(\\)";
3102 c_fix_arg
= "extern unsigned int fread(), fwrite();\n%1%2";
3103 c_fix_arg
= "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
3105 test_text
= "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
3110 * Fix casts as lvalues in glibc
's <rpc/xdr.h>.
3113 hackname = rpc_xdr_lvalue_cast_a;
3115 select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
3117 c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
3118 test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
3119 "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
3124 hackname = rpc_xdr_lvalue_cast_b;
3126 select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
3128 c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
3129 test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
3130 "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
3135 * function class(double x) conflicts with C++ keyword on rs/6000
3138 hackname = rs6000_double;
3140 select = '[^a
-zA
-Z_
]class\
(';
3143 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
3144 c_fix_arg = '^.
*[^a
-zA
-Z_
]class\
(.
*';
3146 test_text = "extern int class();";
3151 * Wrong fchmod prototype on RS/6000.
3154 hackname = rs6000_fchmod;
3156 select = 'fchmod\
(char \
*';
3158 c_fix_arg = "fchmod(int";
3159 test_text = "extern int fchmod(char *, mode_t);";
3164 * parameters conflict with C++ new on rs/6000
3167 hackname = rs6000_param;
3171 select = 'rename\
(const char \
*old
, const char \
*new\
)';
3173 c_fix_arg = 'rename(const char
*_old
, const char
*_new
)';
3175 test_text = 'extern int
rename(const char
*old
, const char
*new
);';
3180 * Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
3181 * for C99. This is wrong for C++, which needs many C99 features, but
3182 * only supports __restrict.
3185 hackname = solaris___restrict;
3186 files = sys/feature_tests.h;
3187 select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
3188 mach = "*-*-solaris2*";
3190 c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
3191 "#else\n%0\n#endif";
3192 test_text = "#define _RESTRICT_KYWD restrict";
3197 * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
3198 * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
3199 * and imaginary definitions which are not supported by GCC.
3202 hackname = solaris_complex;
3203 mach = "*-*-solaris2.*";
3205 select = "#define[ \t]_Complex_I[ \t]_Complex_I";
3206 sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
3207 "#define\t_Complex_I\t(__extension__ 1.0iF)/";
3208 sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
3209 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
3210 sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
3211 test_text = "#define _Complex_I _Complex_I\n"
3212 "#define complex _Complex\n"
3213 "#define _Imaginary_I _Imaginary_I\n"
3214 "#define imaginary _Imaginary\n"
3216 "#define I _Imaginary_I";
3221 * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
3222 * extern "C" instead so libstdc++ can use it.
3225 hackname = solaris_complex_cxx;
3226 mach = "*-*-solaris2.*";
3228 sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
3229 "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
3230 sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
3231 "#ifdef\t__cplusplus\\\n}\\\n#endif";
3232 test_text = "#if !defined(__cplusplus)\n"
3233 "#endif /* !defined(__cplusplus) */";
3238 * g++ rejects functions declared with both C and C++ linkage.
3241 hackname = solaris_cxx_linkage;
3242 mach = '*-*-solaris2
*';
3243 files = "iso/stdlib_iso.h";
3244 select = "(#if __cplusplus >= 199711L)\n"
3245 "(extern \"C\\+\\+\" \\{\n)"
3246 "(.*(bsearch|qsort).*)";
3248 c_fix_arg = "%1 && !__GNUG__\n%2%3";
3251 "#if __cplusplus >= 199711L\n"
3252 "extern \"C++\" {\n"
3253 " void *bsearch(const void *, const void *, size_t, size_t,";
3258 * Solaris <iso/stdio_iso.h> doesn't declare getc for C
++ with
3259 * _STRICT_STDC
, but uses it.
3262 hackname
= solaris_getc_strict_stdc
;
3263 mach
= "*-*-solaris2*";
3264 files
= "iso/stdio_iso.h";
3265 select
= "(.*&& )!defined\\(_STRICT_STDC\\)(.*)";
3267 c_fix_arg
= "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2";
3270 "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
3275 * Before Solaris
10, <iso
/setjmp_iso.h
> doesn
't mark longjump noreturn.
3278 hackname = solaris_longjmp_noreturn;
3279 mach = "*-*-solaris2*";
3280 files = "iso/setjmp_iso.h";
3281 bypass = "__NORETURN";
3282 select = "(.*longjmp\\(jmp_buf.*[^)]+\\));";
3284 c_fix_arg = "%1 __attribute__ ((__noreturn__));";
3286 test_text = "extern void longjmp(jmp_buf, int);";
3291 * Sun Solaris 10 defines several C99 math macros in terms of
3292 * builtins specific to the Studio compiler, in particular not
3293 * compatible with the GNU compiler.
3296 hackname = solaris_math_1;
3297 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3298 bypass = "__GNUC__";
3299 files = iso/math_c99.h;
3301 c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
3302 c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
3304 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3306 "#define HUGE_VAL __builtin_huge_val\n"
3307 "#undef HUGE_VALF\n"
3308 "#define HUGE_VALF __builtin_huge_valf\n"
3309 "#undef HUGE_VALL\n"
3310 "#define HUGE_VALL __builtin_huge_vall";
3314 hackname = solaris_math_2;
3315 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3316 bypass = "__GNUC__";
3317 files = iso/math_c99.h;
3319 c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
3320 c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
3322 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3324 "#define INFINITY __builtin_infinity";
3328 hackname = solaris_math_3;
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\tNAN\t\t(__builtin_nanf(\"\"))";
3334 c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
3336 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3338 "#define NAN __builtin_nan";
3342 hackname = solaris_math_4;
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\tfpclassify(x) \\\n"
3348 " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, (x))";
3349 c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
3351 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3352 "#undef fpclassify\n"
3353 "#define fpclassify(x) __builtin_fpclassify(x)";
3357 hackname = solaris_math_8;
3358 select = '@\
(#\
)math_c99\.h
' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
3359 bypass = "__GNUC__";
3360 files = iso/math_c99.h;
3362 c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
3363 "\t\t\t ? __builtin_signbitf(x) \\\n"
3364 "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
3365 "\t\t\t ? __builtin_signbitl(x) \\\n"
3366 "\t\t\t : __builtin_signbit(x))";
3367 c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
3368 test_text = <<- _EOText_
3369 #ident "@(#)math_c99.h 1.9 04/11/01 SMI"
3371 #define signbit(x) __builtin_signbit(x)
3376 hackname = solaris_math_9;
3377 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3378 bypass = "__GNUC__";
3379 files = iso/math_c99.h;
3381 c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
3382 c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)";
3384 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3385 "#undef isgreater\n"
3386 "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
3387 "#undef isgreaterequal\n"
3388 "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
3390 "#define isless(x, y) ((x) __builtin_isless(y))\n"
3391 "#undef islessequal\n"
3392 "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
3393 "#undef islessgreater\n"
3394 "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
3395 "#undef isunordered\n"
3396 "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
3400 * On Solaris 11, if you do isinf(NaN) you'll get a floating point
3401 * exception. Provide an alternative using GCC
's builtin.
3405 hackname = solaris_math_10;
3406 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3407 files = iso/math_c99.h;
3409 c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
3410 c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
3411 "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);[ \t]*\\\\\n"
3412 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
3413 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*\\(-INFINITY\\);[ \t]*\\}\\)";
3415 '#pragma ident
"@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
3417 "#define isinf(x) __extension__( \\\\\n"
3418 " { __typeof(x) __x_i = (x); \\\\\n"
3419 " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
3420 " __x_i == (__typeof(__x_i)) (-INFINITY); })";
3424 * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
3425 * "0" for the last field of the pthread_mutex_t structure, which is
3426 * of type upad64_t, which itself is typedef'd to int64_t
, but with
3427 * __STDC__
defined (e.g. by
-ansi
) it is a union. So change the
3428 * initializer to
"{0}" instead
3431 hackname
= solaris_mutex_init_2
;
3432 select
= '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3435 * On Solaris
10, this fix is unnecessary because upad64_t is
3436 * always defined correctly regardless of the definition of the
3437 * __STDC__ macro. The first
"mach" pattern matches up to
3438 * solaris9. The second
"mach" pattern will not match any
two (or
3439 * more
) digit solaris version
, but it will match e.g.
2.5.1.
3441 mach
= '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
3443 c_fix_arg
= "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3448 c_fix_arg
= "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+"
3449 "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
3450 ",[ \t]*0\\}" "(|[ \t].*)$";
3452 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3453 "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
3454 "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
3455 "#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \\\\\n"
3456 " {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}\n"
3457 "#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \\\\\n"
3458 " {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}";
3463 * The pow overloads with int were removed in C
++ 2011 DR
550.
3466 hackname
= solaris_pow_int_overload
;
3467 mach
= '*-*-solaris2*';
3468 files
= "iso/math_iso.h";
3469 select
= "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)"
3470 " *\\{[^{}]*\n[^{}]*\\}";
3472 c_fix_arg
= "#if __cplusplus < 201103L\n%0\n#endif";
3475 " inline long double pow(long double __X, int __Y) { return\n"
3476 " __powl(__X, (long double) (__Y)); }";
3481 * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a
"0" for some
3482 * fields of the pthread_rwlock_t structure
, which are of type
3483 * upad64_t
, which itself is typedef
'd to int64_t, but with __STDC__
3484 * defined (e.g. by -ansi) it is a union. So change the initializer
3488 hackname = solaris_rwlock_init_1;
3489 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3491 mach = '*-*-solaris
*';
3493 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3496 "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
3498 c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
3499 "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
3502 '#ident
"@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3503 "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
3508 * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
3509 * structure. As such, it need two levels of brackets, but only
3510 * contains one. Wrap the macro definition in an extra layer.
3513 hackname = solaris_once_init_1;
3514 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3516 mach = '*-*-solaris
*';
3518 c_fix_arg = "%1{%2}%3";
3519 c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
3521 '#pragma ident
"@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
3522 "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
3527 * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
3528 * fields of the pthread_once_t structure, which are of type
3529 * upad64_t, which itself is typedef'd to int64_t
, but with __STDC__
3530 * defined (e.g. by
-ansi
) it is a union. So change the initializer
3531 * to
"{0}" instead. This test relies on solaris_once_init_1.
3534 hackname
= solaris_once_init_2
;
3535 select
= '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3538 * On Solaris
10, this fix is unnecessary because upad64_t is
3539 * always defined correctly regardless of the definition of the
3540 * __STDC__ macro. The first
"mach" pattern matches up to
3541 * solaris9. The second
"mach" pattern will not match any
two (or
3542 * more
) digit solaris version
, but it will match e.g.
2.5.1.
3544 mach
= '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
3546 c_fix_arg
= "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3549 "%1{0}, {0}, {0}, {%3}%4\n"
3551 c_fix_arg
= "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{\\{)"
3552 "(0, 0, 0, )(PTHREAD_[A-Z_]+)(\\}\\})[ \t]*$";
3554 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3555 "#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n";
3560 * Sun Solaris
2 has a version of sys
/int_const.h that defines
3561 * UINT8_C and UINT16_C to unsigned constants.
3564 hackname
= solaris_int_const
;
3565 files
= sys
/int_const.h
;
3566 mach
= '*-*-solaris2*';
3568 c_fix_arg
= "#define\tUINT8_C(c)\t(c)\n"
3570 "#define\tUINT16_C(c)\t(c)";
3571 select
= "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
3573 "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
3575 "#define UINT8_C(c) __CONCAT__(c,u)\n"
3577 "#define UINT16_C(c) __CONCAT__(c,u)";
3582 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3583 * UINT8_MAX and UINT16_MAX to unsigned constants.
3586 hackname
= solaris_int_limits_1
;
3587 files
= sys
/int_limits.h
;
3588 mach
= '*-*-solaris2*';
3590 c_fix_arg
= "#define\tUINT8_MAX\t(255)\n"
3591 "#define\tUINT16_MAX\t(65535)";
3592 select
= "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
3593 "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
3595 "#define UINT8_MAX (255U)\n"
3596 "#define UINT16_MAX (65535U)";
3601 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3602 * INT_FAST16 limits to wrong values for sys
/int_types.h.
3605 hackname
= solaris_int_limits_2
;
3606 files
= sys
/int_limits.h
;
3607 mach
= '*-*-solaris2*';
3609 c_fix_arg
= "#define\t%1_FAST16_%2 %132_%2";
3610 select
= "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
3612 "#define INT_FAST16_MAX INT16_MAX\n"
3613 "#define UINT_FAST16_MAX UINT16_MAX\n"
3614 "#define INT_FAST16_MIN INT16_MIN";
3619 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3620 * SIZE_MAX as unsigned long.
3623 hackname
= solaris_int_limits_3
;
3624 files
= sys
/int_limits.h
;
3625 mach
= '*-*-solaris2*';
3627 c_fix_arg
= "#define\tSIZE_MAX\t4294967295U";
3628 select
= "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
3630 "#define SIZE_MAX 4294967295UL";
3635 * Sun Solaris up to
9 has a version of sys
/int_types.h that forbids use
3636 * of Standard C99
64-bit types in
32-bit mode.
3639 hackname
= solaris_int_types
;
3640 select
= "__STDC__ - 0 == 0";
3641 bypass
= "_LONGLONG_TYPE";
3642 files
= sys
/int_types.h
;
3645 "(defined(_STDC_C99) || !defined(_STRICT_STDC) || defined(__GNUC__))";
3647 "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3648 "typedef long long int64_t;\n"
3650 "#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))\n"
3651 "typedef int64_t intmax_t;\n"
3657 * Solaris
10+ <spawn.h
> uses char
*const argv
[_RESTRICT_KYWD
] in the
3658 * posix_spawn declarations
, which doesn
't work with C++.
3661 hackname = solaris_posix_spawn_restrict;
3663 mach = '*-*-solaris2
*';
3665 c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
3666 select = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
3668 "char *const argv[_RESTRICT_KYWD],\n"
3669 "char *const envp[_RESTRICT_KYWD]);";
3674 * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
3675 * std::__flsbuf, but <iso/stdio_iso.h> uses them.
3678 hackname = solaris_std___filbuf;
3680 mach = '*-*-solaris2
*';
3681 bypass = "using std::__filbuf";
3682 select = "(using std::perror;\n)(#endif)";
3684 c_fix_arg = "%1#ifndef _LP64\n"
3685 "using std::__filbuf;\n"
3686 "using std::__flsbuf;\n"
3689 test_text = "using std::perror;\n"
3695 * Sun Solaris 8 has what appears to be some gross workaround for
3696 * some old version of their c++ compiler. G++ doesn't want it
3697 * either
, but doesn
't want to be tied to SunPRO version numbers.
3700 hackname = solaris_stdio_tag;
3701 files = stdio_tag.h;
3703 select = '__cplusplus
< 54321L';
3704 /* In Solaris 10, the code in stdio_tag.h is conditionalized on
3705 "!defined(__GNUC__)" so we no longer need to fix it. */
3706 bypass = '__GNUC__
';
3707 sed = 's
/defined(__cplusplus
) && (__cplusplus
< 54321L)/0/';
3709 test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
3714 * On Solaris 9, __va_list needs to become a typedef for
3715 * __builtin_va_list to make -Wmissing-format-attribute work.
3718 hackname = solaris_sys_va_list;
3719 files = sys/va_list.h;
3720 mach = '*-*-solaris2.9
';
3721 select = "#if.*__STDC__.*\n"
3722 "typedef void \\*__va_list;\n"
3724 "typedef char \\*__va_list;\n"
3728 c_fix_arg = "#ifdef __GNUC__\n"
3729 "typedef __builtin_va_list __va_list;\n"
3733 test_text = "#if defined(__STDC__) && !defined(__ia64)\n"
3734 "typedef void *__va_list;\n"
3736 "typedef char *__va_list;\n"
3742 * a missing semi-colon at the end of the statsswtch structure definition.
3745 hackname = statsswtch;
3746 files = rpcsvc/rstat.h;
3747 select = "boottime$";
3749 c_fix_arg = "boottime;";
3750 test_text = "struct statswtch {\n int boottime\n};";
3755 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
3756 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
3760 hackname
= stdio_stdarg_h
;
3762 bypass
= "include.*(stdarg\.h|machine/ansi\.h)";
3764 * On Solaris
10, this fix is unncessary
; <stdio.h
> includes
3765 * <iso
/stdio_iso.h
>, which includes
<sys
/va_list.h
>.
3767 mach
= '*-*-solaris2.1[0-9]*';
3772 c_fix_arg
= "#define __need___va_list\n#include <stdarg.h>\n";
3779 * Don
't use or define the name va_list in stdio.h. This is for
3780 * ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
3781 * of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
3782 * indicate that the header knows what it's doing
-- under SUSv2
,
3783 * stdio.h is required to define va_list
, and we shouldn
't break
3787 hackname = stdio_va_list;
3789 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list
';
3791 * On Solaris 10, the definition in
3792 * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
3793 * there is therefore no need for this fix there.
3795 mach = '*-*-solaris2.1
[0-9]*';
3799 * Use __gnuc_va_list in arg types in place of va_list.
3800 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3801 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3802 * trailing parentheses and semicolon save all other systems from this.
3803 * Define
__not_va_list__ (something harmless and unused
)
3804 * instead of va_list.
3805 * Don
't claim to have defined va_list.
3807 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3808 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3809 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3810 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3811 "s@ va_list@ __not_va_list__@\n"
3812 "s@\\*va_list@*__not_va_list__@\n"
3813 "s@ __va_list)@ __gnuc_va_list)@\n"
3814 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3815 "@typedef \\1 __not_va_list__;@\n"
3816 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3817 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3818 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3819 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3820 "s@VA_LIST@DUMMY_VA_LIST@\n"
3821 "s@_Va_LIST@_VA_LIST@";
3822 test_text = "extern void mumble( va_list);";
3827 * Fix headers that use va_list from stdio.h to use the updated
3828 * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
3829 * dealt with elsewhere. The presence of __gnuc_va_list,
3830 * __DJ_va_list, or _G_va_list is taken to indicate that the header
3831 * knows what it's doing.
3834 hackname
= stdio_va_list_clients
;
3842 files
= curses_colr
/curses.h
;
3843 bypass
= '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
3844 /* Don
't fix, if we use va_list from stdarg.h, or if the use is
3845 otherwise protected. */
3846 bypass = 'include
<stdarg\.h
>|#ifdef va_start
';
3849 * Use __gnuc_va_list in arg types in place of va_list.
3850 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3851 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3852 * trailing parentheses and semicolon save all other systems from this.
3853 * Define
__not_va_list__ (something harmless and unused
)
3854 * instead of va_list.
3855 * Don
't claim to have defined va_list.
3857 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3858 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3859 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3860 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3861 "s@ va_list@ __not_va_list__@\n"
3862 "s@\\*va_list@*__not_va_list__@\n"
3863 "s@ __va_list)@ __gnuc_va_list)@\n"
3864 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3865 "@typedef \\1 __not_va_list__;@\n"
3866 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3867 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3868 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3869 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3870 "s@VA_LIST@DUMMY_VA_LIST@\n"
3871 "s@_Va_LIST@_VA_LIST@";
3872 test_text = "extern void mumble( va_list);";
3877 * "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
3878 * is "!defined( __STRICT_ANSI__ )"
3881 hackname = strict_ansi_not;
3882 select = "^([ \t]*#[ \t]*if.*)"
3884 "|__STDC__[ \t]*==[ \t]*0"
3885 "|__STDC__[ \t]*!=[ \t]*1"
3886 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
3887 /* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
3888 bypass = 'GNU and MIPS C compilers define __STDC__ differently
';
3889 /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
3890 is not defined by GCC, so it is safe. */
3891 bypass = '__SCO_VERSION__.
*__STDC__
!= 1';
3892 c_test = stdc_0_in_system_headers;
3895 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
3897 test_text = "#if !__STDC__ \n"
3898 "#if __STDC__ == 0\n"
3899 "#if __STDC__ != 1\n"
3900 "#if __STDC__ - 0 == 0"
3901 "/* not std C */\nint foo;\n"
3902 "\n#end-end-end-end-if :-)";
3907 * is "!defined( __STRICT_ANSI__ )" on continued #if-s
3910 hackname = strict_ansi_not_ctd;
3911 files = math.h, limits.h, stdio.h, signal.h,
3912 stdlib.h, sys/signal.h, time.h;
3914 * Starting at the beginning of a line, skip white space and
3915 * a leading "(" or "&&" or "||". One of those must be found.
3916 * Then, zero, one or more copies of a "defined(_FOO_BAR_) &&"
3917 * expression. If these are nested, then they must accumulate
3918 * because we won't match any closing parentheses. Finally
,
3919 * after skipping over all that
, we must then match our suspect
3920 * phrase
: "__STDC__-0==0" with or without white space.
3922 select
= "^([ \t]*" '(\(|&&|\|\|)'
3923 "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
3925 "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
3926 c_test
= stdc_0_in_system_headers
;
3929 c_fix_arg
= "%1 !defined(__STRICT_ANSI__)";
3931 test_text
= "#if 1 && \\\\\n"
3932 "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
3933 "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
3934 "|| __STDC__ - 0 == 0 ) /* not std C */\n"
3940 * "__STDC__!=0" or
"__STDC__==1" or
"__STDC__-0==1"
3941 * is
"defined( __STRICT_ANSI__ )"
3944 hackname
= strict_ansi_only
;
3945 select
= "^([ \t]*#[ \t]*if.*)"
3946 "(__STDC__[ \t]*!=[ \t]*0"
3947 "|__STDC__[ \t]*==[ \t]*1"
3948 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
3949 "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
3950 c_test
= stdc_0_in_system_headers
;
3953 c_fix_arg
= "%1 defined(__STRICT_ANSI__)";
3955 test_text
= "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
3960 * IRIX
4.0.5 <rpc
/xdr.h
> uses struct __file_s
3961 * in prototype without previous definition.
3964 hackname
= struct_file
;
3966 select
= '^.*xdrstdio_create.*struct __file_s';
3968 c_fix_arg
= "struct __file_s;\n%0";
3969 test_text
= "extern void xdrstdio_create( struct __file_s* );";
3974 * IRIX
4.0.5 <rpc
/auth.h
> uses struct sockaddr
3975 * in prototype without previous definition.
3977 * Don
't fix OpenBSD, which uses struct sockaddr_in prototyping the same
3978 * function, and does define it.
3981 hackname = struct_sockaddr;
3983 select = "^.*authdes_create.*struct sockaddr[^_]";
3984 bypass = "<sys/socket\.h>";
3985 bypass = "struct sockaddr;\n";
3987 c_fix_arg = "struct sockaddr;\n%0";
3988 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
3993 * Apply fix this to all OSs since this problem seems to effect
3994 * more than just SunOS.
3997 hackname = sun_auth_proto;
4002 bypass = "__cplusplus";
4004 * Select those files containing '(*name)()'.
4006 select = '\(\*[a-z][a-z_]*\)\(\)';
4009 c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n"
4010 "#else\n%1();%2\n#endif";
4011 c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
4015 " int (*name)(); /* C++ bad */\n"
4021 * Fix bogus #ifdef on SunOS 4.1.
4024 hackname = sun_bogus_ifdef;
4025 files = "hsfs/hsfs_spec.h";
4026 files = "hsfs/iso_spec.h";
4027 select = '#
ifdef(.
*\|\|.*)
';
4029 c_fix_arg = "#if%1";
4031 test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
4036 * Fix the CAT macro in SunOS memvar.h.
4039 hackname = sun_catmacro;
4040 files = pixrect/memvar.h;
4041 select = "^#define[ \t]+CAT\\(a,b\\).*";
4046 "# define CAT(a,b) a##b\n"
4047 "#else\n%0\n#endif";
4050 "#define CAT(a,b)\ta/**/b";
4055 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
4056 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
4059 hackname = sun_malloc;
4061 bypass = "_CLASSIC_ANSI_TYPES";
4063 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
4064 sed = "s/int[ \t][ \t]*free/void\tfree/g";
4065 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
4066 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
4067 sed = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
4070 "typedef char *\tmalloc_t;\n"
4072 "char*\tmalloc();\n"
4073 "char*\tcalloc();\n"
4074 "char*\trealloc();";
4079 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
4082 hackname = sun_rusers_semi;
4083 files = rpcsvc/rusers.h;
4085 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
4086 test_text = "struct mumble\n int _cnt\n};";
4091 * signal.h on SunOS defines signal using (),
4092 * which causes trouble when compiling with g++ -pedantic.
4095 hackname = sun_signal;
4096 files = sys/signal.h;
4098 select = "^void\t" '\
(\
*signal\
(\
)\
)\
(\
);.
*';
4102 "#ifdef __cplusplus\n"
4103 "void\t(*signal(...))(...);\n"
4104 "#else\n%0\n#endif";
4106 test_text = "void\t(*signal())();";
4111 * Correct the return type for strlen in strings.h in SunOS 4.
4114 hackname = sunos_strlen;
4116 select = "int[ \t]*strlen\\(\\);(.*)";
4118 c_fix_arg = "__SIZE_TYPE__ strlen();%1";
4119 test_text = " int\tstrlen(); /* string length */";
4124 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
4125 * that is visible to any ANSI compiler using this include. Simply
4126 * delete the lines that #define some string functions to internal forms.
4129 hackname = svr4_disable_opt;
4131 select = '#define.
*__std_hdr_
';
4132 sed = '/#define.
*__std_hdr_
/d
';
4133 test_text = "#define strlen __std_hdr_strlen\n";
4138 * Fix broken decl of getcwd present on some svr4 systems.
4141 hackname = svr4_getcwd;
4144 files = prototypes.h;
4145 select = 'getcwd\
(char \
*, int\
)';
4148 c_fix_arg = "getcwd(char *, size_t)";
4150 test_text = "extern char* getcwd(char *, int);";
4155 * Fix broken decl of profil present on some svr4 systems.
4158 hackname = svr4_profil;
4163 'profil\
(unsigned short \
*, unsigned int
, unsigned int
, unsigned int\
)';
4165 c_fix_arg = 'profil(unsigned short
*, size_t
, int
, unsigned int
)';
4168 'profil(unsigned short
*, unsigned int
, unsigned int
, unsigned int
);';
4173 * Correct types for signal handler constants like SIG_DFL; they might be
4174 * void (*) (), and should be void (*) (int). C++ doesn't like the
4178 hackname
= svr4_sighandler_type
;
4179 files
= sys
/signal.h
;
4180 select
= 'void *\(\*\)\(\)';
4182 c_fix_arg
= "void (*)(int)";
4183 test_text
= "#define SIG_DFL (void(*)())0\n"
4184 "#define SIG_IGN (void (*)())0\n";
4189 * Some SysV r4 systems
, including Sequent
's DYNIX/ptx, use the local
4190 * function 'getrnge
' in <regexp.h> before they declare it. For these
4191 * systems add a 'static int
' declaration of 'getrnge
' into <regexp.h>
4194 * 'getrnge
' traditionally manipulates a file-scope global called 'size
',
4195 * so put the declaration right after the declaration of 'size
'.
4197 * Don't do this if there is already a `static void getrnge
' declaration
4198 * present, since this would cause a redeclaration error. Solaris 2.x has
4199 * such a declaration.
4202 hackname = svr4_undeclared_getrnge;
4205 bypass = "static void getrnge";
4208 "static int getrnge ();";
4209 c_fix_arg = "^static int[ \t]+size;";
4210 test_text = "static int size;\n"
4211 "/* stuff which calls getrnge() */\n"
4212 "static getrnge()\n"
4218 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
4219 * in string.h on sysV68
4220 * Correct the return type for strlen in string.h on Lynx.
4221 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
4222 * Add missing const for strdup on OSF/1 V3.0.
4223 * On sysV88 layout is slightly different.
4226 hackname = sysv68_string;
4229 bypass = "_CLASSIC_ANSI_TYPES";
4231 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
4232 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
4233 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
4235 sed = "/^extern char$/N";
4236 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
4238 sed = "/^extern int$/N";
4239 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
4241 sed = "/^\tstrncmp(),$/N";
4242 sed = 's
/^\
(' "\t" 'strncmp()\
),\n\
(' "\t" 'strlen(),\
)$
/'
4243 '\
1;' "\\\nextern unsigned int\\\n\\2/";
4246 "extern int strlen();\n"
4248 "extern int ffs(long);\n"
4261 "\tstrlen(), strspn();";
4266 * Fix return type of calloc, malloc, realloc, bsearch and exit
4269 hackname = sysz_stdlib_for_sun;
4271 bypass = "_CLASSIC_ANSI_TYPES";
4273 select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
4275 c_fix_arg = "void *\t%1(";
4278 "extern char*\tcalloc(size_t);\n"
4279 "extern char*\tmalloc(size_t);\n"
4280 "extern char*\trealloc(void*,size_t);\n"
4281 "extern char*\tbsearch(void*,size_t,size_t);\n";
4286 * __thread is now a keyword.
4289 hackname = thread_keyword;
4290 files = "pthread.h";
4291 files = "bits/sigthread.h";
4292 select = "([* ])__thread([,)])";
4294 c_fix_arg = "%1__thr%2";
4297 "extern int pthread_create (pthread_t *__restrict __thread,\n"
4298 "extern int pthread_kill (pthread_t __thread, int __signo);\n"
4299 "extern int pthread_cancel (pthread_t __thread);";
4303 * if the #if says _cplusplus, not the double underscore __cplusplus
4307 hackname = tinfo_cplusplus;
4309 select = "[ \t]_cplusplus";
4312 c_fix_arg = " __cplusplus";
4313 test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
4318 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4321 hackname = ultrix_const;
4323 select = 'perror\
( char \
*';
4326 c_fix_arg = "%1 const %3 *__";
4327 c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
4328 "[ \t]+(char|void) \\*__";
4331 "extern void perror( char *__s );\n"
4332 "extern int fputs( char *__s, FILE *);\n"
4333 "extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
4334 "extern int fscanf( FILE *__stream, char *__format, ...);\n"
4335 "extern int scanf( char *__format, ...);\n";
4340 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4343 hackname = ultrix_const2;
4346 select = '\
*fopen\
( char \
*';
4348 c_fix_arg = "%1( const char *%3, const char *";
4349 c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
4350 "[ \t]*char[ \t]*\\*([^,]*),"
4351 "[ \t]*char[ \t]*\\*[ \t]*";
4354 "extern FILE *fopen( char *__filename, char *__type );\n"
4355 "extern int sscanf( char *__s, char *__format, ...);\n"
4356 "extern FILE *popen(char *, char *);\n"
4357 "extern char *tempnam(char*,char*);\n";
4362 * Fix definitions of macros used by va-i960.h in VxWorks header file.
4365 hackname = va_i960_macro;
4366 files = arch/i960/archI960.h;
4367 select = "__(vsiz|vali|vpad|alignof__)";
4370 c_fix_arg = "__vx%1";
4373 "extern int __vsiz vsiz;\n"
4374 "extern int __vali vali;\n"
4375 "extern int __vpad vpad;\n"
4376 "#define __alignof__(x) ...";
4381 * Define __CAN_USE_EXTERN_PREFIX on vms.
4384 hackname = vms_define_can_use_extern_prefix;
4385 files = "rtldef/decc$types.h";
4386 select = "#[ \t]*else\n"
4387 "#[ \t]*if defined\\(__DECCXX\\)\n"
4388 "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n";
4393 "# elif defined (__GNUC__)\n"
4394 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n";
4396 test_text = "# else\n"
4397 "# if defined(__DECCXX)\n"
4398 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"
4404 * On VMS, use pragma extern_model instead of VAX-C keywords.
4407 hackname = vms_use_pragma_extern_model;
4408 select = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n"
4409 "# pragma extern_model __save\n";
4413 c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n"
4414 "# pragma extern_model __save\n";
4416 test_text = "#if defined(__DECC) || defined(__DECCXX)\n"
4417 "# pragma extern_model __save\n"
4418 "# pragma extern_model strict_refdef\n"
4419 " extern struct x zz$yy;\n"
4420 "# pragma extern_model __restore\n"
4425 * On VMS, disable the use of dec-c string builtins
4428 hackname = vms_disable_decc_string_builtins;
4429 select = "#if !defined\\(__VAX\\)\n";
4431 files = "rtldef/string.h";
4434 c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n";
4436 test_text = "#if !defined(__VAX)\n";
4440 * On VMS, change <resource.h> to <sys/resource.h> to avoid a
4441 * conflict while building gcc. Likewise for <builtins.h>
4444 hackname = vms_use_quoted_include;
4445 select = "(#[ \t]*include[ \t]+)<(resource|builtins)\\.h>";
4447 files = rtldef/wait.h, starlet_c/pthread.h;
4450 c_fix_arg = '%1<sys
/%2.h
>';
4452 test_text = "# include <resource.h>";
4456 * On VMS, add missing braces around sigset_t constants.
4459 hackname = vms_add_missing_braces;
4460 select = "(_SIG_[A-Z]+_SET[ \t]+= \\{)(0x[0F]+, 0x[0F]+)";
4462 files = "rtldef/signal.h";
4465 c_fix_arg = '%1 {%2} ';
4467 test_text = "static const __sigset_t _SIG_EMPTY_SET = "
4468 "{0x00000000, 0x00000000},\n"
4469 " _SIG_FULL_SET = {0xFFFFFFFF, 0xFFFFFFFF};\n";
4473 * On VMS, fix incompatible redeclaration of hostalias.
4476 hackname = vms_do_not_redeclare_hostalias;
4477 select = "(void[ \t]+fp_nquery \\(const u_char \\*, int, FILE \\*\\);)\n"
4478 "(__char_ptr32[ \t]+hostalias \\(const char \\*\\);)";
4480 files = "rtldef/resolv.h";
4486 test_text = "void fp_nquery (const u_char *, int, FILE *);\n"
4487 "__char_ptr32 hostalias (const char *);\n";
4491 * On VMS, some DEC-C builtins are directly used.
4494 hackname = vms_decc_builtin;
4495 select = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY)";
4497 files = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
4499 sed = "s@__MEMSET@memset@";
4500 sed = "s@__MEMMOVE@memmove@";
4501 sed = "s@__MEMCPY@memcpy@";
4502 sed = "s@__STRLEN@strlen@";
4503 sed = "s@__STRCPY@strcpy@";
4505 test_text = "define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p)))\n";
4509 * On VMS, do not declare getopt and al if pointers are 64 bit.
4512 hackname = vms_no_64bit_getopt;
4513 select = "^[ \t]*(extern[ \t]*)?(int[ \t]*(getopt|optind|opterr|optopt)|(char \\*optarg))([ \t]*\\(.*\\))?;\n";
4514 /* select = "^[ \t](extern[ \t))?(int[ \t](getopt|optind|opterr|optopt))|(char *optarg).*;\n"; */
4516 files = rtldef/stdio.h, rtldef/unistd.h;
4519 c_fix_arg = "#if __INITIAL_POINTER_SIZE != 64 /* getopt is short ptr only. */\n"
4523 test_text = "int getopt (int, char * const [], const char *);";
4527 * On VMS, forward declare structure before referencing them in prototypes.
4530 hackname = vms_forward_declare_struct;
4531 select = "(/\\* forward decls for C\\+\\+ \\*/\n)"
4532 "#ifdef __cplusplus\n";
4534 files = rtldef/if.h;
4538 "#if defined (__cplusplus) || defined (__GNUC__)\n";
4540 test_text = "/* forward decls for C++ */\n"
4541 "#ifdef __cplusplus\n"
4547 * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
4548 * which is not yet fully supported by gcc.
4551 hackname = vms_use_fast_setjmp;
4552 select = "(#[ \t]*if[ \t]*defined\\(__FAST_SETJMP\\)[ \t]*\\|\\|)";
4554 files = rtldef/setjmp.h;
4557 c_fix_arg = "%0 defined (__GNUC__) ||";
4559 test_text = "# if defined(__FAST_SETJMP) || defined(__UNIX_SETJMP)";
4563 * AIX and Interix headers define NULL to be cast to a void pointer,
4564 * which is illegal in ANSI C++.
4567 hackname = void_null;
4577 files = sys/param.h;
4578 files = sys/types.h;
4579 /* avoid changing C++ friendly NULL */
4580 bypass = __cplusplus;
4582 select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
4584 c_fix_arg = "#define NULL 0";
4585 test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
4590 * Make VxWorks header which is almost gcc ready fully gcc ready.
4593 hackname = vxworks_gcc_problem;
4594 files = types/vxTypesBase.h;
4595 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
4597 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
4600 sed = "/[ \t]size_t/i\\\n"
4601 "#ifndef _GCC_SIZE_T\\\n"
4602 "#define _GCC_SIZE_T\n";
4604 sed = "/[ \t]size_t/a\\\n"
4607 sed = "/[ \t]ptrdiff_t/i\\\n"
4608 "#ifndef _GCC_PTRDIFF_T\\\n"
4609 "#define _GCC_PTRDIFF_T\n";
4611 sed = "/[ \t]ptrdiff_t/a\\\n"
4614 sed = "/[ \t]wchar_t/i\\\n"
4615 "#ifndef _GCC_WCHAR_T\\\n"
4616 "#define _GCC_WCHAR_T\n";
4618 sed = "/[ \t]wchar_t/a\\\n"
4622 "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
4623 "typedef unsigned int size_t;\n"
4624 "typedef long ptrdiff_t;\n"
4625 "typedef unsigned short wchar_t;\n"
4626 "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
4630 * Wrap VxWorks ioctl to keep everything pretty
4633 hackname = vxworks_ioctl_macro;
4635 mach = "*-*-vxworks*";
4639 "#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
4640 c_fix_arg = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
4642 test_text = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
4646 * Wrap VxWorks mkdir to be posix compliant
4649 hackname = vxworks_mkdir_macro;
4651 mach = "*-*-vxworks*";
4655 "#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n";
4656 c_fix_arg = "extern[\t ]+STATUS[\t ]+mkdir[\t ]*"
4657 "\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*" /* arg type */
4658 "(|[_[:alpha:]][_[:alnum:]]*)" /* arg name (optional) */
4661 test_text = "extern STATUS mkdir (const char * _qwerty) ;";
4666 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
4669 hackname = vxworks_needs_vxtypes;
4671 select = "uint_t([ \t]+_clocks_per_sec)";
4673 c_fix_arg = "unsigned int%1";
4674 test_text = "uint_t\t_clocks_per_sec;";
4679 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
4682 hackname = vxworks_needs_vxworks;
4684 test = " -r types/vxTypesOld.h";
4685 test = " -n \"`egrep '#include
' $file`\"";
4686 test = " -n \"`egrep ULONG $file`\"";
4687 select = "#[ \t]define[ \t]+__INCstath";
4689 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
4690 "#include <types/vxTypesOld.h>\n";
4692 test_text = "`touch types/vxTypesOld.h`"
4693 "#include </dev/null> /* ULONG */\n"
4694 "# define\t__INCstath <sys/stat.h>";
4698 * Make it so VxWorks does not include gcc/regs.h accidentally
4701 hackname = vxworks_regs;
4702 mach = "*-*-vxworks*";
4704 select = "#[\t ]*include[\t ]+[<\"]regs.h[>\"]";
4706 c_fix_arg = "#include <arch/../regs.h>";
4708 test_text = "#include <regs.h>\n";
4713 * Another bad dependency in VxWorks 5.2 <time.h>.
4716 hackname = vxworks_time;
4718 test = " -r vxWorks.h";
4720 select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
4724 "#ifndef __gcc_VOIDFUNCPTR_defined\n"
4725 "#ifdef __cplusplus\n"
4726 "typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
4728 "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
4730 "#define __gcc_VOIDFUNCPTR_defined\n"
4732 "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
4734 test_text = "`touch vxWorks.h`"
4735 "#define VOIDFUNCPTR (void(*)())";
4739 * This hack makes write const-correct on VxWorks
4742 hackname = vxworks_write_const;
4744 mach = "*-*-vxworks*";
4747 c_fix_arg = "extern int write (int, const char*, size_t);";
4748 c_fix_arg = "extern[\t ]+int[\t ]+write[\t ]*\\("
4750 "[\t ]*char[\t ]*\\*[\t ]*,"
4751 "[\t ]*size_t[\t ]*\\)[\t ]*;";
4753 test_text = "extern int write ( int , char * , size_t ) ;";
4757 * There are several name conflicts with C++ reserved words in X11 header
4758 * files. These are fixed in some versions, so don't do the fixes if
4759 * we find __cplusplus in the file. These were found on the RS
/6000.
4762 hackname
= x11_class
;
4763 files
= X11
/ShellP.h
;
4764 bypass
= __cplusplus
;
4765 select
= "^([ \t]*char \\*)class;(.*)";
4767 c_fix_arg
= "#ifdef __cplusplus\n%1c_class;%2\n"
4768 "#else\n%1class;%2\n#endif";
4777 * class in Xm
/BaseClassI.h
4780 hackname
= x11_class_usage
;
4781 files
= Xm
/BaseClassI.h
;
4782 bypass
= "__cplusplus";
4784 select
= " class\\)";
4786 c_fix_arg
= " c_class)";
4788 test_text
= "extern mumble (int class);\n";
4793 * new in Xm
/Traversal.h
4797 files
= Xm
/Traversal.h
;
4798 bypass
= __cplusplus
;
4800 sed
= "/Widget\told, new;/i\\\n"
4801 "#ifdef __cplusplus\\\n"
4802 "\\\tWidget\told, c_new;\\\n"
4805 sed
= "/Widget\told, new;/a\\\n"
4808 sed
= "s/Widget new,/Widget c_new,/g";
4811 " Widget\told, new;\n"
4812 "};\nextern Wedged( Widget new, Widget old );";
4817 * Incorrect sprintf declaration in X11
/Xmu.h
4820 hackname
= x11_sprintf
;
4822 files
= X11
/Xmu
/Xmu.h
;
4823 select
= "^extern char \\*\tsprintf\\(\\);$";
4826 c_fix_arg
= "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
4828 test_text
= "extern char *\tsprintf();";
4832 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
4833 * that fails when compiling for SSE
-less
32-bit x86.
4836 hackname
= feraiseexcept_nosse_invalid
;
4837 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
4838 files
= bits
/fenv.h
;
4839 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
4840 ": \"x\" \\(__f\\)\\);$";
4841 bypass
= "\"fdiv .*; fwait\"";
4844 c_fix_arg
= <<- _EOText_
4845 # ifdef __SSE_MATH__
4848 %1__asm__
__volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
4849 %1 : "=t" (__f
) : "0" (__f
));
4853 test_text
= <<- _EOText_
4854 __asm__
__volatile__ ("divss %0, %0" : : "x" (__f
));
4858 hackname
= feraiseexcept_nosse_divbyzero
;
4859 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
4860 files
= bits
/fenv.h
;
4861 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
4862 ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
4863 bypass
= "\"fdivp .*; fwait\"";
4866 c_fix_arg
= <<- _EOText_
4867 # ifdef __SSE_MATH__
4870 %1__asm__
__volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
4871 %1 : "=t" (__f
) : "0" (__f
), "u" (__g
) : "st(1)");
4875 test_text
= <<- _EOText_
4876 __asm__
__volatile__ ("divss %1, %0" : : "x" (__f
), "x" (__g
));