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 * SDKs for
10.13 and
10.14 omit the definitions for API_AVAILABLE where
199 * __attribute__((availability
)) is not supported.
202 hackname
= darwin_api_availability
;
203 mach
= "*-*-darwin*";
204 files
= os
/availability.h
;
205 bypass
= "__IPHONE_OS_VERSION_MIN_REQUIRED";
207 " *#define __API_AVAILABLE.*\n"
208 " *#define __API_DEPRECATED.*\n"
209 " *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n"
210 " *#define __API_UNAVAILABLE.*\n";
213 " #define API_AVAILABLE(...)\n"
214 " #define API_DEPRECATED(...)\n"
215 " #define API_DEPRECATED_WITH_REPLACEMENT(...)\n"
216 " #define API_UNAVAILABLE(...)\n";
218 "#define __API_AVAILABLE(...)\n"
219 "#define __API_DEPRECATED(...)\n"
220 "#define __API_DEPRECATED_WITH_REPLACEMENT(...)\n"
221 "#define __API_UNAVAILABLE(...)\n";
225 * This fixes __FD_ZERO bug for linux
2.x.
y (x
<= 2 && y
<= some n
)
228 hackname
= AAB_fd_zero_asm_posix_types_h
;
229 files
= asm
/posix_types.h
;
230 mach
= 'i[34567]86-*-linux*';
233 bypass
= 'posix_types_64';
236 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper
, not
237 * the start
, so that if #include_next gets another instance of
238 * the wrapper
, this will follow the #include_next chain until
239 * we arrive at the real
<asm
/posix_types.h
>.
241 replace
= <<- _EndOfHeader_
242 /* This file fixes a bug in the __FD_ZERO macro
243 for older versions of the Linux kernel.
*/
244 #ifndef _POSIX_TYPES_H_WRAPPER
245 #include
<features.h
>
246 #include_next
<asm
/posix_types.h
>
248 #if
defined(__FD_ZERO
) && !defined(__GLIBC__
)
250 #define
__FD_ZERO(fdsetp
) \
253 __asm__
__volatile__("cld ; rep ; stosl" \
254 : "=&c" (__d0
), "=&D" (__d1
) \
255 : "a" (0), "0" (__FDSET_LONGS
), \
256 "1" ((__kernel_fd_set *)
(fdsetp
)) :"memory"); \
260 #define _POSIX_TYPES_H_WRAPPER
261 #endif
/* _POSIX_TYPES_H_WRAPPER
*/
266 * This fixes __FD_ZERO bug for glibc
-1.x
269 hackname
= AAB_fd_zero_gnu_types_h
;
271 mach
= 'i[34567]86-*-linux*';
274 * Define _TYPES_H_WRAPPER at the end of the wrapper
, not
275 * the start
, so that if #include_next gets another instance of
276 * the wrapper
, this will follow the #include_next chain until
277 * we arrive at the real
<gnu
/types.h
>.
279 replace
= <<- _EndOfHeader_
280 /* This file fixes a bug in the __FD_ZERO macro present in glibc
1.x.
*/
281 #ifndef _TYPES_H_WRAPPER
282 #include
<features.h
>
283 #include_next
<gnu
/types.h
>
285 #if
defined(__FD_ZERO
) && !defined(__GLIBC__
)
287 # define
__FD_ZERO(fdsetp
) \
290 __asm__
__volatile__("cld ; rep ; stosl" \
291 : "=&c" (__d0
), "=&D" (__d1
) \
292 : "a" (0), "0" (__FDSET_LONGS
), \
293 "1" ((__fd_set *)
(fdsetp
)) :"memory"); \
297 #define _TYPES_H_WRAPPER
298 #endif
/* _TYPES_H_WRAPPER
*/
303 * This fixes __FD_ZERO bug for glibc
-2.0.x
306 hackname
= AAB_fd_zero_selectbits_h
;
307 files
= selectbits.h
;
308 mach
= 'i[34567]86-*-linux*';
311 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper
, not
312 * the start
, so that if #include_next gets another instance of
313 * the wrapper
, this will follow the #include_next chain until
314 * we arrive at the real
<selectbits.h
>.
316 replace
= <<- _EndOfHeader_
317 /* This file fixes a bug in the __FD_ZERO macro present in glibc
2.0.x.
*/
318 #ifndef _SELECTBITS_H_WRAPPER
319 #include
<features.h
>
320 #include_next
<selectbits.h
>
322 #if
defined(__FD_ZERO
) && defined(__GLIBC__
) \\
323 && defined(__GLIBC_MINOR__
) && __GLIBC__
== 2 \\
324 && __GLIBC_MINOR__
== 0
326 #define
__FD_ZERO(fdsetp
) \\
329 __asm__
__volatile__ ("cld; rep; stosl" \\
330 : "=&c" (__d0
), "=&D" (__d1
) \\
331 : "a" (0), "0" (sizeof (__fd_set
) \\
332 / sizeof (__fd_mask
)), \\
333 "1" ((__fd_mask *)
(fdsetp
)) \\
338 #define _SELECTBITS_H_WRAPPER
339 #endif
/* _SELECTBITS_H_WRAPPER
*/
344 * Solaris
<sys
/varargs.h
> is a
DDK (aka kernel
-land
) header providing
345 * the same interface as
<stdarg.h
>. No idea why they couldn
't have just
346 * used the standard header.
349 hackname = AAB_solaris_sys_varargs_h;
350 files = "sys/varargs.h";
351 mach = '*-*-solaris
*';
352 replace = <<- _EndOfHeader_
362 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
363 * declaration on Sun OS
4.x. We must only fix this on Sun OS
4.x
, because
364 * many other systems have similar text but correct versions of the file.
365 * To ensure only Sun
's is fixed, we grep for a likely unique string.
366 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
369 hackname = AAB_sun_memcpy;
371 select = "/\\*\t@\\(#\\)"
372 "(head/memory.h\t50.1\t "
373 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
375 replace = <<- _EndOfHeader_
376 /* This file was generated by fixincludes */
381 extern void *memccpy();
382 extern void *memchr();
383 extern void *memcpy();
384 extern void *memset();
386 extern char *memccpy();
387 extern char *memchr();
388 extern char *memcpy();
389 extern char *memset();
390 #endif /* __STDC__ */
394 #endif /* __memory_h__ */
399 * Fix assert.h on VxWorks:
402 hackname = AAB_vxworks_assert;
404 mach = "*-*-vxworks*";
406 replace = <<- _EndOfHeader_
418 #if defined(__STDC__) || defined(__cplusplus)
419 extern void __assert (const char*);
421 extern void __assert ();
425 #define assert(ign) ((void)0)
428 #define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str)
429 #define ASSERT_STRINGIFY_HELPER(str) #str
431 #define assert(test) ((void) \
432 ((test) ? ((void)0) : \
433 __assert("Assertion failed: " #test ", file " \
434 __FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
445 * Add needed include to regs.h (NOT the gcc header) on VxWorks
449 hackname = AAB_vxworks_regs_vxtypes;
451 mach = "*-*-vxworks*";
453 replace = <<- _EndOfHeader_
456 /* regs.h depends on CPU_FAMILY being properly defined, which
457 is done by vxCpu.h. */
458 #include <types/vxCpu.h>
459 /* regs.h includes a CPU_FAMILY-specific header that requires
460 vxTypesOld.h to already have been included. Those headers
461 contain proper _ASMLANGUAGE guards around their typedefs,
462 but vxTypesOld.h itself does not. So we avoid including
463 vxTypesOld.h from assembly. */
465 #include <types/vxTypesOld.h>
467 #include_next <arch/../regs.h>
473 * This hack makes makes unistd.h more POSIX-compliant on VxWorks
476 hackname = AAB_vxworks_unistd;
478 mach = "*-*-vxworks*";
480 replace = <<- _EndOfHeader_
483 #include_next <unistd.h>
486 #define STDIN_FILENO 0
488 #ifndef STDOUT_FILENO
489 #define STDOUT_FILENO 1
491 #ifndef STDERR_FILENO
492 #define STDERR_FILENO 2
494 #endif /* _UNISTD_H */
499 * assert.h on AIX 7 redefines static_assert as _Static_assert without
503 hackname = aix_assert;
506 select = "#define[ \t]static_assert[ \t]_Static_assert";
508 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
509 test_text = "#define static_assert _Static_assert";
513 * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
514 * which only is provided by AIX xlc C99.
517 hackname = aix_complex;
520 select = "#define[ \t]_Complex_I[ \t]__I";
522 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
523 test_text = "#define _Complex_I __I\n";
527 * On AIX some headers are not properly guarded by 'extern
"C"'.
530 hackname = aix_externc;
536 files = sys/localedef.h;
538 bypass = "extern \"C\"";
540 c_fix_arg = "#ifdef __cplusplus\n"
543 c_fix_arg = "#ifdef __cplusplus\n"
546 test_text = "extern int __n_pthreads;\n";
550 * On AIX sys/socket.h assumes C++.
553 hackname = aix_externcpp1;
555 files = "sys/socket.h";
556 select = "#ifndef _KERNEL\n"
557 "#ifdef __cplusplus\n"
558 "extern \"C\" int naccept\\(int, struct sockaddr \\*, socklen_t \\*\\);";
560 c_fix_arg = "#ifndef _KERNEL\n"
561 "#ifdef __cplusplus\n"
563 "extern \"C\" int naccept(int, struct sockaddr *, socklen_t *);";
564 test_text = "#ifndef _KERNEL\n"
565 "#ifdef __cplusplus\n"
566 "extern \"C\" int naccept(int, struct sockaddr *, socklen_t *);";
570 hackname = aix_externcpp2;
572 files = "sys/socket.h";
573 select = "#endif /\\* COMPAT_43 \\*/\n"
574 "#else /\\* __cplusplus \\*/";
576 c_fix_arg = "#endif /* COMPAT_43 */\n"
577 "} /* extern \"C++\" */\n"
578 "#else /* __cplusplus */";
579 test_text = "#endif /* COMPAT_43 */\n"
580 "#else /* __cplusplus */";
584 * inttypes.h STDC_FORMAT_MACROS
587 hackname = aix_inttypes;
589 files = "sys/inttypes.h";
590 select = "#if !defined\\(__cplusplus\\) \\|\\| defined\\(__STDC_FORMAT_MACROS\\)";
593 test_text = "#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)";
597 * malloc.h on AIX6 uses XLC++ specific builtin syntax
600 hackname = aix_malloc;
603 select = "#ifdef __cplusplus\n"
605 "[ \t]extern \"builtin\" char \\*__alloca \\(size_t\\);";
607 c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))\n"
609 "\textern \"builtin\" char *__alloca (size_t);";
610 test_text = "#ifdef __cplusplus\n"
612 "\textern \"builtin\" char *__alloca (size_t);";
616 * net/if_arp.h defines a variable fc_softc instead of adding a
617 * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
620 hackname = aix_net_if_arp;
622 files = "net/if_arp.h";
623 select = "^struct fc_softc \\{";
625 c_fix_arg = "typedef struct _fc_softc {";
626 test_text = "struct fc_softc {\n int a;\n};";
630 * Fix AIX definition of NULL for G++.
635 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
636 time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h;
638 select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*";
640 c_fix_arg = <<- _EOFix_
645 #else /* ! __GNUG__ */
647 #endif /* __GNUG__ */
648 #else /* ! __cplusplus */
649 #define NULL ((void *)0)
650 #endif /* __cplusplus */
653 test_text = "# define\tNULL \t(0L) /* typed NULL */";
657 * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER,
658 * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough
662 hackname = aix_once_init_1;
665 select = "#define[ \t]PTHREAD_ONCE_INIT \\\\\n"
668 c_fix_arg = "#define PTHREAD_ONCE_INIT \\\n"
670 test_text = "#define PTHREAD_ONCE_INIT \\\\\n"
675 hackname = aix_once_init_2;
678 select = "[ \t]0 \\\\\n"
681 c_fix_arg = " 0 \\\n"
683 test_text = " 0 \\\\\n"
688 hackname = aix_mutex_initializer_1;
691 select = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n"
694 c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n"
696 test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
701 hackname = aix_cond_initializer_1;
704 select = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n"
707 c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n"
709 test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n"
714 hackname = aix_rwlock_initializer_1;
717 select = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n"
720 c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n"
722 test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
727 /* On AIX 'typedef struct
{<stuff
>} * physadr_t
;' needs to give the struct a
728 name for linkage purposes. Fortunately it is on exactly one
731 hackname = aix_physadr_t;
734 select = "typedef[ \t]*struct[ \t]*([{][^}]*[}][ \t]*\\*[ \t]*physadr_t;)";
736 c_fix_arg = "typedef struct __physadr_s %1";
737 test_text = "typedef struct { random stuff } * physadr_t;";
741 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
742 * which violates a requirement of ISO C.
745 hackname = aix_pthread;
747 select = "(#define[\t ][A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
750 test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
751 "{...init stuff...}";
755 * AIX stdint.h fixes.
758 hackname = aix_stdint_1;
760 files = stdint-aix.h, stdint.h;
761 select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
762 "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
764 c_fix_arg = "#define UINT8_MAX (255)\n"
765 "#define UINT16_MAX (65535)";
766 test_text = "#define UINT8_MAX (255U)\n"
767 "#define UINT16_MAX (65535U)";
774 hackname = aix_stdint_2;
776 files = stdint-aix.h, stdint.h;
777 select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
778 "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
779 "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
781 "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
782 "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
783 "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
785 c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
786 "#define INTPTR_MAX 9223372036854775807L\n"
787 "#define UINTPTR_MAX 18446744073709551615UL\n"
789 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
790 "#define INTPTR_MAX 2147483647L\n"
791 "#define UINTPTR_MAX 4294967295UL";
792 test_text = "#define INTPTR_MIN INT64_MIN\n"
793 "#define INTPTR_MAX INT64_MAX\n"
794 "#define UINTPTR_MAX UINT64_MAX\n"
796 "#define INTPTR_MIN INT32_MIN\n"
797 "#define INTPTR_MAX INT32_MAX\n"
798 "#define UINTPTR_MAX UINT32_MAX";
805 hackname = aix_stdint_3;
807 files = stdint-aix.h, stdint.h;
808 select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
809 "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
811 "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
812 "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
814 c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
815 "#define PTRDIFF_MAX 9223372036854775807L\n"
817 "#define PTRDIFF_MIN (-2147483647L - 1)\n"
818 "#define PTRDIFF_MAX 2147483647L";
819 test_text = "#define PTRDIFF_MIN INT64_MIN\n"
820 "#define PTRDIFF_MAX INT64_MAX\n"
822 "#define PTRDIFF_MIN INT32_MIN\n"
823 "#define PTRDIFF_MAX INT32_MAX";
830 hackname = aix_stdint_4;
832 files = stdint-aix.h, stdint.h;
833 select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
835 "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
837 c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
839 "#define SIZE_MAX 4294967295UL";
840 test_text = "#define SIZE_MAX UINT64_MAX\n"
842 "#define SIZE_MAX UINT32_MAX";
849 hackname = aix_stdint_5;
851 files = stdint-aix.h, stdint.h;
852 select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
853 "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
855 c_fix_arg = "#define UINT8_C(c) c\n"
856 "#define UINT16_C(c) c";
857 test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
858 "#define UINT16_C(c) __CONCAT__(c,U)";
862 * stdio.h on AIX defines ferror, clearerr and feof as C++ inline, which
863 produces wrong code with G++.
866 hackname = aix_stdio_inline;
869 select = "#ifdef __cplusplus\\\n"
873 c_fix_arg = "#ifdef __cplusplus\n"
876 "#if (defined(__cplusplus) && defined(__IBMCPP__))\n"
878 test_text = "#ifdef __cplusplus\n}\n\n#ifdef ferror";
882 * stdlib.h on AIX uses #define on malloc and friends.
885 hackname = aix_stdlib_malloc;
888 select = "#define[ \t]+malloc[ \t]+__linux_malloc";
890 c_fix_arg = "extern void *malloc(size_t) __asm__(\"__linux_malloc\");";
891 test_text = "#define malloc __linux_malloc";
895 hackname = aix_stdlib_realloc;
898 select = "#define[ \t]+realloc[ \t]+__linux_realloc";
900 c_fix_arg = "extern void *realloc(void *, size_t) __asm__(\"__linux_realloc\");";
901 test_text = "#define realloc __linux_realloc";
905 hackname = aix_stdlib_calloc;
908 select = "#define[ \t]+calloc[ \t]+__linux_calloc";
910 c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"__linux_calloc\");";
911 test_text = "#define calloc __linux_calloc";
915 hackname = aix_stdlib_valloc;
918 select = "#define[ \t]+valloc[ \t]+__linux_valloc";
920 c_fix_arg = "extern void *valloc(size_t) __asm__(\"__linux_valloc\");";
921 test_text = "#define valloc __linux_valloc";
925 hackname = aix_stdlib_vec_malloc;
928 select = "#define[ \t]+malloc[ \t]+vec_malloc";
930 c_fix_arg = "extern void *malloc(size_t) __asm__(\"vec_malloc\");";
931 test_text = "#define malloc vec_malloc";
935 hackname = aix_stdlib_vec_calloc;
938 select = "#define[ \t]+calloc[ \t]+vec_calloc";
940 c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"vec_calloc\");";
941 test_text = "#define calloc vec_calloc";
945 * stdlib.h on AIX 4.3 declares strtof() with a non-const first argument.
948 hackname = aix_strtof_const;
951 select = "((extern[ \t]+)?float[ \t]+strtof)\\(char \\*, char \\*\\*\\);";
953 c_fix_arg = "%1(const char *, char **);";
954 test_text = "extern float strtof(char *, char **);";
958 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
959 * in an otherwise harmless (and #ifed out) macro definition
962 hackname = aix_sysmachine;
964 files = sys/machine.h;
968 test_text = "#define FOO \\\n"
969 " bar \\ \n baz \\ \n bat";
973 * sys/wait.h on AIX 5.2 defines macros that have both signed and
974 * unsigned types in conditional expressions.
977 hackname = aix_syswait_2;
980 select = '\? (\
(\
(\
(\
(unsigned
[^
)]*\
)[^
)]*\
) >> [^
)]*\
) \
& 0xff\
) : -1)';
982 c_fix_arg = "? (int)%1";
983 test_text = "#define WSTOPSIG(__x) "
984 "(int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
988 * sys/signal.h on some versions of AIX uses volatile in the typedef of
989 * sig_atomic_t, which causes gcc to generate a warning about duplicate
990 * volatile when a sig_atomic_t variable is declared volatile, as
991 * required by ANSI C.
994 hackname = aix_volatile;
996 files = sys/signal.h;
997 select = "typedef volatile int sig_atomic_t";
999 c_fix_arg = "typedef int sig_atomic_t";
1000 test_text = "typedef volatile int sig_atomic_t;";
1004 * AIX unistd.h defines a static function with an empty parameter list.
1007 hackname = aix_unistd;
1011 select = "[ \t]+static[ \t]+int[ \t]+getdtablesize\\(\\)";
1013 c_fix_arg = "\tstatic int\t\tgetdtablesize(void)";
1014 test_text = " static int getdtablesize()";
1018 * Fix __assert declaration in assert.h on Alpha OSF/1.
1021 hackname = alpha___assert;
1023 select = '__assert\
(char \
*, char \
*, int\
)';
1025 c_fix_arg = "__assert(const char *, const char *, int)";
1026 test_text = 'extern void
__assert(char
*, char
*, int
);';
1030 * Fix assert macro in assert.h on Alpha OSF/1.
1031 * The superfluous int cast breaks C++.
1034 hackname = alpha_assert;
1036 select = "(#[ \t]*" 'define assert\
(EX\
).*)\
(\
(int\
) \
(EX\
)\
)';
1038 c_fix_arg = "%1(EX)";
1039 test_text = '#define
assert(EX
) (((int
) (EX
)) ?
(void
)0 '
1040 ': __assert(#EX
, __FILE__
, __LINE__
))';
1044 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
1047 hackname = alpha_getopt;
1050 select = 'getopt\
(int
, char \
*\
[\
], *char \
*\
)';
1052 c_fix_arg = "getopt(int, char *const[], const char *)";
1053 test_text = 'extern int
getopt(int
, char
*[], char *)
;';
1057 * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
1060 hackname = alpha_if_semicolon;
1062 select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
1064 c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
1065 test_text = ' struct sockaddr vmif_paddr
/* protocol address
*/';
1069 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
1072 hackname = alpha_parens;
1074 select = '#ifndef\
(__mips64\
)';
1076 c_fix_arg = "#ifndef __mips64";
1077 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
1081 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
1085 hackname = alpha_sbrk;
1087 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
1089 c_fix_arg = "void *sbrk(";
1090 test_text = "extern char* sbrk(ptrdiff_t increment);";
1094 * For C++, avoid any typedef or macro definition of bool,
1095 * and use the built in type instead.
1096 * HP/UX 10.20 also has it in curses_colr/curses.h.
1099 hackname = avoid_bool_define;
1101 files = curses_colr/curses.h;
1105 select = "#[ \t]*define[ \t]+bool[ \t]";
1106 bypass = "__cplusplus";
1109 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1110 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
1112 test_text = "# define bool\t char \n";
1119 hackname = avoid_bool_type;
1121 files = curses_colr/curses.h;
1125 select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
1126 bypass = "__cplusplus";
1129 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1131 test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
1135 * For C++, avoid any typedef definition of wchar_t,
1136 * and use the built in type instead.
1137 * Don't do this for headers that are smart enough to do the right
1138 * thing (recent
[n
]curses.h and Xlib.h
).
1139 * Don
't do it for <linux/nls.h> which is never used from C++ anyway,
1140 * and will be broken by the edit.
1144 hackname = avoid_wchar_t_type;
1146 select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
1147 bypass = "__cplusplus";
1148 bypass = "_LINUX_NLS_H";
1149 bypass = "XFree86: xc/lib/X11/Xlib\\.h";
1152 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1154 test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
1158 * Fix `typedef struct term;' on hppa1.1
-hp
-hpux9.
1161 hackname
= bad_struct_term
;
1163 select
= "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
1165 c_fix_arg
= "struct term;";
1167 test_text
= 'typedef struct term;';
1171 * Fix one other error in this file
:
1172 * a mismatched quote not inside a C comment.
1175 hackname
= badquote
;
1176 files
= sundev
/vuid_event.h
;
1179 c_fix_arg
= "does not";
1181 test_text
= "/* doesn't have matched single quotes */";
1185 * check for broken assert.h that needs stdio.h
1188 hackname
= broken_assert_stdio
;
1191 bypass
= "include.*stdio\\.h";
1193 c_fix_arg
= "#include <stdio.h>\n";
1194 test_text
= "extern FILE* stderr;";
1198 * check for broken assert.h that needs stdlib.h
1201 hackname
= broken_assert_stdlib
;
1203 select
= 'exit *\(|abort *\(';
1204 bypass
= "include.*stdlib\\.h";
1206 c_fix_arg
= "#ifdef __cplusplus\n"
1207 "#include <stdlib.h>\n"
1209 test_text
= "extern void exit ( int );";
1213 * Remove `extern double cabs
' declarations from math.h.
1214 * This conflicts with C99. Discovered on AIX.
1215 * Darwin hides its broken cabs in architecture-specific subdirs.
1218 hackname = broken_cabs;
1219 files = math.h, "architecture/*/math.h";
1220 select = "^extern[ \t]+double[ \t]+cabs";
1222 sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
1223 sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
1225 test_text = "#ifdef __STDC__\n"
1226 "extern double cabs(struct dbl_hypot);\n"
1228 "extern double cabs();\n"
1230 "extern double cabs ( _Complex z );";
1234 * Fixup Darwin's broken check for __builtin_nanf.
1237 hackname
= broken_nan
;
1239 * It is tempting to omit the first
"files" entry. Do not.
1240 * The testing machinery will take the first
"files" entry as the name
1241 * of a test file to play with. It would be a nuisance to have a directory
1242 * with the name
"*".
1244 files
= "architecture/ppc/math.h";
1245 files
= "architecture/*/math.h";
1246 select
= '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)';
1249 c_fix_arg
= "#if 1";
1250 test_text
= "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
1254 * Various systems derived from BSD4.4 contain a macro definition
1255 * for vfscanf that interacts badly with requirements of builtin
-attrs.def.
1256 * Known to be fixed in FreeBSD
5 system headers.
1259 hackname
= bsd_stdio_attrs_conflict
;
1261 mach
= "*-*-*darwin*";
1263 select
= "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
1265 c_fix_arg
= '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n"
1266 '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n"
1267 'int vfscanf(FILE *, const char *, __builtin_va_list) '
1268 '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");';
1269 test_text
= '#define vfscanf __svfscanf';
1273 * Fix various macros used to define ioctl numbers.
1274 * The traditional syntax was
:
1276 * #define
_CTRL(n
, x
) (('n'<<8)+x
)
1277 * #define TCTRLCFOO
_CTRL(T
, 1)
1279 * but this does not work with the C standard
, which disallows macro
1280 * expansion inside strings. We have to rewrite it thus
:
1282 * #define
_CTRL(n
, x
) ((n
<<8)+x
)
1283 * #define TCTRLCFOO
_CTRL('T', 1)
1285 * The select expressions match too much
, but the c_fix code is cautious.
1287 * CTRL might be
: CTRL _CTRL ISCTRL BSD43_CTRL ...
1290 hackname
= ctrl_quotes_def
;
1291 select
= "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
1292 c_fix
= char_macro_def
;
1296 * This is two tests in order to ensure that the
"CTRL(c)" can
1297 * be selected in isolation from the multi
-arg format
1299 test_text
= "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n";
1300 test_text
= "#define _CTRL(c) ('c'&037)";
1304 * Fix various macros used to define ioctl numbers.
1307 hackname
= ctrl_quotes_use
;
1308 select
= "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1309 c_fix
= char_macro_use
;
1311 test_text
= "#define TCTRLFOO BSD43_CTRL(T, 1)";
1315 * sys
/mman.h on HP
/UX is not C
++ ready
,
1316 * even though NO_IMPLICIT_EXTERN_C is defined on HP
/UX.
1318 * rpc
/types.h on OSF1
/2.0 is not C
++ ready
,
1319 * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
1321 * The problem is the declaration of malloc.
1324 hackname
= cxx_unready
;
1326 files
= rpc
/types.h
;
1327 select
= '[^#]+malloc.*;'; /* Catch any form of declaration
1328 not within a macro.
*/
1329 bypass
= '"C"|__BEGIN_DECLS';
1332 c_fix_arg
= "#ifdef __cplusplus\n"
1335 c_fix_arg
= "#ifdef __cplusplus\n"
1338 test_text
= "extern void* malloc( size_t );";
1342 * macOS
10.12 <AvailabilityInternal.h
> uses
__attribute__((availability
))
1346 hackname
= darwin_availabilityinternal
;
1347 mach
= "*-*-darwin*";
1348 files
= AvailabilityInternal.h
;
1349 select
= "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*";
1351 c_fix_arg
= <<- _EOFix_
1352 #if
defined(__has_attribute
)
1353 #if
__has_attribute(availability
)
1363 test_text
= "#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))\n"
1364 "#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))";
1368 * For the AAB_darwin7_9_long_double_funcs
fix (and later fixes for long long
)
1369 * to be useful
, the main math.h must use
<> and not
"" includes.
1372 hackname
= darwin_9_long_double_funcs_2
;
1373 mach
= "*-*-darwin*";
1375 select
= '#include[ \t]+\"';
1377 c_fix_arg
= "%1<%2.h>";
1379 c_fix_arg
= '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
1381 test_text
= '#include <architecture/ppc/math.h>';
1385 * On darwin8 and earlier
, mach
-o
/swap.h isn
't properly guarded
1386 * by 'extern
"C"'. On darwin7 some mach/ headers aren't properly guarded.
1389 hackname
= darwin_externc
;
1390 mach
= "*-*-darwin*";
1391 files
= mach
-o
/swap.h
;
1392 files
= mach
/mach_time.h
;
1393 files
= mach
/mach_traps.h
;
1394 files
= mach
/message.h
;
1396 files
= mach
/semaphore.h
;
1397 bypass
= "extern \"C\"";
1398 bypass
= "__BEGIN_DECLS";
1400 c_fix_arg
= "#ifdef __cplusplus\n"
1403 c_fix_arg
= "#ifdef __cplusplus\n"
1406 test_text
= "extern void swap_fat_header();\n";
1410 * AvailabilityMacros.h on Darwin breaks with GCC
4.0, because of
1411 * bad __GNUC__ tests.
1414 hackname
= darwin_gcc4_breakage
;
1415 mach
= "*-*-darwin*";
1416 files
= AvailabilityMacros.h
;
1417 select
= "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
1419 c_fix_arg
= "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
1420 test_text
= "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
1421 "(__GNUC_MINOR__ >= 1)\n";
1425 * math.h hides the long long functions that are available on the system for
1426 * 10.5 and
10.6 SDKs
, we expect to use them in G
++ without specifying a value
1427 * for __STDC_VERSION__
, or switching __STRICT_ANSI__ off.
1430 hackname
= darwin_ll_funcs_avail
;
1431 mach
= "*-*-darwin*";
1432 files
= architecture
/ppc
/math.h
, architecture
/i386
/math.h
;
1433 select
= "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*"
1434 "__STRICT_ANSI__[^_]*__GNUC__[^\)]*";
1435 sed
= "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*"
1436 "__STRICT_ANSI__[^_]*__GNUC__[^\\)]*\)/#if\ !\(__DARWIN_NO_LONG_LONG\)/";
1437 test_text
= "#if\ !(__DARWIN_NO_LONG_LONG)";
1441 * Before Mac OS X
10.8 <i386
/setjmp.h
> doesn
't mark longjump noreturn.
1444 hackname = darwin_longjmp_noreturn;
1445 mach = "*-*-darwin*";
1446 files = "i386/setjmp.h";
1448 select = "(.*longjmp\\(.*jmp_buf.*[^)]+\\));";
1450 c_fix_arg = "%1 __attribute__ ((__noreturn__));";
1452 test_text = "void siglongjmp(sigjmp_buf, int);";
1456 * Mac OS X 10.11 <os/trace.h> uses attribute on function definition.
1459 hackname = darwin_os_trace_1;
1460 mach = "*-*-darwin*";
1462 select = "^(_os_trace_verify_printf.*) (__attribute__.*)";
1465 test_text = "_os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2)))";
1469 * Mac OS X 10.1[012] <os/trace.h> os_trace_payload_t typedef uses Blocks
1470 * extension without guard.
1473 hackname = darwin_os_trace_2;
1474 mach = "*-*-darwin*";
1476 select = "typedef.*\\^os_trace_payload_t.*";
1478 c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
1479 test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);";
1483 * In Mac OS X 10.1[012] <os/trace.h>, need to guard users of
1484 * os_trace_payload_t typedef, too.
1487 hackname = darwin_os_trace_3;
1488 mach = "*-*-darwin*";
1490 select = <<- _EOSelect_
1494 _os_trace.*os_trace_payload_t payload);
1497 c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
1498 test_text = <<- _EOText_
1499 __API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0))
1500 OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED
1502 _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload);
1504 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0)
1505 OS_EXPORT OS_NOTHROW
1507 _os_trace_internal(void *dso, uint8_t type, const char *format, const uint8_t *buf, size_t buf_size, os_trace_payload_t payload);
1512 * In macOS 10.10 <os/base.h>, doesn't have __has_extension guarded.
1515 hackname
= darwin_os_base_1
;
1516 mach
= "*-*-darwin*";
1518 select
= <<- OS_BASE_1_SEL
1519 #define __has_attribute.
*
1523 c_fix_arg
= <<- OS_BASE_1_FIX
1525 #ifndef __has_extension
1526 #define
__has_extension(x
) 0
1529 test_text
= <<- OS_BASE_1_TEST
1530 #define
__has_attribute(x
) 0
1538 * In macOS
10.10 <dispatch
/object.h
>, has unguarded block syntax.
1541 hackname
= darwin_dispatch_object_1
;
1542 mach
= "*-*-darwin*";
1543 files
= dispatch
/object.h
;
1544 select
= "typedef void.*\\^dispatch_block_t.*";
1546 c_fix_arg
= "#if __BLOCKS__\n%0\n#endif";
1547 test_text
= <<- DISPATCH_OBJECT_1_TEST
1548 typedef
void (^dispatch_block_t
)(void
);
1551 DISPATCH_OBJECT_1_TEST
;
1555 * __private_extern__ doesn
't exist in FSF GCC. Even if it did,
1556 * why would you ever put it in a system header file?
1559 hackname = darwin_private_extern;
1560 mach = "*-*-darwin*";
1561 files = mach-o/dyld.h;
1562 select = "__private_extern__ [a-z_]+ _dyld_";
1564 c_fix_arg = "extern";
1565 c_fix_arg = "__private_extern__";
1566 test_text = "__private_extern__ int _dyld_func_lookup(\n"
1567 "const char *dyld_func_name,\n"
1568 "unsigned long *address);\n";
1572 * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
1573 * unsigned constants.
1576 hackname = darwin_stdint_1;
1577 mach = "*-*-darwin*";
1578 files = stdint-darwin.h, stdint.h;
1580 c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
1581 select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
1582 "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
1583 test_text = "#define UINT8_C(v) (v ## U)\n"
1584 "#define UINT16_C(v) (v ## U)";
1588 * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
1592 hackname = darwin_stdint_2;
1593 mach = "*-*-darwin*";
1594 files = stdint-darwin.h, stdint.h;
1596 c_fix_arg = "#if __WORDSIZE == 64\n"
1597 "#define INTPTR_MAX 9223372036854775807L\n"
1598 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1600 "#define INTPTR_MAX 2147483647L\n"
1601 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1603 select = "#if __WORDSIZE == 64\n"
1604 "#define INTPTR_MIN[ \t]+INT64_MIN\n"
1605 "#define INTPTR_MAX[ \t]+INT64_MAX\n"
1607 "#define INTPTR_MIN[ \t]+INT32_MIN\n"
1608 "#define INTPTR_MAX[ \t]+INT32_MAX\n"
1610 test_text = "#if __WORDSIZE == 64\n"
1611 "#define INTPTR_MIN INT64_MIN\n"
1612 "#define INTPTR_MAX INT64_MAX\n"
1614 "#define INTPTR_MIN INT32_MIN\n"
1615 "#define INTPTR_MAX INT32_MAX\n"
1620 * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
1623 hackname = darwin_stdint_3;
1624 mach = "*-*-darwin*";
1625 files = stdint-darwin.h, stdint.h;
1627 c_fix_arg = "#if __WORDSIZE == 64\n"
1628 "#define UINTPTR_MAX 18446744073709551615UL\n"
1630 "#define UINTPTR_MAX 4294967295UL\n"
1632 select = "#if __WORDSIZE == 64\n"
1633 "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
1635 "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
1637 test_text = "#if __WORDSIZE == 64\n"
1638 "#define UINTPTR_MAX UINT64_MAX\n"
1640 "#define UINTPTR_MAX UINT32_MAX\n"
1645 * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
1648 hackname = darwin_stdint_4;
1649 mach = "*-*-darwin*";
1650 files = stdint-darwin.h, stdint.h;
1652 c_fix_arg = "#if __WORDSIZE == 64\n"
1653 "#define SIZE_MAX 18446744073709551615UL\n"
1655 "#define SIZE_MAX 4294967295UL\n"
1657 select = "#if __WORDSIZE == 64\n"
1658 "#define SIZE_MAX[ \t]+UINT64_MAX\n"
1660 "#define SIZE_MAX[ \t]+UINT32_MAX\n"
1662 test_text = "#if __WORDSIZE == 64\n"
1663 "#define SIZE_MAX UINT64_MAX\n"
1665 "#define SIZE_MAX UINT32_MAX\n"
1670 * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
1671 * with a wrong type.
1674 hackname = darwin_stdint_5;
1675 mach = "*-*-darwin*";
1676 files = stdint-darwin.h, stdint.h;
1678 c_fix_arg = "#if __WORDSIZE == 64\n"
1679 "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
1680 "#define INTMAX_MAX 9223372036854775807L\n"
1681 "#define UINTMAX_MAX 18446744073709551615UL\n"
1683 "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
1684 "#define INTMAX_MAX 9223372036854775807LL\n"
1685 "#define UINTMAX_MAX 18446744073709551615ULL\n"
1687 select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
1688 "#define INTMAX_MAX[ \t]+INT64_MAX\n"
1690 "#define UINTMAX_MAX[ \t]+UINT64_MAX";
1691 test_text = "#define INTMAX_MIN INT64_MIN\n"
1692 "#define INTMAX_MAX INT64_MAX\n"
1694 "#define UINTMAX_MAX UINT64_MAX";
1698 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1699 * with a wrong type.
1702 hackname = darwin_stdint_6;
1703 mach = "*-*-darwin*";
1704 files = stdint-darwin.h, stdint.h;
1706 c_fix_arg = "#if __WORDSIZE == 64\n"
1707 "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
1708 "#define PTRDIFF_MAX 9223372036854775807L\n"
1710 "#define PTRDIFF_MIN (-2147483647 - 1)\n"
1711 "#define PTRDIFF_MAX 2147483647\n"
1713 select = "#if __WORDSIZE == 64\n"
1714 "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
1715 "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
1717 "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
1718 "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
1720 test_text = "#if __WORDSIZE == 64\n"
1721 "#define PTRDIFF_MIN INT64_MIN\n"
1722 "#define PTRDIFF_MAX INT64_MAX\n"
1724 "#define PTRDIFF_MIN INT32_MIN\n"
1725 "#define PTRDIFF_MAX INT32_MAX\n"
1730 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1731 * with a wrong type.
1734 hackname = darwin_stdint_7;
1735 mach = "*-*-darwin*";
1736 files = stdint-darwin.h, stdint.h;
1738 c_fix_arg = "#if __WORDSIZE == 64\n"
1739 "#define INTMAX_C(v) (v ## L)\n"
1740 "#define UINTMAX_C(v) (v ## UL)\n"
1742 "#define INTMAX_C(v) (v ## LL)\n"
1743 "#define UINTMAX_C(v) (v ## ULL)\n"
1745 select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
1746 "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
1747 test_text = "#define INTMAX_C(v) (v ## LL)\n"
1748 "#define UINTMAX_C(v) (v ## ULL)";
1751 /* The SDK included with XCode 10.2 has the file <sys/ucred.h> that uses the
1752 C11 _Atomic keyword (exposing it to C++ code). The work-around here follows
1753 the header in declaring the entity volatile when _Atomic is not available.
1756 hackname = darwin_ucred__Atomic;
1757 mach = "*-*-darwin*";
1758 files = sys/ucred.h;
1761 c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n"
1762 "# define _Atomic volatile\n"
1764 c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n"
1767 test_text = ""; /* Don't provide this for wrap fixes.
*/
1770 /* The darwin headers don
't accept __FLT_EVAL_METHOD__ == 16. */
1772 hackname = darwin_flt_eval_method;
1773 mach = "*-*-darwin*";
1775 select = "^#if __FLT_EVAL_METHOD__ == 0$";
1777 c_fix_arg = "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16";
1778 test_text = "#if __FLT_EVAL_METHOD__ == 0";
1782 * Fix <c_asm.h> on Digital UNIX V4.0:
1783 * It contains a prototype for a DEC C internal asm() function,
1784 * clashing with gcc's asm keyword. So protect this with __DECC.
1787 hackname
= dec_intern_asm
;
1789 sed
= "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1790 sed
= "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
1794 " ... asm stuff ...\n"
1795 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
1799 * Fix typo in
<wchar.h
> on DJGPP
2.03.
1802 hackname
= djgpp_wchar_h
;
1804 select
= "__DJ_wint_t";
1805 bypass
= "sys/djtypes.h";
1807 c_fix_arg
= "%0\n#include <sys/djtypes.h>";
1808 c_fix_arg
= "#include <stddef.h>";
1809 test_text
= "#include <stddef.h>\n"
1810 "extern __DJ_wint_t x;\n";
1814 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1817 hackname
= ecd_cursor
;
1818 files
= "sunwindow/win_lock.h";
1819 files
= "sunwindow/win_cursor.h";
1820 select
= 'ecd\.cursor';
1822 c_fix_arg
= 'ecd_cursor';
1824 test_text
= "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1828 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
1829 * that fails when compiling for SSE
-less
32-bit x86.
1832 hackname
= feraiseexcept_nosse_divbyzero
;
1833 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
1834 files
= bits
/fenv.h
, '*/bits/fenv.h';
1835 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
1836 ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
1837 bypass
= "\"fdivp .*; fwait\"";
1840 c_fix_arg
= <<- _EOText_
1841 # ifdef __SSE_MATH__
1844 %1__asm__
__volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
1845 %1 : "=t" (__f
) : "0" (__f
), "u" (__g
) : "st(1)");
1849 test_text
= <<- _EOText_
1850 __asm__
__volatile__ ("divss %1, %0" : : "x" (__f
), "x" (__g
));
1855 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
1856 * that fails when compiling for SSE
-less
32-bit x86.
1859 hackname
= feraiseexcept_nosse_invalid
;
1860 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
1861 files
= bits
/fenv.h
, '*/bits/fenv.h';
1862 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
1863 ": \"x\" \\(__f\\)\\);$";
1864 bypass
= "\"fdiv .*; fwait\"";
1867 c_fix_arg
= <<- _EOText_
1868 # ifdef __SSE_MATH__
1871 %1__asm__
__volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
1872 %1 : "=t" (__f
) : "0" (__f
));
1876 test_text
= <<- _EOText_
1877 __asm__
__volatile__ ("divss %0, %0" : : "x" (__f
));
1882 * Between
8/24/1998 and
2/17/2001, FreeBSD system headers presume
1883 * neither the existence of GCC
3 nor its exact feature set yet break
1884 * (by design?
) when __GNUC__ is set beyond
2.
1887 hackname
= freebsd_gcc3_breakage
;
1888 mach
= "*-*-freebsd*";
1889 files
= sys
/cdefs.h
;
1890 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
1891 bypass
= '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
1893 c_fix_arg
= '%0 || __GNUC__ >= 3';
1894 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
1898 * Some releases of FreeBSD
4 and FreeBSD
5.0 and
5.1 system headers presume
1899 * neither the existence of GCC
4 nor its exact feature set yet break
1900 * (by design?
) when __GNUC__ is set beyond
3.
1903 hackname
= freebsd_gcc4_breakage
;
1904 mach
= "*-*-freebsd*";
1905 files
= sys
/cdefs.h
;
1906 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
1908 c_fix_arg
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
1909 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
1913 * Some versions of glibc don
't expect the C99 inline semantics.
1916 hackname = glibc_c99_inline_1;
1917 files = features.h, '*/features.h
';
1918 select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
1920 c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
1922 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
1923 && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
1924 # define __USE_EXTERN_INLINES 1
1930 * Similar, but a version that didn't have __NO_INLINE__
1933 hackname
= glibc_c99_inline_1a
;
1934 files
= features.h
, '*/features.h';
1935 select
= "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
1936 "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
1938 c_fix_arg
= "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
1940 #if
__GNUC_PREREQ (2, 7) && defined __OPTIMIZE__
&& !defined __OPTIMIZE_SIZE__
1941 # define __USE_EXTERN_INLINES
1
1947 * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
1948 * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
1949 * The remaining glibc_c99_inline_
* fixes deal with some of those headers.
1952 hackname
= glibc_c99_inline_2
;
1953 files
= sys
/stat.h
, '*/sys/stat.h';
1954 select
= "extern __inline__ int";
1955 sed
= "s/extern int \\(stat\\)/"
1956 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1957 "__inline__ int \\1/";
1958 sed
= "s/extern int \\([lf]stat\\)/"
1959 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1960 "__inline__ int \\1/";
1961 sed
= "s/extern int \\(mknod\\)/"
1962 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1963 "__inline__ int \\1/";
1964 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
1965 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1966 "__inline__ int __REDIRECT\\1 (\\2/";
1967 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
1968 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1969 "__inline__ int __REDIRECT\\1 (\\2/";
1970 sed
= "s/^extern __inline__ int/"
1971 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1974 extern int
fstat64 (int __fd
, struct stat64
*__buf
) __THROW
__nonnull ((2));
1975 extern __inline__ int
1976 __NTH (fstat64 (int __fd
, struct stat64
*__statbuf
))
1982 * glibc_c99_inline_3
1985 hackname
= glibc_c99_inline_3
;
1986 files
= bits
/string2.h
, '*/bits/string2.h';
1987 select
= "extern __inline";
1988 bypass
= "__extern_inline|__GNU_STDC_INLINE__";
1990 c_fix_arg
= "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
1991 c_fix_arg
= "^# ifdef __cplusplus$";
1994 # define __STRING_INLINE inline
1996 # define __STRING_INLINE extern __inline
2002 * glibc_c99_inline_4
2005 hackname
= glibc_c99_inline_4
;
2006 files
= sys
/sysmacros.h
, '*/sys/sysmacros.h', wchar.h
, '*/wchar.h',
2007 pthread.h
, '*/pthread.h';
2008 bypass
= "__extern_inline|__gnu_inline__";
2009 select
= "(^| )extern __inline";
2011 c_fix_arg
= "%0 __attribute__ ((__gnu_inline__))";
2013 __extension__ extern __inline unsigned int
2014 extern __inline unsigned int
2018 /* glibc
-2.27 to
2.36 assume GCC
7 or later supports some or all
2019 * of _Float
{16,32,64,128} and _Float
{32,64,128}x keywords for C
,
2020 * but doesn
't for C++.
2023 hackname = glibc_cxx_floatn_1;
2024 files = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h";
2025 select = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
2026 "(([ \t]*/\\*[^\n]*\\*/\n)?"
2027 "([ \t]*#[ \t]*if[^\n]*\n)?"
2028 "[ \t]*#[ \t]*define __f(16|32|64|128)x?\\()";
2030 c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
2032 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
2033 /* The literal suffix f128 exists only since GCC 7.0. */
2034 # define __f128(x) x##l
2036 # define __f128(x) x##f128
2038 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
2039 /* The literal suffix (f128) exist for powerpc only since GCC 7.0. */
2040 # if __LDBL_MANT_DIG__ == 113
2041 # define __f128(x) x##l
2043 # define __f128(x) x##q
2046 # define __f128(x) x##f128
2048 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
2049 # ifdef __NO_LONG_DOUBLE_MATH
2050 # define __f64(x) x##l
2055 # define __f64(x) x##f64
2061 hackname = glibc_cxx_floatn_2;
2062 files = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h";
2063 select = "^([ \t]*#[ \t]*(el)?if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
2064 "(([ \t]*/\\*[^\n]*\\*/\n)?"
2065 "[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)";
2067 c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%3";
2069 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
2070 typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
2072 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
2073 typedef __float128 _Float128;
2076 # elif !__GNUC_PREREQ (7, 0) || defined __cplusplus
2077 typedef __float128 _Float128;
2083 hackname = glibc_cxx_floatn_3;
2084 files = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h";
2085 select = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
2086 "(([ \t]*/\\*[^\n]*\n?[^\n]*\\*/\n)?"
2087 "([ \t]*#[ \t]*if[^\n]*\n)?"
2088 "([ \t]*typedef[ \t]+[^\n]*;\n)?"
2089 "[ \t]*#[ \t]*define __CFLOAT(16|32|64|128)X?[ \t]+)";
2091 c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
2093 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
2094 # define __CFLOAT128 _Complex long double
2096 # define __CFLOAT128 _Complex _Float128
2098 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
2099 /* Add a typedef for older GCC compilers which don't natively support
2100 _Complex _Float128.
*/
2101 typedef _Complex float __cfloat128
__attribute__ ((__mode__ (__TC__
)));
2102 # define __CFLOAT128 __cfloat128
2104 # define __CFLOAT128 _Complex _Float128
2106 # if
!__GNUC_PREREQ (7, 0) || defined __cplusplus
2107 # ifdef __NO_LONG_DOUBLE_MATH
2108 # define __CFLOAT64 _Complex long double
2110 # define __CFLOAT64 _Complex double
2113 # define __CFLOAT64 _Complex _Float64
2119 hackname
= glibc_cxx_floatn_4
;
2120 files
= bits
/floatn.h
, "*/bits/floatn.h";
2121 select
= "^([ \t]*#[ \t]*if __LDBL_MANT_DIG__ == 113 && )defined __cplusplus\n"
2122 "(([ \t]*/\\*[^\n]*\\*/\n)?"
2123 "[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float128;)";
2125 c_fix_arg
= "%1defined __cplusplus && !__GNUC_PREREQ (13, 0)\n%2";
2127 # if __LDBL_MANT_DIG__
== 113 && defined __cplusplus
2128 typedef long double _Float128
;
2129 # define __CFLOAT128 _Complex long double
2135 hackname
= glibc_cxx_floatn_5
;
2136 files
= bits
/floatn.h
, bits
/floatn
-common.h
, "*/bits/floatn.h", "*/bits/floatn-common.h";
2137 select
= "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
2138 "([ \t]*#[ \t]+error \"_Float128[xX] supported but no )";
2140 c_fix_arg
= "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
2142 # if
!__GNUC_PREREQ (7, 0) || defined __cplusplus
2143 # error
"_Float128X supported but no constant suffix"
2145 # if
!__GNUC_PREREQ (7, 0) || defined __cplusplus
2146 # error
"_Float128x supported but no type"
2151 /* glibc
-2.3.5 defines pthread mutex initializers incorrectly
,
2152 * so we replace them with versions that correspond to the
2156 hackname
= glibc_mutex_init
;
2158 select
= '\{ *\{ *0, *\} *\}';
2159 sed
= "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
2160 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
2161 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
2162 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
2163 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
2164 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
2165 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
2166 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
2167 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
2168 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
2169 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
2170 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
2171 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
2172 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
2173 sed
= "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
2174 "N;s/^[ \t]*#[ \t]*"
2175 "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
2176 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
2178 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
2181 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
2183 sed
= "s/{ \\(0, 0, 0, 0, 0, 0, "
2184 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
2185 sed
= "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
2186 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
2188 test_text
= <<- _EOText_
2189 #define PTHREAD_MUTEX_INITIALIZER
\\
2192 # if __WORDSIZE
== 64
2193 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
2194 { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
2195 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
2196 { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
2197 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
2198 { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
2200 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
2201 { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
2202 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
2203 { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
2204 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
2205 { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
2208 # define PTHREAD_RWLOCK_INITIALIZER
\\
2211 # if __WORDSIZE
== 64
2212 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
2213 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\
2214 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
2216 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
2217 { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
2220 #define PTHREAD_COND_INITIALIZER
{ { 0, } }
2224 /* glibc versions before
2.5 have a version of stdint.h that defines
2225 UINT8_C and UINT16_C to produce unsigned constants
, as do uClibc
2226 versions with stdint.h based on those glibc versions.
*/
2228 hackname
= glibc_stdint
;
2230 select
= "GNU C Library";
2232 c_fix_arg
= "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
2233 c_fix_arg
= "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
2234 test_text
= "/* This file is part of the GNU C Library. */\n"
2235 "# define UINT8_C(c)\tc ## U\n"
2236 "# define UINT16_C(c)\tc ## U";
2239 /* Some versions of glibc have a version of bits
/string2.h that
2240 produces
"value computed is not used" warnings from strncpy
; fix
2241 this definition by using __builtin_strncpy instead as in newer
2244 hackname
= glibc_strncpy
;
2245 files
= bits
/string2.h
, '*/bits/string2.h';
2246 bypass
= "__builtin_strncpy";
2248 c_fix_arg
= "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
2249 c_fix_arg
= "# define strncpy([^\n]*\\\\\n)*[^\n]*";
2251 # define
strncpy(dest
, src
, n
) \
2252 (__extension__ (__builtin_constant_p (src
) && __builtin_constant_p (n
) \\
2253 ?
(strlen (src
) + 1 >= ((size_t
) (n
)) \\
2254 ?
(char *)
memcpy (dest
, src
, n
) \\
2255 : strncpy (dest
, src
, n
)) \\
2256 : strncpy (dest
, src
, n
)))
2261 /* glibc
's tgmath.h relies on an expression that is not an integer
2262 constant expression being treated as it was by GCC 4.4 and
2265 hackname = glibc_tgmath;
2267 select = '\
(\
(\
(type\
) 0.25\
) && \
(\
(type\
) 0.25 - 1\
)\
)';
2268 bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
2270 c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || "
2271 "(__builtin_classify_type ((type) 0) == 9 && "
2272 "__builtin_classify_type (__real__ ((type) 0)) == 8))";
2273 test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
2277 * Fix these files to use the types we think they should for
2278 * ptrdiff_t, size_t, and wchar_t.
2280 * This defines the types in terms of macros predefined by our 'cpp
'.
2281 * This is supposedly necessary for glibc's handling of these types.
2282 * It
's probably not necessary for anyone else, but it doesn't hurt.
2285 hackname
= gnu_types
;
2286 files
= "sys/types.h";
2288 files
= "sys/stdtypes.h";
2292 bypass
= '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
2293 select
= "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
2295 /* The Solaris
10 headers already define these types correctly.
*/
2296 mach
= '*-*-solaris2.1[0-9]*';
2299 test_text
= "typedef long int ptrdiff_t; /* long int */\n"
2300 "typedef uint_t size_t; /* uint_t */\n"
2301 "typedef ushort_t wchar_t; /* ushort_t */";
2305 * Fix HP
& Sony
's use of "../machine/xxx.h"
2306 * to refer to: <machine/xxx.h>
2309 hackname = hp_inline;
2310 files = sys/spinlock.h;
2311 files = machine/machparam.h;
2312 select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
2315 c_fix_arg = "%1<machine
/%2.h
>";
2317 c_fix_arg = "([ \t]*#
[ \t]*include
[ \t]+)" '"\.\.
/machine
/'
2320 test_text = ' # include "..
/machine
/mumble.h
"';
2324 * Check for (...) in C++ code in HP/UX sys/file.h.
2327 hackname = hp_sysfile;
2329 select = "HPUX_SOURCE
";
2332 c_fix_arg = "(struct file
*, ...
)";
2333 c_fix_arg = '\(\.\.\.\)';
2335 test_text = "extern void
foo(...
); /* HPUX_SOURCE
- bad varargs
*/";
2339 * Un-Hide a series of five FP defines from post-1999 compliance GCC:
2340 * FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
2343 hackname = hppa_hpux_fp_macros;
2344 mach = "hppa
*-hp
-hpux11
*";
2346 select = "#
[ \t]*define
[ \t]*FP_NORMAL.
*\n"
2347 "#
[ \t]*define
[ \t]*FP_ZERO.
*\n"
2348 "#
[ \t]*define
[ \t]*FP_INFINITE.
*\n"
2349 "#
[ \t]*define
[ \t]*FP_SUBNORMAL.
*\n"
2350 "#
[ \t]*define
[ \t]*FP_NAN.
*\n";
2352 c_fix_arg = <<- _EOFix_
2353 #endif /* _INCLUDE_HPUX_SOURCE */
2355 #if defined(_INCLUDE_HPUX_SOURCE) || \
2356 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
2359 #ifdef _INCLUDE_HPUX_SOURCE
2364 "# define FP_NORMAL
0\n"
2365 "# define FP_ZERO
1\n"
2366 "# define FP_INFINITE
2\n"
2367 "# define FP_SUBNORMAL
3\n"
2368 "# define FP_NAN
4\n";
2372 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
2373 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
2376 hackname = hpux10_cpp_pow_inline;
2377 files = fixinc-test-limits.h, math.h;
2378 select = <<- END_POW_INLINE
2379 ^# +ifdef +__cplusplus
2381 +inline +double +pow\(double +__d,int +__expon\) +\{
2382 [ ]+return +pow\(__d,\(double\)__expon\);
2393 "# ifdef __cplusplus
\n"
2395 " inline double
pow(double __d
,int __expon
) {\n"
2396 "\t return
pow(__d
,(double
)__expon
);\n"
2398 ' extern "C
"' " {\n"
2404 hackname = hpux11_cpp_pow_inline;
2406 select = " +inline double pow
\\(double d
,int expon
\\) \\{\n"
2407 " +return pow
\\(d
, \\(double
\\)expon
\\);\n"
2413 " inline double
pow(double d
,int expon
) {\n"
2414 " return
pow(d
, (double
)expon
);\n"
2419 * This hack fixes the declarations of _DINFINITY, _SINFINITY and _SQNAN.
2422 hackname = hpux_math_constexpr;
2423 mach = "*-hp
-hpux11
*";
2425 sed = "s@^
[ \t]*extern
[ \t]*const
[ \t]*double
[ \t]*_DINFINITY
;"
2426 "[ \t]*$@# define
_DINFINITY (__builtin_inf ())@
";
2427 sed = "s@^
[ \t]*extern
[ \t]*const
[ \t]*float
[ \t]*_SINFINITY
;"
2428 "[ \t]*$@# define
_SINFINITY (__builtin_inff ())@
";
2429 sed = "s@^
[ \t]*extern
[ \t]*const
[ \t]*float
[ \t]*_SQNAN
;"
2430 "[ \t]*$@# define
_SQNAN (__builtin_nanf (\\\"\\\"))@
";
2431 test_text = " extern const double _DINFINITY
;\n"
2432 " extern const float _SINFINITY
;\n"
2433 " extern const float _SQNAN
;";
2437 * Fix hpux 10.X missing ctype declarations 1
2440 hackname = hpux10_ctype_declarations1;
2442 select = "^#
[ \t]*define _toupper
\\(__c
\\)[ \t]*__toupper
\\(__c
\\)";
2443 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*__tolower
[ \t]*\\(";
2445 c_fix_arg = "#ifdef _PROTOTYPES
\n"
2446 "extern int
__tolower(int
);\n"
2447 "extern int
__toupper(int
);\n"
2448 "#else
/* NOT _PROTOTYPES
*/\n"
2449 "extern int
__tolower();\n"
2450 "extern int
__toupper();\n"
2451 "#endif
/* _PROTOTYPES
*/\n\n"
2454 test_text = "# define
_toupper(__c
) __toupper(__c
)\n";
2458 * Fix hpux 10.X missing ctype declarations 2
2461 hackname = hpux10_ctype_declarations2;
2463 select = "^# if defined
\\(_SB_CTYPE_MACROS
\\) && \\!defined
\\(__lint
\\)";
2464 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*_isalnum
[ \t]*\\(";
2466 c_fix_arg = "%0\n\n"
2467 "#ifdef _PROTOTYPES
\n"
2468 " extern int
_isalnum(int
);\n"
2469 " extern int
_isalpha(int
);\n"
2470 " extern int
_iscntrl(int
);\n"
2471 " extern int
_isdigit(int
);\n"
2472 " extern int
_isgraph(int
);\n"
2473 " extern int
_islower(int
);\n"
2474 " extern int
_isprint(int
);\n"
2475 " extern int
_ispunct(int
);\n"
2476 " extern int
_isspace(int
);\n"
2477 " extern int
_isupper(int
);\n"
2478 " extern int
_isxdigit(int
);\n"
2479 "# else
/* not _PROTOTYPES
*/\n"
2480 " extern int
_isalnum();\n"
2481 " extern int
_isalpha();\n"
2482 " extern int
_iscntrl();\n"
2483 " extern int
_isdigit();\n"
2484 " extern int
_isgraph();\n"
2485 " extern int
_islower();\n"
2486 " extern int
_isprint();\n"
2487 " extern int
_ispunct();\n"
2488 " extern int
_isspace();\n"
2489 " extern int
_isupper();\n"
2490 " extern int
_isxdigit();\n"
2491 "#endif
/* _PROTOTYPES
*/\n";
2493 test_text = "# if
defined(_SB_CTYPE_MACROS
) && !defined(__lint
)\n"
2494 " extern unsigned int
*__SB_masks
;\n";
2498 * Fix hpux 10.X missing stdio declarations
2501 hackname = hpux10_stdio_declarations;
2503 select = "^#
[ \t]*define _iob
[ \t]*__iob
";
2504 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*vsnprintf
[ \t]*\\(";
2506 c_fix_arg = "%0\n\n"
2507 "# if
defined(__STDC__
) ||
defined(__cplusplus
)\n"
2508 " extern int
snprintf(char
*, size_t
, const char
*, ...
);\n"
2509 " extern int
vsnprintf(char
*, size_t
, const char
*, __va_list
);\n"
2510 "# else
/* not __STDC__
) || __cplusplus
*/\n"
2511 " extern int
snprintf();\n"
2512 " extern int
vsnprintf();\n"
2513 "# endif
/* __STDC__
) || __cplusplus
*/\n";
2515 test_text = "# define _iob __iob
\n";
2519 * The HP-UX stddef.h is replaced by gcc's. It doesn't include sys/stdsyms.h.
2520 * As a result, we need to include sys/stdsyms.h in alloca.h.
2523 hackname = hppa_hpux11_alloca;
2524 mach = "hppa
*-*-hpux11
*";
2526 select = "#ifndef _STDDEF_INCLUDED
";
2528 c_fix_arg = "#ifndef _SYS_STDSYMS_INCLUDED
\n"
2529 "# include
<sys
/stdsyms.h
>\n"
2530 "#endif
/* _SYS_STDSYMS_INCLUDED
*/\n\n"
2533 test_text = "#ifndef _STDDEF_INCLUDED
";
2537 * Make sure hpux defines abs in header.
2540 hackname = hpux11_abs;
2541 mach = "*-hp
-hpux11
*";
2543 select = "ifndef _MATH_INCLUDED
";
2545 c_fix_arg = "if
!defined(_MATH_INCLUDED
) ||
defined(__GNUG__
)";
2546 test_text = "#ifndef _MATH_INCLUDED
";
2550 * Fix hpux11 __LWP_RWLOCK_VALID define
2553 hackname = hpux11_lwp_rwlock_valid;
2554 mach = "*-hp
-hpux11
*";
2555 files = sys/pthread.h;
2556 select = "#define __LWP_RWLOCK_VALID
[ \t]*0x8c91";
2558 c_fix_arg = "#define __LWP_RWLOCK_VALID
-29551";
2559 test_text = "#define __LWP_RWLOCK_VALID
0x8c91";
2566 hackname = hpux11_extern_sendfile;
2567 mach = "*-hp
-hpux11.
[12]*";
2568 files = sys/socket.h;
2569 select = "^
[ \t]*extern sbsize_t sendfile.
*\n.
*, int
\\)\\);\n";
2571 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2572 test_text = " extern sbsize_t sendfile
__((int
, int
, off_t
, bsize_t
,\n"
2573 " const struct iovec
*, int
));\n";
2580 hackname = hpux11_extern_sendpath;
2581 mach = "*-hp
-hpux11.
[12]*";
2582 files = sys/socket.h;
2583 select = "^
[ \t]*extern sbsize_t sendpath.
*\n.
*, int
\\)\\);\n";
2585 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2586 test_text = " extern sbsize_t sendpath
__((int
, int
, off_t
, bsize_t
,\n"
2587 " const struct iovec
*, int
));\n";
2591 * Keep HP-UX 11 from stomping on C++ math namespace
2592 * with defines for fabsf.
2595 hackname = hpux11_fabsf;
2596 mach = "*-hp
-hpux11
*";
2598 select = "^
[ \t]*#
[ \t]*define
[ \t]+fabsf
\\(.
*";
2601 c_fix_arg = "#ifndef __cplusplus
\n%0\n#endif
";
2605 "# define
fabsf(x
) ((float
)fabs((double
)(float
)(x
)))\n"
2610 * The definitions for PTHREAD_MUTEX_INITIALIZER and similar initializers
2611 * in pthread.h need to be constant expressions to be standard complient.
2612 * As a result, we need to remove the void * casts in the initializers
2613 * (see hpux11_pthread_const) and to change the __(M|C|RW)POINTER defines
2614 * to use the long type.
2617 hackname = hpux11_pthread_pointer;
2618 mach = "*-hp
-hpux11.
[0-3]*";
2619 files = sys/pthread.h;
2620 select = "(void
[ \t]*\\*)
(m|c|rw
)(_ptr
)";
2623 c_fix_arg = "long
\t%2%3";
2624 test_text = "#define __MPOINTER
\t\tvoid
\t *m_ptr
";
2628 * Remove void pointer cast and fix C99 constant in __POINTER_SET defines.
2631 hackname = hpux11_pthread_const;
2632 mach = "*-hp
-hpux11.
[0-3]*";
2633 files = sys/pthread.h;
2634 select = "^
(#define
[ \t]+__POINTER_SET
[ \t0,]*)
(.
*\\))";
2638 test_text = "#define __POINTER_SET
\t\t((void *)
1LL)";
2642 * Prevent HP-UX 11 from defining __size_t and preventing size_t from
2643 * being defined by having it define _hpux_size_t instead.
2646 hackname = hpux11_size_t;
2647 mach = "*-hp
-hpux11
*";
2648 select = "__size_t
";
2651 c_fix_arg = "_hpux_size_t
";
2654 "#define __size_t size_t
\n"
2655 " extern int
getpwuid_r( char
*, __size_t
, struct passwd
**)
;\n";
2659 * Fix hpux 11.00 broken snprintf declaration
2660 * (third argument is char *, needs to be const char * to prevent
2661 * spurious warnings with -Wwrite-strings or in C++).
2664 hackname = hpux11_snprintf;
2666 select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
2667 ' *(char *\*, *\.\.\.\);)';
2669 c_fix_arg = '%1 const %3';
2671 test_text = "extern int
snprintf(char
*, size_t
, char
*, ...
);\n"
2672 "extern int
snprintf(char
*, __size_t
, char
*, ...
);\n"
2673 "extern int
snprintf(char
*, _hpux_size_t
, char
*, ...
);";
2677 * Fix hpux 11.00 broken vsnprintf declaration
2680 hackname = hpux11_vsnprintf;
2682 select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
2683 'const char \*,) __va__list\);';
2685 c_fix_arg = "%1 __va_list
);";
2687 test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
2692 * Fix missing const in hpux vsscanf declaration
2695 hackname = hpux_vsscanf;
2698 select = '(extern int vsscanf\()char';
2700 c_fix_arg = "%1const char
";
2702 test_text = 'extern int vsscanf(char *, const char *, __va_list);';
2706 * get rid of bogus inline definitions in HP-UX 8.0
2709 hackname = hpux8_bogus_inlines;
2712 bypass = "__GNUG__
";
2713 sed = "s@inline int
abs(int
[a
-z
][a
-z
]*)
{.
*}"
2714 "@extern
\"C
\" int
abs(int
);@
";
2715 sed = "s@inline double
abs(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2716 sed = "s@inline int
sqr(int
[a
-z
][a
-z
]*)
{.
*}@@
";
2717 sed = "s@inline double
sqr(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2718 test_text = "inline int
abs(int v
) { return (v
>=0)?v
:-v
; }\n"
2719 "inline double
sqr(double v
) { return v
**0.5; }";
2726 hackname = hpux_c99_intptr;
2727 mach = "*-hp
-hpux11.3
*";
2728 files = stdint-hpux11.h, stdint.h;
2729 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MAX
[ \t]*"
2730 "INT32_MAX
[ \t]*$@#define
PTRDIFF_MAX (2147483647l)@
";
2731 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MIN
[ \t]*"
2732 "INT32_MIN
[ \t]*$@#define
PTRDIFF_MIN (-PTRDIFF_MAX
- 1)@
";
2733 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MAX
[ \t]*"
2734 "INT32_MAX
[ \t]*$@#define
INTPTR_MAX (2147483647l)@
";
2735 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MIN
[ \t]*"
2736 "INT32_MIN
[ \t]*$@#define
INTPTR_MIN (-INTPTR_MAX
- 1)@
";
2737 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINTPTR_MAX
[ \t]*"
2738 "UINT32_MAX
[ \t]*$@#define
UINTPTR_MAX (4294967295ul)@
";
2739 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*SIZE_MAX
[ \t]*"
2740 "UINT32_MAX
[ \t]*$@#define
SIZE_MAX (4294967295ul)@
";
2741 test_text = "#define PTRDIFF_MAX INT32_MAX
\n"
2742 "#define PTRDIFF_MIN INT32_MIN
\n"
2743 "#define INTPTR_MAX INT32_MAX
\n"
2744 "#define INTPTR_MIN INT32_MIN
\n"
2745 "#define UINTPTR_MAX UINT32_MAX
\n"
2746 "#define SIZE_MAX UINT32_MAX
\n";
2750 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2753 hackname = hpux_c99_inttypes;
2754 mach = "*-hp
-hpux11.
[23]*";
2756 files = stdint-hpux11.h, stdint.h;
2757 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*"
2758 "__CONCAT_U__(__c
)[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2759 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*"
2760 "__CONCAT_U__(__c
)[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2761 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT32_C(__c
)[ \t]*"
2762 "__CONCAT__(__c
,l
)[ \t]*$@#define
INT32_C(__c
) (__c
)@
";
2763 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT32_C(__c
)[ \t].
*$@
"
2764 "#define
UINT32_C(__c
) __CONCAT__(__c
,u
)@
";
2765 test_text = "#define
UINT8_C(__c
) __CONCAT_U__(__c
)\n"
2766 "#define
UINT16_C(__c
) __CONCAT_U__(__c
)\n"
2767 "#define
INT32_C(__c
) __CONCAT__(__c
,l
)\n"
2768 "#define
UINT32_C(__c
) __CONCAT__(__c
,ul
)\n";
2772 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2775 hackname = hpux_c99_inttypes2;
2776 mach = "*-hp
-hpux11.2
*";
2777 files = stdint-hpux11.h, stdint.h;
2778 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT8_C(__c
)[ \t]*"
2779 "((signed char
)(__c
))[ \t]*$@#define
INT8_C(__c
) (__c
)@
";
2780 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*"
2781 "((unsigned char
)(__c
))[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2782 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT16_C(__c
)[ \t]*"
2783 "((short
)(__c
))[ \t]*$@#define
INT16_C(__c
) (__c
)@
";
2784 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*"
2785 "((unsigned short
)(__c
))[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2786 test_text = "# define
INT8_C(__c
) ((signed char
)(__c
))\n"
2787 "# define
UINT8_C(__c
) ((unsigned char
)(__c
))\n"
2788 "# define
INT16_C(__c
) ((short
)(__c
))\n"
2789 "# define
UINT16_C(__c
) ((unsigned short
)(__c
))\n";
2793 * Fix broken and missing defines in inttypes.h
2796 hackname = hpux_c99_inttypes3;
2797 mach = "hppa
*-hp
-hpux11
*";
2799 select = "#define
[ \t]INTPTR_MAX
[ \t]*\n"
2800 "#define
[ \t]UINTPTR_MAX
[ \t]*\n";
2802 c_fix_arg = "#undef SIZE_MAX
\n"
2803 "#define SIZE_MAX __SIZE_MAX__
\n"
2804 "#ifdef __INTPTR_MAX__
\n"
2805 "# undef INTPTR_MAX
\n"
2806 "# define INTPTR_MAX __INTPTR_MAX__
\n"
2807 "# undef INTPTR_MIN
\n"
2808 "# define
INTPTR_MIN (-INTPTR_MAX
- 1)\n"
2810 "#ifdef __UINTPTR_MAX__
\n"
2811 "# undef UINTPTR_MAX
\n"
2812 "# define UINTPTR_MAX __UINTPTR_MAX__
\n"
2814 test_text = "#define INTPTR_MAX
\n"
2815 "#define UINTPTR_MAX
\n";
2819 * Fix missing SCNuMAX defines in inttypes.h
2822 hackname = hpux_c99_inttypes4;
2823 mach = "hppa
*-hp
-hpux11.
[01]*";
2825 sed = "/^
[ \t]*#
[ \t]*define
[ \t]*SCNxMAX
[ \t]*SCNx64
/a
\\\n"
2826 "#define SCNuMAX
\t SCNu64
\n";
2827 sed = "/^
[ \t]*#
[ \t]*define
[ \t]*SCNxMAX
[ \t]*SCNx32
/a
\\\n"
2828 "#define SCNuMAX
\t SCNu32
\n";
2829 test_text = "#define SCNxMAX SCNx64
\n"
2830 "#define SCNxMAX SCNx32
\n";
2834 * Fix missing PRIdPTR defines in inttypes.h
2837 hackname = hpux_c99_inttypes5;
2838 mach = "hppa
*-hp
-hpux11.
[01]*";
2840 select = "#ifndef
[ \t]_KERNEL
[ \t]*\n";
2842 c_fix_arg = "#ifndef __LP64__
\n"
2843 "#define PRIdPTR
\t\tPRId
32\n"
2844 "#define PRIiPTR
\t\tPRIi
32\n"
2845 "#define PRIoPTR
\t\tPRIo
32\n"
2846 "#define PRIuPTR
\t\tPRIu
32\n"
2847 "#define PRIxPTR
\t\tPRIx
32\n"
2848 "#define PRIXPTR
\t\tPRIX
32\n"
2850 "#define PRIdPTR
\t\tPRId
64\n"
2851 "#define PRIiPTR
\t\tPRIi
64\n"
2852 "#define PRIoPTR
\t\tPRIo
64\n"
2853 "#define PRIuPTR
\t\tPRIu
64\n"
2854 "#define PRIxPTR
\t\tPRIx
64\n"
2855 "#define PRIXPTR
\t\tPRIX
64\n"
2857 "#ifndef _KERNEL
\n";
2858 test_text = "#ifndef _KERNEL
\n";
2862 * Fix hpux broken ctype macros
2865 hackname = hpux_ctype_macros;
2867 select = '((: |\()__SB_masks \? )'
2868 '(__SB_masks\[__(alnum|c)\] & _IS)';
2870 c_fix_arg = "%1(int
)%3";
2872 test_text = ": __SB_masks ? __SB_masks
[__alnum
] & _ISCNTRL
\n"
2873 "# define
isalpha(__c
) (__SB_masks ? __SB_masks
[__c
] & _IS
\n";
2880 hackname = hpux_extern_errno;
2881 mach = "*-hp
-hpux10.
*";
2882 mach = "*-hp
-hpux11.
[0-2]*";
2884 select = "^
[ \t]*extern int errno
;$
";
2886 c_fix_arg = "#ifdef __cplusplus
\n"
2890 "#ifdef __cplusplus
\n"
2893 test_text = " extern int errno
;\n";
2897 * Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
2900 hackname = hpux_htonl;
2901 files = netinet/in.h;
2902 select = "#ifndef _XOPEN_SOURCE_EXTENDED
[ \t]*\n"
2904 " \\* Macros for number representation conversion
\\.
\n"
2908 c_fix_arg = "#if
1\n%1";
2910 test_text = "#ifndef _XOPEN_SOURCE_EXTENDED
\n"
2912 " * Macros for number representation conversion.
\n"
2915 "#define
ntohl(x
) (x
)\n"
2916 "#define
ntohs(x
) (x
)\n"
2917 "#define
htonl(x
) (x
)\n"
2918 "#define
htons(x
) (x
)\n"
2920 "#endif
/* ! _XOPEN_SOURCE_EXTENDED
*/";
2924 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2927 hackname = hpux_imaginary_i;
2928 mach = "ia64
-hp
-hpux11.
*";
2930 select = "^
[ \t]*#
[ \t]*define
[ \t]*_Complex_I.
*";
2932 c_fix_arg = "#define
_Complex_I (__extension__
1.0iF
)";
2933 test_text = "#define
_Complex_I (0.f
+_Imaginary_I
)\n";
2937 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2940 hackname = hpux_inttype_int8_t;
2941 mach = "*-hp
-hpux1
[01].
*";
2942 files = sys/_inttypes.h;
2943 select = "^
[ \t]*typedef
[ \t]*char
[ \t]*int(_least
){0,1}8_t.
*";
2945 c_fix_arg = "typedef signed char int
%18_t
;";
2946 test_text = "typedef char int_least8_t
;\n"
2947 "typedef char int8_t
;\n";
2954 hackname = hpux_long_double;
2955 mach = "*-*-hpux10
*";
2956 mach = "*-*-hpux11.
[012]*";
2958 select = "extern
[ \t]long_double
[ \t]strtold
";
2959 bypass = "long_double_t
";
2960 sed = "/^#
[ \t]*ifndef _LONG_DOUBLE
/,/\\/\\* _LONG_DOUBLE
\\*\\//D
";
2961 sed = "s
/long_double
/long double
/g
";
2963 test_text = "# ifndef _LONG_DOUBLE
\n"
2964 "# define _LONG_DOUBLE
\n"
2965 " typedef struct
{\n"
2966 " unsigned int word1
, word2
, word3
, word4
;\n"
2968 "# endif
/* _LONG_DOUBLE
*/\n"
2969 "extern long_double
strtold(const char
*, char
**)
;\n";
2973 * We cannot use the above rule on 11.31 because it removes the strtold
2974 * definition. ia64 is OK with no hack, PA needs some help.
2977 hackname = hpux_long_double_2;
2978 mach = "hppa
*-*-hpux11.3
*";
2980 select = "#
[ \t]*if
[ \t]*!defined
\\(__ia64
\\) \\|
\\|
"
2981 "defined
\\(_PROTOTYPES
\\) \\|
\\|
"
2982 "defined
\\(_LONG_DOUBLE_STRUCT
\\)";
2984 c_fix_arg = "# if
!defined(_PROTOTYPES
) ||
defined(_LONG_DOUBLE_STRUCT
)";
2986 test_text = "# if
!defined(__ia64
) ||
"
2987 "!defined(_PROTOTYPES
) ||
"
2988 "defined(_LONG_DOUBLE_STRUCT
)\n";
2992 * Add missing braces to pthread initializer defines.
2995 hackname = hpux_pthread_initializers;
2996 mach = "*-hp
-hpux11.
[0-3]*";
2997 files = sys/pthread.h;
2998 sed = "s@^
[ \t]*1, 1, 1, 1,[ \t]*\\\\"
2999 "@
\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@
";
3000 sed = "s@^
[ \t]*1,[ \t]*\\\\"
3002 sed = "/^
[ \t]*0$
/d
";
3003 sed = "s@__PTHREAD_MUTEX_VALID
, 0"
3004 "@
{ __PTHREAD_MUTEX_VALID
, 0 }@
";
3005 sed = "s@^
[ \t]*0, 0, -1, 0,[ \t]*\\\\"
3006 "@
\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@
";
3007 sed = "s@
0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
3008 "@
{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
3009 sed = "s@^
[ \t]*__LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
3010 "@
\t{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
3011 sed = "s@^
[ \t]*0, 0[ \t]*\\\\"
3012 "@
\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@
";
3013 sed = "s@__PTHREAD_COND_VALID
, 0"
3014 "@
{ __PTHREAD_COND_VALID
, 0 }@
";
3015 sed = "s@__LWP_COND_VALID
, 0,[ \t]*\\\\"
3016 "@
{ __LWP_COND_VALID
, 0 },\t\t\t\t\t\\\\@
";
3017 sed = "s@__PTHREAD_RWLOCK_VALID
, 0"
3018 "@
{ __PTHREAD_RWLOCK_VALID
, 0 }@
";
3019 sed = "s@__LWP_RWLOCK_VALID
, 0,[ \t]*\\\\"
3020 "@
{ __LWP_RWLOCK_VALID
, 0 },\t\t\t\t\t\\\\@
";
3021 sed = "s@^
[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
3022 "@
\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@
";
3023 test_text = "#define PTHREAD_MUTEX_INITIALIZER
{\t\t\t\t\t\\\\\n"
3024 "\t__PTHREAD_MUTEX_VALID
, 0,\t\t\t\t\t\\\\\n"
3025 "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE
),\t\t\\\\\n"
3026 "\t__SPNLCK_INITIALIZER
,\t\t\t\t\t\t\\\\\n"
3027 "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
3028 "\t0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
3029 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
3034 * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
3035 * type and mpinfou is only defined when _KERNEL is set.
3038 hackname = hpux_spu_info;
3039 mach = "*-hp
-hpux
*";
3041 * It is tempting to omit the first "files
" entry. Do not.
3042 * The testing machinery will take the first "files
" entry as the name
3043 * of a test file to play with. It would be a nuisance to have a directory
3044 * with the name "*".
3046 files = "ia64
/sys
/getppdp.h
";
3047 files = "*/sys
/getppdp.h
";
3048 select = "^.
*extern.
*spu_info.
*";
3051 c_fix_arg = "#ifdef _KERNEL
\n%0\n#endif
";
3053 test_text = "extern union mpinfou spu_info
[];";
3057 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
3060 hackname = hpux_stdint_least_fast;
3061 mach = "*-hp
-hpux11.2
*";
3062 files = stdint-hpux11.h, stdint.h;
3064 "^
[ \t]*#
[ \t]*define
[ \t]+UINT_(LEAST|FAST
)64_MAX
[ \t]+ULLONG_MAX
";
3066 c-fix-arg = "# define UINT_
%164_MAX __UINT64_MAX__
";
3067 test-text = "# define UINT_FAST64_MAX ULLONG_MAX
\n"
3068 "# define UINT_LEAST64_MAX ULLONG_MAX
\n";
3072 * Add noreturn attribute to longjmp declarations in hpux <setjmp.h>
3075 hackname = hpux_longjmp;
3076 mach = "*-hp
-hpux
*";
3078 select = "^
[ \t]*extern
[ \t]+void
[ \t]+.
*longjmp
[ \t]*\
(__
\\(\\(.
*int
\\)\\)|
\\(.
*int
\\)|
\\(\\)\
)";
3081 c_fix_arg = "%0 __attribute__ ((__noreturn__
))";
3083 test_text = 'extern void longjmp __((jmp_buf, int));';
3087 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
3090 hackname = hpux_systime;
3092 select = "^extern struct sigevent
;";
3095 c_fix_arg = "struct sigevent
;";
3097 test_text = 'extern struct sigevent;';
3101 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
3104 hackname = huge_val_hex;
3105 files = bits/huge_val.h, '*/bits/huge_val.h';
3106 select = "^#
[ \t]*define
[ \t]*HUGE_VAL
[ \t].
*0x1\\.0p.
*";
3107 bypass = "__builtin_huge_val
";
3110 c_fix_arg = "#define
HUGE_VAL (__builtin_huge_val())\n";
3112 test_text = "# define HUGE_VAL
\t(__extension__
0x1.0p2047
)";
3116 * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
3119 hackname = huge_valf_hex;
3120 files = bits/huge_val.h, '*/bits/huge_val.h';
3121 select = "^#
[ \t]*define
[ \t]*HUGE_VALF
[ \t].
*0x1\\.0p.
*";
3122 bypass = "__builtin_huge_valf
";
3125 c_fix_arg = "#define
HUGE_VALF (__builtin_huge_valf())\n";
3127 test_text = "# define
HUGE_VALF (__extension__
0x1.0p255f
)";
3131 * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
3134 hackname = huge_vall_hex;
3135 files = bits/huge_val.h, '*/bits/huge_val.h';
3136 select = "^#
[ \t]*define
[ \t]*HUGE_VALL
[ \t].
*0x1\\.0p.
*";
3137 bypass = "__builtin_huge_vall
";
3140 c_fix_arg = "#define
HUGE_VALL (__builtin_huge_vall())\n";
3142 test_text = "# define
HUGE_VALL (__extension__
0x1.0p32767L
)";
3146 * Fix return type of abort and free
3149 hackname = int_abort_free_and_exit;
3151 select = "int
[ \t]+(abort|free|exit
)[ \t]*\\(";
3152 bypass = "_CLASSIC_ANSI_TYPES
";
3155 c_fix_arg = "void
\t%1(";
3157 test_text = "extern int
abort(int
);\n"
3158 "extern int
free(void*)
;\n"
3159 "extern int
exit(void*)
;";
3163 * Fix various macros used to define ioctl numbers.
3164 * The traditional syntax was:
3166 * #define _IO(n, x) (('n'<<8)+x)
3167 * #define TIOCFOO _IO(T, 1)
3169 * but this does not work with the C standard, which disallows macro
3170 * expansion inside strings. We have to rewrite it thus:
3172 * #define _IO(n, x) ((n<<8)+x)
3173 * #define TIOCFOO _IO('T', 1)
3175 * The select expressions match too much, but the c_fix code is cautious.
3177 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
3180 hackname = io_quotes_def;
3181 select = "define
[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*\\([a
-zA
-Z
][,)]";
3182 c_fix = char_macro_def;
3185 "#define
BSD43__IOWR(n
, x
) (('n'<<8)+x
)\n"
3186 "#define
_IOWN(x
,y
,t
) (_IOC_IN|
(((t
)&_IOCPARM_MASK
)<<16)|
('x'<<8)|y
)\n"
3187 "#define
_IO(x
,y
) ('x'<<8|y
)";
3189 "#define
XX_IO(x
) ('x'<<8|
256)";
3193 * Fix the usage of the ioctl macro numbers.
3196 hackname = io_quotes_use;
3197 select = "define
[ \t]+[A
-Z0
-9_
]+[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*[ \t]*"
3199 c_fix = char_macro_use;
3201 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
3202 "#define TIOCFOO \\\\\n"
3203 "BSD43__IOWR(T, 1) /* Some are multi-line */";
3207 * Check for missing ';' in struct
3210 hackname = ip_missing_semi;
3211 files = netinet/ip.h;
3213 sed = "/^struct/,/^};/s/}$/};/";
3219 "}; /* mumbled struct */\n";
3223 * Non-traditional "const" declaration in Irix's limits.h.
3226 hackname
= irix_limits_const
;
3227 files
= fixinc
-test
-limits.h
, limits.h
;
3228 select
= "^extern const ";
3230 c_fix_arg
= "extern __const ";
3231 test_text
= "extern const char limit; /* test limits */";
3235 * IRIX
5.x
's stdio.h declares some functions that take a va_list as
3236 * taking char *. However, GCC uses void * for va_list, so
3237 * calling vfprintf with a va_list fails in C++. */
3239 hackname = irix_stdio_va_list;
3242 select = '/\
* va_list \
*/ char \
*';
3244 c_fix_arg = "__gnuc_va_list";
3246 "extern int printf( const char *, /* va_list */ char * );";
3250 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
3251 * use / * * / to concatenate tokens.
3254 hackname = kandr_concat;
3255 files = "sparc/asm_linkage.h";
3256 files = "sun*/asm_linkage.h";
3257 files = "arm/as_support.h";
3258 files = "arm/mc_type.h";
3259 files = "arm/xcb.h";
3260 files = "dev/chardefmac.h";
3261 files = "dev/ps_irq.h";
3262 files = "dev/screen.h";
3263 files = "dev/scsi.h";
3264 files = "sys/tty.h";
3265 files = "Xm.acorn/XmP.h";
3266 files = bsd43/bsd43_.h;
3270 test_text = "#define __CONCAT__(a,b) a/**/b";
3274 * The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
3275 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
3276 * constant on recent versions of g
++.
3279 hackname
= linux_ia64_ucontext
;
3280 files
= "sys/ucontext.h";
3281 mach
= "ia64-*-linux*";
3282 select
= '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
3283 '->sc_gr\[0\]\) - \(char \*\) 0\)';
3285 c_fix_arg
= "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
3286 test_text
= "# define _SC_GR0_OFFSET\t\\\\\n"
3287 "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
3291 * Remove header file warning from sys
/time.h. Autoconf
's
3292 * AC_HEADER_TIME recommends to include both sys/time.h and time.h
3293 * which causes warning on LynxOS. Remove the warning.
3296 hackname = lynxos_no_warning_in_sys_time_h;
3298 select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
3301 test_text = "#warning Using <time.h> instead of <sys/time.h>";
3305 * Add missing declaration for putenv.
3308 hackname = lynxos_missing_putenv;
3309 mach = '*-*-lynxos
*';
3311 bypass = 'putenv
[ \t]*\\(';
3312 select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
3315 "extern int putenv _AP((char *));";
3316 c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
3317 test_text = "extern char *getenv _AP((const char *));";
3321 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
3323 * On NetBSD, machine is a symbolic link to an architecture specific
3324 * directory name, so we can't match a specific file name here.
3327 hackname
= machine_ansi_h_va_list
;
3328 select
= "define[ \t]+_BSD_VA_LIST_[ \t]";
3329 bypass
= '__builtin_va_list';
3332 c_fix_arg
= "%1__builtin_va_list";
3333 c_fix_arg
= "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
3335 test_text
= " # define _BSD_VA_LIST_\tchar**";
3339 * Fix non
-ansi machine name defines
3342 hackname
= machine_name
;
3343 c_test
= machine_name
;
3344 c_fix
= machine_name
;
3346 test_text
= "/* MACH_DIFF: */\n"
3347 "#if defined( i386 ) || defined( sparc ) || defined( vax ) || "
3348 "defined( linux ) || __has_include ( <linux.h> )"
3349 "\n/* no uniform test, so be careful :-) */";
3353 * Some math.h files define struct
exception (it
's in the System V
3354 * Interface Definition), which conflicts with the class exception defined
3355 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
3356 * This is not a great fix, but I haven't been able to think of anything
3360 hackname
= math_exception
;
3362 select
= "struct exception";
3364 * This should be bypassed on __cplusplus
, but some supposedly C
++
3365 * aware headers
, such as Solaris
8 and
9, don
't wrap their struct
3366 * exception either. So currently we bypass only for glibc, based on a
3367 * comment in the fixed glibc header. Ick.
3369 bypass = 'We have a problem when using C\
+\
+|for C\
+\
+, '
3370 '_
[a
-z0
-9A
-Z_
]+_exception
; for C
, exception
';
3371 /* The Solaris 10 headers already get this right. */
3372 mach = '*-*-solaris2.1
[0-9]*';
3376 c_fix_arg = "#ifdef __cplusplus\n"
3377 "#define exception __math_exception\n"
3380 c_fix_arg = "#ifdef __cplusplus\n"
3381 "#undef exception\n"
3384 test_text = "typedef struct exception t_math_exception;";
3388 * This looks pretty broken to me. ``dbl_max_def'' will contain
3389 * "define DBL_MAX " at the start, when what we really want is just
3390 * the value portion. Can't figure out how to write a test case
3391 * for this either
:-(
3394 hackname
= math_huge_val_from_dbl_max
;
3398 * IF HUGE_VAL is defined to be DBL_MAX
*and
* DBL_MAX is _not_ defined
3399 * in math.h
, this fix applies.
3401 select
= "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
3402 bypass
= "define[ \t]+DBL_MAX";
3406 * See if we have a definition for DBL_MAX in float.h.
3407 * If we do
, we will replace the one in math.h with that one.
3410 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
3411 "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
3413 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
3414 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
3415 "s@DBL_MAX@'\"$dbl_max_def@\"\n"
3420 "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
3421 "#define HUGE_VAL DBL_MAX";
3428 hackname
= nested_auth_des
;
3430 select
= '(/\*.*rpc/auth_des\.h>.*)/\*';
3432 c_fix_arg
= "%1*/ /*";
3433 test_text
= "/*#include <rpc/auth_des.h> /* skip this */";
3437 * Some versions of NetBSD don
't expect the C99 inline semantics.
3440 hackname = netbsd_c99_inline_1;
3441 mach = "*-*-netbsd*";
3443 select = "extern __inline int";
3446 c_fix_arg = "extern\n"
3447 "#ifdef __GNUC_STDC_INLINE__\n"
3448 "__attribute__((__gnu_inline__))\n"
3452 test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
3456 * netbsd_c99_inline_2
3459 hackname = netbsd_c99_inline_2;
3460 mach = "*-*-netbsd*";
3462 select = "#define _SIGINLINE extern __inline";
3465 c_fix_arg = <<- _EOArg_
3466 #ifdef __GNUC_STDC_INLINE__
3467 #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
3473 test_text = "#define _SIGINLINE extern __inline";
3477 * NetBSD has a semicolon after the ending '}' for some extern "C".
3480 hackname = netbsd_extra_semicolon;
3481 mach = "*-*-netbsd*";
3482 files = sys/cdefs.h;
3483 select = "#define[ \t]*__END_DECLS[ \t]*};";
3486 c_fix_arg = "#define __END_DECLS }";
3488 test_text = "#define __END_DECLS };";
3492 * newlib's stdint.h has several failures to conform to C99. The fix
3493 * for these removed a comment that can be matched to identify unfixed
3497 hackname
= newlib_stdint_1
;
3498 files
= stdint
-newlib.h
, stdint.h
;
3499 select
= "@todo - Add support for wint_t types";
3500 sed
= "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
3501 sed
= "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
3502 sed
= "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
3503 sed
= "s@#define INT_LEAST32_MIN.*@"
3504 "#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
3505 sed
= "s@#define INT_LEAST32_MAX.*@"
3506 "#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
3507 sed
= "s@#define UINT_LEAST32_MAX.*@"
3508 "#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
3509 sed
= 's@#define INT_FAST\([0-9]*\)_MIN.*@'
3510 '#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
3511 sed
= 's@#define INT_FAST\([0-9]*\)_MAX.*@'
3512 '#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
3513 sed
= 's@#define UINT_FAST\([0-9]*\)_MAX.*@'
3514 '#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
3515 sed
= "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
3516 sed
= "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
3517 sed
= "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
3518 sed
= "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
3519 sed
= "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
3520 test_text
= "/* @todo - Add support for wint_t types. */\n"
3521 "#define INT32_MIN (-2147483647-1)\n"
3522 "#define INT32_MAX 2147483647\n"
3523 "#define UINT32_MAX 4294967295U\n"
3524 "#define INT_LEAST32_MIN (-2147483647-1)\n"
3525 "#define INT_LEAST32_MAX 2147483647\n"
3526 "#define UINT_LEAST32_MAX 4294967295U\n"
3527 "#define INT_FAST8_MIN INT8_MIN\n"
3528 "#define INT_FAST8_MAX INT8_MAX\n"
3529 "#define UINT_FAST8_MAX UINT8_MAX\n"
3530 "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
3531 "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
3532 "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
3533 "#define UINT8_C(x) x##U\n"
3534 "#define UINT16_C(x) x##U";
3541 hackname
= newlib_stdint_2
;
3542 files
= stdint
-newlib.h
, stdint.h
;
3543 select
= "@todo - Add support for wint_t types";
3545 c_fix_arg
= "#define INTMAX_MAX __INTMAX_MAX__\n"
3546 "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
3547 "#define UINTMAX_MAX __UINTMAX_MAX__\n"
3548 "#define WCHAR_MAX __WCHAR_MAX__\n"
3549 "#define WCHAR_MIN __WCHAR_MIN__\n"
3550 "#define WINT_MAX __WINT_MAX__\n"
3551 "#define WINT_MIN __WINT_MIN__\n\n"
3553 c_fix_arg
= '/\*\* Macros for minimum-width integer constant expressions \*/';
3554 test_text
= "/* @todo - Add support for wint_t types. */\n"
3555 "/** Macros for minimum-width integer constant expressions */";
3559 * NeXT
3.2 adds const prefix to some math functions.
3560 * These conflict with the built
-in functions.
3563 hackname
= next_math_prefix
;
3564 files
= ansi
/math.h
;
3565 select
= "^extern[ \t]+double[ \t]+__const__[ \t]";
3568 c_fix_arg
= "extern double %1(";
3569 c_fix_arg
= "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
3571 test_text
= "extern\tdouble\t__const__\tmumble();";
3575 * NeXT
3.2 uses the word
"template" as a parameter for some
3576 * functions. GCC reports an invalid use of a reserved key word
3577 * with the built
-in functions.
3580 hackname
= next_template
;
3582 select
= "[ \t]template\\)";
3586 c_fix_arg
= "\\(([^)]*)[ \t]template\\)";
3587 test_text
= "extern mumble( char * template); /* fix */";
3591 * NeXT
3.2 includes the keyword volatile in the
abort() and
exit()
3592 * function prototypes. That conflicts with the built
-in functions.
3595 hackname
= next_volitile
;
3596 files
= ansi
/stdlib.h
;
3597 select
= "^extern[ \t]+volatile[ \t]+void[ \t]";
3600 c_fix_arg
= "extern void %1(";
3601 c_fix_arg
= "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
3603 test_text
= "extern\tvolatile\tvoid\tabort();";
3607 * NeXT
2.0 defines
'int wait(union wait*)', which conflicts with Posix
.1.
3608 * Note that version
3 of the NeXT system has wait.h in a different directory
,
3609 * so that this code won
't do anything. But wait.h in version 3 has a
3610 * conditional, so it doesn't need this fix. So everything is okay.
3613 hackname
= next_wait_union
;
3616 select
= 'wait\(union wait';
3618 c_fix_arg
= "wait(void";
3619 test_text
= "extern pid_d wait(union wait*);";
3623 * a missing semi
-colon at the end of the nodeent structure definition.
3626 hackname
= nodeent_syntax
;
3627 files
= netdnet
/dnetdb.h
;
3628 select
= "char[ \t]*\\*na_addr[ \t]*$";
3631 test_text
= "char *na_addr\t";
3635 * Fix OpenBSD
's NULL definition.
3638 hackname = openbsd_null_definition;
3639 mach = "*-*-openbsd*";
3640 files = locale.h, stddef.h, stdio.h, string.h,
3641 time.h, unistd.h, wchar.h, sys/param.h;
3642 select = "__GNUG__";
3644 c_fix_arg = "#ifndef NULL\n"
3645 "#ifdef __cplusplus\n"
3647 "#define NULL\t__null\n"
3648 "#else\t /* ! __GNUG__ */\n"
3649 "#define NULL\t0L\n"
3650 "#endif\t /* __GNUG__ */\n"
3651 "#else\t /* ! __cplusplus */\n"
3652 "#define NULL\t((void *)0)\n"
3653 "#endif\t /* __cplusplus */\n"
3654 "#endif\t /* !NULL */";
3656 c_fix_arg = "^#ifndef[ \t]*NULL\n"
3657 "^#ifdef[ \t]*__GNUG__\n"
3658 "^#define[ \t]*NULL[ \t]*__null\n"
3660 "^#define[ \t]*NULL[ \t]*0L\n"
3666 "#define NULL __null\n"
3674 * obstack.h used casts as lvalues.
3676 * We need to change postincrements of casted pointers (which are
3677 * then dereferenced and assigned into) of the form
3679 * *((TYPE*)PTRVAR)++ = (VALUE)
3681 * into expressions like
3683 * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
3685 * which is correct for the cases used in obstack.h since PTRVAR is
3686 * of type char * and the value of the expression is not used.
3689 hackname = obstack_lvalue_cast;
3691 select = '\
*\
(\
(([^
()]*)\
*\
)(.*)\
)\
+\
+ = \
(([^
()]*)\
)';
3693 c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
3694 test_text = "*((void **) (h)->next_free)++ = (aptr)";
3698 * Fix OpenBSD's va_start define.
3701 hackname
= openbsd_va_start
;
3702 mach
= "*-*-openbsd*";
3704 select
= '__builtin_stdarg_start';
3706 c_fix_arg
= __builtin_va_start
;
3708 test_text
= "#define va_start(v,l) __builtin_stdarg_start((v),l)";
3712 * sys
/lc_core.h on some versions of OSF1
/4.x pollutes the namespace by
3713 * defining regex.h related types. This causes libg
++ build and usage
3714 * failures. Fixing this correctly requires checking and modifying
3 files.
3717 hackname
= osf_namespace_a
;
3718 files
= reg_types.h
;
3719 files
= sys
/lc_core.h
;
3720 test
= " -r reg_types.h";
3721 test
= " -r sys/lc_core.h";
3722 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3723 test
= " -z \"`grep __regex_t regex.h`\"";
3727 c_fix_arg
= "reg(ex|off|match)_t";
3729 test_text
= "`touch sys/lc_core.h`"
3730 "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
3731 "extern regex_t re;\n"
3732 "extern regoff_t ro;\n"
3733 "extern regmatch_t rm;\n";
3737 hackname
= osf_namespace_c
;
3739 test
= " -r reg_types.h";
3740 test
= " -r sys/lc_core.h";
3741 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3742 test
= " -z \"`grep __regex_t regex.h`\"";
3744 select
= "#include <reg_types\.h>.*";
3747 "typedef __regex_t\tregex_t;\n"
3748 "typedef __regoff_t\tregoff_t;\n"
3749 "typedef __regmatch_t\tregmatch_t;";
3751 test_text
= "#include <reg_types.h>";
3755 * On broken glibc
-2.3.3 systems an array of incomplete structures is
3756 * passed to __sigsetjmp. Fix that to take a pointer instead.
3759 hackname
= pthread_incomplete_struct_argument
;
3761 select
= "struct __jmp_buf_tag";
3763 c_fix_arg
= "%1 *%2%3";
3764 c_fix_arg
= "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) "
3765 "(__env)\\[1\\](.*)$";
3766 test_text
= "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], "
3771 * Fix return type of fread and fwrite on sysV68
3774 hackname
= read_ret_type
;
3776 select
= "extern int\t.*, fread\\(\\), fwrite\\(\\)";
3778 c_fix_arg
= "extern unsigned int fread(), fwrite();\n%1%2";
3779 c_fix_arg
= "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
3781 test_text
= "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
3785 * Fix casts as lvalues in glibc
's <rpc/xdr.h>.
3788 hackname = rpc_xdr_lvalue_cast_a;
3790 select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
3792 c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
3793 test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
3794 "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
3798 * rpc_xdr_lvalue_cast_b
3801 hackname = rpc_xdr_lvalue_cast_b;
3803 select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
3805 c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
3806 test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
3807 "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
3811 * function class(double x) conflicts with C++ keyword on rs/6000
3814 hackname = rs6000_double;
3816 select = '[^a
-zA
-Z_
]class\
(';
3819 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
3820 c_fix_arg = '^.
*[^a
-zA
-Z_
]class\
(.
*';
3822 test_text = "extern int class();";
3826 * Wrong fchmod prototype on RS/6000.
3829 hackname = rs6000_fchmod;
3831 select = 'fchmod\
(char \
*';
3833 c_fix_arg = "fchmod(int";
3834 test_text = "extern int fchmod(char *, mode_t);";
3838 * parameters conflict with C++ new on rs/6000
3841 hackname = rs6000_param;
3845 select = 'rename\
(const char \
*old
, const char \
*new\
)';
3847 c_fix_arg = 'rename(const char
*_old
, const char
*_new
)';
3849 test_text = 'extern int
rename(const char
*old
, const char
*new
);';
3853 * Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
3854 * for C99. This is wrong for C++, which needs many C99 features, but
3855 * only supports __restrict.
3858 hackname = solaris___restrict;
3859 files = sys/feature_tests.h;
3860 select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
3861 mach = "*-*-solaris2*";
3863 c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
3864 "#else\n%0\n#endif";
3865 test_text = "#define _RESTRICT_KYWD restrict";
3869 * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
3870 * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
3871 * and imaginary definitions which are not supported by GCC.
3874 hackname = solaris_complex;
3875 mach = "*-*-solaris2.*";
3877 select = "#define[ \t]_Complex_I[ \t]_Complex_I";
3878 sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
3879 "#define\t_Complex_I\t(__extension__ 1.0iF)/";
3880 sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
3881 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
3882 sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
3883 test_text = "#define _Complex_I _Complex_I\n"
3884 "#define complex _Complex\n"
3885 "#define _Imaginary_I _Imaginary_I\n"
3886 "#define imaginary _Imaginary\n"
3888 "#define I _Imaginary_I";
3892 * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
3893 * extern "C" instead so libstdc++ can use it.
3896 hackname = solaris_complex_cxx;
3897 mach = "*-*-solaris2.*";
3899 sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
3900 "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
3901 sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
3902 "#ifdef\t__cplusplus\\\n}\\\n#endif";
3903 test_text = "#if !defined(__cplusplus)\n"
3904 "#endif /* !defined(__cplusplus) */";
3908 * g++ rejects functions declared with both C and C++ linkage.
3911 hackname = solaris_cxx_linkage;
3912 mach = '*-*-solaris2
*';
3913 files = "iso/stdlib_iso.h";
3914 select = "(#if __cplusplus >= 199711L)\n"
3915 "(extern \"C\\+\\+\" \\{\n)"
3916 "(.*(bsearch|qsort).*)";
3918 c_fix_arg = "%1 && !__GNUG__\n%2%3";
3921 "#if __cplusplus >= 199711L\n"
3922 "extern \"C++\" {\n"
3923 " void *bsearch(const void *, const void *, size_t, size_t,";
3927 * Solaris <iso/stdio_iso.h> doesn't declare getc for C
++ with
3928 * _STRICT_STDC
, but uses it.
3931 hackname
= solaris_getc_strict_stdc
;
3932 mach
= "*-*-solaris2*";
3933 files
= "iso/stdio_iso.h";
3934 select
= "(.*&& )!defined\\(_STRICT_STDC\\)(.*)";
3936 c_fix_arg
= "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2";
3939 "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
3943 * Solaris
<iso
/stdio_iso.h
> should deprecate gets before C11.
3946 hackname
= solaris_gets_c11
;
3947 mach
= "*-*-solaris2*";
3948 files
= "iso/stdio_iso.h";
3949 select
= "(extern char[ \t]*\\*gets\\(char \\*\\));";
3952 c_fix_arg
= "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n"
3953 "%1 __attribute__((__deprecated__));\n"
3956 test_text
= "extern char *gets(char *);";
3960 * Solaris
<iso
/stdio_iso.h
> shouldn
't declare gets for C++14.
3963 hackname = solaris_gets_cxx14;
3964 mach = "*-*-solaris2*";
3965 files = "iso/stdio_iso.h";
3966 select = <<- _EOSelect_
3967 (#if __STDC_VERSION__ < 201112L)
3968 (extern char \*gets\(char \*\) __ATTR_DEPRECATED;)
3971 c_fix_arg = "%1 && __cplusplus < 201402L\n%2";
3973 test_text = <<- _EOText_
3974 #if __STDC_VERSION__ < 201112L
3975 extern char *gets(char *) __ATTR_DEPRECATED;
3980 * Sun Solaris 2 has a version of sys/int_const.h that defines
3981 * UINT8_C and UINT16_C to unsigned constants.
3984 hackname = solaris_int_const;
3985 files = sys/int_const.h;
3986 mach = '*-*-solaris2
*';
3988 c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
3990 "#define\tUINT16_C(c)\t(c)";
3991 select = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
3993 "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
3995 "#define UINT8_C(c) __CONCAT__(c,u)\n"
3997 "#define UINT16_C(c) __CONCAT__(c,u)";
4001 * Sun Solaris 2 has a version of sys/int_limits.h that defines
4002 * UINT8_MAX and UINT16_MAX to unsigned constants.
4005 hackname = solaris_int_limits_1;
4006 files = sys/int_limits.h;
4007 mach = '*-*-solaris2
*';
4009 c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
4010 "#define\tUINT16_MAX\t(65535)";
4011 select = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
4012 "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
4014 "#define UINT8_MAX (255U)\n"
4015 "#define UINT16_MAX (65535U)";
4019 * Sun Solaris 2 has a version of sys/int_limits.h that defines
4020 * INT_FAST16 limits to wrong values for sys/int_types.h.
4023 hackname = solaris_int_limits_2;
4024 files = sys/int_limits.h;
4025 mach = '*-*-solaris2
*';
4027 c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
4028 select = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
4030 "#define INT_FAST16_MAX INT16_MAX\n"
4031 "#define UINT_FAST16_MAX UINT16_MAX\n"
4032 "#define INT_FAST16_MIN INT16_MIN";
4036 * Sun Solaris 2 has a version of sys/int_limits.h that defines
4037 * SIZE_MAX as unsigned long.
4040 hackname = solaris_int_limits_3;
4041 files = sys/int_limits.h;
4042 mach = '*-*-solaris2
*';
4044 c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
4045 select = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
4047 "#define SIZE_MAX 4294967295UL";
4051 * Sun Solaris 10 defines several C99 math macros in terms of
4052 * builtins specific to the Studio compiler, in particular not
4053 * compatible with the GNU compiler.
4056 hackname = solaris_math_1;
4057 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
4058 bypass = "__GNUC__";
4059 files = iso/math_c99.h;
4061 c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
4062 c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
4064 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
4066 "#define HUGE_VAL __builtin_huge_val\n"
4067 "#undef HUGE_VALF\n"
4068 "#define HUGE_VALF __builtin_huge_valf\n"
4069 "#undef HUGE_VALL\n"
4070 "#define HUGE_VALL __builtin_huge_vall";
4074 * On Solaris 11, if you do isinf(NaN) you'll get a floating point
4075 * exception. Provide an alternative using GCC
's builtin.
4078 hackname = solaris_math_10;
4079 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
4080 files = iso/math_c99.h;
4082 c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
4083 c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
4084 "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);"
4086 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
4087 "INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
4088 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
4089 "\\(-INFINITY\\);[ \t]*\\}\\)";
4091 '#pragma ident
"@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
4093 "#define isinf(x) __extension__( \\\\\n"
4094 " { __typeof(x) __x_i = (x); \\\\\n"
4095 " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
4096 " __x_i == (__typeof(__x_i)) (-INFINITY); })";
4100 * Solaris math INFINITY
4103 hackname = solaris_math_2;
4104 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
4105 bypass = "__GNUC__";
4106 files = iso/math_c99.h;
4108 c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
4109 c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
4111 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
4113 "#define INFINITY __builtin_infinity";
4120 hackname = solaris_math_3;
4121 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
4122 bypass = "__GNUC__";
4123 files = iso/math_c99.h;
4125 c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
4126 c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
4128 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
4130 "#define NAN __builtin_nan";
4134 * Solaris math fpclassify
4137 hackname = solaris_math_4;
4138 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
4139 bypass = "__GNUC__";
4140 files = iso/math_c99.h;
4142 c_fix_arg = "#define\tfpclassify(x) \\\n"
4143 " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, "
4144 "FP_SUBNORMAL, FP_ZERO, (x))";
4145 c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
4147 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
4148 "#undef fpclassify\n"
4149 "#define fpclassify(x) __builtin_fpclassify(x)";
4153 * Solaris math signbit
4156 hackname = solaris_math_8;
4157 select = '@\
(#\
)math_c99\.h
' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
4158 bypass = "__GNUC__";
4159 files = iso/math_c99.h;
4161 c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
4162 "\t\t\t ? __builtin_signbitf(x) \\\n"
4163 "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
4164 "\t\t\t ? __builtin_signbitl(x) \\\n"
4165 "\t\t\t : __builtin_signbit(x))";
4166 c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
4167 test_text = <<- _EOText_
4168 #ident "@(#)math_c99.h 1.9 04/11/01 SMI"
4170 #define signbit(x) __builtin_signbit(x)
4175 * Solaris math comparison macros
4178 hackname = solaris_math_9;
4179 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
4180 bypass = "__GNUC__";
4181 files = iso/math_c99.h;
4183 c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
4184 c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) "
4185 "__builtin_[a-z]+\\(y\\)\\)";
4187 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
4188 "#undef isgreater\n"
4189 "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
4190 "#undef isgreaterequal\n"
4191 "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
4193 "#define isless(x, y) ((x) __builtin_isless(y))\n"
4194 "#undef islessequal\n"
4195 "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
4196 "#undef islessgreater\n"
4197 "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
4198 "#undef isunordered\n"
4199 "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
4203 * Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing
4207 hackname = solaris_math_11;
4208 select = '@\
(#\
)math_c99\.h
' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ ";
4209 files = iso/math_c99.h;
4211 c_fix_arg = << _EOArg_
4213 #define signbit(x) (sizeof(x) == sizeof(float) \
4214 ? __builtin_signbitf(x) \
4215 : sizeof(x) == sizeof(long double) \
4216 ? __builtin_signbitl(x) \
4217 : __builtin_signbit(x))
4219 c_fix_arg = << _EOArg_
4221 #if defined\(__sparc\)
4222 #define[ ]+signbit\(x\)[ ]+__extension__\( \\
4223 [ ]+\{[ ]*__typeof\(x\)[ ]*__x_s[ ]*=[ ]*\(x\);[ ]*\\
4224 [ ]+\(int\)[ ]*\(\*\(unsigned[ ]*\*\)[ ]*\&__x_s[ ]*>>[ ]*31\);[ ]*\}\)
4225 #elif defined\(__i386\) \|\| defined\(__amd64\)
4226 #define[ ]+signbit\(x\)[ ]+__extension__\( \\
4227 [ ]+\{ __typeof\(x\) __x_s = \(x\); \\
4228 [ ]+\(sizeof \(__x_s\) == sizeof \(float\) \? \\
4229 [ ]+\(int\) \(\*\(unsigned \*\) \&__x_s >> 31\) : \\
4230 [ ]+sizeof \(__x_s\) == sizeof \(double\) \? \\
4231 [ ]+\(int\) \(\(\(unsigned \*\) \&__x_s\)\[1\] >> 31\) : \\
4232 [ ]+\(int\) \(\(\(unsigned short \*\) \&__x_s\)\[4\] >> 15\)\); \}\)
4235 test_text = << _EOText_
4236 /* @(#)math_c99.h 1.14 13/03/27 */
4238 #if defined(__sparc)
4239 #define signbit(x) __extension__( \\
4240 { __typeof(x) __x_s = (x); \\
4241 (int) (*(unsigned *) &__x_s >> 31); })
4242 #elif defined(__i386) || defined(__amd64)
4243 #define signbit(x) __extension__( \\
4244 { __typeof(x) __x_s = (x); \\
4245 (sizeof (__x_s) == sizeof (float) ? \\
4246 (int) (*(unsigned *) &__x_s >> 31) : \\
4247 sizeof (__x_s) == sizeof (double) ? \\
4248 (int) (((unsigned *) &__x_s)[1] >> 31) : \\
4249 (int) (((unsigned short *) &__x_s)[4] >> 15)); })
4255 * Some versions of Solaris 10+ <math.h> #undef libstdc++-internal macros.
4258 hackname = solaris_math_12;
4260 mach = '*-*-solaris2
*';
4261 select = '#undef.
*_GLIBCXX_USE_C99_MATH
';
4262 sed = "/#undef[ \t]*_GLIBCXX_USE_C99_MATH/d";
4263 test_text = << _EOText_
4264 #if __cplusplus >= 201103L
4265 #undef _GLIBCXX_USE_C99_MATH
4266 #undef _GLIBCXX_USE_C99_MATH_TR1
4272 * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
4273 * structure. As such, it need two levels of brackets, but only
4274 * contains one. Wrap the macro definition in an extra layer.
4277 hackname = solaris_once_init_1;
4278 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
4280 mach = '*-*-solaris
*';
4282 c_fix_arg = "%1{%2}%3";
4283 c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
4285 '#pragma ident
"@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
4286 "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
4290 * Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the
4291 * posix_spawn declarations, which doesn't work with C
++.
4294 hackname
= solaris_posix_spawn_restrict
;
4296 mach
= '*-*-solaris2*';
4298 c_fix_arg
= "%1*_RESTRICT_KYWD %2%3";
4299 select
= "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
4301 "char *const argv[_RESTRICT_KYWD],\n"
4302 "char *const envp[_RESTRICT_KYWD]);";
4306 * The pow overloads with int were removed in C
++ 2011 DR
550.
4309 hackname
= solaris_pow_int_overload
;
4310 mach
= '*-*-solaris2*';
4311 files
= "iso/math_iso.h";
4312 select
= "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)"
4313 " *\\{[^{}]*\n[^{}]*\\}";
4315 c_fix_arg
= "#if __cplusplus < 201103L\n%0\n#endif";
4318 " inline long double pow(long double __X, int __Y) { return\n"
4319 " __powl(__X, (long double) (__Y)); }";
4323 * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a
"0" for some
4324 * fields of the pthread_rwlock_t structure
, which are of type
4325 * upad64_t
, which itself is typedef
'd to int64_t, but with __STDC__
4326 * defined (e.g. by -ansi) it is a union. So change the initializer
4330 hackname = solaris_rwlock_init_1;
4331 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
4333 mach = '*-*-solaris
*';
4335 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
4338 "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
4340 c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
4341 "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
4344 '#ident
"@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
4345 "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
4349 * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
4350 * std::__flsbuf, but <iso/stdio_iso.h> uses them.
4353 hackname = solaris_std___filbuf;
4355 mach = '*-*-solaris2
*';
4356 bypass = "using std::__filbuf";
4357 select = "(using std::perror;\n)(#endif)";
4359 c_fix_arg = "%1#ifndef _LP64\n"
4360 "using std::__filbuf;\n"
4361 "using std::__flsbuf;\n"
4364 test_text = "using std::perror;\n"
4369 * Solaris <stdio.h> shouldn't use std
::gets for C
++14.
4372 hackname
= solaris_std_gets_cxx14
;
4373 mach
= "*-*-solaris2*";
4375 select
= "using std::gets;";
4378 c_fix_arg
= "#if __cplusplus < 201402L\n%0\n#endif";
4380 test_text
= "using std::gets;";
4384 * Sun Solaris
8 has what appears to be some gross workaround for
4385 * some old version of their c
++ compiler. G
++ doesn
't want it
4386 * either, but doesn't want to be tied to SunPRO version numbers.
4389 hackname
= solaris_stdio_tag
;
4390 files
= stdio_tag.h
;
4392 select
= '__cplusplus < 54321L';
4393 /* In Solaris
10, the code in stdio_tag.h is conditionalized on
4394 "!defined(__GNUC__)" so we no longer need to fix it.
*/
4395 bypass
= '__GNUC__';
4396 sed
= 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
4398 test_text
= "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
4402 * Solaris
<stdlib.h
> shouldn
't use _Noreturn, breaks with C++.
4405 hackname = solaris_stdlib_noreturn;
4406 mach = "*-*-solaris2*";
4407 files = "iso/stdlib_c99.h";
4408 select = "(extern) _Noreturn (void quick_exit\\(int\\));";
4411 c_fix_arg = "%1 %2 __attribute__((__noreturn__));";
4413 test_text = "extern _Noreturn void quick_exit(int);";
4417 * a missing semi-colon at the end of the statsswtch structure definition.
4420 hackname = statsswtch;
4421 files = rpcsvc/rstat.h;
4422 select = "boottime$";
4424 c_fix_arg = "boottime;";
4425 test_text = "struct statswtch {\n int boottime\n};";
4429 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
4430 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
4434 hackname
= stdio_stdarg_h
;
4436 bypass
= "include.*(stdarg\.h|machine/ansi\.h)";
4438 * On Solaris
10, this fix is unncessary
; <stdio.h
> includes
4439 * <iso
/stdio_iso.h
>, which includes
<sys
/va_list.h
>.
4441 mach
= '*-*-solaris2.1[0-9]*';
4446 c_fix_arg
= "#define __need___va_list\n#include <stdarg.h>\n";
4452 * Don
't use or define the name va_list in stdio.h. This is for
4453 * ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
4454 * of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
4455 * indicate that the header knows what it's doing
-- under SUSv2
,
4456 * stdio.h is required to define va_list
, and we shouldn
't break
4460 hackname = stdio_va_list;
4462 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list
';
4464 * On Solaris 10, the definition in
4465 * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
4466 * there is therefore no need for this fix there.
4468 mach = '*-*-solaris2.1
[0-9]*';
4472 * Use __gnuc_va_list in arg types in place of va_list.
4473 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
4474 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
4475 * trailing parentheses and semicolon save all other systems from this.
4476 * Define
__not_va_list__ (something harmless and unused
)
4477 * instead of va_list.
4478 * Don
't claim to have defined va_list.
4480 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
4481 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
4482 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
4483 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
4484 "s@ va_list@ __not_va_list__@\n"
4485 "s@\\*va_list@*__not_va_list__@\n"
4486 "s@ __va_list)@ __gnuc_va_list)@\n"
4487 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
4488 "@typedef \\1 __not_va_list__;@\n"
4489 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
4490 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
4491 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
4492 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
4493 "s@VA_LIST@DUMMY_VA_LIST@\n"
4494 "s@_Va_LIST@_VA_LIST@";
4495 test_text = "extern void mumble( va_list);";
4499 * Fix headers that use va_list from stdio.h to use the updated
4500 * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
4501 * dealt with elsewhere. The presence of __gnuc_va_list,
4502 * __DJ_va_list, or _G_va_list is taken to indicate that the header
4503 * knows what it's doing.
4506 hackname
= stdio_va_list_clients
;
4514 files
= curses_colr
/curses.h
;
4515 bypass
= '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
4516 /* Don
't fix, if we use va_list from stdarg.h, or if the use is
4517 otherwise protected. */
4518 bypass = 'include
<stdarg\.h
>|#ifdef va_start
';
4521 * Use __gnuc_va_list in arg types in place of va_list.
4522 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
4523 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
4524 * trailing parentheses and semicolon save all other systems from this.
4525 * Define
__not_va_list__ (something harmless and unused
)
4526 * instead of va_list.
4527 * Don
't claim to have defined va_list.
4529 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
4530 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
4531 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
4532 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
4533 "s@ va_list@ __not_va_list__@\n"
4534 "s@\\*va_list@*__not_va_list__@\n"
4535 "s@ __va_list)@ __gnuc_va_list)@\n"
4536 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
4537 "@typedef \\1 __not_va_list__;@\n"
4538 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
4539 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
4540 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
4541 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
4542 "s@VA_LIST@DUMMY_VA_LIST@\n"
4543 "s@_Va_LIST@_VA_LIST@";
4544 test_text = "extern void mumble( va_list);";
4548 * "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
4549 * is "!defined( __STRICT_ANSI__ )"
4552 hackname = strict_ansi_not;
4553 select = "^([ \t]*#[ \t]*if.*)"
4555 "|__STDC__[ \t]*==[ \t]*0"
4556 "|__STDC__[ \t]*!=[ \t]*1"
4557 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
4558 /* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
4559 bypass = 'GNU and MIPS C compilers define __STDC__ differently
';
4560 /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
4561 is not defined by GCC, so it is safe. */
4562 bypass = '__SCO_VERSION__.
*__STDC__
!= 1';
4563 c_test = stdc_0_in_system_headers;
4566 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
4568 test_text = "#if !__STDC__ \n"
4569 "#if __STDC__ == 0\n"
4570 "#if __STDC__ != 1\n"
4571 "#if __STDC__ - 0 == 0"
4572 "/* not std C */\nint foo;\n"
4573 "\n#end-end-end-end-if :-)";
4578 * is "!defined( __STRICT_ANSI__ )" on continued #if-s
4581 hackname = strict_ansi_not_ctd;
4582 files = math.h, limits.h, stdio.h, signal.h,
4583 stdlib.h, sys/signal.h, time.h;
4585 * Starting at the beginning of a line, skip white space and
4586 * a leading "(" or "&&" or "||". One of those must be found.
4587 * Then, zero, one or more copies of a "defined(_FOO_BAR_) &&"
4588 * expression. If these are nested, then they must accumulate
4589 * because we won't match any closing parentheses. Finally
,
4590 * after skipping over all that
, we must then match our suspect
4591 * phrase
: "__STDC__-0==0" with or without white space.
4593 select
= "^([ \t]*" '(\(|&&|\|\|)'
4594 "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
4596 "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
4597 c_test
= stdc_0_in_system_headers
;
4600 c_fix_arg
= "%1 !defined(__STRICT_ANSI__)";
4602 test_text
= "#if 1 && \\\\\n"
4603 "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
4604 "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
4605 "|| __STDC__ - 0 == 0 ) /* not std C */\n"
4610 * "__STDC__!=0" or
"__STDC__==1" or
"__STDC__-0==1"
4611 * is
"defined( __STRICT_ANSI__ )"
4614 hackname
= strict_ansi_only
;
4615 select
= "^([ \t]*#[ \t]*if.*)"
4616 "(__STDC__[ \t]*!=[ \t]*0"
4617 "|__STDC__[ \t]*==[ \t]*1"
4618 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
4619 "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
4620 c_test
= stdc_0_in_system_headers
;
4623 c_fix_arg
= "%1 defined(__STRICT_ANSI__)";
4625 test_text
= "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
4629 * IRIX
4.0.5 <rpc
/xdr.h
> uses struct __file_s
4630 * in prototype without previous definition.
4633 hackname
= struct_file
;
4635 select
= '^.*xdrstdio_create.*struct __file_s';
4637 c_fix_arg
= "struct __file_s;\n%0";
4638 test_text
= "extern void xdrstdio_create( struct __file_s* );";
4642 * IRIX
4.0.5 <rpc
/auth.h
> uses struct sockaddr
4643 * in prototype without previous definition.
4645 * Don
't fix OpenBSD, which uses struct sockaddr_in prototyping the same
4646 * function, and does define it.
4649 hackname = struct_sockaddr;
4651 select = "^.*authdes_create.*struct sockaddr[^_]";
4652 bypass = "<sys/socket\.h>";
4653 bypass = "struct sockaddr;\n";
4655 c_fix_arg = "struct sockaddr;\n%0";
4656 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
4660 * Apply fix this to all OSs since this problem seems to effect
4661 * more than just SunOS.
4664 hackname = sun_auth_proto;
4669 bypass = "__cplusplus";
4671 * Select those files containing '(*name)()'.
4673 select = '\(\*[a-z][a-z_]*\)\(\)';
4676 c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n"
4677 "#else\n%1();%2\n#endif";
4678 c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
4682 " int (*name)(); /* C++ bad */\n"
4687 * Fix bogus #ifdef on SunOS 4.1.
4690 hackname = sun_bogus_ifdef;
4691 files = "hsfs/hsfs_spec.h";
4692 files = "hsfs/iso_spec.h";
4693 select = '#
ifdef(.
*\|\|.*)
';
4695 c_fix_arg = "#if%1";
4697 test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
4701 * Fix the CAT macro in SunOS memvar.h.
4704 hackname = sun_catmacro;
4705 files = pixrect/memvar.h;
4706 select = "^#define[ \t]+CAT\\(a,b\\).*";
4711 "# define CAT(a,b) a##b\n"
4712 "#else\n%0\n#endif";
4715 "#define CAT(a,b)\ta/**/b";
4719 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
4720 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
4723 hackname = sun_malloc;
4725 bypass = "_CLASSIC_ANSI_TYPES";
4727 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
4728 sed = "s/int[ \t][ \t]*free/void\tfree/g";
4729 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
4730 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
4731 sed = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
4734 "typedef char *\tmalloc_t;\n"
4736 "char*\tmalloc();\n"
4737 "char*\tcalloc();\n"
4738 "char*\trealloc();";
4742 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
4745 hackname = sun_rusers_semi;
4746 files = rpcsvc/rusers.h;
4748 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
4749 test_text = "struct mumble\n int _cnt\n};";
4753 * signal.h on SunOS defines signal using (),
4754 * which causes trouble when compiling with g++ -pedantic.
4757 hackname = sun_signal;
4758 files = sys/signal.h;
4760 select = "^void\t" '\
(\
*signal\
(\
)\
)\
(\
);.
*';
4764 "#ifdef __cplusplus\n"
4765 "void\t(*signal(...))(...);\n"
4766 "#else\n%0\n#endif";
4768 test_text = "void\t(*signal())();";
4772 * Correct the return type for strlen in strings.h in SunOS 4.
4775 hackname = sunos_strlen;
4777 select = "int[ \t]*strlen\\(\\);(.*)";
4779 c_fix_arg = "__SIZE_TYPE__ strlen();%1";
4780 test_text = " int\tstrlen(); /* string length */";
4784 * Linux kernel's vt.h breaks C
++
4787 hackname
= suse_linux_vt_cxx
;
4790 select
= "^[ \t]*unsigned int new;";
4792 c_fix_arg
= "unsigned int newev;";
4794 test_text
= " unsigned int new; /* New console (if changing) */";
4798 * Disable apparent native compiler optimization cruft in SVR4.2
<string.h
>
4799 * that is visible to any ANSI compiler using this include. Simply
4800 * delete the lines that #define some string functions to internal forms.
4803 hackname
= svr4_disable_opt
;
4805 select
= '#define.*__std_hdr_';
4806 sed
= '/#define.*__std_hdr_/d';
4807 test_text
= "#define strlen __std_hdr_strlen\n";
4811 * Fix broken decl of getcwd present on some svr4 systems.
4814 hackname
= svr4_getcwd
;
4817 files
= prototypes.h
;
4818 select
= 'getcwd\(char \*, int\)';
4821 c_fix_arg
= "getcwd(char *, size_t)";
4823 test_text
= "extern char* getcwd(char *, int);";
4827 * Fix broken decl of profil present on some svr4 systems.
4830 hackname
= svr4_profil
;
4835 'profil\(unsigned short \*, unsigned int, unsigned int, unsigned int\)';
4837 c_fix_arg
= 'profil(unsigned short *, size_t, int, unsigned int)';
4840 'profil(unsigned short *, unsigned int, unsigned int, unsigned int);';
4844 * Correct types for signal handler constants like SIG_DFL
; they might be
4845 * void (*) (), and should be void (*) (int). C++ doesn't like the
4849 hackname = svr4_sighandler_type;
4850 files = sys/signal.h;
4851 select = 'void *\(\*\)\(\)';
4853 c_fix_arg = "void (*)(int)";
4854 test_text = "#define SIG_DFL (void(*)())0\n"
4855 "#define SIG_IGN (void (*)())0\n";
4859 * Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local
4860 * function 'getrnge' in <regexp.h> before they declare it. For these
4861 * systems add a 'static int' declaration of 'getrnge' into <regexp.h>
4864 * 'getrnge' traditionally manipulates a file-scope global called 'size',
4865 * so put the declaration right after the declaration of 'size'.
4867 * Don't do this if there is already a `static void getrnge' declaration
4868 * present, since this would cause a redeclaration error. Solaris 2.x has
4869 * such a declaration.
4872 hackname = svr4_undeclared_getrnge;
4875 bypass = "static void getrnge";
4878 "static int getrnge ();";
4879 c_fix_arg = "^static int[ \t]+size;";
4880 test_text = "static int size;\n"
4881 "/* stuff which calls getrnge() */\n"
4882 "static getrnge()\n"
4887 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
4888 * in string.h on sysV68
4889 * Correct the return type for strlen in string.h on Lynx.
4890 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
4891 * Add missing const for strdup on OSF/1 V3.0.
4892 * On sysV88 layout is slightly different.
4895 hackname = sysv68_string;
4898 bypass = "_CLASSIC_ANSI_TYPES";
4900 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
4901 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
4902 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
4904 sed = "/^extern char$/N";
4905 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
4907 sed = "/^extern int$/N";
4908 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
4910 sed = "/^\tstrncmp(),$/N";
4911 sed = 's/^\(' "\t" 'strncmp()\),\n\(' "\t" 'strlen(),\)$/'
4912 '\1;' "\\\nextern unsigned int\\\n\\2/";
4915 "extern int strlen();\n"
4917 "extern int ffs(long);\n"
4930 "\tstrlen(), strspn();";
4934 * Fix return type of calloc, malloc, realloc, bsearch and exit
4937 hackname = sysz_stdlib_for_sun;
4939 bypass = "_CLASSIC_ANSI_TYPES";
4941 select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
4943 c_fix_arg = "void *\t%1(";
4946 "extern char*\tcalloc(size_t);\n"
4947 "extern char*\tmalloc(size_t);\n"
4948 "extern char*\trealloc(void*,size_t);\n"
4949 "extern char*\tbsearch(void*,size_t,size_t);\n";
4953 * __thread is now a keyword.
4956 hackname = thread_keyword;
4957 files = "pthread.h";
4958 files = bits/sigthread.h, '*/bits/sigthread.h';
4959 select = "([* ])__thread([,)])";
4961 c_fix_arg = "%1__thr%2";
4964 "extern int pthread_create (pthread_t *__restrict __thread,\n"
4965 "extern int pthread_kill (pthread_t __thread, int __signo);\n"
4966 "extern int pthread_cancel (pthread_t __thread);";
4970 * if the #if says _cplusplus, not the double underscore __cplusplus
4974 hackname = tinfo_cplusplus;
4976 select = "[ \t]_cplusplus";
4979 c_fix_arg = " __cplusplus";
4980 test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
4984 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4987 hackname = ultrix_const;
4989 select = 'perror\( char \*';
4992 c_fix_arg = "%1 const %3 *__";
4993 c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
4994 "[ \t]+(char|void
) \\*__
";
4997 "extern void
perror( char
*__s
);\n"
4998 "extern int
fputs( char
*__s
, FILE *)
;\n"
4999 "extern size_t
fwrite( void
*__ptr
, size_t
, size_t
, FILE *)
;\n"
5000 "extern int
fscanf( FILE
*__stream
, char
*__format
, ...
);\n"
5001 "extern int
scanf( char
*__format
, ...
);\n";
5005 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
5008 hackname = ultrix_const2;
5011 select = '\*fopen\( char \*';
5013 c_fix_arg = "%1( const char
*%3, const char
*";
5014 c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam
))\\("
5015 "[ \t]*char
[ \t]*\\*([^
,]*)
,"
5016 "[ \t]*char
[ \t]*\\*[ \t]*";
5019 "extern FILE
*fopen( char
*__filename
, char
*__type
);\n"
5020 "extern int
sscanf( char
*__s
, char
*__format
, ...
);\n"
5021 "extern FILE
*popen(char
*, char *)
;\n"
5022 "extern char
*tempnam(char
*,char*)
;\n";
5026 * Fix definitions of macros used by va-i960.h in VxWorks header file.
5029 hackname = va_i960_macro;
5030 files = arch/i960/archI960.h;
5031 select = "__(vsiz|vali|vpad|alignof__
)";
5034 c_fix_arg = "__vx
%1";
5037 "extern int __vsiz vsiz
;\n"
5038 "extern int __vali vali
;\n"
5039 "extern int __vpad vpad
;\n"
5040 "#define
__alignof__(x
) ...
";
5044 * On VMS, add missing braces around sigset_t constants.
5047 hackname = vms_add_missing_braces;
5048 select = "(_SIG_
[A
-Z
]+_SET
[ \t]+= \\{)(0x
[0F
]+, 0x
[0F
]+)";
5050 files = "rtldef
/signal.h
";
5053 c_fix_arg = '%1 {%2} ';
5055 test_text = "static const __sigset_t _SIG_EMPTY_SET
= "
5056 "{0x00000000, 0x00000000},\n"
5057 " _SIG_FULL_SET
= {0xFFFFFFFF, 0xFFFFFFFF};\n";
5061 * On VMS, some DEC-C builtins are directly used.
5064 hackname = vms_decc_builtin;
5065 select = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY
)";
5067 files = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
5069 sed = "s@__MEMSET@memset@
";
5070 sed = "s@__MEMMOVE@memmove@
";
5071 sed = "s@__MEMCPY@memcpy@
";
5072 sed = "s@__STRLEN@strlen@
";
5073 sed = "s@__STRCPY@strcpy@
";
5075 test_text = "define
FD_ZERO(__p
) __MEMSET((__p
), 0, sizeof(*(__p)))\n";
5079 * Define __CAN_USE_EXTERN_PREFIX on vms.
5082 hackname = vms_define_can_use_extern_prefix;
5083 files = "rtldef/decc$types.h";
5084 select = "#[ \t]*else\n"
5085 "#[ \t]*if defined\\(__DECCXX\\)\n"
5086 "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n";
5091 "# elif defined (__GNUC__)\n"
5092 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n";
5094 test_text = "# else\n"
5095 "# if defined(__DECCXX)\n"
5096 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"
5102 * On VMS, disable the use of dec-c string builtins
5105 hackname = vms_disable_decc_string_builtins;
5106 select = "#if !defined\\(__VAX\\)\n";
5108 files = "rtldef/string.h";
5111 c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n";
5113 test_text = "#if !defined(__VAX)\n";
5117 * On VMS, fix incompatible redeclaration of hostalias.
5120 hackname = vms_do_not_redeclare_hostalias;
5121 select = "(void[ \t]+fp_nquery \\(const u_char \\*, int, FILE \\*\\);)\n"
5122 "(__char_ptr32[ \t]+hostalias \\(const char \\*\\);)";
5124 files = "rtldef/resolv.h";
5130 test_text = "void fp_nquery (const u_char *, int, FILE *);\n"
5131 "__char_ptr32
hostalias (const char *)
;\n";
5135 * On VMS, forward declare structure before referencing them in prototypes.
5138 hackname = vms_forward_declare_struct;
5139 select = "(/\\* forward decls for C
\\+\\+ \\*/\n)"
5140 "#ifdef __cplusplus
\n";
5142 files = rtldef/if.h;
5146 "#if
defined (__cplusplus
) ||
defined (__GNUC__
)\n";
5148 test_text = "/* forward decls for C
++ */\n"
5149 "#ifdef __cplusplus
\n"
5155 * On VMS, do not declare getopt and al if pointers are 64 bit.
5158 hackname = vms_no_64bit_getopt;
5159 select = "^
[ \t]*(extern
[ \t]*)?
(int
[ \t]*(getopt|optind|opterr|optopt
)"
5160 "|
(char
\\*optarg
))([ \t]*\\(.
*\\))?
;\n";
5162 files = rtldef/stdio.h, rtldef/unistd.h;
5165 c_fix_arg = <<- _EOArg_
5166 #if __INITIAL_POINTER_SIZE != 64 /* getopt is short ptr only. */
5171 test_text = "int
getopt (int
, char
* const
[], const char *)
;";
5175 * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
5176 * which is not yet fully supported by gcc.
5179 hackname = vms_use_fast_setjmp;
5180 select = "(#
[ \t]*if
[ \t]*defined
\\(__FAST_SETJMP
\\)[ \t]*\\|
\\|
)";
5182 files = rtldef/setjmp.h;
5185 c_fix_arg = "%0 defined (__GNUC__
) ||
";
5187 test_text = "# if
defined(__FAST_SETJMP
) ||
defined(__UNIX_SETJMP
)";
5191 * On VMS, use pragma extern_model instead of VAX-C keywords.
5194 hackname = vms_use_pragma_extern_model;
5195 select = "#if defined
\\(__DECC
\\) \\|
\\| defined
\\(__DECCXX
\\)\n"
5196 "# pragma extern_model __save
\n";
5200 c_fix_arg = "#if
defined(__DECC
) ||
defined(__DECCXX
) ||
defined(__GNUC__
)\n"
5201 "# pragma extern_model __save
\n";
5203 test_text = "#if
defined(__DECC
) ||
defined(__DECCXX
)\n"
5204 "# pragma extern_model __save
\n"
5205 "# pragma extern_model strict_refdef
\n"
5206 " extern struct x zz$yy
;\n"
5207 "# pragma extern_model __restore
\n"
5212 * On VMS, change <resource.h> to <sys/resource.h> to avoid a
5213 * conflict while building gcc. Likewise for <builtins.h>
5216 hackname = vms_use_quoted_include;
5217 select = "(#
[ \t]*include
[ \t]+)<(resource|builtins
)\\.h
>";
5219 files = rtldef/wait.h, starlet_c/pthread.h;
5222 c_fix_arg = '%1<sys/%2.h>';
5224 test_text = "# include
<resource.h
>";
5228 * AIX and Interix headers define NULL to be cast to a void pointer,
5229 * which is illegal in ANSI C++.
5232 hackname = void_null;
5233 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
5234 time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h;
5235 /* avoid changing C++ friendly NULL */
5236 bypass = __cplusplus;
5238 select = "^#
[ \t]*define
[ \t]+NULL
[ \t]+\\(\\(void
[ \t]*\\*\\)0\\)";
5240 c_fix_arg = <<- _EOFix_
5245 #else /* ! __GNUG__ */
5247 #endif /* __GNUG__ */
5248 #else /* ! __cplusplus */
5249 #define NULL ((void *)0)
5250 #endif /* __cplusplus */
5253 test_text = "# define
\tNULL
\t((void *)
0) /* typed NULL
*/";
5257 * Make VxWorks header which is almost gcc ready fully gcc ready.
5260 hackname = vxworks_gcc_problem;
5261 files = types/vxTypesBase.h;
5262 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__
";
5264 sed = "s
/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__
/"
5267 sed = "/[ \t]size_t
/i
\\\n"
5268 "#ifndef _GCC_SIZE_T
\\\n"
5269 "#define _GCC_SIZE_T
\n";
5271 sed = "/[ \t]size_t
/a
\\\n"
5274 sed = "/[ \t]ptrdiff_t
/i
\\\n"
5275 "#ifndef _GCC_PTRDIFF_T
\\\n"
5276 "#define _GCC_PTRDIFF_T
\n";
5278 sed = "/[ \t]ptrdiff_t
/a
\\\n"
5281 sed = "/[ \t]wchar_t
/i
\\\n"
5282 "#ifndef _GCC_WCHAR_T
\\\n"
5283 "#define _GCC_WCHAR_T
\n";
5285 sed = "/[ \t]wchar_t
/a
\\\n"
5289 "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__
\n"
5290 "typedef unsigned int size_t
;\n"
5291 "typedef long ptrdiff_t
;\n"
5292 "typedef unsigned short wchar_t
;\n"
5293 "#endif
/* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__
*/\n";
5297 * Wrap VxWorks ioctl to keep everything pretty
5300 hackname = vxworks_ioctl_macro;
5302 mach = "*-*-vxworks
*";
5306 "#define
ioctl(fd
, func
, arg
) ioctl(fd
, func
, (int
)(arg
))\n";
5307 c_fix_arg = "extern
[\t ]+int
[\t ]+ioctl
[\t ]*\\([\t ,[:alnum
:]]*\\);";
5309 test_text = "extern int
ioctl ( int asdf1234
, int jkl
, int qwerty
) ;";
5313 * Provide C99 FP classification support in VxWorks math.h if
5314 * not already there. Note the strict expectation on #define without
5315 * whitespaces in the bypass expression, which "works
" for
5316 * the system headers we have met and doesn't match test texts for
5317 * other hacks, found in the test baseline.
5320 hackname = vxworks_math_h_fp_c99;
5321 mach = "*-*-vxworks
*";
5323 bypass = "#define
[ \t]+FP_INFINITE
";
5324 select = "#define HUGE_VAL
[ \t]*_ARCH.
*";
5326 c_fix_arg = << _EOArg_
5332 #define FP_INFINITE 1
5334 #define FP_NORMAL (-1)
5335 #define FP_SUBNORMAL (-2)
5338 #define fpclassify(x) \
5339 __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, \
5340 FP_SUBNORMAL, FP_ZERO, (x))
5342 #define signbit(x) __builtin_signbit(x)
5343 #define isfinite(x) __builtin_isfinite(x)
5344 #define isnormal(x) __builtin_isnormal(x)
5345 #define isnan(x) __builtin_isnan(x)
5346 #define isinf(x) __builtin_isinf(x)
5348 #define isgreater(x, y) __builtin_isgreater((x),(y))
5349 #define isgreaterequal(x, y) __builtin_isgreaterequal((x),(y))
5350 #define isless(x, y) __builtin_isless((x),(y))
5351 #define islessequal(x, y) __builtin_islessequal((x),(y))
5352 #define islessgreater(x, y) __builtin_islessgreater((x),(y))
5353 #define isunordered(x, y) __builtin_isunordered((x),(y))
5359 test_text = "#define HUGE_VAL _ARCH_HUGH_VAL
";
5363 * mkdir's posix interface expects two arguments. While the RTP VxWorks
5364 * API is fine, the kernel version handles only one. We used to expose
5365 * a macro and this didn't play nice with uses such as posix:mkdir(x, y)
5366 * in libstdc++, so we expose a vararg prototype instead.
5369 hackname = vxworks_posix_mkdir;
5371 mach = "*-*-vxworks
*";
5374 c_fix_arg = "extern STATUS
mkdir(const char
*dir
, ...
);";
5375 c_fix_arg = "extern
[\t ]+STATUS
[\t ]+mkdir
[\t ]*"
5376 "\\([\t ]*const
[\t ]+char
[\t ]*\\*[\t ]*" /* arg type */
5377 "(|
[_
[:alpha
:]][_
[:alnum
:]]*)
" /* arg name (optional) */
5380 test_text = "extern STATUS
mkdir (const char
* _qwerty
) ;";
5384 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
5387 hackname = vxworks_needs_vxtypes;
5389 select = "uint_t([ \t]+_clocks_per_sec
)";
5391 c_fix_arg = "unsigned int
%1";
5392 test_text = "uint_t
\t_clocks_per_sec
;";
5396 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
5399 hackname = vxworks_needs_vxworks;
5401 test = " -r types
/vxTypesOld.h
";
5402 test = " -n
\"`egrep
'#include' $file`
\"";
5403 test = " -n
\"`egrep ULONG $file`
\"";
5404 select = "#
[ \t]define
[ \t]+__INCstath
";
5406 sed = "/#
[ \t]define
[ \t][ \t]*__INCstath
/a
\\\n"
5407 "#include
<types
/vxTypesOld.h
>\n";
5409 test_text = "`touch types
/vxTypesOld.h`
"
5410 "#include
</dev
/null
> /* ULONG
*/\n"
5411 "# define
\t__INCstath
<sys
/stat.h
>";
5415 * yvals.h on VxWorks-6 expects the toolchain to provide its own
5416 * version of the header, which we don't do. Arrange to fallback
5417 * on the system definition.
5420 hackname = vxworks_next_yvals;
5421 mach = "*-*-vxworks
*";
5423 select = "#include_next
<yvals.h
>";
5425 c_fix_arg = "#if
0 /* GCC does not provide yvals.h.
*/\n%1";
5426 c_fix_arg = "#if .
*\n"
5428 "(#include_next
<yvals.h
>\n)";
5430 test_text = "#
if (defined(__cplusplus
) && defined(__GNUC__
))\n"
5431 "/* GCC C
++ has it
's own yvals.h */\n"
5432 "#include_next <yvals.h>\n"
5437 * Make it so VxWorks does not include gcc/regs.h accidentally
5440 hackname = vxworks_regs;
5441 mach = "*-*-vxworks*";
5443 select = "#[\t ]*include[\t ]+[<\"]regs.h[>\"]";
5445 c_fix_arg = "#include <arch/../regs.h>";
5447 test_text = "#include <regs.h>\n";
5451 * Likewise, open's posix interface allows two or three arguments and
5452 * some VxWorks headers expose only a strict
3 arguments version. Merely
5453 * changing the prototype into a varargs one is risky as the implementation
5454 * would receive garbage in the third arg for calls providing only two
,
5455 * which libstdc
++ does. We simply provide an always inline overload for C
++
5458 * Both fcntl.h and ioLib.h might
"feature" such a prototype for _WRS_KERNEL.
5459 * The latter #includes the former
though (since
1992 according to the embedded
5460 * log
), so just leave ioLib.h alone.
5463 hackname
= vxworks_posix_open
;
5464 mach
= "*-*-vxworks*";
5467 select
= "extern int.*open \\(const char \\*[ a-z]*, int[ a-z]*, int[ a-z]*\\);";
5469 c_fix_arg
= << _EOArg_
5472 #if
defined(__cplusplus
)
5474 inline int
open (const char
*, int
) __attribute__((__always_inline__
));
5477 open (const char
*name
, int flags
)
5479 return
open (name
, flags
, 0);
5487 "extern int open (const char *, int, int);\n"
5488 "extern int open (const char *name, int flags, int mode );\n";
5492 * Another bad dependency in VxWorks
5.2 <time.h
>.
5495 hackname
= vxworks_time
;
5497 test
= " -r vxWorks.h";
5499 select
= "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
5503 "#ifndef __gcc_VOIDFUNCPTR_defined\n"
5504 "#ifdef __cplusplus\n"
5505 "typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
5507 "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
5509 "#define __gcc_VOIDFUNCPTR_defined\n"
5511 "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
5513 test_text
= "`touch vxWorks.h`"
5514 "#define VOIDFUNCPTR (void(*)())";
5518 * This hack makes write const
-correct on VxWorks
5521 hackname
= vxworks_write_const
;
5523 mach
= "*-*-vxworks*";
5526 c_fix_arg
= "extern int write (int, const char*, size_t);";
5527 c_fix_arg
= "extern[\t ]+int[\t ]+write[\t ]*\\("
5529 "[\t ]*char[\t ]*\\*[\t ]*,"
5530 "[\t ]*size_t[\t ]*\\)[\t ]*;";
5532 test_text
= "extern int write ( int , char * , size_t ) ;";
5536 * This hack ensures the include_next in the fixed unistd.h actually
5537 * finds the system
's unistd.h and not the fixed unistd.h again.
5540 hackname = vxworks_iolib_include_unistd;
5542 mach = "*-*-vxworks*";
5543 select = "#include \"unistd.h\"";
5546 c_fix_arg = "#include <unistd.h>";
5548 test_text = "#include \"unistd.h\"";
5552 * Make sure there is a visible prototype of sysClkRateGet() when
5553 * CLOCKS_PER_SEC is #defined to that in time.h for VxWorks. This would
5554 * typically be provided by sysLib.h.
5556 * The new #include has to come after the one for vxWorks.h in kernel headers
5557 * and vxWorks.h is typically not #included in RTP headers. yvals.h is
5558 * conditionally included in the latter, instead, and new #include are better
5559 * inserted after that.
5562 hackname = vxworks_time_h_syslib;
5564 mach = "*-*-vxworks*";
5565 select = "[ \t]*#define[ \t]+CLOCKS_PER_SEC[ \t]+sysClkRateGet.*";
5568 c_fix_arg = "%0\n#include <sysLib.h>";
5569 c_fix_arg = "#include <vxWorks.h>|#endif.* _YVALS.*";
5572 "/* kernel header pattern: */\n"
5573 "#include <vxWorks.h>\n"
5575 "/* rtp header pattern: */\n"
5577 "#include <yvals.h>\n"
5578 "#endif /* _YVALS */\n"
5580 "#define CLOCKS_PER_SEC sysClkRateGet()";
5584 * There are several name conflicts with C++ reserved words in X11 header
5585 * files. These are fixed in some versions, so don't do the fixes if
5586 * we find __cplusplus in the file. These were found on the RS
/6000.
5589 hackname
= x11_class
;
5590 files
= X11
/ShellP.h
;
5591 bypass
= __cplusplus
;
5592 select
= "^([ \t]*char \\*)class;(.*)";
5594 c_fix_arg
= "#ifdef __cplusplus\n%1c_class;%2\n"
5595 "#else\n%1class;%2\n#endif";
5603 * class in Xm
/BaseClassI.h
5606 hackname
= x11_class_usage
;
5607 files
= Xm
/BaseClassI.h
;
5608 bypass
= "__cplusplus";
5610 select
= " class\\)";
5612 c_fix_arg
= " c_class)";
5614 test_text
= "extern mumble (int class);\n";
5618 * new in Xm
/Traversal.h
5622 files
= Xm
/Traversal.h
;
5623 bypass
= __cplusplus
;
5625 sed
= "/Widget\told, new;/i\\\n"
5626 "#ifdef __cplusplus\\\n"
5627 "\\\tWidget\told, c_new;\\\n"
5630 sed
= "/Widget\told, new;/a\\\n"
5633 sed
= "s/Widget new,/Widget c_new,/g";
5636 " Widget\told, new;\n"
5637 "};\nextern Wedged( Widget new, Widget old );";
5641 * Incorrect sprintf declaration in X11
/Xmu.h
5644 hackname
= x11_sprintf
;
5646 files
= X11
/Xmu
/Xmu.h
;
5647 select
= "^extern char \\*\tsprintf\\(\\);$";
5650 c_fix_arg
= "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
5652 test_text
= "extern char *\tsprintf();";