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");
67 /* On AIX when _LARGE_FILES is defined fcntl.h defines open to
68 * open64 and creat to creat64. This fixes fcntl.h to
69 * undef those defines and use __asm__ to alias the symbols if
70 * building with g
++ and
-D_LARGE_FILES
73 hackname
= AAB_aix_fcntl
;
75 select
= "define open[ \t]open64";
77 test
-text
= ''; /* no way to test
*/
83 c_fix_arg
= <<- _EOArg_
85 #if defined __GNUG__
&& defined _LARGE_FILES
&& defined __cplusplus
86 #define __need__aix_fcntl_h_fix
87 #ifdef __need__aix_fcntl_h_fix
91 /* Alias the symbols using asm
*/
93 extern int
open(const char
*, int
, ...
) __asm__("open64");
94 extern int
creat(const char
*, mode_t
) __asm__("creat64");
95 #
if (_XOPEN_SOURCE
>= 700)
96 extern int
openat(int
, const char
*, int
, ...
) __asm__("open64at");
106 * On Mac OS
10.3.9, the
'long double' functions are available in
107 * libSystem
, but are not prototyped in math.h.
110 hackname
= AAB_darwin7_9_long_double_funcs
;
111 mach
= "*-*-darwin7.9*";
112 files
= architecture
/ppc
/math.h
;
114 replace
= <<- _EndOfHeader_
115 /* This file prototypes the long double functions available on Mac OS
119 # define __APPLE_CC__
1345
120 # include_next
<architecture
/ppc
/math.h
>
122 # define __APPLE_CC__
1
123 # ifndef __LIBMLDBL_COMPAT
124 # ifdef __LONG_DOUBLE_128__
125 # define
__LIBMLDBL_COMPAT(sym
) __asm("_" #sym
"$LDBL128")
127 # define
__LIBMLDBL_COMPAT(sym
)
128 # endif
/* __LONG_DOUBLE_128__
*/
129 # endif
/* __LIBMLDBL_COMPAT
*/
133 extern long double
acosl( long double
) __LIBMLDBL_COMPAT(acosl
);
134 extern long double
asinl( long double
) __LIBMLDBL_COMPAT(asinl
);
135 extern long double
atanl( long double
) __LIBMLDBL_COMPAT(atanl
);
136 extern long double
atan2l( long double
, long double
) __LIBMLDBL_COMPAT(atan2l
);
137 extern long double
cosl( long double
) __LIBMLDBL_COMPAT(cosl
);
138 extern long double
sinl( long double
) __LIBMLDBL_COMPAT(sinl
);
139 extern long double
tanl( long double
) __LIBMLDBL_COMPAT(tanl
);
140 extern long double
acoshl( long double
) __LIBMLDBL_COMPAT(acoshl
);
141 extern long double
asinhl( long double
) __LIBMLDBL_COMPAT(asinhl
);
142 extern long double
atanhl( long double
) __LIBMLDBL_COMPAT(atanhl
);
143 extern long double
coshl( long double
) __LIBMLDBL_COMPAT(coshl
);
144 extern long double
sinhl( long double
) __LIBMLDBL_COMPAT(sinhl
);
145 extern long double
tanhl( long double
) __LIBMLDBL_COMPAT(tanhl
);
146 extern long double
expl( long double
) __LIBMLDBL_COMPAT(expl
);
147 extern long double
exp2l( long double
) __LIBMLDBL_COMPAT(exp2l
);
148 extern long double
expm1l( long double
) __LIBMLDBL_COMPAT(expm1l
);
149 extern long double
logl( long double
) __LIBMLDBL_COMPAT(logl
);
150 extern long double
log10l( long double
) __LIBMLDBL_COMPAT(log10l
);
151 extern long double
log2l( long double
) __LIBMLDBL_COMPAT(log2l
);
152 extern long double
log1pl( long double
) __LIBMLDBL_COMPAT(log1pl
);
153 extern long double
logbl( long double
) __LIBMLDBL_COMPAT(logbl
);
154 extern long double
modfl( long double
, long double
* ) __LIBMLDBL_COMPAT(modfl
);
155 extern long double
ldexpl( long double
, int
) __LIBMLDBL_COMPAT(ldexpl
);
156 extern long double
frexpl( long double
, int
* ) __LIBMLDBL_COMPAT(frexpl
);
157 extern int
ilogbl( long double
) __LIBMLDBL_COMPAT(ilogbl
);
158 extern long double
scalbnl( long double
, int
) __LIBMLDBL_COMPAT(scalbnl
);
159 extern long double
scalblnl( long double
, long int
) __LIBMLDBL_COMPAT(scalblnl
);
160 extern long double
fabsl( long double
) __LIBMLDBL_COMPAT(fabsl
);
161 extern long double
cbrtl( long double
) __LIBMLDBL_COMPAT(cbrtl
);
162 extern long double
hypotl( long double
, long double
) __LIBMLDBL_COMPAT(hypotl
);
163 extern long double
powl( long double
, long double
) __LIBMLDBL_COMPAT(powl
);
164 extern long double
sqrtl( long double
) __LIBMLDBL_COMPAT(sqrtl
);
165 extern long double
erfl( long double
) __LIBMLDBL_COMPAT(erfl
);
166 extern long double
erfcl( long double
) __LIBMLDBL_COMPAT(erfcl
);
167 extern long double
lgammal( long double
) __LIBMLDBL_COMPAT(lgammal
);
168 extern long double
tgammal( long double
) __LIBMLDBL_COMPAT(tgammal
);
169 extern long double
ceill( long double
) __LIBMLDBL_COMPAT(ceill
);
170 extern long double
floorl( long double
) __LIBMLDBL_COMPAT(floorl
);
171 extern long double
nearbyintl( long double
) __LIBMLDBL_COMPAT(nearbyintl
);
172 extern long double
rintl( long double
) __LIBMLDBL_COMPAT(rintl
);
173 extern long int
lrintl( long double
) __LIBMLDBL_COMPAT(lrintl
);
174 extern long long int
llrintl( long double
) __LIBMLDBL_COMPAT(llrintl
);
175 extern long double
roundl( long double
) __LIBMLDBL_COMPAT(roundl
);
176 extern long int
lroundl( long double
) __LIBMLDBL_COMPAT(lroundl
);
177 extern long long int
llroundl( long double
) __LIBMLDBL_COMPAT(llroundl
);
178 extern long double
truncl( long double
) __LIBMLDBL_COMPAT(truncl
);
179 extern long double
fmodl( long double
, long double
) __LIBMLDBL_COMPAT(fmodl
);
180 extern long double
remainderl( long double
, long double
) __LIBMLDBL_COMPAT(remainderl
);
181 extern long double
remquol( long double
, long double
, int
* ) __LIBMLDBL_COMPAT(remquol
);
182 extern long double
copysignl( long double
, long double
) __LIBMLDBL_COMPAT(copysignl
);
183 extern long double
nanl( const char
* ) __LIBMLDBL_COMPAT(nanl
);
184 extern long double
nextafterl( long double
, long double
) __LIBMLDBL_COMPAT(nextafterl
);
185 extern long double
nexttowardl( long double
, long double
) __LIBMLDBL_COMPAT(nexttowardl
);
186 extern long double
fdiml( long double
, long double
) __LIBMLDBL_COMPAT(fdiml
);
187 extern long double
fmaxl( long double
, long double
) __LIBMLDBL_COMPAT(fmaxl
);
188 extern long double
fminl( long double
, long double
) __LIBMLDBL_COMPAT(fminl
);
189 extern long double
fmal( long double
, long double
, long double
) __LIBMLDBL_COMPAT(fmal
);
193 #endif
/* __MATH__
*/
198 * This fixes __FD_ZERO bug for linux
2.x.
y (x
<= 2 && y
<= some n
)
201 hackname
= AAB_fd_zero_asm_posix_types_h
;
202 files
= asm
/posix_types.h
;
203 mach
= 'i[34567]86-*-linux*';
206 bypass
= 'posix_types_64';
209 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper
, not
210 * the start
, so that if #include_next gets another instance of
211 * the wrapper
, this will follow the #include_next chain until
212 * we arrive at the real
<asm
/posix_types.h
>.
214 replace
= <<- _EndOfHeader_
215 /* This file fixes a bug in the __FD_ZERO macro
216 for older versions of the Linux kernel.
*/
217 #ifndef _POSIX_TYPES_H_WRAPPER
218 #include
<features.h
>
219 #include_next
<asm
/posix_types.h
>
221 #if
defined(__FD_ZERO
) && !defined(__GLIBC__
)
223 #define
__FD_ZERO(fdsetp
) \
226 __asm__
__volatile__("cld ; rep ; stosl" \
227 : "=&c" (__d0
), "=&D" (__d1
) \
228 : "a" (0), "0" (__FDSET_LONGS
), \
229 "1" ((__kernel_fd_set *)
(fdsetp
)) :"memory"); \
233 #define _POSIX_TYPES_H_WRAPPER
234 #endif
/* _POSIX_TYPES_H_WRAPPER
*/
239 * This fixes __FD_ZERO bug for glibc
-1.x
242 hackname
= AAB_fd_zero_gnu_types_h
;
244 mach
= 'i[34567]86-*-linux*';
247 * Define _TYPES_H_WRAPPER at the end of the wrapper
, not
248 * the start
, so that if #include_next gets another instance of
249 * the wrapper
, this will follow the #include_next chain until
250 * we arrive at the real
<gnu
/types.h
>.
252 replace
= <<- _EndOfHeader_
253 /* This file fixes a bug in the __FD_ZERO macro present in glibc
1.x.
*/
254 #ifndef _TYPES_H_WRAPPER
255 #include
<features.h
>
256 #include_next
<gnu
/types.h
>
258 #if
defined(__FD_ZERO
) && !defined(__GLIBC__
)
260 # define
__FD_ZERO(fdsetp
) \
263 __asm__
__volatile__("cld ; rep ; stosl" \
264 : "=&c" (__d0
), "=&D" (__d1
) \
265 : "a" (0), "0" (__FDSET_LONGS
), \
266 "1" ((__fd_set *)
(fdsetp
)) :"memory"); \
270 #define _TYPES_H_WRAPPER
271 #endif
/* _TYPES_H_WRAPPER
*/
276 * This fixes __FD_ZERO bug for glibc
-2.0.x
279 hackname
= AAB_fd_zero_selectbits_h
;
280 files
= selectbits.h
;
281 mach
= 'i[34567]86-*-linux*';
284 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper
, not
285 * the start
, so that if #include_next gets another instance of
286 * the wrapper
, this will follow the #include_next chain until
287 * we arrive at the real
<selectbits.h
>.
289 replace
= <<- _EndOfHeader_
290 /* This file fixes a bug in the __FD_ZERO macro present in glibc
2.0.x.
*/
291 #ifndef _SELECTBITS_H_WRAPPER
292 #include
<features.h
>
293 #include_next
<selectbits.h
>
295 #if
defined(__FD_ZERO
) && defined(__GLIBC__
) \\
296 && defined(__GLIBC_MINOR__
) && __GLIBC__
== 2 \\
297 && __GLIBC_MINOR__
== 0
299 #define
__FD_ZERO(fdsetp
) \\
302 __asm__
__volatile__ ("cld; rep; stosl" \\
303 : "=&c" (__d0
), "=&D" (__d1
) \\
304 : "a" (0), "0" (sizeof (__fd_set
) \\
305 / sizeof (__fd_mask
)), \\
306 "1" ((__fd_mask *)
(fdsetp
)) \\
311 #define _SELECTBITS_H_WRAPPER
312 #endif
/* _SELECTBITS_H_WRAPPER
*/
317 * Solaris
<sys
/varargs.h
> is a
DDK (aka kernel
-land
) header providing
318 * the same interface as
<stdarg.h
>. No idea why they couldn
't have just
319 * used the standard header.
322 hackname = AAB_solaris_sys_varargs_h;
323 files = "sys/varargs.h";
324 mach = '*-*-solaris
*';
325 replace = <<- _EndOfHeader_
335 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
336 * declaration on Sun OS
4.x. We must only fix this on Sun OS
4.x
, because
337 * many other systems have similar text but correct versions of the file.
338 * To ensure only Sun
's is fixed, we grep for a likely unique string.
339 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
342 hackname = AAB_sun_memcpy;
344 select = "/\\*\t@\\(#\\)"
345 "(head/memory.h\t50.1\t "
346 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
348 replace = <<- _EndOfHeader_
349 /* This file was generated by fixincludes */
354 extern void *memccpy();
355 extern void *memchr();
356 extern void *memcpy();
357 extern void *memset();
359 extern char *memccpy();
360 extern char *memchr();
361 extern char *memcpy();
362 extern char *memset();
363 #endif /* __STDC__ */
367 #endif /* __memory_h__ */
372 * Fix assert.h on VxWorks:
375 hackname = AAB_vxworks_assert;
377 mach = "*-*-vxworks*";
379 replace = <<- _EndOfHeader_
387 #if defined(__STDC__) || defined(__cplusplus)
388 extern void __assert (const char*);
390 extern void __assert ();
394 #define assert(ign) ((void)0)
397 #define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str)
398 #define ASSERT_STRINGIFY_HELPER(str) #str
400 #define assert(test) ((void) \
401 ((test) ? ((void)0) : \
402 __assert("Assertion failed: " ASSERT_STRINGIFY(test) ", file " \
403 __FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
412 * Add needed include to regs.h (NOT the gcc header) on VxWorks
416 hackname = AAB_vxworks_regs_vxtypes;
418 mach = "*-*-vxworks*";
420 replace = <<- _EndOfHeader_
423 #include <types/vxTypesOld.h>
424 #include_next <arch/../regs.h>
430 * Make VxWorks stdint.h a bit more compliant - add typedefs
433 hackname = AAB_vxworks_stdint;
435 mach = "*-*-vxworks*";
437 replace = <<- _EndOfHeader_
440 /* get int*_t, uint*_t */
441 #include <types/vxTypes.h>
443 /* get legacy vxworks types for compatibility */
444 #include <types/vxTypesOld.h>
446 typedef long intptr_t;
447 typedef unsigned long uintptr_t;
449 typedef int64_t intmax_t;
450 typedef uint64_t uintmax_t;
452 typedef int8_t int_least8_t;
453 typedef int16_t int_least16_t;
454 typedef int32_t int_least32_t;
455 typedef int64_t int_least64_t;
457 typedef uint8_t uint_least8_t;
458 typedef uint16_t uint_least16_t;
459 typedef uint32_t uint_least32_t;
460 typedef uint64_t uint_least64_t;
462 typedef int8_t int_fast8_t;
463 typedef int int_fast16_t;
464 typedef int32_t int_fast32_t;
465 typedef int64_t int_fast64_t;
467 typedef uint8_t uint_fast8_t;
468 typedef unsigned int uint_fast16_t;
469 typedef uint32_t uint_fast32_t;
470 typedef uint64_t uint_fast64_t;
473 #define UINT8_MAX (~(uint8_t)0)
475 #define UINT16_MAX (~(uint16_t)0)
477 #define UINT32_MAX (~(uint32_t)0)
479 #define UINT64_MAX (~(uint64_t)0)
482 #define UINTPTR_MAX (~(uintptr_t)0)
483 #define UINTPTR_MIN 0
485 /* Need to do int_fast16_t as well, as type
486 size may be architecture dependent */
487 #define UINT_FAST16_MAX (~(uint_fast16_t)0)
488 #define UINT_FAST16_MAX 0
490 #define INT8_MAX (UINT8_MAX>>1)
491 #define INT8_MIN (INT8_MAX+1)
492 #define INT16_MAX (UINT16_MAX>>1)
493 #define INT16_MIN (INT16_MAX+1)
494 #define INT32_MAX (UINT32_MAX>>1)
495 #define INT32_MIN (INT32_MAX+1)
496 #define INT64_MAX (UINT64_MAX>>1)
497 #define INT64_MIN (INT64_MAX+1)
499 #define INTPTR_MAX (UINTPTR_MAX>>1)
500 #define INTPTR_MIN (INTPTR_MAX+1)
502 #define INT_FAST16_MAX (UINT_FAST16_MAX>>1)
503 #define INT_FAST16_MIN (INT_FAST16_MAX+1)
505 /* now define equiv. constants */
506 #define UINT_FAST8_MAX UINT8_MAX
507 #define UINT_FAST8_MIN UINT_FAST8_MIN
508 #define INT_FAST8_MAX INT8_MAX
509 #define INT_FAST8_MIN INT8_MIN
510 #define UINT_FAST32_MAX UINT32_MAX
511 #define UINT_FAST32_MIN UINT32_MIN
512 #define INT_FAST32_MAX INT32_MAX
513 #define INT_FAST32_MIN INT32_MIN
514 #define UINT_FAST64_MAX UINT64_MAX
515 #define UINT_FAST64_MIN UINT64_MIN
516 #define INT_FAST64_MAX INT64_MAX
517 #define INT_FAST64_MIN INT64_MIN
519 #define UINT_LEAST8_MAX UINT8_MAX
520 #define UINT_LEAST8_MIN UINT8_MIN
521 #define INT_LEAST8_MAX INT8_MAX
522 #define INT_LEAST8_MIN INT8_MIN
523 #define UINT_LEAST16_MAX UINT16_MAX
524 #define UINT_LEAST16_MIN UINT16_MIN
525 #define INT_LEAST16_MAX INT16_MAX
526 #define INT_LEAST16_MIN INT16_MIN
527 #define UINT_LEAST32_MAX UINT32_MAX
528 #define UINT_LEAST32_MIN UINT32_MIN
529 #define INT_LEAST32_MAX INT32_MAX
530 #define INT_LEAST32_MIN INT32_MIN
531 #define UINT_LEAST64_MAX UINT64_MAX
532 #define UINT_LEAST64_MIN UINT64_MIN
533 #define INT_LEAST64_MAX INT64_MAX
534 #define INT_LEAST64_MIN INT64_MIN
536 #define UINTMAX_MAX UINT64_MAX
537 #define UINTMAX_MIN UINT64_MIN
538 #define INTMAX_MAX INT64_MAX
539 #define INTMAX_MIN INT64_MIN
546 * This hack makes makes unistd.h more POSIX-compliant on VxWorks
549 hackname = AAB_vxworks_unistd;
551 mach = "*-*-vxworks*";
553 replace = <<- _EndOfHeader_
556 #include_next <unistd.h>
559 #define STDIN_FILENO 0
561 #ifndef STDOUT_FILENO
562 #define STDOUT_FILENO 1
564 #ifndef STDERR_FILENO
565 #define STDERR_FILENO 2
567 #endif /* _UNISTD_H */
572 * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
573 * which only is provided by AIX xlc C99.
576 hackname = aix_complex;
579 select = "#define[ \t]_Complex_I[ \t]__I";
581 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
582 test_text = "#define _Complex_I __I\n";
586 * malloc.h on AIX6 uses XLC++ specific builtin syntax
589 hackname = aix_malloc;
592 select = "#ifdef __cplusplus";
594 c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
595 test_text = "#ifdef __cplusplus";
599 * net/if_arp.h defines a variable fc_softc instead of adding a
600 * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
603 hackname = aix_net_if_arp;
605 files = "net/if_arp.h";
606 select = "^struct fc_softc \\{";
608 c_fix_arg = "typedef struct _fc_softc {";
609 test_text = "struct fc_softc {\n int a;\n};";
613 * Fix AIX definition of NULL for G++.
618 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
619 time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h;
621 select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*";
623 c_fix_arg = <<- _EOFix_
628 #else /* ! __GNUG__ */
630 #endif /* __GNUG__ */
631 #else /* ! __cplusplus */
632 #define NULL ((void *)0)
633 #endif /* __cplusplus */
636 test_text = "# define\tNULL \t(0L) /* typed NULL */";
640 * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER,
641 * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough
645 hackname = aix_once_init_1;
648 select = "#define[ \t]PTHREAD_ONCE_INIT \\\\\n"
651 c_fix_arg = "#define PTHREAD_ONCE_INIT \\\n"
653 test_text = "#define PTHREAD_ONCE_INIT \\\\\n"
658 hackname = aix_once_init_2;
661 select = "[ \t]0 \\\\\n"
664 c_fix_arg = " 0 \\\n"
666 test_text = " 0 \\\\\n"
671 hackname = aix_mutex_initializer_1;
674 select = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n"
677 c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n"
679 test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
684 hackname = aix_cond_initializer_1;
687 select = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n"
690 c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n"
692 test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n"
697 hackname = aix_rwlock_initializer_1;
700 select = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n"
703 c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n"
705 test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
710 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
711 * which violates a requirement of ISO C.
714 hackname = aix_pthread;
716 select = "(#define [A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
719 test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
720 "{...init stuff...}";
724 * AIX stdint.h fixes.
727 hackname = aix_stdint_1;
729 files = stdint-aix.h, stdint.h;
730 select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
731 "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
733 c_fix_arg = "#define UINT8_MAX (255)\n"
734 "#define UINT16_MAX (65535)";
735 test_text = "#define UINT8_MAX (255U)\n"
736 "#define UINT16_MAX (65535U)";
743 hackname = aix_stdint_2;
745 files = stdint-aix.h, stdint.h;
746 select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
747 "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
748 "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
750 "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
751 "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
752 "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
754 c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
755 "#define INTPTR_MAX 9223372036854775807L\n"
756 "#define UINTPTR_MAX 18446744073709551615UL\n"
758 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
759 "#define INTPTR_MAX 2147483647L\n"
760 "#define UINTPTR_MAX 4294967295UL";
761 test_text = "#define INTPTR_MIN INT64_MIN\n"
762 "#define INTPTR_MAX INT64_MAX\n"
763 "#define UINTPTR_MAX UINT64_MAX\n"
765 "#define INTPTR_MIN INT32_MIN\n"
766 "#define INTPTR_MAX INT32_MAX\n"
767 "#define UINTPTR_MAX UINT32_MAX";
774 hackname = aix_stdint_3;
776 files = stdint-aix.h, stdint.h;
777 select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
778 "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
780 "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
781 "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
783 c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
784 "#define PTRDIFF_MAX 9223372036854775807L\n"
786 "#define PTRDIFF_MIN (-2147483647L - 1)\n"
787 "#define PTRDIFF_MAX 2147483647L";
788 test_text = "#define PTRDIFF_MIN INT64_MIN\n"
789 "#define PTRDIFF_MAX INT64_MAX\n"
791 "#define PTRDIFF_MIN INT32_MIN\n"
792 "#define PTRDIFF_MAX INT32_MAX";
799 hackname = aix_stdint_4;
801 files = stdint-aix.h, stdint.h;
802 select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
804 "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
806 c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
808 "#define SIZE_MAX 4294967295UL";
809 test_text = "#define SIZE_MAX UINT64_MAX\n"
811 "#define SIZE_MAX UINT32_MAX";
818 hackname = aix_stdint_5;
820 files = stdint-aix.h, stdint.h;
821 select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
822 "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
824 c_fix_arg = "#define UINT8_C(c) c\n"
825 "#define UINT16_C(c) c";
826 test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
827 "#define UINT16_C(c) __CONCAT__(c,U)";
831 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
832 * in an otherwise harmless (and #ifed out) macro definition
835 hackname = aix_sysmachine;
836 files = sys/machine.h;
840 test_text = "#define FOO \\\n"
841 " bar \\ \n baz \\ \n bat";
845 * sys/wait.h on AIX 5.2 defines macros that have both signed and
846 * unsigned types in conditional expressions.
849 hackname = aix_syswait_2;
851 select = '\? (\
(\
(\
(\
(unsigned
[^
)]*\
)[^
)]*\
) >> [^
)]*\
) \
& 0xff\
) : -1)';
853 c_fix_arg = "? (int)%1";
854 test_text = "#define WSTOPSIG(__x) "
855 "(int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
859 * sys/signal.h on some versions of AIX uses volatile in the typedef of
860 * sig_atomic_t, which causes gcc to generate a warning about duplicate
861 * volatile when a sig_atomic_t variable is declared volatile, as
862 * required by ANSI C.
865 hackname = aix_volatile;
866 files = sys/signal.h;
867 select = "typedef volatile int sig_atomic_t";
869 c_fix_arg = "typedef int sig_atomic_t";
870 test_text = "typedef volatile int sig_atomic_t;";
874 * Fix __assert declaration in assert.h on Alpha OSF/1.
877 hackname = alpha___assert;
879 select = '__assert\
(char \
*, char \
*, int\
)';
881 c_fix_arg = "__assert(const char *, const char *, int)";
882 test_text = 'extern void
__assert(char
*, char
*, int
);';
886 * Fix assert macro in assert.h on Alpha OSF/1.
887 * The superfluous int cast breaks C++.
890 hackname = alpha_assert;
892 select = "(#[ \t]*" 'define assert\
(EX\
).*)\
(\
(int\
) \
(EX\
)\
)';
894 c_fix_arg = "%1(EX)";
895 test_text = '#define
assert(EX
) (((int
) (EX
)) ?
(void
)0 '
896 ': __assert(#EX
, __FILE__
, __LINE__
))';
900 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
903 hackname = alpha_getopt;
906 select = 'getopt\
(int
, char \
*\
[\
], *char \
*\
)';
908 c_fix_arg = "getopt(int, char *const[], const char *)";
909 test_text = 'extern int
getopt(int
, char
*[], char *)
;';
913 * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
916 hackname = alpha_if_semicolon;
918 select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
920 c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
921 test_text = ' struct sockaddr vmif_paddr
/* protocol address
*/';
925 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
928 hackname = alpha_parens;
930 select = '#ifndef\
(__mips64\
)';
932 c_fix_arg = "#ifndef __mips64";
933 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
937 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
941 hackname = alpha_sbrk;
943 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
945 c_fix_arg = "void *sbrk(";
946 test_text = "extern char* sbrk(ptrdiff_t increment);";
950 * For C++, avoid any typedef or macro definition of bool,
951 * and use the built in type instead.
952 * HP/UX 10.20 also has it in curses_colr/curses.h.
955 hackname = avoid_bool_define;
957 files = curses_colr/curses.h;
961 select = "#[ \t]*define[ \t]+bool[ \t]";
962 bypass = "__cplusplus";
965 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
966 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
968 test_text = "# define bool\t char \n";
975 hackname = avoid_bool_type;
977 files = curses_colr/curses.h;
981 select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
982 bypass = "__cplusplus";
985 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
987 test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
991 * For C++, avoid any typedef definition of wchar_t,
992 * and use the built in type instead.
993 * Don't do this for headers that are smart enough to do the right
994 * thing (recent
[n
]curses.h and Xlib.h
).
995 * Don
't do it for <linux/nls.h> which is never used from C++ anyway,
996 * and will be broken by the edit.
1000 hackname = avoid_wchar_t_type;
1002 select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
1003 bypass = "__cplusplus";
1004 bypass = "_LINUX_NLS_H";
1005 bypass = "XFree86: xc/lib/X11/Xlib\\.h";
1008 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1010 test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
1014 * Fix `typedef struct term;' on hppa1.1
-hp
-hpux9.
1017 hackname
= bad_struct_term
;
1019 select
= "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
1021 c_fix_arg
= "struct term;";
1023 test_text
= 'typedef struct term;';
1027 * Fix one other error in this file
:
1028 * a mismatched quote not inside a C comment.
1031 hackname
= badquote
;
1032 files
= sundev
/vuid_event.h
;
1035 c_fix_arg
= "does not";
1037 test_text
= "/* doesn't have matched single quotes */";
1041 * check for broken assert.h that needs stdio.h
1044 hackname
= broken_assert_stdio
;
1047 bypass
= "include.*stdio\\.h";
1049 c_fix_arg
= "#include <stdio.h>\n";
1050 test_text
= "extern FILE* stderr;";
1054 * check for broken assert.h that needs stdlib.h
1057 hackname
= broken_assert_stdlib
;
1059 select
= 'exit *\(|abort *\(';
1060 bypass
= "include.*stdlib\\.h";
1062 c_fix_arg
= "#ifdef __cplusplus\n"
1063 "#include <stdlib.h>\n"
1065 test_text
= "extern void exit ( int );";
1069 * Remove `extern double cabs
' declarations from math.h.
1070 * This conflicts with C99. Discovered on AIX.
1071 * Darwin hides its broken cabs in architecture-specific subdirs.
1074 hackname = broken_cabs;
1075 files = math.h, "architecture/*/math.h";
1076 select = "^extern[ \t]+double[ \t]+cabs";
1078 sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
1079 sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
1081 test_text = "#ifdef __STDC__\n"
1082 "extern double cabs(struct dbl_hypot);\n"
1084 "extern double cabs();\n"
1086 "extern double cabs ( _Complex z );";
1090 * Fixup Darwin's broken check for __builtin_nanf.
1093 hackname
= broken_nan
;
1095 * It is tempting to omit the first
"files" entry. Do not.
1096 * The testing machinery will take the first
"files" entry as the name
1097 * of a test file to play with. It would be a nuisance to have a directory
1098 * with the name
"*".
1100 files
= "architecture/ppc/math.h";
1101 files
= "architecture/*/math.h";
1102 select
= '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)';
1105 c_fix_arg
= "#if 1";
1106 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 * Fix various macros used to define ioctl numbers.
1130 * The traditional syntax was
:
1132 * #define
_CTRL(n
, x
) (('n'<<8)+x
)
1133 * #define TCTRLCFOO
_CTRL(T
, 1)
1135 * but this does not work with the C standard
, which disallows macro
1136 * expansion inside strings. We have to rewrite it thus
:
1138 * #define
_CTRL(n
, x
) ((n
<<8)+x
)
1139 * #define TCTRLCFOO
_CTRL('T', 1)
1141 * The select expressions match too much
, but the c_fix code is cautious.
1143 * CTRL might be
: CTRL _CTRL ISCTRL BSD43_CTRL ...
1146 hackname
= ctrl_quotes_def
;
1147 select
= "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
1148 c_fix
= char_macro_def
;
1152 * This is two tests in order to ensure that the
"CTRL(c)" can
1153 * be selected in isolation from the multi
-arg format
1155 test_text
= "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n";
1156 test_text
= "#define _CTRL(c) ('c'&037)";
1160 * Fix various macros used to define ioctl numbers.
1163 hackname
= ctrl_quotes_use
;
1164 select
= "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1165 c_fix
= char_macro_use
;
1167 test_text
= "#define TCTRLFOO BSD43_CTRL(T, 1)";
1171 * sys
/mman.h on HP
/UX is not C
++ ready
,
1172 * even though NO_IMPLICIT_EXTERN_C is defined on HP
/UX.
1174 * rpc
/types.h on OSF1
/2.0 is not C
++ ready
,
1175 * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
1177 * The problem is the declaration of malloc.
1180 hackname
= cxx_unready
;
1182 files
= rpc
/types.h
;
1183 select
= '[^#]+malloc.*;'; /* Catch any form of declaration
1184 not within a macro.
*/
1185 bypass
= '"C"|__BEGIN_DECLS';
1188 c_fix_arg
= "#ifdef __cplusplus\n"
1191 c_fix_arg
= "#ifdef __cplusplus\n"
1194 test_text
= "extern void* malloc( size_t );";
1198 * For the AAB_darwin7_9_long_double_funcs fix to be useful
,
1199 * you have to not use
"" includes.
1202 hackname
= darwin_9_long_double_funcs_2
;
1203 mach
= "*-*-darwin7.9*";
1205 select
= '#include[ \t]+\"';
1207 c_fix_arg
= "%1<%2.h>";
1209 c_fix_arg
= '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
1211 test_text
= '#include "architecture/ppc/math.h"';
1215 * On darwin8 and earlier
, mach
-o
/swap.h isn
't properly guarded
1216 * by 'extern
"C"'. On darwin7 some mach/ headers aren't properly guarded.
1219 hackname
= darwin_externc
;
1220 mach
= "*-*-darwin*";
1221 files
= mach
-o
/swap.h
;
1222 files
= mach
/mach_time.h
;
1223 files
= mach
/mach_traps.h
;
1224 files
= mach
/message.h
;
1226 files
= mach
/semaphore.h
;
1227 bypass
= "extern \"C\"";
1228 bypass
= "__BEGIN_DECLS";
1230 c_fix_arg
= "#ifdef __cplusplus\n"
1233 c_fix_arg
= "#ifdef __cplusplus\n"
1236 test_text
= "extern void swap_fat_header();\n";
1240 * AvailabilityMacros.h on Darwin breaks with GCC
4.0, because of
1241 * bad __GNUC__ tests.
1244 hackname
= darwin_gcc4_breakage
;
1245 mach
= "*-*-darwin*";
1246 files
= AvailabilityMacros.h
;
1247 select
= "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
1249 c_fix_arg
= "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
1250 test_text
= "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
1251 "(__GNUC_MINOR__ >= 1)\n";
1255 * __private_extern__ doesn
't exist in FSF GCC. Even if it did,
1256 * why would you ever put it in a system header file?
1259 hackname = darwin_private_extern;
1260 mach = "*-*-darwin*";
1261 files = mach-o/dyld.h;
1262 select = "__private_extern__ [a-z_]+ _dyld_";
1264 c_fix_arg = "extern";
1265 c_fix_arg = "__private_extern__";
1266 test_text = "__private_extern__ int _dyld_func_lookup(\n"
1267 "const char *dyld_func_name,\n"
1268 "unsigned long *address);\n";
1272 * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
1273 * unsigned constants.
1276 hackname = darwin_stdint_1;
1277 mach = "*-*-darwin*";
1278 files = stdint-darwin.h, stdint.h;
1280 c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
1281 select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
1282 "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
1283 test_text = "#define UINT8_C(v) (v ## U)\n"
1284 "#define UINT16_C(v) (v ## U)";
1288 * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
1292 hackname = darwin_stdint_2;
1293 mach = "*-*-darwin*";
1294 files = stdint-darwin.h, stdint.h;
1296 c_fix_arg = "#if __WORDSIZE == 64\n"
1297 "#define INTPTR_MAX 9223372036854775807L\n"
1298 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1300 "#define INTPTR_MAX 2147483647L\n"
1301 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1303 select = "#if __WORDSIZE == 64\n"
1304 "#define INTPTR_MIN[ \t]+INT64_MIN\n"
1305 "#define INTPTR_MAX[ \t]+INT64_MAX\n"
1307 "#define INTPTR_MIN[ \t]+INT32_MIN\n"
1308 "#define INTPTR_MAX[ \t]+INT32_MAX\n"
1310 test_text = "#if __WORDSIZE == 64\n"
1311 "#define INTPTR_MIN INT64_MIN\n"
1312 "#define INTPTR_MAX INT64_MAX\n"
1314 "#define INTPTR_MIN INT32_MIN\n"
1315 "#define INTPTR_MAX INT32_MAX\n"
1320 * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
1323 hackname = darwin_stdint_3;
1324 mach = "*-*-darwin*";
1325 files = stdint-darwin.h, stdint.h;
1327 c_fix_arg = "#if __WORDSIZE == 64\n"
1328 "#define UINTPTR_MAX 18446744073709551615UL\n"
1330 "#define UINTPTR_MAX 4294967295UL\n"
1332 select = "#if __WORDSIZE == 64\n"
1333 "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
1335 "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
1337 test_text = "#if __WORDSIZE == 64\n"
1338 "#define UINTPTR_MAX UINT64_MAX\n"
1340 "#define UINTPTR_MAX UINT32_MAX\n"
1345 * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
1348 hackname = darwin_stdint_4;
1349 mach = "*-*-darwin*";
1350 files = stdint-darwin.h, stdint.h;
1352 c_fix_arg = "#if __WORDSIZE == 64\n"
1353 "#define SIZE_MAX 18446744073709551615UL\n"
1355 "#define SIZE_MAX 4294967295UL\n"
1357 select = "#if __WORDSIZE == 64\n"
1358 "#define SIZE_MAX[ \t]+UINT64_MAX\n"
1360 "#define SIZE_MAX[ \t]+UINT32_MAX\n"
1362 test_text = "#if __WORDSIZE == 64\n"
1363 "#define SIZE_MAX UINT64_MAX\n"
1365 "#define SIZE_MAX UINT32_MAX\n"
1370 * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
1371 * with a wrong type.
1374 hackname = darwin_stdint_5;
1375 mach = "*-*-darwin*";
1376 files = stdint-darwin.h, stdint.h;
1378 c_fix_arg = "#if __WORDSIZE == 64\n"
1379 "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
1380 "#define INTMAX_MAX 9223372036854775807L\n"
1381 "#define UINTMAX_MAX 18446744073709551615UL\n"
1383 "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
1384 "#define INTMAX_MAX 9223372036854775807LL\n"
1385 "#define UINTMAX_MAX 18446744073709551615ULL\n"
1387 select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
1388 "#define INTMAX_MAX[ \t]+INT64_MAX\n"
1390 "#define UINTMAX_MAX[ \t]+UINT64_MAX";
1391 test_text = "#define INTMAX_MIN INT64_MIN\n"
1392 "#define INTMAX_MAX INT64_MAX\n"
1394 "#define UINTMAX_MAX UINT64_MAX";
1398 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1399 * with a wrong type.
1402 hackname = darwin_stdint_6;
1403 mach = "*-*-darwin*";
1404 files = stdint-darwin.h, stdint.h;
1406 c_fix_arg = "#if __WORDSIZE == 64\n"
1407 "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
1408 "#define PTRDIFF_MAX 9223372036854775807L\n"
1410 "#define PTRDIFF_MIN (-2147483647 - 1)\n"
1411 "#define PTRDIFF_MAX 2147483647\n"
1413 select = "#if __WORDSIZE == 64\n"
1414 "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
1415 "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
1417 "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
1418 "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
1420 test_text = "#if __WORDSIZE == 64\n"
1421 "#define PTRDIFF_MIN INT64_MIN\n"
1422 "#define PTRDIFF_MAX INT64_MAX\n"
1424 "#define PTRDIFF_MIN INT32_MIN\n"
1425 "#define PTRDIFF_MAX INT32_MAX\n"
1430 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1431 * with a wrong type.
1434 hackname = darwin_stdint_7;
1435 mach = "*-*-darwin*";
1436 files = stdint-darwin.h, stdint.h;
1438 c_fix_arg = "#if __WORDSIZE == 64\n"
1439 "#define INTMAX_C(v) (v ## L)\n"
1440 "#define UINTMAX_C(v) (v ## UL)\n"
1442 "#define INTMAX_C(v) (v ## LL)\n"
1443 "#define UINTMAX_C(v) (v ## ULL)\n"
1445 select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
1446 "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
1447 test_text = "#define INTMAX_C(v) (v ## LL)\n"
1448 "#define UINTMAX_C(v) (v ## ULL)";
1452 * Fix <c_asm.h> on Digital UNIX V4.0:
1453 * It contains a prototype for a DEC C internal asm() function,
1454 * clashing with gcc's asm keyword. So protect this with __DECC.
1457 hackname
= dec_intern_asm
;
1459 sed
= "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1460 sed
= "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
1464 " ... asm stuff ...\n"
1465 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
1469 * Fix typo in
<wchar.h
> on DJGPP
2.03.
1472 hackname
= djgpp_wchar_h
;
1474 select
= "__DJ_wint_t";
1475 bypass
= "sys/djtypes.h";
1477 c_fix_arg
= "%0\n#include <sys/djtypes.h>";
1478 c_fix_arg
= "#include <stddef.h>";
1479 test_text
= "#include <stddef.h>\n"
1480 "extern __DJ_wint_t x;\n";
1484 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1487 hackname
= ecd_cursor
;
1488 files
= "sunwindow/win_lock.h";
1489 files
= "sunwindow/win_cursor.h";
1490 select
= 'ecd\.cursor';
1492 c_fix_arg
= 'ecd_cursor';
1494 test_text
= "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1498 * Between
8/24/1998 and
2/17/2001, FreeBSD system headers presume
1499 * neither the existence of GCC
3 nor its exact feature set yet break
1500 * (by design?
) when __GNUC__ is set beyond
2.
1503 hackname
= freebsd_gcc3_breakage
;
1504 mach
= "*-*-freebsd*";
1505 files
= sys
/cdefs.h
;
1506 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
1507 bypass
= '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
1509 c_fix_arg
= '%0 || __GNUC__ >= 3';
1510 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
1514 * Some releases of FreeBSD
4 and FreeBSD
5.0 and
5.1 system headers presume
1515 * neither the existence of GCC
4 nor its exact feature set yet break
1516 * (by design?
) when __GNUC__ is set beyond
3.
1519 hackname
= freebsd_gcc4_breakage
;
1520 mach
= "*-*-freebsd*";
1521 files
= sys
/cdefs.h
;
1522 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
1524 c_fix_arg
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
1525 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
1529 * Some versions of glibc don
't expect the C99 inline semantics.
1532 hackname = glibc_c99_inline_1;
1533 files = features.h, '*/features.h
';
1534 select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
1536 c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
1538 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
1539 && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
1540 # define __USE_EXTERN_INLINES 1
1546 * Similar, but a version that didn't have __NO_INLINE__
1549 hackname
= glibc_c99_inline_1a
;
1550 files
= features.h
, '*/features.h';
1551 select
= "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
1552 "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
1554 c_fix_arg
= "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
1556 #if
__GNUC_PREREQ (2, 7) && defined __OPTIMIZE__
&& !defined __OPTIMIZE_SIZE__
1557 # define __USE_EXTERN_INLINES
1
1563 * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
1564 * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
1565 * The remaining glibc_c99_inline_
* fixes deal with some of those headers.
1568 hackname
= glibc_c99_inline_2
;
1569 files
= sys
/stat.h
, '*/sys/stat.h';
1570 select
= "extern __inline__ int";
1571 sed
= "s/extern int \\(stat\\)/"
1572 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1573 "__inline__ int \\1/";
1574 sed
= "s/extern int \\([lf]stat\\)/"
1575 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1576 "__inline__ int \\1/";
1577 sed
= "s/extern int \\(mknod\\)/"
1578 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1579 "__inline__ int \\1/";
1580 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
1581 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1582 "__inline__ int __REDIRECT\\1 (\\2/";
1583 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
1584 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1585 "__inline__ int __REDIRECT\\1 (\\2/";
1586 sed
= "s/^extern __inline__ int/"
1587 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1590 extern int
fstat64 (int __fd
, struct stat64
*__buf
) __THROW
__nonnull ((2));
1591 extern __inline__ int
1592 __NTH (fstat64 (int __fd
, struct stat64
*__statbuf
))
1598 * glibc_c99_inline_3
1601 hackname
= glibc_c99_inline_3
;
1602 files
= bits
/string2.h
, '*/bits/string2.h';
1603 select
= "extern __inline";
1604 bypass
= "__extern_inline|__GNU_STDC_INLINE__";
1606 c_fix_arg
= "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
1607 c_fix_arg
= "^# ifdef __cplusplus$";
1610 # define __STRING_INLINE inline
1612 # define __STRING_INLINE extern __inline
1618 * glibc_c99_inline_4
1621 hackname
= glibc_c99_inline_4
;
1622 files
= sys
/sysmacros.h
, '*/sys/sysmacros.h', wchar.h
, '*/wchar.h';
1623 bypass
= "__extern_inline|__gnu_inline__";
1624 select
= "(^| )extern __inline";
1626 c_fix_arg
= "%0 __attribute__ ((__gnu_inline__))";
1628 __extension__ extern __inline unsigned int
1629 extern __inline unsigned int
1633 /* glibc
-2.3.5 defines pthread mutex initializers incorrectly
,
1634 * so we replace them with versions that correspond to the
1638 hackname
= glibc_mutex_init
;
1640 select
= '\{ *\{ *0, *\} *\}';
1641 sed
= "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
1642 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
1643 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1644 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
1645 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1646 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
1647 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1648 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
1649 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1650 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1651 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1652 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
1653 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1654 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1655 sed
= "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
1656 "N;s/^[ \t]*#[ \t]*"
1657 "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
1658 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
1660 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1663 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1665 sed
= "s/{ \\(0, 0, 0, 0, 0, 0, "
1666 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
1667 sed
= "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
1668 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
1670 test_text
= <<- _EOText_
1671 #define PTHREAD_MUTEX_INITIALIZER
\\
1674 # if __WORDSIZE
== 64
1675 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1676 { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1677 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1678 { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1679 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1680 { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1682 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1683 { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1684 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1685 { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1686 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1687 { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1690 # define PTHREAD_RWLOCK_INITIALIZER
\\
1693 # if __WORDSIZE
== 64
1694 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1695 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\
1696 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1698 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1699 { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1702 #define PTHREAD_COND_INITIALIZER
{ { 0, } }
1706 /* glibc versions before
2.5 have a version of stdint.h that defines
1707 UINT8_C and UINT16_C to produce unsigned constants
, as do uClibc
1708 versions with stdint.h based on those glibc versions.
*/
1710 hackname
= glibc_stdint
;
1712 select
= "GNU C Library";
1714 c_fix_arg
= "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
1715 c_fix_arg
= "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
1716 test_text
= "/* This file is part of the GNU C Library. */\n"
1717 "# define UINT8_C(c)\tc ## U\n"
1718 "# define UINT16_C(c)\tc ## U";
1721 /* Some versions of glibc have a version of bits
/string2.h that
1722 produces
"value computed is not used" warnings from strncpy
; fix
1723 this definition by using __builtin_strncpy instead as in newer
1726 hackname
= glibc_strncpy
;
1727 files
= bits
/string2.h
;
1728 bypass
= "__builtin_strncpy";
1730 c_fix_arg
= "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
1731 c_fix_arg
= "# define strncpy([^\n]*\\\\\n)*[^\n]*";
1733 # define
strncpy(dest
, src
, n
) \
1734 (__extension__ (__builtin_constant_p (src
) && __builtin_constant_p (n
) \\
1735 ?
(strlen (src
) + 1 >= ((size_t
) (n
)) \\
1736 ?
(char *)
memcpy (dest
, src
, n
) \\
1737 : strncpy (dest
, src
, n
)) \\
1738 : strncpy (dest
, src
, n
)))
1743 /* glibc
's tgmath.h relies on an expression that is not an integer
1744 constant expression being treated as it was by GCC 4.4 and
1747 hackname = glibc_tgmath;
1749 select = '\
(\
(\
(type\
) 0.25\
) && \
(\
(type\
) 0.25 - 1\
)\
)';
1750 bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
1752 c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || "
1753 "(__builtin_classify_type ((type) 0) == 9 && "
1754 "__builtin_classify_type (__real__ ((type) 0)) == 8))";
1755 test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
1759 * Fix these files to use the types we think they should for
1760 * ptrdiff_t, size_t, and wchar_t.
1762 * This defines the types in terms of macros predefined by our 'cpp
'.
1763 * This is supposedly necessary for glibc's handling of these types.
1764 * It
's probably not necessary for anyone else, but it doesn't hurt.
1767 hackname
= gnu_types
;
1768 files
= "sys/types.h";
1770 files
= "sys/stdtypes.h";
1774 bypass
= '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
1775 select
= "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
1777 /* The Solaris
10 headers already define these types correctly.
*/
1778 mach
= '*-*-solaris2.1[0-9]*';
1781 test_text
= "typedef long int ptrdiff_t; /* long int */\n"
1782 "typedef uint_t size_t; /* uint_t */\n"
1783 "typedef ushort_t wchar_t; /* ushort_t */";
1787 * Fix HP
& Sony
's use of "../machine/xxx.h"
1788 * to refer to: <machine/xxx.h>
1791 hackname = hp_inline;
1792 files = sys/spinlock.h;
1793 files = machine/machparam.h;
1794 select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
1797 c_fix_arg = "%1<machine
/%2.h
>";
1799 c_fix_arg = "([ \t]*#
[ \t]*include
[ \t]+)" '"\.\.
/machine
/'
1802 test_text = ' # include "..
/machine
/mumble.h
"';
1806 * Check for (...) in C++ code in HP/UX sys/file.h.
1809 hackname = hp_sysfile;
1811 select = "HPUX_SOURCE
";
1814 c_fix_arg = "(struct file
*, ...
)";
1815 c_fix_arg = '\(\.\.\.\)';
1817 test_text = "extern void
foo(...
); /* HPUX_SOURCE
- bad varargs
*/";
1821 * Un-Hide a series of five FP defines from post-1999 compliance GCC:
1822 * FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
1825 hackname = hppa_hpux_fp_macros;
1826 mach = "hppa
*-hp
-hpux11
*";
1828 select = "#
[ \t]*define
[ \t]*FP_NORMAL.
*\n"
1829 "#
[ \t]*define
[ \t]*FP_ZERO.
*\n"
1830 "#
[ \t]*define
[ \t]*FP_INFINITE.
*\n"
1831 "#
[ \t]*define
[ \t]*FP_SUBNORMAL.
*\n"
1832 "#
[ \t]*define
[ \t]*FP_NAN.
*\n";
1834 c_fix_arg = <<- _EOFix_
1835 #endif /* _INCLUDE_HPUX_SOURCE */
1837 #if defined(_INCLUDE_HPUX_SOURCE) || \
1838 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
1841 #ifdef _INCLUDE_HPUX_SOURCE
1846 "# define FP_NORMAL
0\n"
1847 "# define FP_ZERO
1\n"
1848 "# define FP_INFINITE
2\n"
1849 "# define FP_SUBNORMAL
3\n"
1850 "# define FP_NAN
4\n";
1854 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
1855 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
1858 hackname = hpux10_cpp_pow_inline;
1859 files = fixinc-test-limits.h, math.h;
1860 select = <<- END_POW_INLINE
1861 ^# +ifdef +__cplusplus
1863 +inline +double +pow\(double +__d,int +__expon\) +\{
1864 [ ]+return +pow\(__d,\(double\)__expon\);
1875 "# ifdef __cplusplus
\n"
1877 " inline double
pow(double __d
,int __expon
) {\n"
1878 "\t return
pow(__d
,(double
)__expon
);\n"
1880 ' extern "C
"' " {\n"
1886 hackname = hpux11_cpp_pow_inline;
1888 select = " +inline double pow
\\(double d
,int expon
\\) \\{\n"
1889 " +return pow
\\(d
, \\(double
\\)expon
\\);\n"
1895 " inline double
pow(double d
,int expon
) {\n"
1896 " return
pow(d
, (double
)expon
);\n"
1901 * Fix hpux 10.X missing ctype declarations 1
1904 hackname = hpux10_ctype_declarations1;
1906 select = "^#
[ \t]*define _toupper
\\(__c
\\)[ \t]*__toupper
\\(__c
\\)";
1907 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*__tolower
[ \t]*\\(";
1909 c_fix_arg = "#ifdef _PROTOTYPES
\n"
1910 "extern int
__tolower(int
);\n"
1911 "extern int
__toupper(int
);\n"
1912 "#else
/* NOT _PROTOTYPES
*/\n"
1913 "extern int
__tolower();\n"
1914 "extern int
__toupper();\n"
1915 "#endif
/* _PROTOTYPES
*/\n\n"
1918 test_text = "# define
_toupper(__c
) __toupper(__c
)\n";
1922 * Fix hpux 10.X missing ctype declarations 2
1925 hackname = hpux10_ctype_declarations2;
1927 select = "^# if defined
\\(_SB_CTYPE_MACROS
\\) && \\!defined
\\(__lint
\\)";
1928 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*_isalnum
[ \t]*\\(";
1930 c_fix_arg = "%0\n\n"
1931 "#ifdef _PROTOTYPES
\n"
1932 " extern int
_isalnum(int
);\n"
1933 " extern int
_isalpha(int
);\n"
1934 " extern int
_iscntrl(int
);\n"
1935 " extern int
_isdigit(int
);\n"
1936 " extern int
_isgraph(int
);\n"
1937 " extern int
_islower(int
);\n"
1938 " extern int
_isprint(int
);\n"
1939 " extern int
_ispunct(int
);\n"
1940 " extern int
_isspace(int
);\n"
1941 " extern int
_isupper(int
);\n"
1942 " extern int
_isxdigit(int
);\n"
1943 "# else
/* not _PROTOTYPES
*/\n"
1944 " extern int
_isalnum();\n"
1945 " extern int
_isalpha();\n"
1946 " extern int
_iscntrl();\n"
1947 " extern int
_isdigit();\n"
1948 " extern int
_isgraph();\n"
1949 " extern int
_islower();\n"
1950 " extern int
_isprint();\n"
1951 " extern int
_ispunct();\n"
1952 " extern int
_isspace();\n"
1953 " extern int
_isupper();\n"
1954 " extern int
_isxdigit();\n"
1955 "#endif
/* _PROTOTYPES
*/\n";
1957 test_text = "# if
defined(_SB_CTYPE_MACROS
) && !defined(__lint
)\n"
1958 " extern unsigned int
*__SB_masks
;\n";
1962 * Fix hpux 10.X missing stdio declarations
1965 hackname = hpux10_stdio_declarations;
1967 select = "^#
[ \t]*define _iob
[ \t]*__iob
";
1968 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*vsnprintf
[ \t]*\\(";
1970 c_fix_arg = "%0\n\n"
1971 "# if
defined(__STDC__
) ||
defined(__cplusplus
)\n"
1972 " extern int
snprintf(char
*, size_t
, const char
*, ...
);\n"
1973 " extern int
vsnprintf(char
*, size_t
, const char
*, __va_list
);\n"
1974 "# else
/* not __STDC__
) || __cplusplus
*/\n"
1975 " extern int
snprintf();\n"
1976 " extern int
vsnprintf();\n"
1977 "# endif
/* __STDC__
) || __cplusplus
*/\n";
1979 test_text = "# define _iob __iob
\n";
1983 * Make sure hpux defines abs in header.
1986 hackname = hpux11_abs;
1987 mach = "*-hp
-hpux11
*";
1989 select = "ifndef _MATH_INCLUDED
";
1991 c_fix_arg = "if
!defined(_MATH_INCLUDED
) ||
defined(__GNUG__
)";
1992 test_text = "#ifndef _MATH_INCLUDED
";
1996 * Keep HP-UX 11 from stomping on C++ math namespace
1997 * with defines for fabsf.
2000 hackname = hpux11_fabsf;
2002 select = "^
[ \t]*#
[ \t]*define
[ \t]+fabsf
\\(.
*";
2003 bypass = "__cplusplus
";
2006 c_fix_arg = "#ifndef __cplusplus
\n%0\n#endif
";
2010 "# define
fabsf(x
) ((float
)fabs((double
)(float
)(x
)))\n"
2015 * Fix C99 constant in __POINTER_SET define.
2018 hackname = hpux11_pthread_const;
2019 mach = "*-hp
-hpux11.
[0-3]*";
2020 files = sys/pthread.h;
2021 select = "^#define
[ \t]*__POINTER_SET
[ \t]*\\(\\(void
\\*\\) 1LL\\)";
2024 c_fix_arg = "#define __POINTER_SET
\t\t((void *)
1L)";
2025 test_text = "#define __POINTER_SET
\t\t((void *)
1LL)";
2029 * Prevent HP-UX 11 from defining __size_t and preventing size_t from
2030 * being defined by having it define _hpux_size_t instead.
2033 hackname = hpux11_size_t;
2034 mach = "*-hp
-hpux11
*";
2035 select = "__size_t
";
2038 c_fix_arg = "_hpux_size_t
";
2041 "#define __size_t size_t
\n"
2042 " extern int
getpwuid_r( char
*, __size_t
, struct passwd
**)
;\n";
2046 * Fix hpux 11.00 broken snprintf declaration
2047 * (third argument is char *, needs to be const char * to prevent
2048 * spurious warnings with -Wwrite-strings or in C++).
2051 hackname = hpux11_snprintf;
2053 select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
2054 ' *(char *\*, *\.\.\.\);)';
2056 c_fix_arg = '%1 const %3';
2058 test_text = "extern int
snprintf(char
*, size_t
, char
*, ...
);\n"
2059 "extern int
snprintf(char
*, __size_t
, char
*, ...
);\n"
2060 "extern int
snprintf(char
*, _hpux_size_t
, char
*, ...
);";
2064 * Fix hpux 11.00 broken vsnprintf declaration
2067 hackname = hpux11_vsnprintf;
2069 select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
2070 'const char \*,) __va__list\);';
2072 c_fix_arg = "%1 __va_list
);";
2074 test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
2079 * get rid of bogus inline definitions in HP-UX 8.0
2082 hackname = hpux8_bogus_inlines;
2085 bypass = "__GNUG__
";
2086 sed = "s@inline int
abs(int
[a
-z
][a
-z
]*)
{.
*}"
2087 "@extern
\"C
\" int
abs(int
);@
";
2088 sed = "s@inline double
abs(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2089 sed = "s@inline int
sqr(int
[a
-z
][a
-z
]*)
{.
*}@@
";
2090 sed = "s@inline double
sqr(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2091 test_text = "inline int
abs(int v
) { return (v
>=0)?v
:-v
; }\n"
2092 "inline double
sqr(double v
) { return v
**0.5; }";
2096 * Fix hpux broken ctype macros
2099 hackname = hpux_ctype_macros;
2101 select = '((: |\()__SB_masks \? )'
2102 '(__SB_masks\[__(alnum|c)\] & _IS)';
2104 c_fix_arg = "%1(int
)%3";
2106 test_text = ": __SB_masks ? __SB_masks
[__alnum
] & _ISCNTRL
\n"
2107 "# define
isalpha(__c
) (__SB_masks ? __SB_masks
[__c
] & _IS
\n";
2111 * Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
2114 hackname = hpux_htonl;
2115 files = netinet/in.h;
2116 select = "#ifndef _XOPEN_SOURCE_EXTENDED
[ \t]*\n"
2118 " \\* Macros for number representation conversion
\\.
\n"
2122 c_fix_arg = "#if
1\n%1";
2124 test_text = "#ifndef _XOPEN_SOURCE_EXTENDED
\n"
2126 " * Macros for number representation conversion.
\n"
2129 "#define
ntohl(x
) (x
)\n"
2130 "#define
ntohs(x
) (x
)\n"
2131 "#define
htonl(x
) (x
)\n"
2132 "#define
htons(x
) (x
)\n"
2134 "#endif
/* ! _XOPEN_SOURCE_EXTENDED
*/";
2141 hackname = hpux_long_double;
2142 mach = "*-*-hpux10
*";
2143 mach = "*-*-hpux11.
[012]*";
2145 select = "extern
[ \t]long_double
[ \t]strtold
";
2146 bypass = "long_double_t
";
2147 sed = "/^#
[ \t]*ifndef _LONG_DOUBLE
/,/\\/\\* _LONG_DOUBLE
\\*\\//D
";
2148 sed = "s
/long_double
/long double
/g
";
2150 test_text = "# ifndef _LONG_DOUBLE
\n"
2151 "# define _LONG_DOUBLE
\n"
2152 " typedef struct
{\n"
2153 " unsigned int word1
, word2
, word3
, word4
;\n"
2155 "# endif
/* _LONG_DOUBLE
*/\n"
2156 "extern long_double
strtold(const char
*, char
**)
;\n";
2160 * We cannot use the above rule on 11.31 because it removes the strtold
2161 * definition. ia64 is OK with no hack, PA needs some help.
2164 hackname = hpux_long_double_2;
2165 mach = "hppa
*-*-hpux11.3
*";
2167 select = "#
[ \t]*if
[ \t]*!defined
\\(__ia64
\\) \\|
\\|
"
2168 "defined
\\(_PROTOTYPES
\\) \\|
\\|
"
2169 "defined
\\(_LONG_DOUBLE_STRUCT
\\)";
2171 c_fix_arg = "# if
!defined(_PROTOTYPES
) ||
defined(_LONG_DOUBLE_STRUCT
)";
2173 test_text = "# if
!defined(__ia64
) ||
"
2174 "!defined(_PROTOTYPES
) ||
"
2175 "defined(_LONG_DOUBLE_STRUCT
)\n";
2179 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2182 hackname = hpux_systime;
2184 select = "^extern struct sigevent
;";
2187 c_fix_arg = "struct sigevent
;";
2189 test_text = 'extern struct sigevent;';
2193 * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
2194 * type and mpinfou is only defined when _KERNEL is set.
2197 hackname = hpux_spu_info;
2198 mach = "*-hp
-hpux
*";
2200 * It is tempting to omit the first "files
" entry. Do not.
2201 * The testing machinery will take the first "files
" entry as the name
2202 * of a test file to play with. It would be a nuisance to have a directory
2203 * with the name "*".
2205 files = "ia64
/sys
/getppdp.h
";
2206 files = "*/sys
/getppdp.h
";
2207 select = "^.
*extern.
*spu_info.
*";
2210 c_fix_arg = "#ifdef _KERNEL
\n%0\n#endif
";
2212 test_text = "extern union mpinfou spu_info
[];";
2216 hackname = hpux11_extern_sendfile;
2217 mach = "*-hp
-hpux11.
[12]*";
2218 files = sys/socket.h;
2219 select = "^
[ \t]*extern sbsize_t sendfile.
*\n.
*, int
\\)\\);\n";
2221 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2222 test_text = " extern sbsize_t sendfile
__((int
, int
, off_t
, bsize_t
,\n"
2223 " const struct iovec
*, int
));\n";
2227 hackname = hpux11_extern_sendpath;
2228 mach = "*-hp
-hpux11.
[12]*";
2229 files = sys/socket.h;
2230 select = "^
[ \t]*extern sbsize_t sendpath.
*\n.
*, int
\\)\\);\n";
2232 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2233 test_text = " extern sbsize_t sendpath
__((int
, int
, off_t
, bsize_t
,\n"
2234 " const struct iovec
*, int
));\n";
2238 hackname = hpux_extern_errno;
2239 mach = "*-hp
-hpux10.
*";
2240 mach = "*-hp
-hpux11.
[0-2]*";
2242 select = "^
[ \t]*extern int errno
;$
";
2244 c_fix_arg = "#ifdef __cplusplus
\n"
2248 "#ifdef __cplusplus
\n"
2251 test_text = " extern int errno
;\n";
2255 * Add missing braces to pthread initializer defines.
2258 hackname = hpux_pthread_initializers;
2259 mach = "*-hp
-hpux11.
[0-3]*";
2260 files = sys/pthread.h;
2261 sed = "s@^
[ \t]*1, 1, 1, 1,[ \t]*\\\\"
2262 "@
\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@
";
2263 sed = "s@^
[ \t]*1,[ \t]*\\\\"
2265 sed = "/^
[ \t]*0$
/d
";
2266 sed = "s@__PTHREAD_MUTEX_VALID
, 0"
2267 "@
{ __PTHREAD_MUTEX_VALID
, 0 }@
";
2268 sed = "s@^
[ \t]*0, 0, -1, 0,[ \t]*\\\\"
2269 "@
\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@
";
2270 sed = "s@
0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2271 "@
{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2272 sed = "s@^
[ \t]*__LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2273 "@
\t{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2274 sed = "s@^
[ \t]*0, 0[ \t]*\\\\"
2275 "@
\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@
";
2276 sed = "s@__PTHREAD_COND_VALID
, 0"
2277 "@
{ __PTHREAD_COND_VALID
, 0 }@
";
2278 sed = "s@__LWP_COND_VALID
, 0,[ \t]*\\\\"
2279 "@
{ __LWP_COND_VALID
, 0 },\t\t\t\t\t\\\\@
";
2280 sed = "s@__PTHREAD_RWLOCK_VALID
, 0"
2281 "@
{ __PTHREAD_RWLOCK_VALID
, 0 }@
";
2282 sed = "s@__LWP_RWLOCK_VALID
, 0,[ \t]*\\\\"
2283 "@
{ __LWP_RWLOCK_VALID
, 0 },\t\t\t\t\t\\\\@
";
2284 sed = "s@^
[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
2285 "@
\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@
";
2286 test_text = "#define PTHREAD_MUTEX_INITIALIZER
{\t\t\t\t\t\\\\\n"
2287 "\t__PTHREAD_MUTEX_VALID
, 0,\t\t\t\t\t\\\\\n"
2288 "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE
),\t\t\\\\\n"
2289 "\t__SPNLCK_INITIALIZER
,\t\t\t\t\t\t\\\\\n"
2290 "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
2291 "\t0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
2292 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
2297 hackname = hpux_c99_intptr;
2298 mach = "*-hp
-hpux11.3
*";
2299 files = stdint-hpux11.h, stdint.h;
2300 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MAX
[ \t]*"
2301 "INT32_MAX
[ \t]*$@#define
PTRDIFF_MAX (2147483647l)@
";
2302 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MIN
[ \t]*"
2303 "INT32_MIN
[ \t]*$@#define
PTRDIFF_MIN (-PTRDIFF_MAX
- 1)@
";
2304 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MAX
[ \t]*"
2305 "INT32_MAX
[ \t]*$@#define
INTPTR_MAX (2147483647l)@
";
2306 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MIN
[ \t]*"
2307 "INT32_MIN
[ \t]*$@#define
INTPTR_MIN (-INTPTR_MAX
- 1)@
";
2308 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINTPTR_MAX
[ \t]*"
2309 "UINT32_MAX
[ \t]*$@#define
UINTPTR_MAX (4294967295ul)@
";
2310 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*SIZE_MAX
[ \t]*"
2311 "UINT32_MAX
[ \t]*$@#define
SIZE_MAX (4294967295ul)@
";
2312 test_text = "#define PTRDIFF_MAX INT32_MAX
\n"
2313 "#define PTRDIFF_MIN INT32_MIN
\n"
2314 "#define INTPTR_MAX INT32_MAX
\n"
2315 "#define INTPTR_MIN INT32_MIN
\n"
2316 "#define UINTPTR_MAX UINT32_MAX
\n"
2317 "#define SIZE_MAX UINT32_MAX
\n";
2321 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2325 hackname = hpux_c99_inttypes;
2326 mach = "*-hp
-hpux11.
[23]*";
2328 files = stdint-hpux11.h, stdint.h;
2329 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*"
2330 "__CONCAT_U__(__c
)[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2331 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*"
2332 "__CONCAT_U__(__c
)[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2333 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT32_C(__c
)[ \t]*"
2334 "__CONCAT__(__c
,l
)[ \t]*$@#define
INT32_C(__c
) (__c
)@
";
2335 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT32_C(__c
)[ \t].
*$@
"
2336 "#define
UINT32_C(__c
) __CONCAT__(__c
,u
)@
";
2337 test_text = "#define
UINT8_C(__c
) __CONCAT_U__(__c
)\n"
2338 "#define
UINT16_C(__c
) __CONCAT_U__(__c
)\n"
2339 "#define
INT32_C(__c
) __CONCAT__(__c
,l
)\n"
2340 "#define
UINT32_C(__c
) __CONCAT__(__c
,ul
)\n";
2344 hackname = hpux_c99_inttypes2;
2345 mach = "*-hp
-hpux11.2
*";
2346 files = stdint-hpux11.h, stdint.h;
2347 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT8_C(__c
)[ \t]*"
2348 "((signed char
)(__c
))[ \t]*$@#define
INT8_C(__c
) (__c
)@
";
2349 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*"
2350 "((unsigned char
)(__c
))[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2351 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT16_C(__c
)[ \t]*"
2352 "((short
)(__c
))[ \t]*$@#define
INT16_C(__c
) (__c
)@
";
2353 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*"
2354 "((unsigned short
)(__c
))[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2355 test_text = "# define
INT8_C(__c
) ((signed char
)(__c
))\n"
2356 "# define
UINT8_C(__c
) ((unsigned char
)(__c
))\n"
2357 "# define
INT16_C(__c
) ((short
)(__c
))\n"
2358 "# define
UINT16_C(__c
) ((unsigned short
)(__c
))\n";
2362 hackname = hpux_stdint_least_fast;
2363 mach = "*-hp
-hpux11.2
*";
2364 files = stdint-hpux11.h, stdint.h;
2366 "^
[ \t]*#
[ \t]*define
[ \t]+UINT_(LEAST|FAST
)64_MAX
[ \t]+ULLONG_MAX
";
2368 c-fix-arg = "# define UINT_
%164_MAX __UINT64_MAX__
";
2369 test-text = "# define UINT_FAST64_MAX ULLONG_MAX
\n"
2370 "# define UINT_LEAST64_MAX ULLONG_MAX
\n";
2375 hackname = hpux_inttype_int8_t;
2376 mach = "*-hp
-hpux1
[01].
*";
2377 files = sys/_inttypes.h;
2378 select = "^
[ \t]*typedef
[ \t]*char
[ \t]*int(_least
){0,1}8_t.
*";
2380 c_fix_arg = "typedef signed char int
%18_t
;";
2381 test_text = "typedef char int_least8_t
;\n"
2382 "typedef char int8_t
;\n";
2386 hackname = hpux_imaginary_i;
2387 mach = "ia64
-hp
-hpux11.
*";
2389 select = "^
[ \t]*#
[ \t]*define
[ \t]*_Complex_I.
*";
2391 c_fix_arg = "#define
_Complex_I (__extension__
1.0iF
)";
2392 test_text = "#define
_Complex_I (0.f
+_Imaginary_I
)\n";
2396 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
2399 hackname = huge_val_hex;
2400 files = bits/huge_val.h;
2401 select = "^#
[ \t]*define
[ \t]*HUGE_VAL
[ \t].
*0x1\\.0p.
*";
2402 bypass = "__builtin_huge_val
";
2405 c_fix_arg = "#define
HUGE_VAL (__builtin_huge_val())\n";
2407 test_text = "# define HUGE_VAL
\t(__extension__
0x1.0p2047
)";
2411 * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
2414 hackname = huge_valf_hex;
2415 files = bits/huge_val.h;
2416 select = "^#
[ \t]*define
[ \t]*HUGE_VALF
[ \t].
*0x1\\.0p.
*";
2417 bypass = "__builtin_huge_valf
";
2420 c_fix_arg = "#define
HUGE_VALF (__builtin_huge_valf())\n";
2422 test_text = "# define
HUGE_VALF (__extension__
0x1.0p255f
)";
2426 * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
2429 hackname = huge_vall_hex;
2430 files = bits/huge_val.h;
2431 select = "^#
[ \t]*define
[ \t]*HUGE_VALL
[ \t].
*0x1\\.0p.
*";
2432 bypass = "__builtin_huge_vall
";
2435 c_fix_arg = "#define
HUGE_VALL (__builtin_huge_vall())\n";
2437 test_text = "# define
HUGE_VALL (__extension__
0x1.0p32767L
)";
2441 * Fix return type of abort and free
2444 hackname = int_abort_free_and_exit;
2446 select = "int
[ \t]+(abort|free|exit
)[ \t]*\\(";
2447 bypass = "_CLASSIC_ANSI_TYPES
";
2450 c_fix_arg = "void
\t%1(";
2452 test_text = "extern int
abort(int
);\n"
2453 "extern int
free(void*)
;\n"
2454 "extern int
exit(void*)
;";
2458 * Fix various macros used to define ioctl numbers.
2459 * The traditional syntax was:
2461 * #define _IO(n, x) (('n'<<8)+x)
2462 * #define TIOCFOO _IO(T, 1)
2464 * but this does not work with the C standard, which disallows macro
2465 * expansion inside strings. We have to rewrite it thus:
2467 * #define _IO(n, x) ((n<<8)+x)
2468 * #define TIOCFOO _IO('T', 1)
2470 * The select expressions match too much, but the c_fix code is cautious.
2472 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
2475 hackname = io_quotes_def;
2476 select = "define
[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*\\([a
-zA
-Z
][,)]";
2477 c_fix = char_macro_def;
2480 "#define
BSD43__IOWR(n
, x
) (('n'<<8)+x
)\n"
2481 "#define
_IOWN(x
,y
,t
) (_IOC_IN|
(((t
)&_IOCPARM_MASK
)<<16)|
('x'<<8)|y
)\n"
2482 "#define
_IO(x
,y
) ('x'<<8|y
)";
2484 "#define
XX_IO(x
) ('x'<<8|
256)";
2488 * Fix the usage of the ioctl macro numbers.
2491 hackname = io_quotes_use;
2492 select = "define
[ \t]+[A
-Z0
-9_
]+[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*[ \t]*"
2494 c_fix = char_macro_use;
2496 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
2497 "#define TIOCFOO \\\\\n"
2498 "BSD43__IOWR(T, 1) /* Some are multi-line */";
2502 * Check for missing ';' in struct
2505 hackname = ip_missing_semi;
2506 files = netinet/ip.h;
2508 sed = "/^struct/,/^};/s/}$/};/";
2514 "}; /* mumbled struct */\n";
2518 * Non-traditional "const" declaration in Irix's limits.h.
2521 hackname
= irix_limits_const
;
2522 files
= fixinc
-test
-limits.h
, limits.h
;
2523 select
= "^extern const ";
2525 c_fix_arg
= "extern __const ";
2526 test_text
= "extern const char limit; /* test limits */";
2530 * IRIX
5.x
's stdio.h declares some functions that take a va_list as
2531 * taking char *. However, GCC uses void * for va_list, so
2532 * calling vfprintf with a va_list fails in C++. */
2534 hackname = irix_stdio_va_list;
2537 select = '/\
* va_list \
*/ char \
*';
2539 c_fix_arg = "__gnuc_va_list";
2541 "extern int printf( const char *, /* va_list */ char * );";
2545 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
2546 * use / * * / to concatenate tokens.
2549 hackname = kandr_concat;
2550 files = "sparc/asm_linkage.h";
2551 files = "sun*/asm_linkage.h";
2552 files = "arm/as_support.h";
2553 files = "arm/mc_type.h";
2554 files = "arm/xcb.h";
2555 files = "dev/chardefmac.h";
2556 files = "dev/ps_irq.h";
2557 files = "dev/screen.h";
2558 files = "dev/scsi.h";
2559 files = "sys/tty.h";
2560 files = "Xm.acorn/XmP.h";
2561 files = bsd43/bsd43_.h;
2565 test_text = "#define __CONCAT__(a,b) a/**/b";
2568 /* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
2569 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
2570 * constant on recent versions of g
++.
2573 hackname
= linux_ia64_ucontext
;
2574 files
= "sys/ucontext.h";
2575 mach
= "ia64-*-linux*";
2576 select
= '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
2577 '->sc_gr\[0\]\) - \(char \*\) 0\)';
2579 c_fix_arg
= "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
2580 test_text
= "# define _SC_GR0_OFFSET\t\\\\\n"
2581 "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
2585 * Remove header file warning from sys
/time.h. Autoconf
's
2586 * AC_HEADER_TIME recommends to include both sys/time.h and time.h
2587 * which causes warning on LynxOS. Remove the warning.
2590 hackname = lynxos_no_warning_in_sys_time_h;
2592 select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
2595 test_text = "#warning Using <time.h> instead of <sys/time.h>";
2599 * Add missing declaration for putenv.
2602 hackname = lynxos_missing_putenv;
2603 mach = '*-*-lynxos
*';
2605 bypass = 'putenv
[ \t]*\\(';
2606 select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2609 "extern int putenv _AP((char *));";
2610 c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2611 test_text = "extern char *getenv _AP((const char *));";
2615 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
2617 * On NetBSD, machine is a symbolic link to an architecture specific
2618 * directory name, so we can't match a specific file name here.
2621 hackname
= machine_ansi_h_va_list
;
2622 select
= "define[ \t]+_BSD_VA_LIST_[ \t]";
2623 bypass
= '__builtin_va_list';
2626 c_fix_arg
= "%1__builtin_va_list";
2627 c_fix_arg
= "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
2629 test_text
= " # define _BSD_VA_LIST_\tchar**";
2633 * Fix non
-ansi machine name defines
2636 hackname
= machine_name
;
2637 c_test
= machine_name
;
2638 c_fix
= machine_name
;
2640 test_text
= "/* MACH_DIFF: */\n"
2641 "#if defined( i386 ) || defined( sparc ) || defined( vax )"
2642 "\n/* no uniform test, so be careful :-) */";
2646 * Some math.h files define struct
exception (it
's in the System V
2647 * Interface Definition), which conflicts with the class exception defined
2648 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
2649 * This is not a great fix, but I haven't been able to think of anything
2653 hackname
= math_exception
;
2655 select
= "struct exception";
2657 * This should be bypassed on __cplusplus
, but some supposedly C
++
2658 * aware headers
, such as Solaris
8 and
9, don
't wrap their struct
2659 * exception either. So currently we bypass only for glibc, based on a
2660 * comment in the fixed glibc header. Ick.
2662 bypass = 'We have a problem when using C\
+\
+|for C\
+\
+, '
2663 '_
[a
-z0
-9A
-Z_
]+_exception
; for C
, exception
';
2666 c_fix_arg = "#ifdef __cplusplus\n"
2667 "#define exception __math_exception\n"
2670 c_fix_arg = "#ifdef __cplusplus\n"
2671 "#undef exception\n"
2674 test_text = "typedef struct exception t_math_exception;";
2678 * This looks pretty broken to me. ``dbl_max_def'' will contain
2679 * "define DBL_MAX " at the start, when what we really want is just
2680 * the value portion. Can't figure out how to write a test case
2681 * for this either
:-(
2684 hackname
= math_huge_val_from_dbl_max
;
2688 * IF HUGE_VAL is defined to be DBL_MAX
*and
* DBL_MAX is _not_ defined
2689 * in math.h
, this fix applies.
2691 select
= "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
2692 bypass
= "define[ \t]+DBL_MAX";
2696 * See if we have a definition for DBL_MAX in float.h.
2697 * If we do
, we will replace the one in math.h with that one.
2700 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
2701 "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
2703 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
2704 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
2705 "s@DBL_MAX@'\"$dbl_max_def@\"\n"
2710 "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
2711 "#define HUGE_VAL DBL_MAX";
2718 hackname
= nested_auth_des
;
2720 select
= '(/\*.*rpc/auth_des\.h>.*)/\*';
2722 c_fix_arg
= "%1*/ /*";
2723 test_text
= "/*#include <rpc/auth_des.h> /* skip this */";
2727 * Some versions of NetBSD don
't expect the C99 inline semantics.
2730 hackname = netbsd_c99_inline_1;
2731 mach = "*-*-netbsd*";
2733 select = "extern __inline int";
2736 c_fix_arg = "extern\n"
2737 "#ifdef __GNUC_STDC_INLINE__\n"
2738 "__attribute__((__gnu_inline__))\n"
2742 test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
2746 * netbsd_c99_inline_2
2749 hackname = netbsd_c99_inline_2;
2750 mach = "*-*-netbsd*";
2752 select = "#define _SIGINLINE extern __inline";
2755 c_fix_arg = <<- _EOArg_
2756 #ifdef __GNUC_STDC_INLINE__
2757 #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
2763 test_text = "#define _SIGINLINE extern __inline";
2767 * NetBSD has a semicolon after the ending '}' for some extern "C".
2770 hackname = netbsd_extra_semicolon;
2771 mach = "*-*-netbsd*";
2772 files = sys/cdefs.h;
2773 select = "#define[ \t]*__END_DECLS[ \t]*};";
2776 c_fix_arg = "#define __END_DECLS }";
2778 test_text = "#define __END_DECLS };";
2781 /* newlib's stdint.h has several failures to conform to C99. The fix
2782 for these removed a comment that can be matched to identify unfixed
2785 hackname
= newlib_stdint_1
;
2786 files
= stdint
-newlib.h
, stdint.h
;
2787 select
= "@todo - Add support for wint_t types";
2788 sed
= "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
2789 sed
= "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
2790 sed
= "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
2791 sed
= "s@#define INT_LEAST32_MIN.*@"
2792 "#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
2793 sed
= "s@#define INT_LEAST32_MAX.*@"
2794 "#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
2795 sed
= "s@#define UINT_LEAST32_MAX.*@"
2796 "#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
2797 sed
= 's@#define INT_FAST\([0-9]*\)_MIN.*@'
2798 '#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
2799 sed
= 's@#define INT_FAST\([0-9]*\)_MAX.*@'
2800 '#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
2801 sed
= 's@#define UINT_FAST\([0-9]*\)_MAX.*@'
2802 '#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
2803 sed
= "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
2804 sed
= "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
2805 sed
= "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
2806 sed
= "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
2807 sed
= "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
2808 test_text
= "/* @todo - Add support for wint_t types. */\n"
2809 "#define INT32_MIN (-2147483647-1)\n"
2810 "#define INT32_MAX 2147483647\n"
2811 "#define UINT32_MAX 4294967295U\n"
2812 "#define INT_LEAST32_MIN (-2147483647-1)\n"
2813 "#define INT_LEAST32_MAX 2147483647\n"
2814 "#define UINT_LEAST32_MAX 4294967295U\n"
2815 "#define INT_FAST8_MIN INT8_MIN\n"
2816 "#define INT_FAST8_MAX INT8_MAX\n"
2817 "#define UINT_FAST8_MAX UINT8_MAX\n"
2818 "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
2819 "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
2820 "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
2821 "#define UINT8_C(x) x##U\n"
2822 "#define UINT16_C(x) x##U";
2829 hackname
= newlib_stdint_2
;
2830 files
= stdint
-newlib.h
, stdint.h
;
2831 select
= "@todo - Add support for wint_t types";
2833 c_fix_arg
= "#define INTMAX_MAX __INTMAX_MAX__\n"
2834 "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
2835 "#define UINTMAX_MAX __UINTMAX_MAX__\n"
2836 "#define WCHAR_MAX __WCHAR_MAX__\n"
2837 "#define WCHAR_MIN __WCHAR_MIN__\n"
2838 "#define WINT_MAX __WINT_MAX__\n"
2839 "#define WINT_MIN __WINT_MIN__\n\n"
2841 c_fix_arg
= '/\*\* Macros for minimum-width integer constant expressions \*/';
2842 test_text
= "/* @todo - Add support for wint_t types. */\n"
2843 "/** Macros for minimum-width integer constant expressions */";
2847 * NeXT
3.2 adds const prefix to some math functions.
2848 * These conflict with the built
-in functions.
2851 hackname
= next_math_prefix
;
2852 files
= ansi
/math.h
;
2853 select
= "^extern[ \t]+double[ \t]+__const__[ \t]";
2856 c_fix_arg
= "extern double %1(";
2857 c_fix_arg
= "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
2859 test_text
= "extern\tdouble\t__const__\tmumble();";
2863 * NeXT
3.2 uses the word
"template" as a parameter for some
2864 * functions. GCC reports an invalid use of a reserved key word
2865 * with the built
-in functions.
2868 hackname
= next_template
;
2870 select
= "[ \t]template\\)";
2874 c_fix_arg
= "\\(([^)]*)[ \t]template\\)";
2875 test_text
= "extern mumble( char * template); /* fix */";
2879 * NeXT
3.2 includes the keyword volatile in the
abort() and
exit()
2880 * function prototypes. That conflicts with the built
-in functions.
2883 hackname
= next_volitile
;
2884 files
= ansi
/stdlib.h
;
2885 select
= "^extern[ \t]+volatile[ \t]+void[ \t]";
2888 c_fix_arg
= "extern void %1(";
2889 c_fix_arg
= "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
2891 test_text
= "extern\tvolatile\tvoid\tabort();";
2895 * NeXT
2.0 defines
'int wait(union wait*)', which conflicts with Posix
.1.
2896 * Note that version
3 of the NeXT system has wait.h in a different directory
,
2897 * so that this code won
't do anything. But wait.h in version 3 has a
2898 * conditional, so it doesn't need this fix. So everything is okay.
2901 hackname
= next_wait_union
;
2904 select
= 'wait\(union wait';
2906 c_fix_arg
= "wait(void";
2907 test_text
= "extern pid_d wait(union wait*);";
2911 * a missing semi
-colon at the end of the nodeent structure definition.
2914 hackname
= nodeent_syntax
;
2915 files
= netdnet
/dnetdb.h
;
2916 select
= "char[ \t]*\\*na_addr[ \t]*$";
2919 test_text
= "char *na_addr\t";
2923 * Fix OpenBSD
's NULL definition.
2926 hackname = openbsd_null_definition;
2927 mach = "*-*-openbsd*";
2928 files = locale.h, stddef.h, stdio.h, string.h,
2929 time.h, unistd.h, wchar.h, sys/param.h;
2930 select = "__GNUG__";
2932 c_fix_arg = "#ifndef NULL\n"
2933 "#ifdef __cplusplus\n"
2935 "#define NULL\t__null\n"
2936 "#else\t /* ! __GNUG__ */\n"
2937 "#define NULL\t0L\n"
2938 "#endif\t /* __GNUG__ */\n"
2939 "#else\t /* ! __cplusplus */\n"
2940 "#define NULL\t((void *)0)\n"
2941 "#endif\t /* __cplusplus */\n"
2942 "#endif\t /* !NULL */";
2944 c_fix_arg = "^#ifndef[ \t]*NULL\n"
2945 "^#ifdef[ \t]*__GNUG__\n"
2946 "^#define[ \t]*NULL[ \t]*__null\n"
2948 "^#define[ \t]*NULL[ \t]*0L\n"
2954 "#define NULL __null\n"
2962 * obstack.h used casts as lvalues.
2964 * We need to change postincrements of casted pointers (which are
2965 * then dereferenced and assigned into) of the form
2967 * *((TYPE*)PTRVAR)++ = (VALUE)
2969 * into expressions like
2971 * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
2973 * which is correct for the cases used in obstack.h since PTRVAR is
2974 * of type char * and the value of the expression is not used.
2977 hackname = obstack_lvalue_cast;
2979 select = '\
*\
(\
(([^
()]*)\
*\
)(.*)\
)\
+\
+ = \
(([^
()]*)\
)';
2981 c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
2982 test_text = "*((void **) (h)->next_free)++ = (aptr)";
2986 * Fix OpenBSD's va_start define.
2989 hackname
= openbsd_va_start
;
2990 mach
= "*-*-openbsd*";
2992 select
= '__builtin_stdarg_start';
2994 c_fix_arg
= __builtin_va_start
;
2996 test_text
= "#define va_start(v,l) __builtin_stdarg_start((v),l)";
3000 * sys
/lc_core.h on some versions of OSF1
/4.x pollutes the namespace by
3001 * defining regex.h related types. This causes libg
++ build and usage
3002 * failures. Fixing this correctly requires checking and modifying
3 files.
3005 hackname
= osf_namespace_a
;
3006 files
= reg_types.h
;
3007 files
= sys
/lc_core.h
;
3008 test
= " -r reg_types.h";
3009 test
= " -r sys/lc_core.h";
3010 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3011 test
= " -z \"`grep __regex_t regex.h`\"";
3015 c_fix_arg
= "reg(ex|off|match)_t";
3017 test_text
= "`touch sys/lc_core.h`"
3018 "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
3019 "extern regex_t re;\n"
3020 "extern regoff_t ro;\n"
3021 "extern regmatch_t rm;\n";
3025 hackname
= osf_namespace_c
;
3027 test
= " -r reg_types.h";
3028 test
= " -r sys/lc_core.h";
3029 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3030 test
= " -z \"`grep __regex_t regex.h`\"";
3032 select
= "#include <reg_types\.h>.*";
3035 "typedef __regex_t\tregex_t;\n"
3036 "typedef __regoff_t\tregoff_t;\n"
3037 "typedef __regmatch_t\tregmatch_t;";
3039 test_text
= "#include <reg_types.h>";
3043 * On broken glibc
-2.3.3 systems an array of incomplete structures is
3044 * passed to __sigsetjmp. Fix that to take a pointer instead.
3047 hackname
= pthread_incomplete_struct_argument
;
3049 select
= "struct __jmp_buf_tag";
3051 c_fix_arg
= "%1 *%2%3";
3052 c_fix_arg
= "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) "
3053 "(__env)\\[1\\](.*)$";
3054 test_text
= "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], "
3059 * Fix return type of fread and fwrite on sysV68
3062 hackname
= read_ret_type
;
3064 select
= "extern int\t.*, fread\\(\\), fwrite\\(\\)";
3066 c_fix_arg
= "extern unsigned int fread(), fwrite();\n%1%2";
3067 c_fix_arg
= "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
3069 test_text
= "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
3073 * Fix casts as lvalues in glibc
's <rpc/xdr.h>.
3076 hackname = rpc_xdr_lvalue_cast_a;
3078 select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
3080 c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
3081 test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
3082 "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
3086 * rpc_xdr_lvalue_cast_b
3089 hackname = rpc_xdr_lvalue_cast_b;
3091 select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
3093 c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
3094 test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
3095 "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
3099 * function class(double x) conflicts with C++ keyword on rs/6000
3102 hackname = rs6000_double;
3104 select = '[^a
-zA
-Z_
]class\
(';
3107 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
3108 c_fix_arg = '^.
*[^a
-zA
-Z_
]class\
(.
*';
3110 test_text = "extern int class();";
3114 * Wrong fchmod prototype on RS/6000.
3117 hackname = rs6000_fchmod;
3119 select = 'fchmod\
(char \
*';
3121 c_fix_arg = "fchmod(int";
3122 test_text = "extern int fchmod(char *, mode_t);";
3126 * parameters conflict with C++ new on rs/6000
3129 hackname = rs6000_param;
3133 select = 'rename\
(const char \
*old
, const char \
*new\
)';
3135 c_fix_arg = 'rename(const char
*_old
, const char
*_new
)';
3137 test_text = 'extern int
rename(const char
*old
, const char
*new
);';
3141 * Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
3142 * for C99. This is wrong for C++, which needs many C99 features, but
3143 * only supports __restrict.
3146 hackname = solaris___restrict;
3147 files = sys/feature_tests.h;
3148 select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
3149 mach = "*-*-solaris2*";
3151 c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
3152 "#else\n%0\n#endif";
3153 test_text = "#define _RESTRICT_KYWD restrict";
3157 * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
3158 * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
3159 * and imaginary definitions which are not supported by GCC.
3162 hackname = solaris_complex;
3163 mach = "*-*-solaris2.*";
3165 select = "#define[ \t]_Complex_I[ \t]_Complex_I";
3166 sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
3167 "#define\t_Complex_I\t(__extension__ 1.0iF)/";
3168 sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
3169 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
3170 sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
3171 test_text = "#define _Complex_I _Complex_I\n"
3172 "#define complex _Complex\n"
3173 "#define _Imaginary_I _Imaginary_I\n"
3174 "#define imaginary _Imaginary\n"
3176 "#define I _Imaginary_I";
3180 * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
3181 * extern "C" instead so libstdc++ can use it.
3184 hackname = solaris_complex_cxx;
3185 mach = "*-*-solaris2.*";
3187 sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
3188 "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
3189 sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
3190 "#ifdef\t__cplusplus\\\n}\\\n#endif";
3191 test_text = "#if !defined(__cplusplus)\n"
3192 "#endif /* !defined(__cplusplus) */";
3196 * g++ rejects functions declared with both C and C++ linkage.
3199 hackname = solaris_cxx_linkage;
3200 mach = '*-*-solaris2
*';
3201 files = "iso/stdlib_iso.h";
3202 select = "(#if __cplusplus >= 199711L)\n"
3203 "(extern \"C\\+\\+\" \\{\n)"
3204 "(.*(bsearch|qsort).*)";
3206 c_fix_arg = "%1 && !__GNUG__\n%2%3";
3209 "#if __cplusplus >= 199711L\n"
3210 "extern \"C++\" {\n"
3211 " void *bsearch(const void *, const void *, size_t, size_t,";
3215 * Solaris <iso/stdio_iso.h> doesn't declare getc for C
++ with
3216 * _STRICT_STDC
, but uses it.
3219 hackname
= solaris_getc_strict_stdc
;
3220 mach
= "*-*-solaris2*";
3221 files
= "iso/stdio_iso.h";
3222 select
= "(.*&& )!defined\\(_STRICT_STDC\\)(.*)";
3224 c_fix_arg
= "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2";
3227 "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
3231 * Before Solaris
10, <iso
/setjmp_iso.h
> doesn
't mark longjump noreturn.
3234 hackname = solaris_longjmp_noreturn;
3235 mach = "*-*-solaris2*";
3236 files = "iso/setjmp_iso.h";
3237 bypass = "__NORETURN";
3238 select = "(.*longjmp\\(jmp_buf.*[^)]+\\));";
3240 c_fix_arg = "%1 __attribute__ ((__noreturn__));";
3242 test_text = "extern void longjmp(jmp_buf, int);";
3246 * Sun Solaris 10 defines several C99 math macros in terms of
3247 * builtins specific to the Studio compiler, in particular not
3248 * compatible with the GNU compiler.
3251 hackname = solaris_math_1;
3252 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3253 bypass = "__GNUC__";
3254 files = iso/math_c99.h;
3256 c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
3257 c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
3259 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3261 "#define HUGE_VAL __builtin_huge_val\n"
3262 "#undef HUGE_VALF\n"
3263 "#define HUGE_VALF __builtin_huge_valf\n"
3264 "#undef HUGE_VALL\n"
3265 "#define HUGE_VALL __builtin_huge_vall";
3269 hackname = solaris_math_2;
3270 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3271 bypass = "__GNUC__";
3272 files = iso/math_c99.h;
3274 c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
3275 c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
3277 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3279 "#define INFINITY __builtin_infinity";
3283 hackname = solaris_math_3;
3284 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3285 bypass = "__GNUC__";
3286 files = iso/math_c99.h;
3288 c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
3289 c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
3291 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3293 "#define NAN __builtin_nan";
3297 hackname = solaris_math_4;
3298 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3299 bypass = "__GNUC__";
3300 files = iso/math_c99.h;
3302 c_fix_arg = "#define\tfpclassify(x) \\\n"
3303 " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, "
3304 "FP_SUBNORMAL, FP_ZERO, (x))";
3305 c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
3307 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3308 "#undef fpclassify\n"
3309 "#define fpclassify(x) __builtin_fpclassify(x)";
3313 hackname = solaris_math_8;
3314 select = '@\
(#\
)math_c99\.h
' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
3315 bypass = "__GNUC__";
3316 files = iso/math_c99.h;
3318 c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
3319 "\t\t\t ? __builtin_signbitf(x) \\\n"
3320 "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
3321 "\t\t\t ? __builtin_signbitl(x) \\\n"
3322 "\t\t\t : __builtin_signbit(x))";
3323 c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
3324 test_text = <<- _EOText_
3325 #ident "@(#)math_c99.h 1.9 04/11/01 SMI"
3327 #define signbit(x) __builtin_signbit(x)
3332 hackname = solaris_math_9;
3333 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3334 bypass = "__GNUC__";
3335 files = iso/math_c99.h;
3337 c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
3338 c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) "
3339 "__builtin_[a-z]+\\(y\\)\\)";
3341 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3342 "#undef isgreater\n"
3343 "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
3344 "#undef isgreaterequal\n"
3345 "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
3347 "#define isless(x, y) ((x) __builtin_isless(y))\n"
3348 "#undef islessequal\n"
3349 "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
3350 "#undef islessgreater\n"
3351 "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
3352 "#undef isunordered\n"
3353 "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
3357 * On Solaris 11, if you do isinf(NaN) you'll get a floating point
3358 * exception. Provide an alternative using GCC
's builtin.
3362 hackname = solaris_math_10;
3363 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3364 files = iso/math_c99.h;
3366 c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
3367 c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
3368 "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);"
3370 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
3371 "INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
3372 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
3373 "\\(-INFINITY\\);[ \t]*\\}\\)";
3375 '#pragma ident
"@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
3377 "#define isinf(x) __extension__( \\\\\n"
3378 " { __typeof(x) __x_i = (x); \\\\\n"
3379 " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
3380 " __x_i == (__typeof(__x_i)) (-INFINITY); })";
3384 * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
3385 * "0" for the last field of the pthread_mutex_t structure, which is
3386 * of type upad64_t, which itself is typedef'd to int64_t
, but with
3387 * __STDC__
defined (e.g. by
-ansi
) it is a union. So change the
3388 * initializer to
"{0}" instead
3391 hackname
= solaris_mutex_init_2
;
3392 select
= '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3395 * On Solaris
10, this fix is unnecessary because upad64_t is
3396 * always defined correctly regardless of the definition of the
3397 * __STDC__ macro. The first
"mach" pattern matches up to
3398 * solaris9. The second
"mach" pattern will not match any
two (or
3399 * more
) digit solaris version
, but it will match e.g.
2.5.1.
3401 mach
= '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
3403 c_fix_arg
= "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3408 c_fix_arg
= "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+"
3409 "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
3410 ",[ \t]*0\\}" "(|[ \t].*)$";
3412 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3413 "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
3414 "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
3415 "#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \\\\\n"
3416 " {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}\n"
3417 "#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \\\\\n"
3418 " {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}";
3422 * The pow overloads with int were removed in C
++ 2011 DR
550.
3425 hackname
= solaris_pow_int_overload
;
3426 mach
= '*-*-solaris2*';
3427 files
= "iso/math_iso.h";
3428 select
= "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)"
3429 " *\\{[^{}]*\n[^{}]*\\}";
3431 c_fix_arg
= "#if __cplusplus < 201103L\n%0\n#endif";
3434 " inline long double pow(long double __X, int __Y) { return\n"
3435 " __powl(__X, (long double) (__Y)); }";
3439 * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a
"0" for some
3440 * fields of the pthread_rwlock_t structure
, which are of type
3441 * upad64_t
, which itself is typedef
'd to int64_t, but with __STDC__
3442 * defined (e.g. by -ansi) it is a union. So change the initializer
3446 hackname = solaris_rwlock_init_1;
3447 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3449 mach = '*-*-solaris
*';
3451 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3454 "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
3456 c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
3457 "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
3460 '#ident
"@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3461 "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
3465 * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
3466 * structure. As such, it need two levels of brackets, but only
3467 * contains one. Wrap the macro definition in an extra layer.
3470 hackname = solaris_once_init_1;
3471 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3473 mach = '*-*-solaris
*';
3475 c_fix_arg = "%1{%2}%3";
3476 c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
3478 '#pragma ident
"@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
3479 "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
3483 * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
3484 * fields of the pthread_once_t structure, which are of type
3485 * upad64_t, which itself is typedef'd to int64_t
, but with __STDC__
3486 * defined (e.g. by
-ansi
) it is a union. So change the initializer
3487 * to
"{0}" instead. This test relies on solaris_once_init_1.
3490 hackname
= solaris_once_init_2
;
3491 select
= '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3494 * On Solaris
10, this fix is unnecessary because upad64_t is
3495 * always defined correctly regardless of the definition of the
3496 * __STDC__ macro. The first
"mach" pattern matches up to
3497 * solaris9. The second
"mach" pattern will not match any
two (or
3498 * more
) digit solaris version
, but it will match e.g.
2.5.1.
3500 mach
= '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
3502 c_fix_arg
= "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3505 "%1{0}, {0}, {0}, {%3}%4\n"
3507 c_fix_arg
= "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{\\{)"
3508 "(0, 0, 0, )(PTHREAD_[A-Z_]+)(\\}\\})[ \t]*$";
3510 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3511 "#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n";
3515 * Sun Solaris
2 has a version of sys
/int_const.h that defines
3516 * UINT8_C and UINT16_C to unsigned constants.
3519 hackname
= solaris_int_const
;
3520 files
= sys
/int_const.h
;
3521 mach
= '*-*-solaris2*';
3523 c_fix_arg
= "#define\tUINT8_C(c)\t(c)\n"
3525 "#define\tUINT16_C(c)\t(c)";
3526 select
= "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
3528 "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
3530 "#define UINT8_C(c) __CONCAT__(c,u)\n"
3532 "#define UINT16_C(c) __CONCAT__(c,u)";
3536 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3537 * UINT8_MAX and UINT16_MAX to unsigned constants.
3540 hackname
= solaris_int_limits_1
;
3541 files
= sys
/int_limits.h
;
3542 mach
= '*-*-solaris2*';
3544 c_fix_arg
= "#define\tUINT8_MAX\t(255)\n"
3545 "#define\tUINT16_MAX\t(65535)";
3546 select
= "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
3547 "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
3549 "#define UINT8_MAX (255U)\n"
3550 "#define UINT16_MAX (65535U)";
3554 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3555 * INT_FAST16 limits to wrong values for sys
/int_types.h.
3558 hackname
= solaris_int_limits_2
;
3559 files
= sys
/int_limits.h
;
3560 mach
= '*-*-solaris2*';
3562 c_fix_arg
= "#define\t%1_FAST16_%2 %132_%2";
3563 select
= "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
3565 "#define INT_FAST16_MAX INT16_MAX\n"
3566 "#define UINT_FAST16_MAX UINT16_MAX\n"
3567 "#define INT_FAST16_MIN INT16_MIN";
3571 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3572 * SIZE_MAX as unsigned long.
3575 hackname
= solaris_int_limits_3
;
3576 files
= sys
/int_limits.h
;
3577 mach
= '*-*-solaris2*';
3579 c_fix_arg
= "#define\tSIZE_MAX\t4294967295U";
3580 select
= "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
3582 "#define SIZE_MAX 4294967295UL";
3586 * Sun Solaris up to
9 has a version of sys
/int_types.h that forbids use
3587 * of Standard C99
64-bit types in
32-bit mode.
3590 hackname
= solaris_int_types
;
3591 select
= "__STDC__ - 0 == 0";
3592 bypass
= "_LONGLONG_TYPE";
3593 files
= sys
/int_types.h
;
3596 "(defined(_STDC_C99) || !defined(_STRICT_STDC) || defined(__GNUC__))";
3598 "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3599 "typedef long long int64_t;\n"
3601 "#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))\n"
3602 "typedef int64_t intmax_t;\n"
3607 * Solaris
10+ <spawn.h
> uses char
*const argv
[_RESTRICT_KYWD
] in the
3608 * posix_spawn declarations
, which doesn
't work with C++.
3611 hackname = solaris_posix_spawn_restrict;
3613 mach = '*-*-solaris2
*';
3615 c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
3616 select = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
3618 "char *const argv[_RESTRICT_KYWD],\n"
3619 "char *const envp[_RESTRICT_KYWD]);";
3623 * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
3624 * std::__flsbuf, but <iso/stdio_iso.h> uses them.
3627 hackname = solaris_std___filbuf;
3629 mach = '*-*-solaris2
*';
3630 bypass = "using std::__filbuf";
3631 select = "(using std::perror;\n)(#endif)";
3633 c_fix_arg = "%1#ifndef _LP64\n"
3634 "using std::__filbuf;\n"
3635 "using std::__flsbuf;\n"
3638 test_text = "using std::perror;\n"
3643 * Sun Solaris 8 has what appears to be some gross workaround for
3644 * some old version of their c++ compiler. G++ doesn't want it
3645 * either
, but doesn
't want to be tied to SunPRO version numbers.
3648 hackname = solaris_stdio_tag;
3649 files = stdio_tag.h;
3651 select = '__cplusplus
< 54321L';
3652 /* In Solaris 10, the code in stdio_tag.h is conditionalized on
3653 "!defined(__GNUC__)" so we no longer need to fix it. */
3654 bypass = '__GNUC__
';
3655 sed = 's
/defined(__cplusplus
) && (__cplusplus
< 54321L)/0/';
3657 test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
3661 * On Solaris 9, __va_list needs to become a typedef for
3662 * __builtin_va_list to make -Wmissing-format-attribute work.
3665 hackname = solaris_sys_va_list;
3666 files = sys/va_list.h;
3667 mach = '*-*-solaris2.9
';
3668 select = "#if.*__STDC__.*\n"
3669 "typedef void \\*__va_list;\n"
3671 "typedef char \\*__va_list;\n"
3675 c_fix_arg = "#ifdef __GNUC__\n"
3676 "typedef __builtin_va_list __va_list;\n"
3680 test_text = "#if defined(__STDC__) && !defined(__ia64)\n"
3681 "typedef void *__va_list;\n"
3683 "typedef char *__va_list;\n"
3688 * a missing semi-colon at the end of the statsswtch structure definition.
3691 hackname = statsswtch;
3692 files = rpcsvc/rstat.h;
3693 select = "boottime$";
3695 c_fix_arg = "boottime;";
3696 test_text = "struct statswtch {\n int boottime\n};";
3700 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
3701 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
3705 hackname
= stdio_stdarg_h
;
3707 bypass
= "include.*(stdarg\.h|machine/ansi\.h)";
3709 * On Solaris
10, this fix is unncessary
; <stdio.h
> includes
3710 * <iso
/stdio_iso.h
>, which includes
<sys
/va_list.h
>.
3712 mach
= '*-*-solaris2.1[0-9]*';
3717 c_fix_arg
= "#define __need___va_list\n#include <stdarg.h>\n";
3723 * Don
't use or define the name va_list in stdio.h. This is for
3724 * ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
3725 * of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
3726 * indicate that the header knows what it's doing
-- under SUSv2
,
3727 * stdio.h is required to define va_list
, and we shouldn
't break
3731 hackname = stdio_va_list;
3733 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list
';
3735 * On Solaris 10, the definition in
3736 * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
3737 * there is therefore no need for this fix there.
3739 mach = '*-*-solaris2.1
[0-9]*';
3743 * Use __gnuc_va_list in arg types in place of va_list.
3744 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3745 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3746 * trailing parentheses and semicolon save all other systems from this.
3747 * Define
__not_va_list__ (something harmless and unused
)
3748 * instead of va_list.
3749 * Don
't claim to have defined va_list.
3751 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3752 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3753 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3754 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3755 "s@ va_list@ __not_va_list__@\n"
3756 "s@\\*va_list@*__not_va_list__@\n"
3757 "s@ __va_list)@ __gnuc_va_list)@\n"
3758 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3759 "@typedef \\1 __not_va_list__;@\n"
3760 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3761 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3762 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3763 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3764 "s@VA_LIST@DUMMY_VA_LIST@\n"
3765 "s@_Va_LIST@_VA_LIST@";
3766 test_text = "extern void mumble( va_list);";
3770 * Fix headers that use va_list from stdio.h to use the updated
3771 * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
3772 * dealt with elsewhere. The presence of __gnuc_va_list,
3773 * __DJ_va_list, or _G_va_list is taken to indicate that the header
3774 * knows what it's doing.
3777 hackname
= stdio_va_list_clients
;
3785 files
= curses_colr
/curses.h
;
3786 bypass
= '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
3787 /* Don
't fix, if we use va_list from stdarg.h, or if the use is
3788 otherwise protected. */
3789 bypass = 'include
<stdarg\.h
>|#ifdef va_start
';
3792 * Use __gnuc_va_list in arg types in place of va_list.
3793 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3794 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3795 * trailing parentheses and semicolon save all other systems from this.
3796 * Define
__not_va_list__ (something harmless and unused
)
3797 * instead of va_list.
3798 * Don
't claim to have defined va_list.
3800 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3801 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3802 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3803 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3804 "s@ va_list@ __not_va_list__@\n"
3805 "s@\\*va_list@*__not_va_list__@\n"
3806 "s@ __va_list)@ __gnuc_va_list)@\n"
3807 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3808 "@typedef \\1 __not_va_list__;@\n"
3809 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3810 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3811 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3812 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3813 "s@VA_LIST@DUMMY_VA_LIST@\n"
3814 "s@_Va_LIST@_VA_LIST@";
3815 test_text = "extern void mumble( va_list);";
3819 * "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
3820 * is "!defined( __STRICT_ANSI__ )"
3823 hackname = strict_ansi_not;
3824 select = "^([ \t]*#[ \t]*if.*)"
3826 "|__STDC__[ \t]*==[ \t]*0"
3827 "|__STDC__[ \t]*!=[ \t]*1"
3828 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
3829 /* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
3830 bypass = 'GNU and MIPS C compilers define __STDC__ differently
';
3831 /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
3832 is not defined by GCC, so it is safe. */
3833 bypass = '__SCO_VERSION__.
*__STDC__
!= 1';
3834 c_test = stdc_0_in_system_headers;
3837 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
3839 test_text = "#if !__STDC__ \n"
3840 "#if __STDC__ == 0\n"
3841 "#if __STDC__ != 1\n"
3842 "#if __STDC__ - 0 == 0"
3843 "/* not std C */\nint foo;\n"
3844 "\n#end-end-end-end-if :-)";
3849 * is "!defined( __STRICT_ANSI__ )" on continued #if-s
3852 hackname = strict_ansi_not_ctd;
3853 files = math.h, limits.h, stdio.h, signal.h,
3854 stdlib.h, sys/signal.h, time.h;
3856 * Starting at the beginning of a line, skip white space and
3857 * a leading "(" or "&&" or "||". One of those must be found.
3858 * Then, zero, one or more copies of a "defined(_FOO_BAR_) &&"
3859 * expression. If these are nested, then they must accumulate
3860 * because we won't match any closing parentheses. Finally
,
3861 * after skipping over all that
, we must then match our suspect
3862 * phrase
: "__STDC__-0==0" with or without white space.
3864 select
= "^([ \t]*" '(\(|&&|\|\|)'
3865 "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
3867 "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
3868 c_test
= stdc_0_in_system_headers
;
3871 c_fix_arg
= "%1 !defined(__STRICT_ANSI__)";
3873 test_text
= "#if 1 && \\\\\n"
3874 "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
3875 "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
3876 "|| __STDC__ - 0 == 0 ) /* not std C */\n"
3881 * "__STDC__!=0" or
"__STDC__==1" or
"__STDC__-0==1"
3882 * is
"defined( __STRICT_ANSI__ )"
3885 hackname
= strict_ansi_only
;
3886 select
= "^([ \t]*#[ \t]*if.*)"
3887 "(__STDC__[ \t]*!=[ \t]*0"
3888 "|__STDC__[ \t]*==[ \t]*1"
3889 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
3890 "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
3891 c_test
= stdc_0_in_system_headers
;
3894 c_fix_arg
= "%1 defined(__STRICT_ANSI__)";
3896 test_text
= "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
3900 * IRIX
4.0.5 <rpc
/xdr.h
> uses struct __file_s
3901 * in prototype without previous definition.
3904 hackname
= struct_file
;
3906 select
= '^.*xdrstdio_create.*struct __file_s';
3908 c_fix_arg
= "struct __file_s;\n%0";
3909 test_text
= "extern void xdrstdio_create( struct __file_s* );";
3913 * IRIX
4.0.5 <rpc
/auth.h
> uses struct sockaddr
3914 * in prototype without previous definition.
3916 * Don
't fix OpenBSD, which uses struct sockaddr_in prototyping the same
3917 * function, and does define it.
3920 hackname = struct_sockaddr;
3922 select = "^.*authdes_create.*struct sockaddr[^_]";
3923 bypass = "<sys/socket\.h>";
3924 bypass = "struct sockaddr;\n";
3926 c_fix_arg = "struct sockaddr;\n%0";
3927 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
3931 * Apply fix this to all OSs since this problem seems to effect
3932 * more than just SunOS.
3935 hackname = sun_auth_proto;
3940 bypass = "__cplusplus";
3942 * Select those files containing '(*name)()'.
3944 select = '\(\*[a-z][a-z_]*\)\(\)';
3947 c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n"
3948 "#else\n%1();%2\n#endif";
3949 c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
3953 " int (*name)(); /* C++ bad */\n"
3958 * Fix bogus #ifdef on SunOS 4.1.
3961 hackname = sun_bogus_ifdef;
3962 files = "hsfs/hsfs_spec.h";
3963 files = "hsfs/iso_spec.h";
3964 select = '#
ifdef(.
*\|\|.*)
';
3966 c_fix_arg = "#if%1";
3968 test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
3972 * Fix the CAT macro in SunOS memvar.h.
3975 hackname = sun_catmacro;
3976 files = pixrect/memvar.h;
3977 select = "^#define[ \t]+CAT\\(a,b\\).*";
3982 "# define CAT(a,b) a##b\n"
3983 "#else\n%0\n#endif";
3986 "#define CAT(a,b)\ta/**/b";
3990 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
3991 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
3994 hackname = sun_malloc;
3996 bypass = "_CLASSIC_ANSI_TYPES";
3998 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
3999 sed = "s/int[ \t][ \t]*free/void\tfree/g";
4000 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
4001 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
4002 sed = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
4005 "typedef char *\tmalloc_t;\n"
4007 "char*\tmalloc();\n"
4008 "char*\tcalloc();\n"
4009 "char*\trealloc();";
4013 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
4016 hackname = sun_rusers_semi;
4017 files = rpcsvc/rusers.h;
4019 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
4020 test_text = "struct mumble\n int _cnt\n};";
4024 * signal.h on SunOS defines signal using (),
4025 * which causes trouble when compiling with g++ -pedantic.
4028 hackname = sun_signal;
4029 files = sys/signal.h;
4031 select = "^void\t" '\
(\
*signal\
(\
)\
)\
(\
);.
*';
4035 "#ifdef __cplusplus\n"
4036 "void\t(*signal(...))(...);\n"
4037 "#else\n%0\n#endif";
4039 test_text = "void\t(*signal())();";
4043 * Correct the return type for strlen in strings.h in SunOS 4.
4046 hackname = sunos_strlen;
4048 select = "int[ \t]*strlen\\(\\);(.*)";
4050 c_fix_arg = "__SIZE_TYPE__ strlen();%1";
4051 test_text = " int\tstrlen(); /* string length */";
4055 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
4056 * that is visible to any ANSI compiler using this include. Simply
4057 * delete the lines that #define some string functions to internal forms.
4060 hackname = svr4_disable_opt;
4062 select = '#define.
*__std_hdr_
';
4063 sed = '/#define.
*__std_hdr_
/d
';
4064 test_text = "#define strlen __std_hdr_strlen\n";
4068 * Fix broken decl of getcwd present on some svr4 systems.
4071 hackname = svr4_getcwd;
4074 files = prototypes.h;
4075 select = 'getcwd\
(char \
*, int\
)';
4078 c_fix_arg = "getcwd(char *, size_t)";
4080 test_text = "extern char* getcwd(char *, int);";
4084 * Fix broken decl of profil present on some svr4 systems.
4087 hackname = svr4_profil;
4092 'profil\
(unsigned short \
*, unsigned int
, unsigned int
, unsigned int\
)';
4094 c_fix_arg = 'profil(unsigned short
*, size_t
, int
, unsigned int
)';
4097 'profil(unsigned short
*, unsigned int
, unsigned int
, unsigned int
);';
4101 * Correct types for signal handler constants like SIG_DFL; they might be
4102 * void (*) (), and should be void (*) (int). C++ doesn't like the
4106 hackname
= svr4_sighandler_type
;
4107 files
= sys
/signal.h
;
4108 select
= 'void *\(\*\)\(\)';
4110 c_fix_arg
= "void (*)(int)";
4111 test_text
= "#define SIG_DFL (void(*)())0\n"
4112 "#define SIG_IGN (void (*)())0\n";
4116 * Some SysV r4 systems
, including Sequent
's DYNIX/ptx, use the local
4117 * function 'getrnge
' in <regexp.h> before they declare it. For these
4118 * systems add a 'static int
' declaration of 'getrnge
' into <regexp.h>
4121 * 'getrnge
' traditionally manipulates a file-scope global called 'size
',
4122 * so put the declaration right after the declaration of 'size
'.
4124 * Don't do this if there is already a `static void getrnge
' declaration
4125 * present, since this would cause a redeclaration error. Solaris 2.x has
4126 * such a declaration.
4129 hackname = svr4_undeclared_getrnge;
4132 bypass = "static void getrnge";
4135 "static int getrnge ();";
4136 c_fix_arg = "^static int[ \t]+size;";
4137 test_text = "static int size;\n"
4138 "/* stuff which calls getrnge() */\n"
4139 "static getrnge()\n"
4144 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
4145 * in string.h on sysV68
4146 * Correct the return type for strlen in string.h on Lynx.
4147 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
4148 * Add missing const for strdup on OSF/1 V3.0.
4149 * On sysV88 layout is slightly different.
4152 hackname = sysv68_string;
4155 bypass = "_CLASSIC_ANSI_TYPES";
4157 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
4158 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
4159 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
4161 sed = "/^extern char$/N";
4162 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
4164 sed = "/^extern int$/N";
4165 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
4167 sed = "/^\tstrncmp(),$/N";
4168 sed = 's
/^\
(' "\t" 'strncmp()\
),\n\
(' "\t" 'strlen(),\
)$
/'
4169 '\
1;' "\\\nextern unsigned int\\\n\\2/";
4172 "extern int strlen();\n"
4174 "extern int ffs(long);\n"
4187 "\tstrlen(), strspn();";
4191 * Fix return type of calloc, malloc, realloc, bsearch and exit
4194 hackname = sysz_stdlib_for_sun;
4196 bypass = "_CLASSIC_ANSI_TYPES";
4198 select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
4200 c_fix_arg = "void *\t%1(";
4203 "extern char*\tcalloc(size_t);\n"
4204 "extern char*\tmalloc(size_t);\n"
4205 "extern char*\trealloc(void*,size_t);\n"
4206 "extern char*\tbsearch(void*,size_t,size_t);\n";
4210 * __thread is now a keyword.
4213 hackname = thread_keyword;
4214 files = "pthread.h";
4215 files = "bits/sigthread.h";
4216 select = "([* ])__thread([,)])";
4218 c_fix_arg = "%1__thr%2";
4221 "extern int pthread_create (pthread_t *__restrict __thread,\n"
4222 "extern int pthread_kill (pthread_t __thread, int __signo);\n"
4223 "extern int pthread_cancel (pthread_t __thread);";
4227 * if the #if says _cplusplus, not the double underscore __cplusplus
4231 hackname = tinfo_cplusplus;
4233 select = "[ \t]_cplusplus";
4236 c_fix_arg = " __cplusplus";
4237 test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
4241 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4244 hackname = ultrix_const;
4246 select = 'perror\
( char \
*';
4249 c_fix_arg = "%1 const %3 *__";
4250 c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
4251 "[ \t]+(char|void) \\*__";
4254 "extern void perror( char *__s );\n"
4255 "extern int fputs( char *__s, FILE *);\n"
4256 "extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
4257 "extern int fscanf( FILE *__stream, char *__format, ...);\n"
4258 "extern int scanf( char *__format, ...);\n";
4262 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4265 hackname = ultrix_const2;
4268 select = '\
*fopen\
( char \
*';
4270 c_fix_arg = "%1( const char *%3, const char *";
4271 c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
4272 "[ \t]*char[ \t]*\\*([^,]*),"
4273 "[ \t]*char[ \t]*\\*[ \t]*";
4276 "extern FILE *fopen( char *__filename, char *__type );\n"
4277 "extern int sscanf( char *__s, char *__format, ...);\n"
4278 "extern FILE *popen(char *, char *);\n"
4279 "extern char *tempnam(char*,char*);\n";
4283 * Fix definitions of macros used by va-i960.h in VxWorks header file.
4286 hackname = va_i960_macro;
4287 files = arch/i960/archI960.h;
4288 select = "__(vsiz|vali|vpad|alignof__)";
4291 c_fix_arg = "__vx%1";
4294 "extern int __vsiz vsiz;\n"
4295 "extern int __vali vali;\n"
4296 "extern int __vpad vpad;\n"
4297 "#define __alignof__(x) ...";
4301 * Define __CAN_USE_EXTERN_PREFIX on vms.
4304 hackname = vms_define_can_use_extern_prefix;
4305 files = "rtldef/decc$types.h";
4306 select = "#[ \t]*else\n"
4307 "#[ \t]*if defined\\(__DECCXX\\)\n"
4308 "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n";
4313 "# elif defined (__GNUC__)\n"
4314 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n";
4316 test_text = "# else\n"
4317 "# if defined(__DECCXX)\n"
4318 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"
4324 * On VMS, use pragma extern_model instead of VAX-C keywords.
4327 hackname = vms_use_pragma_extern_model;
4328 select = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n"
4329 "# pragma extern_model __save\n";
4333 c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n"
4334 "# pragma extern_model __save\n";
4336 test_text = "#if defined(__DECC) || defined(__DECCXX)\n"
4337 "# pragma extern_model __save\n"
4338 "# pragma extern_model strict_refdef\n"
4339 " extern struct x zz$yy;\n"
4340 "# pragma extern_model __restore\n"
4345 * On VMS, disable the use of dec-c string builtins
4348 hackname = vms_disable_decc_string_builtins;
4349 select = "#if !defined\\(__VAX\\)\n";
4351 files = "rtldef/string.h";
4354 c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n";
4356 test_text = "#if !defined(__VAX)\n";
4360 * On VMS, change <resource.h> to <sys/resource.h> to avoid a
4361 * conflict while building gcc. Likewise for <builtins.h>
4364 hackname = vms_use_quoted_include;
4365 select = "(#[ \t]*include[ \t]+)<(resource|builtins)\\.h>";
4367 files = rtldef/wait.h, starlet_c/pthread.h;
4370 c_fix_arg = '%1<sys
/%2.h
>';
4372 test_text = "# include <resource.h>";
4376 * On VMS, add missing braces around sigset_t constants.
4379 hackname = vms_add_missing_braces;
4380 select = "(_SIG_[A-Z]+_SET[ \t]+= \\{)(0x[0F]+, 0x[0F]+)";
4382 files = "rtldef/signal.h";
4385 c_fix_arg = '%1 {%2} ';
4387 test_text = "static const __sigset_t _SIG_EMPTY_SET = "
4388 "{0x00000000, 0x00000000},\n"
4389 " _SIG_FULL_SET = {0xFFFFFFFF, 0xFFFFFFFF};\n";
4393 * On VMS, fix incompatible redeclaration of hostalias.
4396 hackname = vms_do_not_redeclare_hostalias;
4397 select = "(void[ \t]+fp_nquery \\(const u_char \\*, int, FILE \\*\\);)\n"
4398 "(__char_ptr32[ \t]+hostalias \\(const char \\*\\);)";
4400 files = "rtldef/resolv.h";
4406 test_text = "void fp_nquery (const u_char *, int, FILE *);\n"
4407 "__char_ptr32 hostalias (const char *);\n";
4411 * On VMS, some DEC-C builtins are directly used.
4414 hackname = vms_decc_builtin;
4415 select = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY)";
4417 files = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
4419 sed = "s@__MEMSET@memset@";
4420 sed = "s@__MEMMOVE@memmove@";
4421 sed = "s@__MEMCPY@memcpy@";
4422 sed = "s@__STRLEN@strlen@";
4423 sed = "s@__STRCPY@strcpy@";
4425 test_text = "define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p)))\n";
4429 * On VMS, do not declare getopt and al if pointers are 64 bit.
4432 hackname = vms_no_64bit_getopt;
4433 select = "^[ \t]*(extern[ \t]*)?(int[ \t]*(getopt|optind|opterr|optopt)"
4434 "|(char \\*optarg))([ \t]*\\(.*\\))?;\n";
4436 files = rtldef/stdio.h, rtldef/unistd.h;
4439 c_fix_arg = <<- _EOArg_
4440 #if __INITIAL_POINTER_SIZE != 64 /* getopt is short ptr only. */
4445 test_text = "int getopt (int, char * const [], const char *);";
4449 * On VMS, forward declare structure before referencing them in prototypes.
4452 hackname = vms_forward_declare_struct;
4453 select = "(/\\* forward decls for C\\+\\+ \\*/\n)"
4454 "#ifdef __cplusplus\n";
4456 files = rtldef/if.h;
4460 "#if defined (__cplusplus) || defined (__GNUC__)\n";
4462 test_text = "/* forward decls for C++ */\n"
4463 "#ifdef __cplusplus\n"
4469 * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
4470 * which is not yet fully supported by gcc.
4473 hackname = vms_use_fast_setjmp;
4474 select = "(#[ \t]*if[ \t]*defined\\(__FAST_SETJMP\\)[ \t]*\\|\\|)";
4476 files = rtldef/setjmp.h;
4479 c_fix_arg = "%0 defined (__GNUC__) ||";
4481 test_text = "# if defined(__FAST_SETJMP) || defined(__UNIX_SETJMP)";
4485 * AIX and Interix headers define NULL to be cast to a void pointer,
4486 * which is illegal in ANSI C++.
4489 hackname = void_null;
4490 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
4491 time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h;
4492 /* avoid changing C++ friendly NULL */
4493 bypass = __cplusplus;
4495 select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
4497 c_fix_arg = <<- _EOFix_
4502 #else /* ! __GNUG__ */
4504 #endif /* __GNUG__ */
4505 #else /* ! __cplusplus */
4506 #define NULL ((void *)0)
4507 #endif /* __cplusplus */
4510 test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
4514 * Make VxWorks header which is almost gcc ready fully gcc ready.
4517 hackname = vxworks_gcc_problem;
4518 files = types/vxTypesBase.h;
4519 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
4521 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
4524 sed = "/[ \t]size_t/i\\\n"
4525 "#ifndef _GCC_SIZE_T\\\n"
4526 "#define _GCC_SIZE_T\n";
4528 sed = "/[ \t]size_t/a\\\n"
4531 sed = "/[ \t]ptrdiff_t/i\\\n"
4532 "#ifndef _GCC_PTRDIFF_T\\\n"
4533 "#define _GCC_PTRDIFF_T\n";
4535 sed = "/[ \t]ptrdiff_t/a\\\n"
4538 sed = "/[ \t]wchar_t/i\\\n"
4539 "#ifndef _GCC_WCHAR_T\\\n"
4540 "#define _GCC_WCHAR_T\n";
4542 sed = "/[ \t]wchar_t/a\\\n"
4546 "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
4547 "typedef unsigned int size_t;\n"
4548 "typedef long ptrdiff_t;\n"
4549 "typedef unsigned short wchar_t;\n"
4550 "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
4554 * Wrap VxWorks ioctl to keep everything pretty
4557 hackname = vxworks_ioctl_macro;
4559 mach = "*-*-vxworks*";
4563 "#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
4564 c_fix_arg = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
4566 test_text = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
4570 * Wrap VxWorks mkdir to be posix compliant
4573 hackname = vxworks_mkdir_macro;
4575 mach = "*-*-vxworks*";
4579 "#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n";
4580 c_fix_arg = "extern[\t ]+STATUS[\t ]+mkdir[\t ]*"
4581 "\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*" /* arg type */
4582 "(|[_[:alpha:]][_[:alnum:]]*)" /* arg name (optional) */
4585 test_text = "extern STATUS mkdir (const char * _qwerty) ;";
4589 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
4592 hackname = vxworks_needs_vxtypes;
4594 select = "uint_t([ \t]+_clocks_per_sec)";
4596 c_fix_arg = "unsigned int%1";
4597 test_text = "uint_t\t_clocks_per_sec;";
4601 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
4604 hackname = vxworks_needs_vxworks;
4606 test = " -r types/vxTypesOld.h";
4607 test = " -n \"`egrep '#include
' $file`\"";
4608 test = " -n \"`egrep ULONG $file`\"";
4609 select = "#[ \t]define[ \t]+__INCstath";
4611 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
4612 "#include <types/vxTypesOld.h>\n";
4614 test_text = "`touch types/vxTypesOld.h`"
4615 "#include </dev/null> /* ULONG */\n"
4616 "# define\t__INCstath <sys/stat.h>";
4620 * Make it so VxWorks does not include gcc/regs.h accidentally
4623 hackname = vxworks_regs;
4624 mach = "*-*-vxworks*";
4626 select = "#[\t ]*include[\t ]+[<\"]regs.h[>\"]";
4628 c_fix_arg = "#include <arch/../regs.h>";
4630 test_text = "#include <regs.h>\n";
4634 * Another bad dependency in VxWorks 5.2 <time.h>.
4637 hackname = vxworks_time;
4639 test = " -r vxWorks.h";
4641 select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
4645 "#ifndef __gcc_VOIDFUNCPTR_defined\n"
4646 "#ifdef __cplusplus\n"
4647 "typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
4649 "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
4651 "#define __gcc_VOIDFUNCPTR_defined\n"
4653 "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
4655 test_text = "`touch vxWorks.h`"
4656 "#define VOIDFUNCPTR (void(*)())";
4660 * This hack makes write const-correct on VxWorks
4663 hackname = vxworks_write_const;
4665 mach = "*-*-vxworks*";
4668 c_fix_arg = "extern int write (int, const char*, size_t);";
4669 c_fix_arg = "extern[\t ]+int[\t ]+write[\t ]*\\("
4671 "[\t ]*char[\t ]*\\*[\t ]*,"
4672 "[\t ]*size_t[\t ]*\\)[\t ]*;";
4674 test_text = "extern int write ( int , char * , size_t ) ;";
4678 * There are several name conflicts with C++ reserved words in X11 header
4679 * files. These are fixed in some versions, so don't do the fixes if
4680 * we find __cplusplus in the file. These were found on the RS
/6000.
4683 hackname
= x11_class
;
4684 files
= X11
/ShellP.h
;
4685 bypass
= __cplusplus
;
4686 select
= "^([ \t]*char \\*)class;(.*)";
4688 c_fix_arg
= "#ifdef __cplusplus\n%1c_class;%2\n"
4689 "#else\n%1class;%2\n#endif";
4697 * class in Xm
/BaseClassI.h
4700 hackname
= x11_class_usage
;
4701 files
= Xm
/BaseClassI.h
;
4702 bypass
= "__cplusplus";
4704 select
= " class\\)";
4706 c_fix_arg
= " c_class)";
4708 test_text
= "extern mumble (int class);\n";
4712 * new in Xm
/Traversal.h
4716 files
= Xm
/Traversal.h
;
4717 bypass
= __cplusplus
;
4719 sed
= "/Widget\told, new;/i\\\n"
4720 "#ifdef __cplusplus\\\n"
4721 "\\\tWidget\told, c_new;\\\n"
4724 sed
= "/Widget\told, new;/a\\\n"
4727 sed
= "s/Widget new,/Widget c_new,/g";
4730 " Widget\told, new;\n"
4731 "};\nextern Wedged( Widget new, Widget old );";
4735 * Incorrect sprintf declaration in X11
/Xmu.h
4738 hackname
= x11_sprintf
;
4740 files
= X11
/Xmu
/Xmu.h
;
4741 select
= "^extern char \\*\tsprintf\\(\\);$";
4744 c_fix_arg
= "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
4746 test_text
= "extern char *\tsprintf();";
4750 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
4751 * that fails when compiling for SSE
-less
32-bit x86.
4754 hackname
= feraiseexcept_nosse_invalid
;
4755 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
4756 files
= bits
/fenv.h
;
4757 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
4758 ": \"x\" \\(__f\\)\\);$";
4759 bypass
= "\"fdiv .*; fwait\"";
4762 c_fix_arg
= <<- _EOText_
4763 # ifdef __SSE_MATH__
4766 %1__asm__
__volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
4767 %1 : "=t" (__f
) : "0" (__f
));
4771 test_text
= <<- _EOText_
4772 __asm__
__volatile__ ("divss %0, %0" : : "x" (__f
));
4777 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
4778 * that fails when compiling for SSE
-less
32-bit x86.
4781 hackname
= feraiseexcept_nosse_divbyzero
;
4782 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
4783 files
= bits
/fenv.h
;
4784 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
4785 ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
4786 bypass
= "\"fdivp .*; fwait\"";
4789 c_fix_arg
= <<- _EOText_
4790 # ifdef __SSE_MATH__
4793 %1__asm__
__volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
4794 %1 : "=t" (__f
) : "0" (__f
), "u" (__g
) : "st(1)");
4798 test_text
= <<- _EOText_
4799 __asm__
__volatile__ ("divss %1, %0" : : "x" (__f
), "x" (__g
));
4804 * Old Linux kernel
's <compiler.h> header breaks Traditional CPP
4807 hackname = complier_h_tradcpp;
4808 files = linux/compiler.h;
4810 select = "#define __builtin_warning\\(x, y\\.\\.\\.\\) \\(1\\)";
4812 c_fix_arg = "/* __builtin_warning(x, y...) is obsolete */";
4814 test_text = "#define __builtin_warning(x, y...) (1)";