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[ \t]*=[ \t]*(.*);'
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 * assert.h on AIX 7 redefines static_assert as _Static_assert without
576 hackname = aix_assert;
579 select = "#define[ \t]static_assert[ \t]_Static_assert";
581 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
582 test_text = "#define static_assert _Static_assert";
586 * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
587 * which only is provided by AIX xlc C99.
590 hackname = aix_complex;
593 select = "#define[ \t]_Complex_I[ \t]__I";
595 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
596 test_text = "#define _Complex_I __I\n";
600 * malloc.h on AIX6 uses XLC++ specific builtin syntax
603 hackname = aix_malloc;
606 select = "#ifdef __cplusplus";
608 c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
609 test_text = "#ifdef __cplusplus";
613 * net/if_arp.h defines a variable fc_softc instead of adding a
614 * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
617 hackname = aix_net_if_arp;
619 files = "net/if_arp.h";
620 select = "^struct fc_softc \\{";
622 c_fix_arg = "typedef struct _fc_softc {";
623 test_text = "struct fc_softc {\n int a;\n};";
627 * Fix AIX definition of NULL for G++.
632 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
633 time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h;
635 select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*";
637 c_fix_arg = <<- _EOFix_
642 #else /* ! __GNUG__ */
644 #endif /* __GNUG__ */
645 #else /* ! __cplusplus */
646 #define NULL ((void *)0)
647 #endif /* __cplusplus */
650 test_text = "# define\tNULL \t(0L) /* typed NULL */";
654 * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER,
655 * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough
659 hackname = aix_once_init_1;
662 select = "#define[ \t]PTHREAD_ONCE_INIT \\\\\n"
665 c_fix_arg = "#define PTHREAD_ONCE_INIT \\\n"
667 test_text = "#define PTHREAD_ONCE_INIT \\\\\n"
672 hackname = aix_once_init_2;
675 select = "[ \t]0 \\\\\n"
678 c_fix_arg = " 0 \\\n"
680 test_text = " 0 \\\\\n"
685 hackname = aix_mutex_initializer_1;
688 select = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n"
691 c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n"
693 test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
698 hackname = aix_cond_initializer_1;
701 select = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n"
704 c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n"
706 test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n"
711 hackname = aix_rwlock_initializer_1;
714 select = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n"
717 c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n"
719 test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
724 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
725 * which violates a requirement of ISO C.
728 hackname = aix_pthread;
730 select = "(#define[\t ][A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
733 test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
734 "{...init stuff...}";
738 * AIX stdint.h fixes.
741 hackname = aix_stdint_1;
743 files = stdint-aix.h, stdint.h;
744 select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
745 "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
747 c_fix_arg = "#define UINT8_MAX (255)\n"
748 "#define UINT16_MAX (65535)";
749 test_text = "#define UINT8_MAX (255U)\n"
750 "#define UINT16_MAX (65535U)";
757 hackname = aix_stdint_2;
759 files = stdint-aix.h, stdint.h;
760 select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
761 "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
762 "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
764 "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
765 "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
766 "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
768 c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
769 "#define INTPTR_MAX 9223372036854775807L\n"
770 "#define UINTPTR_MAX 18446744073709551615UL\n"
772 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
773 "#define INTPTR_MAX 2147483647L\n"
774 "#define UINTPTR_MAX 4294967295UL";
775 test_text = "#define INTPTR_MIN INT64_MIN\n"
776 "#define INTPTR_MAX INT64_MAX\n"
777 "#define UINTPTR_MAX UINT64_MAX\n"
779 "#define INTPTR_MIN INT32_MIN\n"
780 "#define INTPTR_MAX INT32_MAX\n"
781 "#define UINTPTR_MAX UINT32_MAX";
788 hackname = aix_stdint_3;
790 files = stdint-aix.h, stdint.h;
791 select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
792 "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
794 "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
795 "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
797 c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
798 "#define PTRDIFF_MAX 9223372036854775807L\n"
800 "#define PTRDIFF_MIN (-2147483647L - 1)\n"
801 "#define PTRDIFF_MAX 2147483647L";
802 test_text = "#define PTRDIFF_MIN INT64_MIN\n"
803 "#define PTRDIFF_MAX INT64_MAX\n"
805 "#define PTRDIFF_MIN INT32_MIN\n"
806 "#define PTRDIFF_MAX INT32_MAX";
813 hackname = aix_stdint_4;
815 files = stdint-aix.h, stdint.h;
816 select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
818 "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
820 c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
822 "#define SIZE_MAX 4294967295UL";
823 test_text = "#define SIZE_MAX UINT64_MAX\n"
825 "#define SIZE_MAX UINT32_MAX";
832 hackname = aix_stdint_5;
834 files = stdint-aix.h, stdint.h;
835 select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
836 "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
838 c_fix_arg = "#define UINT8_C(c) c\n"
839 "#define UINT16_C(c) c";
840 test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
841 "#define UINT16_C(c) __CONCAT__(c,U)";
845 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
846 * in an otherwise harmless (and #ifed out) macro definition
849 hackname = aix_sysmachine;
850 files = sys/machine.h;
854 test_text = "#define FOO \\\n"
855 " bar \\ \n baz \\ \n bat";
859 * sys/wait.h on AIX 5.2 defines macros that have both signed and
860 * unsigned types in conditional expressions.
863 hackname = aix_syswait_2;
865 select = '\? (\
(\
(\
(\
(unsigned
[^
)]*\
)[^
)]*\
) >> [^
)]*\
) \
& 0xff\
) : -1)';
867 c_fix_arg = "? (int)%1";
868 test_text = "#define WSTOPSIG(__x) "
869 "(int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
873 * sys/signal.h on some versions of AIX uses volatile in the typedef of
874 * sig_atomic_t, which causes gcc to generate a warning about duplicate
875 * volatile when a sig_atomic_t variable is declared volatile, as
876 * required by ANSI C.
879 hackname = aix_volatile;
880 files = sys/signal.h;
881 select = "typedef volatile int sig_atomic_t";
883 c_fix_arg = "typedef int sig_atomic_t";
884 test_text = "typedef volatile int sig_atomic_t;";
888 * Fix __assert declaration in assert.h on Alpha OSF/1.
891 hackname = alpha___assert;
893 select = '__assert\
(char \
*, char \
*, int\
)';
895 c_fix_arg = "__assert(const char *, const char *, int)";
896 test_text = 'extern void
__assert(char
*, char
*, int
);';
900 * Fix assert macro in assert.h on Alpha OSF/1.
901 * The superfluous int cast breaks C++.
904 hackname = alpha_assert;
906 select = "(#[ \t]*" 'define assert\
(EX\
).*)\
(\
(int\
) \
(EX\
)\
)';
908 c_fix_arg = "%1(EX)";
909 test_text = '#define
assert(EX
) (((int
) (EX
)) ?
(void
)0 '
910 ': __assert(#EX
, __FILE__
, __LINE__
))';
914 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
917 hackname = alpha_getopt;
920 select = 'getopt\
(int
, char \
*\
[\
], *char \
*\
)';
922 c_fix_arg = "getopt(int, char *const[], const char *)";
923 test_text = 'extern int
getopt(int
, char
*[], char *)
;';
927 * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
930 hackname = alpha_if_semicolon;
932 select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
934 c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
935 test_text = ' struct sockaddr vmif_paddr
/* protocol address
*/';
939 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
942 hackname = alpha_parens;
944 select = '#ifndef\
(__mips64\
)';
946 c_fix_arg = "#ifndef __mips64";
947 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
951 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
955 hackname = alpha_sbrk;
957 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
959 c_fix_arg = "void *sbrk(";
960 test_text = "extern char* sbrk(ptrdiff_t increment);";
964 * For C++, avoid any typedef or macro definition of bool,
965 * and use the built in type instead.
966 * HP/UX 10.20 also has it in curses_colr/curses.h.
969 hackname = avoid_bool_define;
971 files = curses_colr/curses.h;
975 select = "#[ \t]*define[ \t]+bool[ \t]";
976 bypass = "__cplusplus";
979 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
980 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
982 test_text = "# define bool\t char \n";
989 hackname = avoid_bool_type;
991 files = curses_colr/curses.h;
995 select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
996 bypass = "__cplusplus";
999 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1001 test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
1005 * For C++, avoid any typedef definition of wchar_t,
1006 * and use the built in type instead.
1007 * Don't do this for headers that are smart enough to do the right
1008 * thing (recent
[n
]curses.h and Xlib.h
).
1009 * Don
't do it for <linux/nls.h> which is never used from C++ anyway,
1010 * and will be broken by the edit.
1014 hackname = avoid_wchar_t_type;
1016 select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
1017 bypass = "__cplusplus";
1018 bypass = "_LINUX_NLS_H";
1019 bypass = "XFree86: xc/lib/X11/Xlib\\.h";
1022 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1024 test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
1028 * Fix `typedef struct term;' on hppa1.1
-hp
-hpux9.
1031 hackname
= bad_struct_term
;
1033 select
= "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
1035 c_fix_arg
= "struct term;";
1037 test_text
= 'typedef struct term;';
1041 * Fix one other error in this file
:
1042 * a mismatched quote not inside a C comment.
1045 hackname
= badquote
;
1046 files
= sundev
/vuid_event.h
;
1049 c_fix_arg
= "does not";
1051 test_text
= "/* doesn't have matched single quotes */";
1055 * check for broken assert.h that needs stdio.h
1058 hackname
= broken_assert_stdio
;
1061 bypass
= "include.*stdio\\.h";
1063 c_fix_arg
= "#include <stdio.h>\n";
1064 test_text
= "extern FILE* stderr;";
1068 * check for broken assert.h that needs stdlib.h
1071 hackname
= broken_assert_stdlib
;
1073 select
= 'exit *\(|abort *\(';
1074 bypass
= "include.*stdlib\\.h";
1076 c_fix_arg
= "#ifdef __cplusplus\n"
1077 "#include <stdlib.h>\n"
1079 test_text
= "extern void exit ( int );";
1083 * Remove `extern double cabs
' declarations from math.h.
1084 * This conflicts with C99. Discovered on AIX.
1085 * Darwin hides its broken cabs in architecture-specific subdirs.
1088 hackname = broken_cabs;
1089 files = math.h, "architecture/*/math.h";
1090 select = "^extern[ \t]+double[ \t]+cabs";
1092 sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
1093 sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
1095 test_text = "#ifdef __STDC__\n"
1096 "extern double cabs(struct dbl_hypot);\n"
1098 "extern double cabs();\n"
1100 "extern double cabs ( _Complex z );";
1104 * Fixup Darwin's broken check for __builtin_nanf.
1107 hackname
= broken_nan
;
1109 * It is tempting to omit the first
"files" entry. Do not.
1110 * The testing machinery will take the first
"files" entry as the name
1111 * of a test file to play with. It would be a nuisance to have a directory
1112 * with the name
"*".
1114 files
= "architecture/ppc/math.h";
1115 files
= "architecture/*/math.h";
1116 select
= '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)';
1119 c_fix_arg
= "#if 1";
1120 test_text
= "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
1124 * Various systems derived from BSD4.4 contain a macro definition
1125 * for vfscanf that interacts badly with requirements of builtin
-attrs.def.
1126 * Known to be fixed in FreeBSD
5 system headers.
1129 hackname
= bsd_stdio_attrs_conflict
;
1131 mach
= "*-*-*darwin*";
1133 select
= "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
1135 c_fix_arg
= '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n"
1136 '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n"
1137 'int vfscanf(FILE *, const char *, __builtin_va_list) '
1138 '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");';
1139 test_text
= '#define vfscanf __svfscanf';
1143 * Fix various macros used to define ioctl numbers.
1144 * The traditional syntax was
:
1146 * #define
_CTRL(n
, x
) (('n'<<8)+x
)
1147 * #define TCTRLCFOO
_CTRL(T
, 1)
1149 * but this does not work with the C standard
, which disallows macro
1150 * expansion inside strings. We have to rewrite it thus
:
1152 * #define
_CTRL(n
, x
) ((n
<<8)+x
)
1153 * #define TCTRLCFOO
_CTRL('T', 1)
1155 * The select expressions match too much
, but the c_fix code is cautious.
1157 * CTRL might be
: CTRL _CTRL ISCTRL BSD43_CTRL ...
1160 hackname
= ctrl_quotes_def
;
1161 select
= "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
1162 c_fix
= char_macro_def
;
1166 * This is two tests in order to ensure that the
"CTRL(c)" can
1167 * be selected in isolation from the multi
-arg format
1169 test_text
= "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n";
1170 test_text
= "#define _CTRL(c) ('c'&037)";
1174 * Fix various macros used to define ioctl numbers.
1177 hackname
= ctrl_quotes_use
;
1178 select
= "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1179 c_fix
= char_macro_use
;
1181 test_text
= "#define TCTRLFOO BSD43_CTRL(T, 1)";
1185 * sys
/mman.h on HP
/UX is not C
++ ready
,
1186 * even though NO_IMPLICIT_EXTERN_C is defined on HP
/UX.
1188 * rpc
/types.h on OSF1
/2.0 is not C
++ ready
,
1189 * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
1191 * The problem is the declaration of malloc.
1194 hackname
= cxx_unready
;
1196 files
= rpc
/types.h
;
1197 select
= '[^#]+malloc.*;'; /* Catch any form of declaration
1198 not within a macro.
*/
1199 bypass
= '"C"|__BEGIN_DECLS';
1202 c_fix_arg
= "#ifdef __cplusplus\n"
1205 c_fix_arg
= "#ifdef __cplusplus\n"
1208 test_text
= "extern void* malloc( size_t );";
1212 * For the AAB_darwin7_9_long_double_funcs fix to be useful
,
1213 * you have to not use
"" includes.
1216 hackname
= darwin_9_long_double_funcs_2
;
1217 mach
= "*-*-darwin7.9*";
1219 select
= '#include[ \t]+\"';
1221 c_fix_arg
= "%1<%2.h>";
1223 c_fix_arg
= '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
1225 test_text
= '#include "architecture/ppc/math.h"';
1229 * On darwin8 and earlier
, mach
-o
/swap.h isn
't properly guarded
1230 * by 'extern
"C"'. On darwin7 some mach/ headers aren't properly guarded.
1233 hackname
= darwin_externc
;
1234 mach
= "*-*-darwin*";
1235 files
= mach
-o
/swap.h
;
1236 files
= mach
/mach_time.h
;
1237 files
= mach
/mach_traps.h
;
1238 files
= mach
/message.h
;
1240 files
= mach
/semaphore.h
;
1241 bypass
= "extern \"C\"";
1242 bypass
= "__BEGIN_DECLS";
1244 c_fix_arg
= "#ifdef __cplusplus\n"
1247 c_fix_arg
= "#ifdef __cplusplus\n"
1250 test_text
= "extern void swap_fat_header();\n";
1254 * AvailabilityMacros.h on Darwin breaks with GCC
4.0, because of
1255 * bad __GNUC__ tests.
1258 hackname
= darwin_gcc4_breakage
;
1259 mach
= "*-*-darwin*";
1260 files
= AvailabilityMacros.h
;
1261 select
= "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
1263 c_fix_arg
= "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
1264 test_text
= "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
1265 "(__GNUC_MINOR__ >= 1)\n";
1269 * __private_extern__ doesn
't exist in FSF GCC. Even if it did,
1270 * why would you ever put it in a system header file?
1273 hackname = darwin_private_extern;
1274 mach = "*-*-darwin*";
1275 files = mach-o/dyld.h;
1276 select = "__private_extern__ [a-z_]+ _dyld_";
1278 c_fix_arg = "extern";
1279 c_fix_arg = "__private_extern__";
1280 test_text = "__private_extern__ int _dyld_func_lookup(\n"
1281 "const char *dyld_func_name,\n"
1282 "unsigned long *address);\n";
1286 * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
1287 * unsigned constants.
1290 hackname = darwin_stdint_1;
1291 mach = "*-*-darwin*";
1292 files = stdint-darwin.h, stdint.h;
1294 c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
1295 select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
1296 "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
1297 test_text = "#define UINT8_C(v) (v ## U)\n"
1298 "#define UINT16_C(v) (v ## U)";
1302 * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
1306 hackname = darwin_stdint_2;
1307 mach = "*-*-darwin*";
1308 files = stdint-darwin.h, stdint.h;
1310 c_fix_arg = "#if __WORDSIZE == 64\n"
1311 "#define INTPTR_MAX 9223372036854775807L\n"
1312 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1314 "#define INTPTR_MAX 2147483647L\n"
1315 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1317 select = "#if __WORDSIZE == 64\n"
1318 "#define INTPTR_MIN[ \t]+INT64_MIN\n"
1319 "#define INTPTR_MAX[ \t]+INT64_MAX\n"
1321 "#define INTPTR_MIN[ \t]+INT32_MIN\n"
1322 "#define INTPTR_MAX[ \t]+INT32_MAX\n"
1324 test_text = "#if __WORDSIZE == 64\n"
1325 "#define INTPTR_MIN INT64_MIN\n"
1326 "#define INTPTR_MAX INT64_MAX\n"
1328 "#define INTPTR_MIN INT32_MIN\n"
1329 "#define INTPTR_MAX INT32_MAX\n"
1334 * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
1337 hackname = darwin_stdint_3;
1338 mach = "*-*-darwin*";
1339 files = stdint-darwin.h, stdint.h;
1341 c_fix_arg = "#if __WORDSIZE == 64\n"
1342 "#define UINTPTR_MAX 18446744073709551615UL\n"
1344 "#define UINTPTR_MAX 4294967295UL\n"
1346 select = "#if __WORDSIZE == 64\n"
1347 "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
1349 "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
1351 test_text = "#if __WORDSIZE == 64\n"
1352 "#define UINTPTR_MAX UINT64_MAX\n"
1354 "#define UINTPTR_MAX UINT32_MAX\n"
1359 * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
1362 hackname = darwin_stdint_4;
1363 mach = "*-*-darwin*";
1364 files = stdint-darwin.h, stdint.h;
1366 c_fix_arg = "#if __WORDSIZE == 64\n"
1367 "#define SIZE_MAX 18446744073709551615UL\n"
1369 "#define SIZE_MAX 4294967295UL\n"
1371 select = "#if __WORDSIZE == 64\n"
1372 "#define SIZE_MAX[ \t]+UINT64_MAX\n"
1374 "#define SIZE_MAX[ \t]+UINT32_MAX\n"
1376 test_text = "#if __WORDSIZE == 64\n"
1377 "#define SIZE_MAX UINT64_MAX\n"
1379 "#define SIZE_MAX UINT32_MAX\n"
1384 * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
1385 * with a wrong type.
1388 hackname = darwin_stdint_5;
1389 mach = "*-*-darwin*";
1390 files = stdint-darwin.h, stdint.h;
1392 c_fix_arg = "#if __WORDSIZE == 64\n"
1393 "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
1394 "#define INTMAX_MAX 9223372036854775807L\n"
1395 "#define UINTMAX_MAX 18446744073709551615UL\n"
1397 "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
1398 "#define INTMAX_MAX 9223372036854775807LL\n"
1399 "#define UINTMAX_MAX 18446744073709551615ULL\n"
1401 select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
1402 "#define INTMAX_MAX[ \t]+INT64_MAX\n"
1404 "#define UINTMAX_MAX[ \t]+UINT64_MAX";
1405 test_text = "#define INTMAX_MIN INT64_MIN\n"
1406 "#define INTMAX_MAX INT64_MAX\n"
1408 "#define UINTMAX_MAX UINT64_MAX";
1412 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1413 * with a wrong type.
1416 hackname = darwin_stdint_6;
1417 mach = "*-*-darwin*";
1418 files = stdint-darwin.h, stdint.h;
1420 c_fix_arg = "#if __WORDSIZE == 64\n"
1421 "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
1422 "#define PTRDIFF_MAX 9223372036854775807L\n"
1424 "#define PTRDIFF_MIN (-2147483647 - 1)\n"
1425 "#define PTRDIFF_MAX 2147483647\n"
1427 select = "#if __WORDSIZE == 64\n"
1428 "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
1429 "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
1431 "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
1432 "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
1434 test_text = "#if __WORDSIZE == 64\n"
1435 "#define PTRDIFF_MIN INT64_MIN\n"
1436 "#define PTRDIFF_MAX INT64_MAX\n"
1438 "#define PTRDIFF_MIN INT32_MIN\n"
1439 "#define PTRDIFF_MAX INT32_MAX\n"
1444 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1445 * with a wrong type.
1448 hackname = darwin_stdint_7;
1449 mach = "*-*-darwin*";
1450 files = stdint-darwin.h, stdint.h;
1452 c_fix_arg = "#if __WORDSIZE == 64\n"
1453 "#define INTMAX_C(v) (v ## L)\n"
1454 "#define UINTMAX_C(v) (v ## UL)\n"
1456 "#define INTMAX_C(v) (v ## LL)\n"
1457 "#define UINTMAX_C(v) (v ## ULL)\n"
1459 select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
1460 "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
1461 test_text = "#define INTMAX_C(v) (v ## LL)\n"
1462 "#define UINTMAX_C(v) (v ## ULL)";
1466 * Fix <c_asm.h> on Digital UNIX V4.0:
1467 * It contains a prototype for a DEC C internal asm() function,
1468 * clashing with gcc's asm keyword. So protect this with __DECC.
1471 hackname
= dec_intern_asm
;
1473 sed
= "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1474 sed
= "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
1478 " ... asm stuff ...\n"
1479 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
1483 * Fix typo in
<wchar.h
> on DJGPP
2.03.
1486 hackname
= djgpp_wchar_h
;
1488 select
= "__DJ_wint_t";
1489 bypass
= "sys/djtypes.h";
1491 c_fix_arg
= "%0\n#include <sys/djtypes.h>";
1492 c_fix_arg
= "#include <stddef.h>";
1493 test_text
= "#include <stddef.h>\n"
1494 "extern __DJ_wint_t x;\n";
1498 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1501 hackname
= ecd_cursor
;
1502 files
= "sunwindow/win_lock.h";
1503 files
= "sunwindow/win_cursor.h";
1504 select
= 'ecd\.cursor';
1506 c_fix_arg
= 'ecd_cursor';
1508 test_text
= "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1512 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
1513 * that fails when compiling for SSE
-less
32-bit x86.
1516 hackname
= feraiseexcept_nosse_divbyzero
;
1517 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
1518 files
= bits
/fenv.h
, '*/bits/fenv.h';
1519 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
1520 ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
1521 bypass
= "\"fdivp .*; fwait\"";
1524 c_fix_arg
= <<- _EOText_
1525 # ifdef __SSE_MATH__
1528 %1__asm__
__volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
1529 %1 : "=t" (__f
) : "0" (__f
), "u" (__g
) : "st(1)");
1533 test_text
= <<- _EOText_
1534 __asm__
__volatile__ ("divss %1, %0" : : "x" (__f
), "x" (__g
));
1539 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
1540 * that fails when compiling for SSE
-less
32-bit x86.
1543 hackname
= feraiseexcept_nosse_invalid
;
1544 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
1545 files
= bits
/fenv.h
, '*/bits/fenv.h';
1546 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
1547 ": \"x\" \\(__f\\)\\);$";
1548 bypass
= "\"fdiv .*; fwait\"";
1551 c_fix_arg
= <<- _EOText_
1552 # ifdef __SSE_MATH__
1555 %1__asm__
__volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
1556 %1 : "=t" (__f
) : "0" (__f
));
1560 test_text
= <<- _EOText_
1561 __asm__
__volatile__ ("divss %0, %0" : : "x" (__f
));
1566 * Between
8/24/1998 and
2/17/2001, FreeBSD system headers presume
1567 * neither the existence of GCC
3 nor its exact feature set yet break
1568 * (by design?
) when __GNUC__ is set beyond
2.
1571 hackname
= freebsd_gcc3_breakage
;
1572 mach
= "*-*-freebsd*";
1573 files
= sys
/cdefs.h
;
1574 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
1575 bypass
= '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
1577 c_fix_arg
= '%0 || __GNUC__ >= 3';
1578 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
1582 * Some releases of FreeBSD
4 and FreeBSD
5.0 and
5.1 system headers presume
1583 * neither the existence of GCC
4 nor its exact feature set yet break
1584 * (by design?
) when __GNUC__ is set beyond
3.
1587 hackname
= freebsd_gcc4_breakage
;
1588 mach
= "*-*-freebsd*";
1589 files
= sys
/cdefs.h
;
1590 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
1592 c_fix_arg
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
1593 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
1597 * Some versions of glibc don
't expect the C99 inline semantics.
1600 hackname = glibc_c99_inline_1;
1601 files = features.h, '*/features.h
';
1602 select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
1604 c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
1606 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
1607 && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
1608 # define __USE_EXTERN_INLINES 1
1614 * Similar, but a version that didn't have __NO_INLINE__
1617 hackname
= glibc_c99_inline_1a
;
1618 files
= features.h
, '*/features.h';
1619 select
= "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
1620 "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
1622 c_fix_arg
= "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
1624 #if
__GNUC_PREREQ (2, 7) && defined __OPTIMIZE__
&& !defined __OPTIMIZE_SIZE__
1625 # define __USE_EXTERN_INLINES
1
1631 * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
1632 * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
1633 * The remaining glibc_c99_inline_
* fixes deal with some of those headers.
1636 hackname
= glibc_c99_inline_2
;
1637 files
= sys
/stat.h
, '*/sys/stat.h';
1638 select
= "extern __inline__ int";
1639 sed
= "s/extern int \\(stat\\)/"
1640 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1641 "__inline__ int \\1/";
1642 sed
= "s/extern int \\([lf]stat\\)/"
1643 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1644 "__inline__ int \\1/";
1645 sed
= "s/extern int \\(mknod\\)/"
1646 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1647 "__inline__ int \\1/";
1648 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
1649 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1650 "__inline__ int __REDIRECT\\1 (\\2/";
1651 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
1652 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1653 "__inline__ int __REDIRECT\\1 (\\2/";
1654 sed
= "s/^extern __inline__ int/"
1655 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1658 extern int
fstat64 (int __fd
, struct stat64
*__buf
) __THROW
__nonnull ((2));
1659 extern __inline__ int
1660 __NTH (fstat64 (int __fd
, struct stat64
*__statbuf
))
1666 * glibc_c99_inline_3
1669 hackname
= glibc_c99_inline_3
;
1670 files
= bits
/string2.h
, '*/bits/string2.h';
1671 select
= "extern __inline";
1672 bypass
= "__extern_inline|__GNU_STDC_INLINE__";
1674 c_fix_arg
= "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
1675 c_fix_arg
= "^# ifdef __cplusplus$";
1678 # define __STRING_INLINE inline
1680 # define __STRING_INLINE extern __inline
1686 * glibc_c99_inline_4
1689 hackname
= glibc_c99_inline_4
;
1690 files
= sys
/sysmacros.h
, '*/sys/sysmacros.h', wchar.h
, '*/wchar.h',
1691 pthread.h
, '*/pthread.h';
1692 bypass
= "__extern_inline|__gnu_inline__";
1693 select
= "(^| )extern __inline";
1695 c_fix_arg
= "%0 __attribute__ ((__gnu_inline__))";
1697 __extension__ extern __inline unsigned int
1698 extern __inline unsigned int
1702 /* glibc
-2.3.5 defines pthread mutex initializers incorrectly
,
1703 * so we replace them with versions that correspond to the
1707 hackname
= glibc_mutex_init
;
1709 select
= '\{ *\{ *0, *\} *\}';
1710 sed
= "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
1711 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
1712 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1713 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
1714 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1715 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
1716 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1717 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
1718 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1719 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1720 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1721 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
1722 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1723 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1724 sed
= "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
1725 "N;s/^[ \t]*#[ \t]*"
1726 "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
1727 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
1729 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1732 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1734 sed
= "s/{ \\(0, 0, 0, 0, 0, 0, "
1735 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
1736 sed
= "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
1737 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
1739 test_text
= <<- _EOText_
1740 #define PTHREAD_MUTEX_INITIALIZER
\\
1743 # if __WORDSIZE
== 64
1744 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1745 { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1746 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1747 { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1748 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1749 { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1751 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1752 { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1753 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1754 { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1755 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1756 { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1759 # define PTHREAD_RWLOCK_INITIALIZER
\\
1762 # if __WORDSIZE
== 64
1763 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1764 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\
1765 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1767 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1768 { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1771 #define PTHREAD_COND_INITIALIZER
{ { 0, } }
1775 /* glibc versions before
2.5 have a version of stdint.h that defines
1776 UINT8_C and UINT16_C to produce unsigned constants
, as do uClibc
1777 versions with stdint.h based on those glibc versions.
*/
1779 hackname
= glibc_stdint
;
1781 select
= "GNU C Library";
1783 c_fix_arg
= "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
1784 c_fix_arg
= "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
1785 test_text
= "/* This file is part of the GNU C Library. */\n"
1786 "# define UINT8_C(c)\tc ## U\n"
1787 "# define UINT16_C(c)\tc ## U";
1790 /* Some versions of glibc have a version of bits
/string2.h that
1791 produces
"value computed is not used" warnings from strncpy
; fix
1792 this definition by using __builtin_strncpy instead as in newer
1795 hackname
= glibc_strncpy
;
1796 files
= bits
/string2.h
, '*/bits/string2.h';
1797 bypass
= "__builtin_strncpy";
1799 c_fix_arg
= "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
1800 c_fix_arg
= "# define strncpy([^\n]*\\\\\n)*[^\n]*";
1802 # define
strncpy(dest
, src
, n
) \
1803 (__extension__ (__builtin_constant_p (src
) && __builtin_constant_p (n
) \\
1804 ?
(strlen (src
) + 1 >= ((size_t
) (n
)) \\
1805 ?
(char *)
memcpy (dest
, src
, n
) \\
1806 : strncpy (dest
, src
, n
)) \\
1807 : strncpy (dest
, src
, n
)))
1812 /* glibc
's tgmath.h relies on an expression that is not an integer
1813 constant expression being treated as it was by GCC 4.4 and
1816 hackname = glibc_tgmath;
1818 select = '\
(\
(\
(type\
) 0.25\
) && \
(\
(type\
) 0.25 - 1\
)\
)';
1819 bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
1821 c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || "
1822 "(__builtin_classify_type ((type) 0) == 9 && "
1823 "__builtin_classify_type (__real__ ((type) 0)) == 8))";
1824 test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
1828 * Fix these files to use the types we think they should for
1829 * ptrdiff_t, size_t, and wchar_t.
1831 * This defines the types in terms of macros predefined by our 'cpp
'.
1832 * This is supposedly necessary for glibc's handling of these types.
1833 * It
's probably not necessary for anyone else, but it doesn't hurt.
1836 hackname
= gnu_types
;
1837 files
= "sys/types.h";
1839 files
= "sys/stdtypes.h";
1843 bypass
= '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
1844 select
= "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
1846 /* The Solaris
10 headers already define these types correctly.
*/
1847 mach
= '*-*-solaris2.1[0-9]*';
1850 test_text
= "typedef long int ptrdiff_t; /* long int */\n"
1851 "typedef uint_t size_t; /* uint_t */\n"
1852 "typedef ushort_t wchar_t; /* ushort_t */";
1856 * Fix HP
& Sony
's use of "../machine/xxx.h"
1857 * to refer to: <machine/xxx.h>
1860 hackname = hp_inline;
1861 files = sys/spinlock.h;
1862 files = machine/machparam.h;
1863 select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
1866 c_fix_arg = "%1<machine
/%2.h
>";
1868 c_fix_arg = "([ \t]*#
[ \t]*include
[ \t]+)" '"\.\.
/machine
/'
1871 test_text = ' # include "..
/machine
/mumble.h
"';
1875 * Check for (...) in C++ code in HP/UX sys/file.h.
1878 hackname = hp_sysfile;
1880 select = "HPUX_SOURCE
";
1883 c_fix_arg = "(struct file
*, ...
)";
1884 c_fix_arg = '\(\.\.\.\)';
1886 test_text = "extern void
foo(...
); /* HPUX_SOURCE
- bad varargs
*/";
1890 * Un-Hide a series of five FP defines from post-1999 compliance GCC:
1891 * FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
1894 hackname = hppa_hpux_fp_macros;
1895 mach = "hppa
*-hp
-hpux11
*";
1897 select = "#
[ \t]*define
[ \t]*FP_NORMAL.
*\n"
1898 "#
[ \t]*define
[ \t]*FP_ZERO.
*\n"
1899 "#
[ \t]*define
[ \t]*FP_INFINITE.
*\n"
1900 "#
[ \t]*define
[ \t]*FP_SUBNORMAL.
*\n"
1901 "#
[ \t]*define
[ \t]*FP_NAN.
*\n";
1903 c_fix_arg = <<- _EOFix_
1904 #endif /* _INCLUDE_HPUX_SOURCE */
1906 #if defined(_INCLUDE_HPUX_SOURCE) || \
1907 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
1910 #ifdef _INCLUDE_HPUX_SOURCE
1915 "# define FP_NORMAL
0\n"
1916 "# define FP_ZERO
1\n"
1917 "# define FP_INFINITE
2\n"
1918 "# define FP_SUBNORMAL
3\n"
1919 "# define FP_NAN
4\n";
1923 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
1924 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
1927 hackname = hpux10_cpp_pow_inline;
1928 files = fixinc-test-limits.h, math.h;
1929 select = <<- END_POW_INLINE
1930 ^# +ifdef +__cplusplus
1932 +inline +double +pow\(double +__d,int +__expon\) +\{
1933 [ ]+return +pow\(__d,\(double\)__expon\);
1944 "# ifdef __cplusplus
\n"
1946 " inline double
pow(double __d
,int __expon
) {\n"
1947 "\t return
pow(__d
,(double
)__expon
);\n"
1949 ' extern "C
"' " {\n"
1955 hackname = hpux11_cpp_pow_inline;
1957 select = " +inline double pow
\\(double d
,int expon
\\) \\{\n"
1958 " +return pow
\\(d
, \\(double
\\)expon
\\);\n"
1964 " inline double
pow(double d
,int expon
) {\n"
1965 " return
pow(d
, (double
)expon
);\n"
1970 * Fix hpux 10.X missing ctype declarations 1
1973 hackname = hpux10_ctype_declarations1;
1975 select = "^#
[ \t]*define _toupper
\\(__c
\\)[ \t]*__toupper
\\(__c
\\)";
1976 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*__tolower
[ \t]*\\(";
1978 c_fix_arg = "#ifdef _PROTOTYPES
\n"
1979 "extern int
__tolower(int
);\n"
1980 "extern int
__toupper(int
);\n"
1981 "#else
/* NOT _PROTOTYPES
*/\n"
1982 "extern int
__tolower();\n"
1983 "extern int
__toupper();\n"
1984 "#endif
/* _PROTOTYPES
*/\n\n"
1987 test_text = "# define
_toupper(__c
) __toupper(__c
)\n";
1991 * Fix hpux 10.X missing ctype declarations 2
1994 hackname = hpux10_ctype_declarations2;
1996 select = "^# if defined
\\(_SB_CTYPE_MACROS
\\) && \\!defined
\\(__lint
\\)";
1997 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*_isalnum
[ \t]*\\(";
1999 c_fix_arg = "%0\n\n"
2000 "#ifdef _PROTOTYPES
\n"
2001 " extern int
_isalnum(int
);\n"
2002 " extern int
_isalpha(int
);\n"
2003 " extern int
_iscntrl(int
);\n"
2004 " extern int
_isdigit(int
);\n"
2005 " extern int
_isgraph(int
);\n"
2006 " extern int
_islower(int
);\n"
2007 " extern int
_isprint(int
);\n"
2008 " extern int
_ispunct(int
);\n"
2009 " extern int
_isspace(int
);\n"
2010 " extern int
_isupper(int
);\n"
2011 " extern int
_isxdigit(int
);\n"
2012 "# else
/* not _PROTOTYPES
*/\n"
2013 " extern int
_isalnum();\n"
2014 " extern int
_isalpha();\n"
2015 " extern int
_iscntrl();\n"
2016 " extern int
_isdigit();\n"
2017 " extern int
_isgraph();\n"
2018 " extern int
_islower();\n"
2019 " extern int
_isprint();\n"
2020 " extern int
_ispunct();\n"
2021 " extern int
_isspace();\n"
2022 " extern int
_isupper();\n"
2023 " extern int
_isxdigit();\n"
2024 "#endif
/* _PROTOTYPES
*/\n";
2026 test_text = "# if
defined(_SB_CTYPE_MACROS
) && !defined(__lint
)\n"
2027 " extern unsigned int
*__SB_masks
;\n";
2031 * Fix hpux 10.X missing stdio declarations
2034 hackname = hpux10_stdio_declarations;
2036 select = "^#
[ \t]*define _iob
[ \t]*__iob
";
2037 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*vsnprintf
[ \t]*\\(";
2039 c_fix_arg = "%0\n\n"
2040 "# if
defined(__STDC__
) ||
defined(__cplusplus
)\n"
2041 " extern int
snprintf(char
*, size_t
, const char
*, ...
);\n"
2042 " extern int
vsnprintf(char
*, size_t
, const char
*, __va_list
);\n"
2043 "# else
/* not __STDC__
) || __cplusplus
*/\n"
2044 " extern int
snprintf();\n"
2045 " extern int
vsnprintf();\n"
2046 "# endif
/* __STDC__
) || __cplusplus
*/\n";
2048 test_text = "# define _iob __iob
\n";
2052 * Make sure hpux defines abs in header.
2055 hackname = hpux11_abs;
2056 mach = "*-hp
-hpux11
*";
2058 select = "ifndef _MATH_INCLUDED
";
2060 c_fix_arg = "if
!defined(_MATH_INCLUDED
) ||
defined(__GNUG__
)";
2061 test_text = "#ifndef _MATH_INCLUDED
";
2068 hackname = hpux11_extern_sendfile;
2069 mach = "*-hp
-hpux11.
[12]*";
2070 files = sys/socket.h;
2071 select = "^
[ \t]*extern sbsize_t sendfile.
*\n.
*, int
\\)\\);\n";
2073 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2074 test_text = " extern sbsize_t sendfile
__((int
, int
, off_t
, bsize_t
,\n"
2075 " const struct iovec
*, int
));\n";
2082 hackname = hpux11_extern_sendpath;
2083 mach = "*-hp
-hpux11.
[12]*";
2084 files = sys/socket.h;
2085 select = "^
[ \t]*extern sbsize_t sendpath.
*\n.
*, int
\\)\\);\n";
2087 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2088 test_text = " extern sbsize_t sendpath
__((int
, int
, off_t
, bsize_t
,\n"
2089 " const struct iovec
*, int
));\n";
2093 * Keep HP-UX 11 from stomping on C++ math namespace
2094 * with defines for fabsf.
2097 hackname = hpux11_fabsf;
2099 select = "^
[ \t]*#
[ \t]*define
[ \t]+fabsf
\\(.
*";
2100 bypass = "__cplusplus
";
2103 c_fix_arg = "#ifndef __cplusplus
\n%0\n#endif
";
2107 "# define
fabsf(x
) ((float
)fabs((double
)(float
)(x
)))\n"
2112 * Fix C99 constant in __POINTER_SET define.
2115 hackname = hpux11_pthread_const;
2116 mach = "*-hp
-hpux11.
[0-3]*";
2117 files = sys/pthread.h;
2118 select = "^#define
[ \t]*__POINTER_SET
[ \t]*\\(\\(void
\\*\\) 1LL\\)";
2121 c_fix_arg = "#define __POINTER_SET
\t\t((void *)
1L)";
2122 test_text = "#define __POINTER_SET
\t\t((void *)
1LL)";
2126 * Prevent HP-UX 11 from defining __size_t and preventing size_t from
2127 * being defined by having it define _hpux_size_t instead.
2130 hackname = hpux11_size_t;
2131 mach = "*-hp
-hpux11
*";
2132 select = "__size_t
";
2135 c_fix_arg = "_hpux_size_t
";
2138 "#define __size_t size_t
\n"
2139 " extern int
getpwuid_r( char
*, __size_t
, struct passwd
**)
;\n";
2143 * Fix hpux 11.00 broken snprintf declaration
2144 * (third argument is char *, needs to be const char * to prevent
2145 * spurious warnings with -Wwrite-strings or in C++).
2148 hackname = hpux11_snprintf;
2150 select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
2151 ' *(char *\*, *\.\.\.\);)';
2153 c_fix_arg = '%1 const %3';
2155 test_text = "extern int
snprintf(char
*, size_t
, char
*, ...
);\n"
2156 "extern int
snprintf(char
*, __size_t
, char
*, ...
);\n"
2157 "extern int
snprintf(char
*, _hpux_size_t
, char
*, ...
);";
2161 * Fix hpux 11.00 broken vsnprintf declaration
2164 hackname = hpux11_vsnprintf;
2166 select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
2167 'const char \*,) __va__list\);';
2169 c_fix_arg = "%1 __va_list
);";
2171 test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
2176 * get rid of bogus inline definitions in HP-UX 8.0
2179 hackname = hpux8_bogus_inlines;
2182 bypass = "__GNUG__
";
2183 sed = "s@inline int
abs(int
[a
-z
][a
-z
]*)
{.
*}"
2184 "@extern
\"C
\" int
abs(int
);@
";
2185 sed = "s@inline double
abs(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2186 sed = "s@inline int
sqr(int
[a
-z
][a
-z
]*)
{.
*}@@
";
2187 sed = "s@inline double
sqr(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2188 test_text = "inline int
abs(int v
) { return (v
>=0)?v
:-v
; }\n"
2189 "inline double
sqr(double v
) { return v
**0.5; }";
2196 hackname = hpux_c99_intptr;
2197 mach = "*-hp
-hpux11.3
*";
2198 files = stdint-hpux11.h, stdint.h;
2199 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MAX
[ \t]*"
2200 "INT32_MAX
[ \t]*$@#define
PTRDIFF_MAX (2147483647l)@
";
2201 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MIN
[ \t]*"
2202 "INT32_MIN
[ \t]*$@#define
PTRDIFF_MIN (-PTRDIFF_MAX
- 1)@
";
2203 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MAX
[ \t]*"
2204 "INT32_MAX
[ \t]*$@#define
INTPTR_MAX (2147483647l)@
";
2205 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MIN
[ \t]*"
2206 "INT32_MIN
[ \t]*$@#define
INTPTR_MIN (-INTPTR_MAX
- 1)@
";
2207 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINTPTR_MAX
[ \t]*"
2208 "UINT32_MAX
[ \t]*$@#define
UINTPTR_MAX (4294967295ul)@
";
2209 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*SIZE_MAX
[ \t]*"
2210 "UINT32_MAX
[ \t]*$@#define
SIZE_MAX (4294967295ul)@
";
2211 test_text = "#define PTRDIFF_MAX INT32_MAX
\n"
2212 "#define PTRDIFF_MIN INT32_MIN
\n"
2213 "#define INTPTR_MAX INT32_MAX
\n"
2214 "#define INTPTR_MIN INT32_MIN
\n"
2215 "#define UINTPTR_MAX UINT32_MAX
\n"
2216 "#define SIZE_MAX UINT32_MAX
\n";
2220 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2223 hackname = hpux_c99_inttypes;
2224 mach = "*-hp
-hpux11.
[23]*";
2226 files = stdint-hpux11.h, stdint.h;
2227 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*"
2228 "__CONCAT_U__(__c
)[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2229 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*"
2230 "__CONCAT_U__(__c
)[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2231 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT32_C(__c
)[ \t]*"
2232 "__CONCAT__(__c
,l
)[ \t]*$@#define
INT32_C(__c
) (__c
)@
";
2233 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT32_C(__c
)[ \t].
*$@
"
2234 "#define
UINT32_C(__c
) __CONCAT__(__c
,u
)@
";
2235 test_text = "#define
UINT8_C(__c
) __CONCAT_U__(__c
)\n"
2236 "#define
UINT16_C(__c
) __CONCAT_U__(__c
)\n"
2237 "#define
INT32_C(__c
) __CONCAT__(__c
,l
)\n"
2238 "#define
UINT32_C(__c
) __CONCAT__(__c
,ul
)\n";
2242 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2245 hackname = hpux_c99_inttypes2;
2246 mach = "*-hp
-hpux11.2
*";
2247 files = stdint-hpux11.h, stdint.h;
2248 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT8_C(__c
)[ \t]*"
2249 "((signed char
)(__c
))[ \t]*$@#define
INT8_C(__c
) (__c
)@
";
2250 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*"
2251 "((unsigned char
)(__c
))[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2252 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT16_C(__c
)[ \t]*"
2253 "((short
)(__c
))[ \t]*$@#define
INT16_C(__c
) (__c
)@
";
2254 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*"
2255 "((unsigned short
)(__c
))[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2256 test_text = "# define
INT8_C(__c
) ((signed char
)(__c
))\n"
2257 "# define
UINT8_C(__c
) ((unsigned char
)(__c
))\n"
2258 "# define
INT16_C(__c
) ((short
)(__c
))\n"
2259 "# define
UINT16_C(__c
) ((unsigned short
)(__c
))\n";
2263 * Fix hpux broken ctype macros
2266 hackname = hpux_ctype_macros;
2268 select = '((: |\()__SB_masks \? )'
2269 '(__SB_masks\[__(alnum|c)\] & _IS)';
2271 c_fix_arg = "%1(int
)%3";
2273 test_text = ": __SB_masks ? __SB_masks
[__alnum
] & _ISCNTRL
\n"
2274 "# define
isalpha(__c
) (__SB_masks ? __SB_masks
[__c
] & _IS
\n";
2281 hackname = hpux_extern_errno;
2282 mach = "*-hp
-hpux10.
*";
2283 mach = "*-hp
-hpux11.
[0-2]*";
2285 select = "^
[ \t]*extern int errno
;$
";
2287 c_fix_arg = "#ifdef __cplusplus
\n"
2291 "#ifdef __cplusplus
\n"
2294 test_text = " extern int errno
;\n";
2298 * Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
2301 hackname = hpux_htonl;
2302 files = netinet/in.h;
2303 select = "#ifndef _XOPEN_SOURCE_EXTENDED
[ \t]*\n"
2305 " \\* Macros for number representation conversion
\\.
\n"
2309 c_fix_arg = "#if
1\n%1";
2311 test_text = "#ifndef _XOPEN_SOURCE_EXTENDED
\n"
2313 " * Macros for number representation conversion.
\n"
2316 "#define
ntohl(x
) (x
)\n"
2317 "#define
ntohs(x
) (x
)\n"
2318 "#define
htonl(x
) (x
)\n"
2319 "#define
htons(x
) (x
)\n"
2321 "#endif
/* ! _XOPEN_SOURCE_EXTENDED
*/";
2325 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2328 hackname = hpux_imaginary_i;
2329 mach = "ia64
-hp
-hpux11.
*";
2331 select = "^
[ \t]*#
[ \t]*define
[ \t]*_Complex_I.
*";
2333 c_fix_arg = "#define
_Complex_I (__extension__
1.0iF
)";
2334 test_text = "#define
_Complex_I (0.f
+_Imaginary_I
)\n";
2338 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2341 hackname = hpux_inttype_int8_t;
2342 mach = "*-hp
-hpux1
[01].
*";
2343 files = sys/_inttypes.h;
2344 select = "^
[ \t]*typedef
[ \t]*char
[ \t]*int(_least
){0,1}8_t.
*";
2346 c_fix_arg = "typedef signed char int
%18_t
;";
2347 test_text = "typedef char int_least8_t
;\n"
2348 "typedef char int8_t
;\n";
2355 hackname = hpux_long_double;
2356 mach = "*-*-hpux10
*";
2357 mach = "*-*-hpux11.
[012]*";
2359 select = "extern
[ \t]long_double
[ \t]strtold
";
2360 bypass = "long_double_t
";
2361 sed = "/^#
[ \t]*ifndef _LONG_DOUBLE
/,/\\/\\* _LONG_DOUBLE
\\*\\//D
";
2362 sed = "s
/long_double
/long double
/g
";
2364 test_text = "# ifndef _LONG_DOUBLE
\n"
2365 "# define _LONG_DOUBLE
\n"
2366 " typedef struct
{\n"
2367 " unsigned int word1
, word2
, word3
, word4
;\n"
2369 "# endif
/* _LONG_DOUBLE
*/\n"
2370 "extern long_double
strtold(const char
*, char
**)
;\n";
2374 * We cannot use the above rule on 11.31 because it removes the strtold
2375 * definition. ia64 is OK with no hack, PA needs some help.
2378 hackname = hpux_long_double_2;
2379 mach = "hppa
*-*-hpux11.3
*";
2381 select = "#
[ \t]*if
[ \t]*!defined
\\(__ia64
\\) \\|
\\|
"
2382 "defined
\\(_PROTOTYPES
\\) \\|
\\|
"
2383 "defined
\\(_LONG_DOUBLE_STRUCT
\\)";
2385 c_fix_arg = "# if
!defined(_PROTOTYPES
) ||
defined(_LONG_DOUBLE_STRUCT
)";
2387 test_text = "# if
!defined(__ia64
) ||
"
2388 "!defined(_PROTOTYPES
) ||
"
2389 "defined(_LONG_DOUBLE_STRUCT
)\n";
2393 * Add missing braces to pthread initializer defines.
2396 hackname = hpux_pthread_initializers;
2397 mach = "*-hp
-hpux11.
[0-3]*";
2398 files = sys/pthread.h;
2399 sed = "s@^
[ \t]*1, 1, 1, 1,[ \t]*\\\\"
2400 "@
\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@
";
2401 sed = "s@^
[ \t]*1,[ \t]*\\\\"
2403 sed = "/^
[ \t]*0$
/d
";
2404 sed = "s@__PTHREAD_MUTEX_VALID
, 0"
2405 "@
{ __PTHREAD_MUTEX_VALID
, 0 }@
";
2406 sed = "s@^
[ \t]*0, 0, -1, 0,[ \t]*\\\\"
2407 "@
\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@
";
2408 sed = "s@
0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2409 "@
{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2410 sed = "s@^
[ \t]*__LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2411 "@
\t{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2412 sed = "s@^
[ \t]*0, 0[ \t]*\\\\"
2413 "@
\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@
";
2414 sed = "s@__PTHREAD_COND_VALID
, 0"
2415 "@
{ __PTHREAD_COND_VALID
, 0 }@
";
2416 sed = "s@__LWP_COND_VALID
, 0,[ \t]*\\\\"
2417 "@
{ __LWP_COND_VALID
, 0 },\t\t\t\t\t\\\\@
";
2418 sed = "s@__PTHREAD_RWLOCK_VALID
, 0"
2419 "@
{ __PTHREAD_RWLOCK_VALID
, 0 }@
";
2420 sed = "s@__LWP_RWLOCK_VALID
, 0,[ \t]*\\\\"
2421 "@
{ __LWP_RWLOCK_VALID
, 0 },\t\t\t\t\t\\\\@
";
2422 sed = "s@^
[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
2423 "@
\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@
";
2424 test_text = "#define PTHREAD_MUTEX_INITIALIZER
{\t\t\t\t\t\\\\\n"
2425 "\t__PTHREAD_MUTEX_VALID
, 0,\t\t\t\t\t\\\\\n"
2426 "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE
),\t\t\\\\\n"
2427 "\t__SPNLCK_INITIALIZER
,\t\t\t\t\t\t\\\\\n"
2428 "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
2429 "\t0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
2430 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
2435 * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
2436 * type and mpinfou is only defined when _KERNEL is set.
2439 hackname = hpux_spu_info;
2440 mach = "*-hp
-hpux
*";
2442 * It is tempting to omit the first "files
" entry. Do not.
2443 * The testing machinery will take the first "files
" entry as the name
2444 * of a test file to play with. It would be a nuisance to have a directory
2445 * with the name "*".
2447 files = "ia64
/sys
/getppdp.h
";
2448 files = "*/sys
/getppdp.h
";
2449 select = "^.
*extern.
*spu_info.
*";
2452 c_fix_arg = "#ifdef _KERNEL
\n%0\n#endif
";
2454 test_text = "extern union mpinfou spu_info
[];";
2458 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2461 hackname = hpux_stdint_least_fast;
2462 mach = "*-hp
-hpux11.2
*";
2463 files = stdint-hpux11.h, stdint.h;
2465 "^
[ \t]*#
[ \t]*define
[ \t]+UINT_(LEAST|FAST
)64_MAX
[ \t]+ULLONG_MAX
";
2467 c-fix-arg = "# define UINT_
%164_MAX __UINT64_MAX__
";
2468 test-text = "# define UINT_FAST64_MAX ULLONG_MAX
\n"
2469 "# define UINT_LEAST64_MAX ULLONG_MAX
\n";
2474 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2477 hackname = hpux_systime;
2479 select = "^extern struct sigevent
;";
2482 c_fix_arg = "struct sigevent
;";
2484 test_text = 'extern struct sigevent;';
2488 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
2491 hackname = huge_val_hex;
2492 files = bits/huge_val.h, '*/bits/huge_val.h';
2493 select = "^#
[ \t]*define
[ \t]*HUGE_VAL
[ \t].
*0x1\\.0p.
*";
2494 bypass = "__builtin_huge_val
";
2497 c_fix_arg = "#define
HUGE_VAL (__builtin_huge_val())\n";
2499 test_text = "# define HUGE_VAL
\t(__extension__
0x1.0p2047
)";
2503 * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
2506 hackname = huge_valf_hex;
2507 files = bits/huge_val.h, '*/bits/huge_val.h';
2508 select = "^#
[ \t]*define
[ \t]*HUGE_VALF
[ \t].
*0x1\\.0p.
*";
2509 bypass = "__builtin_huge_valf
";
2512 c_fix_arg = "#define
HUGE_VALF (__builtin_huge_valf())\n";
2514 test_text = "# define
HUGE_VALF (__extension__
0x1.0p255f
)";
2518 * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
2521 hackname = huge_vall_hex;
2522 files = bits/huge_val.h, '*/bits/huge_val.h';
2523 select = "^#
[ \t]*define
[ \t]*HUGE_VALL
[ \t].
*0x1\\.0p.
*";
2524 bypass = "__builtin_huge_vall
";
2527 c_fix_arg = "#define
HUGE_VALL (__builtin_huge_vall())\n";
2529 test_text = "# define
HUGE_VALL (__extension__
0x1.0p32767L
)";
2533 * Fix return type of abort and free
2536 hackname = int_abort_free_and_exit;
2538 select = "int
[ \t]+(abort|free|exit
)[ \t]*\\(";
2539 bypass = "_CLASSIC_ANSI_TYPES
";
2542 c_fix_arg = "void
\t%1(";
2544 test_text = "extern int
abort(int
);\n"
2545 "extern int
free(void*)
;\n"
2546 "extern int
exit(void*)
;";
2550 * Fix various macros used to define ioctl numbers.
2551 * The traditional syntax was:
2553 * #define _IO(n, x) (('n'<<8)+x)
2554 * #define TIOCFOO _IO(T, 1)
2556 * but this does not work with the C standard, which disallows macro
2557 * expansion inside strings. We have to rewrite it thus:
2559 * #define _IO(n, x) ((n<<8)+x)
2560 * #define TIOCFOO _IO('T', 1)
2562 * The select expressions match too much, but the c_fix code is cautious.
2564 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
2567 hackname = io_quotes_def;
2568 select = "define
[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*\\([a
-zA
-Z
][,)]";
2569 c_fix = char_macro_def;
2572 "#define
BSD43__IOWR(n
, x
) (('n'<<8)+x
)\n"
2573 "#define
_IOWN(x
,y
,t
) (_IOC_IN|
(((t
)&_IOCPARM_MASK
)<<16)|
('x'<<8)|y
)\n"
2574 "#define
_IO(x
,y
) ('x'<<8|y
)";
2576 "#define
XX_IO(x
) ('x'<<8|
256)";
2580 * Fix the usage of the ioctl macro numbers.
2583 hackname = io_quotes_use;
2584 select = "define
[ \t]+[A
-Z0
-9_
]+[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*[ \t]*"
2586 c_fix = char_macro_use;
2588 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
2589 "#define TIOCFOO \\\\\n"
2590 "BSD43__IOWR(T, 1) /* Some are multi-line */";
2594 * Check for missing ';' in struct
2597 hackname = ip_missing_semi;
2598 files = netinet/ip.h;
2600 sed = "/^struct/,/^};/s/}$/};/";
2606 "}; /* mumbled struct */\n";
2610 * Non-traditional "const" declaration in Irix's limits.h.
2613 hackname
= irix_limits_const
;
2614 files
= fixinc
-test
-limits.h
, limits.h
;
2615 select
= "^extern const ";
2617 c_fix_arg
= "extern __const ";
2618 test_text
= "extern const char limit; /* test limits */";
2622 * IRIX
5.x
's stdio.h declares some functions that take a va_list as
2623 * taking char *. However, GCC uses void * for va_list, so
2624 * calling vfprintf with a va_list fails in C++. */
2626 hackname = irix_stdio_va_list;
2629 select = '/\
* va_list \
*/ char \
*';
2631 c_fix_arg = "__gnuc_va_list";
2633 "extern int printf( const char *, /* va_list */ char * );";
2637 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
2638 * use / * * / to concatenate tokens.
2641 hackname = kandr_concat;
2642 files = "sparc/asm_linkage.h";
2643 files = "sun*/asm_linkage.h";
2644 files = "arm/as_support.h";
2645 files = "arm/mc_type.h";
2646 files = "arm/xcb.h";
2647 files = "dev/chardefmac.h";
2648 files = "dev/ps_irq.h";
2649 files = "dev/screen.h";
2650 files = "dev/scsi.h";
2651 files = "sys/tty.h";
2652 files = "Xm.acorn/XmP.h";
2653 files = bsd43/bsd43_.h;
2657 test_text = "#define __CONCAT__(a,b) a/**/b";
2661 * The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
2662 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
2663 * constant on recent versions of g
++.
2666 hackname
= linux_ia64_ucontext
;
2667 files
= "sys/ucontext.h";
2668 mach
= "ia64-*-linux*";
2669 select
= '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
2670 '->sc_gr\[0\]\) - \(char \*\) 0\)';
2672 c_fix_arg
= "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
2673 test_text
= "# define _SC_GR0_OFFSET\t\\\\\n"
2674 "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
2678 * Remove header file warning from sys
/time.h. Autoconf
's
2679 * AC_HEADER_TIME recommends to include both sys/time.h and time.h
2680 * which causes warning on LynxOS. Remove the warning.
2683 hackname = lynxos_no_warning_in_sys_time_h;
2685 select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
2688 test_text = "#warning Using <time.h> instead of <sys/time.h>";
2692 * Add missing declaration for putenv.
2695 hackname = lynxos_missing_putenv;
2696 mach = '*-*-lynxos
*';
2698 bypass = 'putenv
[ \t]*\\(';
2699 select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2702 "extern int putenv _AP((char *));";
2703 c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2704 test_text = "extern char *getenv _AP((const char *));";
2708 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
2710 * On NetBSD, machine is a symbolic link to an architecture specific
2711 * directory name, so we can't match a specific file name here.
2714 hackname
= machine_ansi_h_va_list
;
2715 select
= "define[ \t]+_BSD_VA_LIST_[ \t]";
2716 bypass
= '__builtin_va_list';
2719 c_fix_arg
= "%1__builtin_va_list";
2720 c_fix_arg
= "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
2722 test_text
= " # define _BSD_VA_LIST_\tchar**";
2726 * Fix non
-ansi machine name defines
2729 hackname
= machine_name
;
2730 c_test
= machine_name
;
2731 c_fix
= machine_name
;
2733 test_text
= "/* MACH_DIFF: */\n"
2734 "#if defined( i386 ) || defined( sparc ) || defined( vax )"
2735 "\n/* no uniform test, so be careful :-) */";
2739 * Some math.h files define struct
exception (it
's in the System V
2740 * Interface Definition), which conflicts with the class exception defined
2741 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
2742 * This is not a great fix, but I haven't been able to think of anything
2746 hackname
= math_exception
;
2748 select
= "struct exception";
2750 * This should be bypassed on __cplusplus
, but some supposedly C
++
2751 * aware headers
, such as Solaris
8 and
9, don
't wrap their struct
2752 * exception either. So currently we bypass only for glibc, based on a
2753 * comment in the fixed glibc header. Ick.
2755 bypass = 'We have a problem when using C\
+\
+|for C\
+\
+, '
2756 '_
[a
-z0
-9A
-Z_
]+_exception
; for C
, exception
';
2757 /* The Solaris 10 headers already get this right. */
2758 mach = '*-*-solaris2.1
[0-9]*';
2762 c_fix_arg = "#ifdef __cplusplus\n"
2763 "#define exception __math_exception\n"
2766 c_fix_arg = "#ifdef __cplusplus\n"
2767 "#undef exception\n"
2770 test_text = "typedef struct exception t_math_exception;";
2774 * This looks pretty broken to me. ``dbl_max_def'' will contain
2775 * "define DBL_MAX " at the start, when what we really want is just
2776 * the value portion. Can't figure out how to write a test case
2777 * for this either
:-(
2780 hackname
= math_huge_val_from_dbl_max
;
2784 * IF HUGE_VAL is defined to be DBL_MAX
*and
* DBL_MAX is _not_ defined
2785 * in math.h
, this fix applies.
2787 select
= "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
2788 bypass
= "define[ \t]+DBL_MAX";
2792 * See if we have a definition for DBL_MAX in float.h.
2793 * If we do
, we will replace the one in math.h with that one.
2796 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
2797 "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
2799 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
2800 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
2801 "s@DBL_MAX@'\"$dbl_max_def@\"\n"
2806 "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
2807 "#define HUGE_VAL DBL_MAX";
2814 hackname
= nested_auth_des
;
2816 select
= '(/\*.*rpc/auth_des\.h>.*)/\*';
2818 c_fix_arg
= "%1*/ /*";
2819 test_text
= "/*#include <rpc/auth_des.h> /* skip this */";
2823 * Some versions of NetBSD don
't expect the C99 inline semantics.
2826 hackname = netbsd_c99_inline_1;
2827 mach = "*-*-netbsd*";
2829 select = "extern __inline int";
2832 c_fix_arg = "extern\n"
2833 "#ifdef __GNUC_STDC_INLINE__\n"
2834 "__attribute__((__gnu_inline__))\n"
2838 test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
2842 * netbsd_c99_inline_2
2845 hackname = netbsd_c99_inline_2;
2846 mach = "*-*-netbsd*";
2848 select = "#define _SIGINLINE extern __inline";
2851 c_fix_arg = <<- _EOArg_
2852 #ifdef __GNUC_STDC_INLINE__
2853 #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
2859 test_text = "#define _SIGINLINE extern __inline";
2863 * NetBSD has a semicolon after the ending '}' for some extern "C".
2866 hackname = netbsd_extra_semicolon;
2867 mach = "*-*-netbsd*";
2868 files = sys/cdefs.h;
2869 select = "#define[ \t]*__END_DECLS[ \t]*};";
2872 c_fix_arg = "#define __END_DECLS }";
2874 test_text = "#define __END_DECLS };";
2878 * newlib's stdint.h has several failures to conform to C99. The fix
2879 * for these removed a comment that can be matched to identify unfixed
2883 hackname
= newlib_stdint_1
;
2884 files
= stdint
-newlib.h
, stdint.h
;
2885 select
= "@todo - Add support for wint_t types";
2886 sed
= "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
2887 sed
= "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
2888 sed
= "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
2889 sed
= "s@#define INT_LEAST32_MIN.*@"
2890 "#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
2891 sed
= "s@#define INT_LEAST32_MAX.*@"
2892 "#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
2893 sed
= "s@#define UINT_LEAST32_MAX.*@"
2894 "#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
2895 sed
= 's@#define INT_FAST\([0-9]*\)_MIN.*@'
2896 '#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
2897 sed
= 's@#define INT_FAST\([0-9]*\)_MAX.*@'
2898 '#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
2899 sed
= 's@#define UINT_FAST\([0-9]*\)_MAX.*@'
2900 '#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
2901 sed
= "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
2902 sed
= "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
2903 sed
= "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
2904 sed
= "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
2905 sed
= "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
2906 test_text
= "/* @todo - Add support for wint_t types. */\n"
2907 "#define INT32_MIN (-2147483647-1)\n"
2908 "#define INT32_MAX 2147483647\n"
2909 "#define UINT32_MAX 4294967295U\n"
2910 "#define INT_LEAST32_MIN (-2147483647-1)\n"
2911 "#define INT_LEAST32_MAX 2147483647\n"
2912 "#define UINT_LEAST32_MAX 4294967295U\n"
2913 "#define INT_FAST8_MIN INT8_MIN\n"
2914 "#define INT_FAST8_MAX INT8_MAX\n"
2915 "#define UINT_FAST8_MAX UINT8_MAX\n"
2916 "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
2917 "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
2918 "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
2919 "#define UINT8_C(x) x##U\n"
2920 "#define UINT16_C(x) x##U";
2927 hackname
= newlib_stdint_2
;
2928 files
= stdint
-newlib.h
, stdint.h
;
2929 select
= "@todo - Add support for wint_t types";
2931 c_fix_arg
= "#define INTMAX_MAX __INTMAX_MAX__\n"
2932 "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
2933 "#define UINTMAX_MAX __UINTMAX_MAX__\n"
2934 "#define WCHAR_MAX __WCHAR_MAX__\n"
2935 "#define WCHAR_MIN __WCHAR_MIN__\n"
2936 "#define WINT_MAX __WINT_MAX__\n"
2937 "#define WINT_MIN __WINT_MIN__\n\n"
2939 c_fix_arg
= '/\*\* Macros for minimum-width integer constant expressions \*/';
2940 test_text
= "/* @todo - Add support for wint_t types. */\n"
2941 "/** Macros for minimum-width integer constant expressions */";
2945 * NeXT
3.2 adds const prefix to some math functions.
2946 * These conflict with the built
-in functions.
2949 hackname
= next_math_prefix
;
2950 files
= ansi
/math.h
;
2951 select
= "^extern[ \t]+double[ \t]+__const__[ \t]";
2954 c_fix_arg
= "extern double %1(";
2955 c_fix_arg
= "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
2957 test_text
= "extern\tdouble\t__const__\tmumble();";
2961 * NeXT
3.2 uses the word
"template" as a parameter for some
2962 * functions. GCC reports an invalid use of a reserved key word
2963 * with the built
-in functions.
2966 hackname
= next_template
;
2968 select
= "[ \t]template\\)";
2972 c_fix_arg
= "\\(([^)]*)[ \t]template\\)";
2973 test_text
= "extern mumble( char * template); /* fix */";
2977 * NeXT
3.2 includes the keyword volatile in the
abort() and
exit()
2978 * function prototypes. That conflicts with the built
-in functions.
2981 hackname
= next_volitile
;
2982 files
= ansi
/stdlib.h
;
2983 select
= "^extern[ \t]+volatile[ \t]+void[ \t]";
2986 c_fix_arg
= "extern void %1(";
2987 c_fix_arg
= "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
2989 test_text
= "extern\tvolatile\tvoid\tabort();";
2993 * NeXT
2.0 defines
'int wait(union wait*)', which conflicts with Posix
.1.
2994 * Note that version
3 of the NeXT system has wait.h in a different directory
,
2995 * so that this code won
't do anything. But wait.h in version 3 has a
2996 * conditional, so it doesn't need this fix. So everything is okay.
2999 hackname
= next_wait_union
;
3002 select
= 'wait\(union wait';
3004 c_fix_arg
= "wait(void";
3005 test_text
= "extern pid_d wait(union wait*);";
3009 * a missing semi
-colon at the end of the nodeent structure definition.
3012 hackname
= nodeent_syntax
;
3013 files
= netdnet
/dnetdb.h
;
3014 select
= "char[ \t]*\\*na_addr[ \t]*$";
3017 test_text
= "char *na_addr\t";
3021 * Fix OpenBSD
's NULL definition.
3024 hackname = openbsd_null_definition;
3025 mach = "*-*-openbsd*";
3026 files = locale.h, stddef.h, stdio.h, string.h,
3027 time.h, unistd.h, wchar.h, sys/param.h;
3028 select = "__GNUG__";
3030 c_fix_arg = "#ifndef NULL\n"
3031 "#ifdef __cplusplus\n"
3033 "#define NULL\t__null\n"
3034 "#else\t /* ! __GNUG__ */\n"
3035 "#define NULL\t0L\n"
3036 "#endif\t /* __GNUG__ */\n"
3037 "#else\t /* ! __cplusplus */\n"
3038 "#define NULL\t((void *)0)\n"
3039 "#endif\t /* __cplusplus */\n"
3040 "#endif\t /* !NULL */";
3042 c_fix_arg = "^#ifndef[ \t]*NULL\n"
3043 "^#ifdef[ \t]*__GNUG__\n"
3044 "^#define[ \t]*NULL[ \t]*__null\n"
3046 "^#define[ \t]*NULL[ \t]*0L\n"
3052 "#define NULL __null\n"
3060 * obstack.h used casts as lvalues.
3062 * We need to change postincrements of casted pointers (which are
3063 * then dereferenced and assigned into) of the form
3065 * *((TYPE*)PTRVAR)++ = (VALUE)
3067 * into expressions like
3069 * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
3071 * which is correct for the cases used in obstack.h since PTRVAR is
3072 * of type char * and the value of the expression is not used.
3075 hackname = obstack_lvalue_cast;
3077 select = '\
*\
(\
(([^
()]*)\
*\
)(.*)\
)\
+\
+ = \
(([^
()]*)\
)';
3079 c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
3080 test_text = "*((void **) (h)->next_free)++ = (aptr)";
3084 * Fix OpenBSD's va_start define.
3087 hackname
= openbsd_va_start
;
3088 mach
= "*-*-openbsd*";
3090 select
= '__builtin_stdarg_start';
3092 c_fix_arg
= __builtin_va_start
;
3094 test_text
= "#define va_start(v,l) __builtin_stdarg_start((v),l)";
3098 * sys
/lc_core.h on some versions of OSF1
/4.x pollutes the namespace by
3099 * defining regex.h related types. This causes libg
++ build and usage
3100 * failures. Fixing this correctly requires checking and modifying
3 files.
3103 hackname
= osf_namespace_a
;
3104 files
= reg_types.h
;
3105 files
= sys
/lc_core.h
;
3106 test
= " -r reg_types.h";
3107 test
= " -r sys/lc_core.h";
3108 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3109 test
= " -z \"`grep __regex_t regex.h`\"";
3113 c_fix_arg
= "reg(ex|off|match)_t";
3115 test_text
= "`touch sys/lc_core.h`"
3116 "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
3117 "extern regex_t re;\n"
3118 "extern regoff_t ro;\n"
3119 "extern regmatch_t rm;\n";
3123 hackname
= osf_namespace_c
;
3125 test
= " -r reg_types.h";
3126 test
= " -r sys/lc_core.h";
3127 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3128 test
= " -z \"`grep __regex_t regex.h`\"";
3130 select
= "#include <reg_types\.h>.*";
3133 "typedef __regex_t\tregex_t;\n"
3134 "typedef __regoff_t\tregoff_t;\n"
3135 "typedef __regmatch_t\tregmatch_t;";
3137 test_text
= "#include <reg_types.h>";
3141 * On broken glibc
-2.3.3 systems an array of incomplete structures is
3142 * passed to __sigsetjmp. Fix that to take a pointer instead.
3145 hackname
= pthread_incomplete_struct_argument
;
3147 select
= "struct __jmp_buf_tag";
3149 c_fix_arg
= "%1 *%2%3";
3150 c_fix_arg
= "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) "
3151 "(__env)\\[1\\](.*)$";
3152 test_text
= "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], "
3157 * Fix return type of fread and fwrite on sysV68
3160 hackname
= read_ret_type
;
3162 select
= "extern int\t.*, fread\\(\\), fwrite\\(\\)";
3164 c_fix_arg
= "extern unsigned int fread(), fwrite();\n%1%2";
3165 c_fix_arg
= "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
3167 test_text
= "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
3171 * Fix casts as lvalues in glibc
's <rpc/xdr.h>.
3174 hackname = rpc_xdr_lvalue_cast_a;
3176 select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
3178 c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
3179 test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
3180 "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
3184 * rpc_xdr_lvalue_cast_b
3187 hackname = rpc_xdr_lvalue_cast_b;
3189 select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
3191 c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
3192 test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
3193 "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
3197 * function class(double x) conflicts with C++ keyword on rs/6000
3200 hackname = rs6000_double;
3202 select = '[^a
-zA
-Z_
]class\
(';
3205 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
3206 c_fix_arg = '^.
*[^a
-zA
-Z_
]class\
(.
*';
3208 test_text = "extern int class();";
3212 * Wrong fchmod prototype on RS/6000.
3215 hackname = rs6000_fchmod;
3217 select = 'fchmod\
(char \
*';
3219 c_fix_arg = "fchmod(int";
3220 test_text = "extern int fchmod(char *, mode_t);";
3224 * parameters conflict with C++ new on rs/6000
3227 hackname = rs6000_param;
3231 select = 'rename\
(const char \
*old
, const char \
*new\
)';
3233 c_fix_arg = 'rename(const char
*_old
, const char
*_new
)';
3235 test_text = 'extern int
rename(const char
*old
, const char
*new
);';
3239 * Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
3240 * for C99. This is wrong for C++, which needs many C99 features, but
3241 * only supports __restrict.
3244 hackname = solaris___restrict;
3245 files = sys/feature_tests.h;
3246 select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
3247 mach = "*-*-solaris2*";
3249 c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
3250 "#else\n%0\n#endif";
3251 test_text = "#define _RESTRICT_KYWD restrict";
3255 * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
3256 * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
3257 * and imaginary definitions which are not supported by GCC.
3260 hackname = solaris_complex;
3261 mach = "*-*-solaris2.*";
3263 select = "#define[ \t]_Complex_I[ \t]_Complex_I";
3264 sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
3265 "#define\t_Complex_I\t(__extension__ 1.0iF)/";
3266 sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
3267 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
3268 sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
3269 test_text = "#define _Complex_I _Complex_I\n"
3270 "#define complex _Complex\n"
3271 "#define _Imaginary_I _Imaginary_I\n"
3272 "#define imaginary _Imaginary\n"
3274 "#define I _Imaginary_I";
3278 * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
3279 * extern "C" instead so libstdc++ can use it.
3282 hackname = solaris_complex_cxx;
3283 mach = "*-*-solaris2.*";
3285 sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
3286 "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
3287 sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
3288 "#ifdef\t__cplusplus\\\n}\\\n#endif";
3289 test_text = "#if !defined(__cplusplus)\n"
3290 "#endif /* !defined(__cplusplus) */";
3294 * g++ rejects functions declared with both C and C++ linkage.
3297 hackname = solaris_cxx_linkage;
3298 mach = '*-*-solaris2
*';
3299 files = "iso/stdlib_iso.h";
3300 select = "(#if __cplusplus >= 199711L)\n"
3301 "(extern \"C\\+\\+\" \\{\n)"
3302 "(.*(bsearch|qsort).*)";
3304 c_fix_arg = "%1 && !__GNUG__\n%2%3";
3307 "#if __cplusplus >= 199711L\n"
3308 "extern \"C++\" {\n"
3309 " void *bsearch(const void *, const void *, size_t, size_t,";
3313 * Solaris <iso/stdio_iso.h> doesn't declare getc for C
++ with
3314 * _STRICT_STDC
, but uses it.
3317 hackname
= solaris_getc_strict_stdc
;
3318 mach
= "*-*-solaris2*";
3319 files
= "iso/stdio_iso.h";
3320 select
= "(.*&& )!defined\\(_STRICT_STDC\\)(.*)";
3322 c_fix_arg
= "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2";
3325 "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
3329 * Sun Solaris
2 has a version of sys
/int_const.h that defines
3330 * UINT8_C and UINT16_C to unsigned constants.
3333 hackname
= solaris_int_const
;
3334 files
= sys
/int_const.h
;
3335 mach
= '*-*-solaris2*';
3337 c_fix_arg
= "#define\tUINT8_C(c)\t(c)\n"
3339 "#define\tUINT16_C(c)\t(c)";
3340 select
= "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
3342 "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
3344 "#define UINT8_C(c) __CONCAT__(c,u)\n"
3346 "#define UINT16_C(c) __CONCAT__(c,u)";
3350 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3351 * UINT8_MAX and UINT16_MAX to unsigned constants.
3354 hackname
= solaris_int_limits_1
;
3355 files
= sys
/int_limits.h
;
3356 mach
= '*-*-solaris2*';
3358 c_fix_arg
= "#define\tUINT8_MAX\t(255)\n"
3359 "#define\tUINT16_MAX\t(65535)";
3360 select
= "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
3361 "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
3363 "#define UINT8_MAX (255U)\n"
3364 "#define UINT16_MAX (65535U)";
3368 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3369 * INT_FAST16 limits to wrong values for sys
/int_types.h.
3372 hackname
= solaris_int_limits_2
;
3373 files
= sys
/int_limits.h
;
3374 mach
= '*-*-solaris2*';
3376 c_fix_arg
= "#define\t%1_FAST16_%2 %132_%2";
3377 select
= "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
3379 "#define INT_FAST16_MAX INT16_MAX\n"
3380 "#define UINT_FAST16_MAX UINT16_MAX\n"
3381 "#define INT_FAST16_MIN INT16_MIN";
3385 * Sun Solaris
2 has a version of sys
/int_limits.h that defines
3386 * SIZE_MAX as unsigned long.
3389 hackname
= solaris_int_limits_3
;
3390 files
= sys
/int_limits.h
;
3391 mach
= '*-*-solaris2*';
3393 c_fix_arg
= "#define\tSIZE_MAX\t4294967295U";
3394 select
= "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
3396 "#define SIZE_MAX 4294967295UL";
3400 * Sun Solaris
10 defines several C99 math macros in terms of
3401 * builtins specific to the Studio compiler
, in particular not
3402 * compatible with the GNU compiler.
3405 hackname
= solaris_math_1
;
3406 select
= '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3407 bypass
= "__GNUC__";
3408 files
= iso
/math_c99.h
;
3410 c_fix_arg
= "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
3411 c_fix_arg
= "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
3413 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3415 "#define HUGE_VAL __builtin_huge_val\n"
3416 "#undef HUGE_VALF\n"
3417 "#define HUGE_VALF __builtin_huge_valf\n"
3418 "#undef HUGE_VALL\n"
3419 "#define HUGE_VALL __builtin_huge_vall";
3423 * On Solaris
11, if you do
isinf(NaN
) you
'll get a floating point
3424 * exception. Provide an alternative using GCC's builtin.
3427 hackname
= solaris_math_10
;
3428 select
= '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3429 files
= iso
/math_c99.h
;
3431 c_fix_arg
= "#define\tisinf(x) __builtin_isinf(x)";
3432 c_fix_arg
= "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
3433 "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);"
3435 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
3436 "INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
3437 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
3438 "\\(-INFINITY\\);[ \t]*\\}\\)";
3440 '#pragma ident "@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
3442 "#define isinf(x) __extension__( \\\\\n"
3443 " { __typeof(x) __x_i = (x); \\\\\n"
3444 " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
3445 " __x_i == (__typeof(__x_i)) (-INFINITY); })";
3449 * Solaris math INFINITY
3452 hackname
= solaris_math_2
;
3453 select
= '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3454 bypass
= "__GNUC__";
3455 files
= iso
/math_c99.h
;
3457 c_fix_arg
= "#define\tINFINITY\t(__builtin_inff())";
3458 c_fix_arg
= "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
3460 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3462 "#define INFINITY __builtin_infinity";
3469 hackname
= solaris_math_3
;
3470 select
= '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3471 bypass
= "__GNUC__";
3472 files
= iso
/math_c99.h
;
3474 c_fix_arg
= "#define\tNAN\t\t(__builtin_nanf(\"\"))";
3475 c_fix_arg
= "^#define[ \t]+NAN[ \t]+__builtin_nan";
3477 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3479 "#define NAN __builtin_nan";
3483 * Solaris math fpclassify
3486 hackname
= solaris_math_4
;
3487 select
= '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3488 bypass
= "__GNUC__";
3489 files
= iso
/math_c99.h
;
3491 c_fix_arg
= "#define\tfpclassify(x) \\\n"
3492 " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, "
3493 "FP_SUBNORMAL, FP_ZERO, (x))";
3494 c_fix_arg
= "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
3496 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3497 "#undef fpclassify\n"
3498 "#define fpclassify(x) __builtin_fpclassify(x)";
3502 * Solaris math signbit
3505 hackname
= solaris_math_8
;
3506 select
= '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
3507 bypass
= "__GNUC__";
3508 files
= iso
/math_c99.h
;
3510 c_fix_arg
= "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
3511 "\t\t\t ? __builtin_signbitf(x) \\\n"
3512 "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
3513 "\t\t\t ? __builtin_signbitl(x) \\\n"
3514 "\t\t\t : __builtin_signbit(x))";
3515 c_fix_arg
= "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
3516 test_text
= <<- _EOText_
3517 #ident
"@(#)math_c99.h 1.9 04/11/01 SMI"
3519 #define
signbit(x
) __builtin_signbit(x
)
3524 * Solaris math comparison macros
3527 hackname
= solaris_math_9
;
3528 select
= '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3529 bypass
= "__GNUC__";
3530 files
= iso
/math_c99.h
;
3532 c_fix_arg
= "#define\t%1(x, y)%2__builtin_%1(x, y)";
3533 c_fix_arg
= "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) "
3534 "__builtin_[a-z]+\\(y\\)\\)";
3536 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3537 "#undef isgreater\n"
3538 "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
3539 "#undef isgreaterequal\n"
3540 "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
3542 "#define isless(x, y) ((x) __builtin_isless(y))\n"
3543 "#undef islessequal\n"
3544 "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
3545 "#undef islessgreater\n"
3546 "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
3547 "#undef isunordered\n"
3548 "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
3552 * Newer Solaris
10/11 GCC signbit implementations cause strict
-aliasing
3556 hackname
= solaris_math_11
;
3557 select
= '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ ";
3558 files
= iso
/math_c99.h
;
3560 c_fix_arg
= << _EOArg_
3562 #define
signbit(x
) (sizeof(x
) == sizeof(float
) \
3563 ?
__builtin_signbitf(x
) \
3564 : sizeof(x
) == sizeof(long double
) \
3565 ?
__builtin_signbitl(x
) \
3566 : __builtin_signbit(x
))
3568 c_fix_arg
= << _EOArg_
3570 #if defined\
(__sparc\
)
3571 #define
[ ]+signbit\
(x\
)[ ]+__extension__\
( \\
3572 [ ]+\
{[ ]*__typeof\
(x\
)[ ]*__x_s
[ ]*=[ ]*\
(x\
);[ ]*\\
3573 [ ]+\
(int\
)[ ]*\
(\
*\
(unsigned
[ ]*\
*\
)[ ]*\
&__x_s
[ ]*>>[ ]*31\
);[ ]*\
}\
)
3574 #elif defined\
(__i386\
) \|\| defined\
(__amd64\
)
3575 #define
[ ]+signbit\
(x\
)[ ]+__extension__\
( \\
3576 [ ]+\
{ __typeof\
(x\
) __x_s
= \
(x\
); \\
3577 [ ]+\
(sizeof \
(__x_s\
) == sizeof \
(float\
) \? \\
3578 [ ]+\
(int\
) \
(\
*\
(unsigned \
*\
) \
&__x_s
>> 31\
) : \\
3579 [ ]+sizeof \
(__x_s\
) == sizeof \
(double\
) \? \\
3580 [ ]+\
(int\
) \
(\
(\
(unsigned \
*\
) \
&__x_s\
)\
[1\
] >> 31\
) : \\
3581 [ ]+\
(int\
) \
(\
(\
(unsigned short \
*\
) \
&__x_s\
)\
[4\
] >> 15\
)\
); \
}\
)
3584 test_text
= << _EOText_
3585 /* @
(#
)math_c99.h
1.14 13/03/27 */
3587 #if
defined(__sparc
)
3588 #define
signbit(x
) __extension__( \\
3589 { __typeof(x
) __x_s
= (x
); \\
3590 (int
) (*(unsigned *) &__x_s
>> 31); })
3591 #elif
defined(__i386
) ||
defined(__amd64
)
3592 #define
signbit(x
) __extension__( \\
3593 { __typeof(x
) __x_s
= (x
); \\
3594 (sizeof (__x_s
) == sizeof (float
) ?
\\
3595 (int
) (*(unsigned *) &__x_s
>> 31) : \\
3596 sizeof (__x_s
) == sizeof (double
) ?
\\
3597 (int
) (((unsigned *)
&__x_s
)[1] >> 31) : \\
3598 (int
) (((unsigned short *)
&__x_s
)[4] >> 15)); })
3604 * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
3605 * structure. As such
, it need two levels of brackets
, but only
3606 * contains one. Wrap the macro definition in an extra layer.
3609 hackname
= solaris_once_init_1
;
3610 select
= '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3612 mach
= '*-*-solaris*';
3614 c_fix_arg
= "%1{%2}%3";
3615 c_fix_arg
= "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
3617 '#pragma ident "@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
3618 "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
3622 * Solaris
10+ <spawn.h
> uses char
*const argv
[_RESTRICT_KYWD
] in the
3623 * posix_spawn declarations
, which doesn
't work with C++.
3626 hackname = solaris_posix_spawn_restrict;
3628 mach = '*-*-solaris2
*';
3630 c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
3631 select = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
3633 "char *const argv[_RESTRICT_KYWD],\n"
3634 "char *const envp[_RESTRICT_KYWD]);";
3638 * The pow overloads with int were removed in C++ 2011 DR 550.
3641 hackname = solaris_pow_int_overload;
3642 mach = '*-*-solaris2
*';
3643 files = "iso/math_iso.h";
3644 select = "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)"
3645 " *\\{[^{}]*\n[^{}]*\\}";
3647 c_fix_arg = "#if __cplusplus < 201103L\n%0\n#endif";
3650 " inline long double pow(long double __X, int __Y) { return\n"
3651 " __powl(__X, (long double) (__Y)); }";
3655 * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some
3656 * fields of the pthread_rwlock_t structure, which are of type
3657 * upad64_t, which itself is typedef'd to int64_t
, but with __STDC__
3658 * defined (e.g. by
-ansi
) it is a union. So change the initializer
3662 hackname
= solaris_rwlock_init_1
;
3663 select
= '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3665 mach
= '*-*-solaris*';
3667 c_fix_arg
= "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3670 "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
3672 c_fix_arg
= "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
3673 "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
3676 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3677 "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
3681 * Before Solaris
10, <stdio.h
> lacks declarations of std
::__filbuf and
3682 * std
::__flsbuf
, but
<iso
/stdio_iso.h
> uses them.
3685 hackname
= solaris_std___filbuf
;
3687 mach
= '*-*-solaris2*';
3688 bypass
= "using std::__filbuf";
3689 select
= "(using std::perror;\n)(#endif)";
3691 c_fix_arg
= "%1#ifndef _LP64\n"
3692 "using std::__filbuf;\n"
3693 "using std::__flsbuf;\n"
3696 test_text
= "using std::perror;\n"
3701 * Sun Solaris
8 has what appears to be some gross workaround for
3702 * some old version of their c
++ compiler. G
++ doesn
't want it
3703 * either, but doesn't want to be tied to SunPRO version numbers.
3706 hackname
= solaris_stdio_tag
;
3707 files
= stdio_tag.h
;
3709 select
= '__cplusplus < 54321L';
3710 /* In Solaris
10, the code in stdio_tag.h is conditionalized on
3711 "!defined(__GNUC__)" so we no longer need to fix it.
*/
3712 bypass
= '__GNUC__';
3713 sed
= 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
3715 test_text
= "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
3719 * a missing semi
-colon at the end of the statsswtch structure definition.
3722 hackname
= statsswtch
;
3723 files
= rpcsvc
/rstat.h
;
3724 select
= "boottime$";
3726 c_fix_arg
= "boottime;";
3727 test_text
= "struct statswtch {\n int boottime\n};";
3731 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
3732 * On
4BSD
-derived systems
, stdio.h defers to machine
/ansi.h
; that
's
3736 hackname = stdio_stdarg_h;
3738 bypass = "include.*(stdarg\.h|machine/ansi\.h)";
3740 * On Solaris 10, this fix is unncessary; <stdio.h> includes
3741 * <iso/stdio_iso.h>, which includes <sys/va_list.h>.
3743 mach = '*-*-solaris2.1
[0-9]*';
3748 c_fix_arg = "#define __need___va_list\n#include <stdarg.h>\n";
3754 * Don't use or define the name va_list in stdio.h. This is for
3755 * ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
3756 * of __gnuc_va_list
, __DJ_va_list
, or _G_va_list is taken to
3757 * indicate that the header knows what it
's doing -- under SUSv2,
3758 * stdio.h is required to define va_list, and we shouldn't break
3762 hackname
= stdio_va_list
;
3764 bypass
= '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
3766 * On Solaris
10, the definition in
3767 * <stdio.h
> is guarded appropriately by the _XPG4 feature macro
;
3768 * there is therefore no need for this fix there.
3770 mach
= '*-*-solaris2.1[0-9]*';
3774 * Use __gnuc_va_list in arg types in place of va_list.
3775 * On
386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3776 * use __gnuc_va_list instead of __VA_LIST__. We
're hoping the
3777 * trailing parentheses and semicolon save all other systems from this.
3778 * Define __not_va_list__ (something harmless and unused)
3779 * instead of va_list.
3780 * Don't claim to have defined va_list.
3782 sed
= "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3783 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3784 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3785 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3786 "s@ va_list@ __not_va_list__@\n"
3787 "s@\\*va_list@*__not_va_list__@\n"
3788 "s@ __va_list)@ __gnuc_va_list)@\n"
3789 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3790 "@typedef \\1 __not_va_list__;@\n"
3791 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3792 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3793 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3794 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3795 "s@VA_LIST@DUMMY_VA_LIST@\n"
3796 "s@_Va_LIST@_VA_LIST@";
3797 test_text
= "extern void mumble( va_list);";
3801 * Fix headers that use va_list from stdio.h to use the updated
3802 * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
3803 * dealt with elsewhere. The presence of __gnuc_va_list
,
3804 * __DJ_va_list
, or _G_va_list is taken to indicate that the header
3805 * knows what it
's doing.
3808 hackname = stdio_va_list_clients;
3816 files = curses_colr/curses.h;
3817 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list
';
3818 /* Don't fix
, if we use va_list from stdarg.h
, or if the use is
3819 otherwise protected.
*/
3820 bypass
= 'include <stdarg\.h>|#ifdef va_start';
3823 * Use __gnuc_va_list in arg types in place of va_list.
3824 * On
386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3825 * use __gnuc_va_list instead of __VA_LIST__. We
're hoping the
3826 * trailing parentheses and semicolon save all other systems from this.
3827 * Define __not_va_list__ (something harmless and unused)
3828 * instead of va_list.
3829 * Don't claim to have defined va_list.
3831 sed
= "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3832 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3833 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3834 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3835 "s@ va_list@ __not_va_list__@\n"
3836 "s@\\*va_list@*__not_va_list__@\n"
3837 "s@ __va_list)@ __gnuc_va_list)@\n"
3838 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3839 "@typedef \\1 __not_va_list__;@\n"
3840 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3841 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3842 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3843 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3844 "s@VA_LIST@DUMMY_VA_LIST@\n"
3845 "s@_Va_LIST@_VA_LIST@";
3846 test_text
= "extern void mumble( va_list);";
3850 * "!__STDC__" or
"__STDC__==0" or
"__STDC__!=1" or
"__STDC__-0==0"
3851 * is
"!defined( __STRICT_ANSI__ )"
3854 hackname
= strict_ansi_not
;
3855 select
= "^([ \t]*#[ \t]*if.*)"
3857 "|__STDC__[ \t]*==[ \t]*0"
3858 "|__STDC__[ \t]*!=[ \t]*1"
3859 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
3860 /* Tru64 UNIX V4.0F
/V5.1
<standards.h
> supports GCC usage of __STDC__.
*/
3861 bypass
= 'GNU and MIPS C compilers define __STDC__ differently';
3862 /* GNU gmp.h uses
"__STDC__ != 1" only if __SCO_VERSION__
, which
3863 is not defined by GCC
, so it is safe.
*/
3864 bypass
= '__SCO_VERSION__.*__STDC__ != 1';
3865 c_test
= stdc_0_in_system_headers
;
3868 c_fix_arg
= "%1 !defined(__STRICT_ANSI__)";
3870 test_text
= "#if !__STDC__ \n"
3871 "#if __STDC__ == 0\n"
3872 "#if __STDC__ != 1\n"
3873 "#if __STDC__ - 0 == 0"
3874 "/* not std C */\nint foo;\n"
3875 "\n#end-end-end-end-if :-)";
3880 * is
"!defined( __STRICT_ANSI__ )" on continued #if
-s
3883 hackname
= strict_ansi_not_ctd
;
3884 files
= math.h
, limits.h
, stdio.h
, signal.h
,
3885 stdlib.h
, sys
/signal.h
, time.h
;
3887 * Starting at the beginning of a line
, skip white space and
3888 * a leading
"(" or
"&&" or
"||". One of those must be found.
3889 * Then
, zero
, one or more copies of a
"defined(_FOO_BAR_) &&"
3890 * expression. If these are nested
, then they must accumulate
3891 * because we won
't match any closing parentheses. Finally,
3892 * after skipping over all that, we must then match our suspect
3893 * phrase: "__STDC__-0==0" with or without white space.
3895 select = "^([ \t]*" '(\
(|
&&|\|\|
)'
3896 "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
3898 "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
3899 c_test = stdc_0_in_system_headers;
3902 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
3904 test_text = "#if 1 && \\\\\n"
3905 "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
3906 "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
3907 "|| __STDC__ - 0 == 0 ) /* not std C */\n"
3912 * "__STDC__!=0" or "__STDC__==1" or "__STDC__-0==1"
3913 * is "defined( __STRICT_ANSI__ )"
3916 hackname = strict_ansi_only;
3917 select = "^([ \t]*#[ \t]*if.*)"
3918 "(__STDC__[ \t]*!=[ \t]*0"
3919 "|__STDC__[ \t]*==[ \t]*1"
3920 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
3921 "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
3922 c_test = stdc_0_in_system_headers;
3925 c_fix_arg = "%1 defined(__STRICT_ANSI__)";
3927 test_text = "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
3931 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
3932 * in prototype without previous definition.
3935 hackname = struct_file;
3937 select = '^.
*xdrstdio_create.
*struct __file_s
';
3939 c_fix_arg = "struct __file_s;\n%0";
3940 test_text = "extern void xdrstdio_create( struct __file_s* );";
3944 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
3945 * in prototype without previous definition.
3947 * Don't fix OpenBSD
, which uses struct sockaddr_in prototyping the same
3948 * function
, and does define it.
3951 hackname
= struct_sockaddr
;
3953 select
= "^.*authdes_create.*struct sockaddr[^_]";
3954 bypass
= "<sys/socket\.h>";
3955 bypass
= "struct sockaddr;\n";
3957 c_fix_arg
= "struct sockaddr;\n%0";
3958 test_text
= "extern AUTH* authdes_create( struct sockaddr* );";
3962 * Apply fix this to all OSs since this problem seems to effect
3963 * more than just SunOS.
3966 hackname
= sun_auth_proto
;
3971 bypass
= "__cplusplus";
3973 * Select those files containing
'(*name)()'.
3975 select
= '\(\*[a-z][a-z_]*\)\(\)';
3978 c_fix_arg
= "#ifdef __cplusplus\n%1(...);%2\n"
3979 "#else\n%1();%2\n#endif";
3980 c_fix_arg
= '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
3984 " int (*name)(); /* C++ bad */\n"
3989 * Fix bogus #ifdef on SunOS
4.1.
3992 hackname
= sun_bogus_ifdef
;
3993 files
= "hsfs/hsfs_spec.h";
3994 files
= "hsfs/iso_spec.h";
3995 select
= '#ifdef(.*\|\|.*)';
3997 c_fix_arg
= "#if%1";
3999 test_text
= "#ifdef __i386__ || __vax__ || __sun4c__";
4003 * Fix the CAT macro in SunOS memvar.h.
4006 hackname
= sun_catmacro
;
4007 files
= pixrect
/memvar.h
;
4008 select
= "^#define[ \t]+CAT\\(a,b\\).*";
4013 "# define CAT(a,b) a##b\n"
4014 "#else\n%0\n#endif";
4017 "#define CAT(a,b)\ta/**/b";
4021 * Fix return type of free and
{c
,m
,re
}alloc in
<malloc.h
> on SunOS
4.1.
4022 * Also fix return type of
{m
,re
}alloc in
<malloc.h
> on sysV68
4025 hackname
= sun_malloc
;
4027 bypass
= "_CLASSIC_ANSI_TYPES";
4029 sed
= "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
4030 sed
= "s/int[ \t][ \t]*free/void\tfree/g";
4031 sed
= "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
4032 sed
= "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
4033 sed
= "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
4036 "typedef char *\tmalloc_t;\n"
4038 "char*\tmalloc();\n"
4039 "char*\tcalloc();\n"
4040 "char*\trealloc();";
4044 * Check for yet more missing
';' in
struct (in SunOS
4.0.x
)
4047 hackname
= sun_rusers_semi
;
4048 files
= rpcsvc
/rusers.h
;
4050 sed
= "/^struct/,/^};/s/_cnt$/_cnt;/";
4051 test_text
= "struct mumble\n int _cnt\n};";
4055 * signal.h on SunOS defines signal
using (),
4056 * which causes trouble when compiling with g
++ -pedantic.
4059 hackname
= sun_signal
;
4060 files
= sys
/signal.h
;
4062 select
= "^void\t" '\(\*signal\(\)\)\(\);.*';
4066 "#ifdef __cplusplus\n"
4067 "void\t(*signal(...))(...);\n"
4068 "#else\n%0\n#endif";
4070 test_text
= "void\t(*signal())();";
4074 * Correct the return type for strlen in strings.h in SunOS
4.
4077 hackname
= sunos_strlen
;
4079 select
= "int[ \t]*strlen\\(\\);(.*)";
4081 c_fix_arg
= "__SIZE_TYPE__ strlen();%1";
4082 test_text
= " int\tstrlen(); /* string length */";
4086 * Linux kernel
's vt.h breaks C++
4089 hackname = suse_linux_vt_cxx;
4092 select = "^[ \t]*unsigned int new;";
4094 c_fix_arg = "unsigned int newev;";
4096 test_text = " unsigned int new; /* New console (if changing) */";
4100 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
4101 * that is visible to any ANSI compiler using this include. Simply
4102 * delete the lines that #define some string functions to internal forms.
4105 hackname = svr4_disable_opt;
4107 select = '#define.
*__std_hdr_
';
4108 sed = '/#define.
*__std_hdr_
/d
';
4109 test_text = "#define strlen __std_hdr_strlen\n";
4113 * Fix broken decl of getcwd present on some svr4 systems.
4116 hackname = svr4_getcwd;
4119 files = prototypes.h;
4120 select = 'getcwd\
(char \
*, int\
)';
4123 c_fix_arg = "getcwd(char *, size_t)";
4125 test_text = "extern char* getcwd(char *, int);";
4129 * Fix broken decl of profil present on some svr4 systems.
4132 hackname = svr4_profil;
4137 'profil\
(unsigned short \
*, unsigned int
, unsigned int
, unsigned int\
)';
4139 c_fix_arg = 'profil(unsigned short
*, size_t
, int
, unsigned int
)';
4142 'profil(unsigned short
*, unsigned int
, unsigned int
, unsigned int
);';
4146 * Correct types for signal handler constants like SIG_DFL; they might be
4147 * void (*) (), and should be void (*) (int). C++ doesn't like the
4151 hackname
= svr4_sighandler_type
;
4152 files
= sys
/signal.h
;
4153 select
= 'void *\(\*\)\(\)';
4155 c_fix_arg
= "void (*)(int)";
4156 test_text
= "#define SIG_DFL (void(*)())0\n"
4157 "#define SIG_IGN (void (*)())0\n";
4161 * Some SysV r4 systems
, including Sequent
's DYNIX/ptx, use the local
4162 * function 'getrnge
' in <regexp.h> before they declare it. For these
4163 * systems add a 'static int
' declaration of 'getrnge
' into <regexp.h>
4166 * 'getrnge
' traditionally manipulates a file-scope global called 'size
',
4167 * so put the declaration right after the declaration of 'size
'.
4169 * Don't do this if there is already a `static void getrnge
' declaration
4170 * present, since this would cause a redeclaration error. Solaris 2.x has
4171 * such a declaration.
4174 hackname = svr4_undeclared_getrnge;
4177 bypass = "static void getrnge";
4180 "static int getrnge ();";
4181 c_fix_arg = "^static int[ \t]+size;";
4182 test_text = "static int size;\n"
4183 "/* stuff which calls getrnge() */\n"
4184 "static getrnge()\n"
4189 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
4190 * in string.h on sysV68
4191 * Correct the return type for strlen in string.h on Lynx.
4192 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
4193 * Add missing const for strdup on OSF/1 V3.0.
4194 * On sysV88 layout is slightly different.
4197 hackname = sysv68_string;
4200 bypass = "_CLASSIC_ANSI_TYPES";
4202 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
4203 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
4204 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
4206 sed = "/^extern char$/N";
4207 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
4209 sed = "/^extern int$/N";
4210 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
4212 sed = "/^\tstrncmp(),$/N";
4213 sed = 's
/^\
(' "\t" 'strncmp()\
),\n\
(' "\t" 'strlen(),\
)$
/'
4214 '\
1;' "\\\nextern unsigned int\\\n\\2/";
4217 "extern int strlen();\n"
4219 "extern int ffs(long);\n"
4232 "\tstrlen(), strspn();";
4236 * Fix return type of calloc, malloc, realloc, bsearch and exit
4239 hackname = sysz_stdlib_for_sun;
4241 bypass = "_CLASSIC_ANSI_TYPES";
4243 select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
4245 c_fix_arg = "void *\t%1(";
4248 "extern char*\tcalloc(size_t);\n"
4249 "extern char*\tmalloc(size_t);\n"
4250 "extern char*\trealloc(void*,size_t);\n"
4251 "extern char*\tbsearch(void*,size_t,size_t);\n";
4255 * __thread is now a keyword.
4258 hackname = thread_keyword;
4259 files = "pthread.h";
4260 files = bits/sigthread.h, '*/bits
/sigthread.h
';
4261 select = "([* ])__thread([,)])";
4263 c_fix_arg = "%1__thr%2";
4266 "extern int pthread_create (pthread_t *__restrict __thread,\n"
4267 "extern int pthread_kill (pthread_t __thread, int __signo);\n"
4268 "extern int pthread_cancel (pthread_t __thread);";
4272 * if the #if says _cplusplus, not the double underscore __cplusplus
4276 hackname = tinfo_cplusplus;
4278 select = "[ \t]_cplusplus";
4281 c_fix_arg = " __cplusplus";
4282 test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
4286 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4289 hackname = ultrix_const;
4291 select = 'perror\
( char \
*';
4294 c_fix_arg = "%1 const %3 *__";
4295 c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
4296 "[ \t]+(char|void) \\*__";
4299 "extern void perror( char *__s );\n"
4300 "extern int fputs( char *__s, FILE *);\n"
4301 "extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
4302 "extern int fscanf( FILE *__stream, char *__format, ...);\n"
4303 "extern int scanf( char *__format, ...);\n";
4307 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4310 hackname = ultrix_const2;
4313 select = '\
*fopen\
( char \
*';
4315 c_fix_arg = "%1( const char *%3, const char *";
4316 c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
4317 "[ \t]*char[ \t]*\\*([^,]*),"
4318 "[ \t]*char[ \t]*\\*[ \t]*";
4321 "extern FILE *fopen( char *__filename, char *__type );\n"
4322 "extern int sscanf( char *__s, char *__format, ...);\n"
4323 "extern FILE *popen(char *, char *);\n"
4324 "extern char *tempnam(char*,char*);\n";
4328 * Fix definitions of macros used by va-i960.h in VxWorks header file.
4331 hackname = va_i960_macro;
4332 files = arch/i960/archI960.h;
4333 select = "__(vsiz|vali|vpad|alignof__)";
4336 c_fix_arg = "__vx%1";
4339 "extern int __vsiz vsiz;\n"
4340 "extern int __vali vali;\n"
4341 "extern int __vpad vpad;\n"
4342 "#define __alignof__(x) ...";
4346 * On VMS, add missing braces around sigset_t constants.
4349 hackname = vms_add_missing_braces;
4350 select = "(_SIG_[A-Z]+_SET[ \t]+= \\{)(0x[0F]+, 0x[0F]+)";
4352 files = "rtldef/signal.h";
4355 c_fix_arg = '%1 {%2} ';
4357 test_text = "static const __sigset_t _SIG_EMPTY_SET = "
4358 "{0x00000000, 0x00000000},\n"
4359 " _SIG_FULL_SET = {0xFFFFFFFF, 0xFFFFFFFF};\n";
4363 * On VMS, some DEC-C builtins are directly used.
4366 hackname = vms_decc_builtin;
4367 select = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY)";
4369 files = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
4371 sed = "s@__MEMSET@memset@";
4372 sed = "s@__MEMMOVE@memmove@";
4373 sed = "s@__MEMCPY@memcpy@";
4374 sed = "s@__STRLEN@strlen@";
4375 sed = "s@__STRCPY@strcpy@";
4377 test_text = "define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p)))\n";
4381 * Define __CAN_USE_EXTERN_PREFIX on vms.
4384 hackname = vms_define_can_use_extern_prefix;
4385 files = "rtldef/decc$types.h";
4386 select = "#[ \t]*else\n"
4387 "#[ \t]*if defined\\(__DECCXX\\)\n"
4388 "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n";
4393 "# elif defined (__GNUC__)\n"
4394 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n";
4396 test_text = "# else\n"
4397 "# if defined(__DECCXX)\n"
4398 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"
4404 * On VMS, disable the use of dec-c string builtins
4407 hackname = vms_disable_decc_string_builtins;
4408 select = "#if !defined\\(__VAX\\)\n";
4410 files = "rtldef/string.h";
4413 c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n";
4415 test_text = "#if !defined(__VAX)\n";
4419 * On VMS, fix incompatible redeclaration of hostalias.
4422 hackname = vms_do_not_redeclare_hostalias;
4423 select = "(void[ \t]+fp_nquery \\(const u_char \\*, int, FILE \\*\\);)\n"
4424 "(__char_ptr32[ \t]+hostalias \\(const char \\*\\);)";
4426 files = "rtldef/resolv.h";
4432 test_text = "void fp_nquery (const u_char *, int, FILE *);\n"
4433 "__char_ptr32 hostalias (const char *);\n";
4437 * On VMS, forward declare structure before referencing them in prototypes.
4440 hackname = vms_forward_declare_struct;
4441 select = "(/\\* forward decls for C\\+\\+ \\*/\n)"
4442 "#ifdef __cplusplus\n";
4444 files = rtldef/if.h;
4448 "#if defined (__cplusplus) || defined (__GNUC__)\n";
4450 test_text = "/* forward decls for C++ */\n"
4451 "#ifdef __cplusplus\n"
4457 * On VMS, do not declare getopt and al if pointers are 64 bit.
4460 hackname = vms_no_64bit_getopt;
4461 select = "^[ \t]*(extern[ \t]*)?(int[ \t]*(getopt|optind|opterr|optopt)"
4462 "|(char \\*optarg))([ \t]*\\(.*\\))?;\n";
4464 files = rtldef/stdio.h, rtldef/unistd.h;
4467 c_fix_arg = <<- _EOArg_
4468 #if __INITIAL_POINTER_SIZE != 64 /* getopt is short ptr only. */
4473 test_text = "int getopt (int, char * const [], const char *);";
4477 * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
4478 * which is not yet fully supported by gcc.
4481 hackname = vms_use_fast_setjmp;
4482 select = "(#[ \t]*if[ \t]*defined\\(__FAST_SETJMP\\)[ \t]*\\|\\|)";
4484 files = rtldef/setjmp.h;
4487 c_fix_arg = "%0 defined (__GNUC__) ||";
4489 test_text = "# if defined(__FAST_SETJMP) || defined(__UNIX_SETJMP)";
4493 * On VMS, use pragma extern_model instead of VAX-C keywords.
4496 hackname = vms_use_pragma_extern_model;
4497 select = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n"
4498 "# pragma extern_model __save\n";
4502 c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n"
4503 "# pragma extern_model __save\n";
4505 test_text = "#if defined(__DECC) || defined(__DECCXX)\n"
4506 "# pragma extern_model __save\n"
4507 "# pragma extern_model strict_refdef\n"
4508 " extern struct x zz$yy;\n"
4509 "# pragma extern_model __restore\n"
4514 * On VMS, change <resource.h> to <sys/resource.h> to avoid a
4515 * conflict while building gcc. Likewise for <builtins.h>
4518 hackname = vms_use_quoted_include;
4519 select = "(#[ \t]*include[ \t]+)<(resource|builtins)\\.h>";
4521 files = rtldef/wait.h, starlet_c/pthread.h;
4524 c_fix_arg = '%1<sys
/%2.h
>';
4526 test_text = "# include <resource.h>";
4530 * AIX and Interix headers define NULL to be cast to a void pointer,
4531 * which is illegal in ANSI C++.
4534 hackname = void_null;
4535 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
4536 time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h;
4537 /* avoid changing C++ friendly NULL */
4538 bypass = __cplusplus;
4540 select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
4542 c_fix_arg = <<- _EOFix_
4547 #else /* ! __GNUG__ */
4549 #endif /* __GNUG__ */
4550 #else /* ! __cplusplus */
4551 #define NULL ((void *)0)
4552 #endif /* __cplusplus */
4555 test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
4559 * Make VxWorks header which is almost gcc ready fully gcc ready.
4562 hackname = vxworks_gcc_problem;
4563 files = types/vxTypesBase.h;
4564 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
4566 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
4569 sed = "/[ \t]size_t/i\\\n"
4570 "#ifndef _GCC_SIZE_T\\\n"
4571 "#define _GCC_SIZE_T\n";
4573 sed = "/[ \t]size_t/a\\\n"
4576 sed = "/[ \t]ptrdiff_t/i\\\n"
4577 "#ifndef _GCC_PTRDIFF_T\\\n"
4578 "#define _GCC_PTRDIFF_T\n";
4580 sed = "/[ \t]ptrdiff_t/a\\\n"
4583 sed = "/[ \t]wchar_t/i\\\n"
4584 "#ifndef _GCC_WCHAR_T\\\n"
4585 "#define _GCC_WCHAR_T\n";
4587 sed = "/[ \t]wchar_t/a\\\n"
4591 "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
4592 "typedef unsigned int size_t;\n"
4593 "typedef long ptrdiff_t;\n"
4594 "typedef unsigned short wchar_t;\n"
4595 "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
4599 * Wrap VxWorks ioctl to keep everything pretty
4602 hackname = vxworks_ioctl_macro;
4604 mach = "*-*-vxworks*";
4608 "#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
4609 c_fix_arg = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
4611 test_text = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
4615 * Wrap VxWorks mkdir to be posix compliant
4618 hackname = vxworks_mkdir_macro;
4620 mach = "*-*-vxworks*";
4624 "#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n";
4625 c_fix_arg = "extern[\t ]+STATUS[\t ]+mkdir[\t ]*"
4626 "\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*" /* arg type */
4627 "(|[_[:alpha:]][_[:alnum:]]*)" /* arg name (optional) */
4630 test_text = "extern STATUS mkdir (const char * _qwerty) ;";
4634 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
4637 hackname = vxworks_needs_vxtypes;
4639 select = "uint_t([ \t]+_clocks_per_sec)";
4641 c_fix_arg = "unsigned int%1";
4642 test_text = "uint_t\t_clocks_per_sec;";
4646 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
4649 hackname = vxworks_needs_vxworks;
4651 test = " -r types/vxTypesOld.h";
4652 test = " -n \"`egrep '#include
' $file`\"";
4653 test = " -n \"`egrep ULONG $file`\"";
4654 select = "#[ \t]define[ \t]+__INCstath";
4656 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
4657 "#include <types/vxTypesOld.h>\n";
4659 test_text = "`touch types/vxTypesOld.h`"
4660 "#include </dev/null> /* ULONG */\n"
4661 "# define\t__INCstath <sys/stat.h>";
4665 * Make it so VxWorks does not include gcc/regs.h accidentally
4668 hackname = vxworks_regs;
4669 mach = "*-*-vxworks*";
4671 select = "#[\t ]*include[\t ]+[<\"]regs.h[>\"]";
4673 c_fix_arg = "#include <arch/../regs.h>";
4675 test_text = "#include <regs.h>\n";
4679 * Another bad dependency in VxWorks 5.2 <time.h>.
4682 hackname = vxworks_time;
4684 test = " -r vxWorks.h";
4686 select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
4690 "#ifndef __gcc_VOIDFUNCPTR_defined\n"
4691 "#ifdef __cplusplus\n"
4692 "typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
4694 "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
4696 "#define __gcc_VOIDFUNCPTR_defined\n"
4698 "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
4700 test_text = "`touch vxWorks.h`"
4701 "#define VOIDFUNCPTR (void(*)())";
4705 * This hack makes write const-correct on VxWorks
4708 hackname = vxworks_write_const;
4710 mach = "*-*-vxworks*";
4713 c_fix_arg = "extern int write (int, const char*, size_t);";
4714 c_fix_arg = "extern[\t ]+int[\t ]+write[\t ]*\\("
4716 "[\t ]*char[\t ]*\\*[\t ]*,"
4717 "[\t ]*size_t[\t ]*\\)[\t ]*;";
4719 test_text = "extern int write ( int , char * , size_t ) ;";
4723 * There are several name conflicts with C++ reserved words in X11 header
4724 * files. These are fixed in some versions, so don't do the fixes if
4725 * we find __cplusplus in the file. These were found on the RS
/6000.
4728 hackname
= x11_class
;
4729 files
= X11
/ShellP.h
;
4730 bypass
= __cplusplus
;
4731 select
= "^([ \t]*char \\*)class;(.*)";
4733 c_fix_arg
= "#ifdef __cplusplus\n%1c_class;%2\n"
4734 "#else\n%1class;%2\n#endif";
4742 * class in Xm
/BaseClassI.h
4745 hackname
= x11_class_usage
;
4746 files
= Xm
/BaseClassI.h
;
4747 bypass
= "__cplusplus";
4749 select
= " class\\)";
4751 c_fix_arg
= " c_class)";
4753 test_text
= "extern mumble (int class);\n";
4757 * new in Xm
/Traversal.h
4761 files
= Xm
/Traversal.h
;
4762 bypass
= __cplusplus
;
4764 sed
= "/Widget\told, new;/i\\\n"
4765 "#ifdef __cplusplus\\\n"
4766 "\\\tWidget\told, c_new;\\\n"
4769 sed
= "/Widget\told, new;/a\\\n"
4772 sed
= "s/Widget new,/Widget c_new,/g";
4775 " Widget\told, new;\n"
4776 "};\nextern Wedged( Widget new, Widget old );";
4780 * Incorrect sprintf declaration in X11
/Xmu.h
4783 hackname
= x11_sprintf
;
4785 files
= X11
/Xmu
/Xmu.h
;
4786 select
= "^extern char \\*\tsprintf\\(\\);$";
4789 c_fix_arg
= "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
4791 test_text
= "extern char *\tsprintf();";