3 autogen definitions fixincl
;
5 /* Define all the fixes we know about for repairing damaged headers.
6 Please see the README before adding or changing entries in this file.
8 This is the sort command
:
10 blocksort output
=inclhack.sorted \
12 trailer
='^/\*EOF\*[/]' \
14 key
=$
'hackname[ \t]*=[ \t]*(.*);'
16 Set up a debug test so we can make the templates emit special
17 code while debugging these fixes
: */
23 /* On AIX when _LARGE_FILES is defined stdio.h defines fopen to
24 * fopen64 etc. and this causes problems when building with g
++
25 * because cstdio udefs everything from stdio.h
, leaving us with
26 * ::fopen has not been declared errors. This fixes stdio.h to
27 * undef those defines and use __asm__ to alias the symbols if
28 * building with g
++ and
-D_LARGE_FILES
31 hackname
= AAB_aix_stdio
;
33 select
= "define fopen fopen64";
35 test
-text
= ''; /* no way to test
*/
41 c_fix_arg
= <<- _EOArg_
43 #if defined __GNUG__
&& defined _LARGE_FILES
&& defined __cplusplus
44 #define __need__aix_stdio_h_fix
45 #ifdef __need__aix_stdio_h_fix
52 /* Alias the symbols using asm
*/
54 extern int
fgetpos(FILE
*, fpos64_t *)
__asm__("fgetpos64");
55 extern FILE
*fopen(const char
*, const char *)
__asm__("fopen64");
56 extern FILE
*freopen(const char
*, const char
*, FILE *)
__asm__("freopen64");
57 extern int
fseeko(FILE
*, off64_t
, int
) __asm__("fseeko64");
58 extern int
fsetpos(FILE
*, const fpos64_t *)
__asm__("fsetpos64");
59 extern off64_t
ftello(FILE *)
__asm__("ftello64");
67 /* On AIX when _LARGE_FILES is defined fcntl.h defines open to
68 * open64 and creat to creat64. This fixes fcntl.h to
69 * undef those defines and use __asm__ to alias the symbols if
70 * building with g
++ and
-D_LARGE_FILES
73 hackname
= AAB_aix_fcntl
;
75 select
= "define open[ \t]open64";
77 test
-text
= ''; /* no way to test
*/
83 c_fix_arg
= <<- _EOArg_
85 #if defined __GNUG__
&& defined _LARGE_FILES
&& defined __cplusplus
86 #define __need__aix_fcntl_h_fix
87 #ifdef __need__aix_fcntl_h_fix
91 /* Alias the symbols using asm
*/
93 extern int
open(const char
*, int
, ...
) __asm__("open64");
94 extern int
creat(const char
*, mode_t
) __asm__("creat64");
95 #
if (_XOPEN_SOURCE
>= 700)
96 extern int
openat(int
, const char
*, int
, ...
) __asm__("open64at");
106 * On Mac OS
10.3.9, the
'long double' functions are available in
107 * libSystem
, but are not prototyped in math.h.
110 hackname
= AAB_darwin7_9_long_double_funcs
;
111 mach
= "*-*-darwin7.9*";
112 files
= architecture
/ppc
/math.h
;
114 replace
= <<- _EndOfHeader_
115 /* This file prototypes the long double functions available on Mac OS
119 # define __APPLE_CC__
1345
120 # include_next
<architecture
/ppc
/math.h
>
122 # define __APPLE_CC__
1
123 # ifndef __LIBMLDBL_COMPAT
124 # ifdef __LONG_DOUBLE_128__
125 # define
__LIBMLDBL_COMPAT(sym
) __asm("_" #sym
"$LDBL128")
127 # define
__LIBMLDBL_COMPAT(sym
)
128 # endif
/* __LONG_DOUBLE_128__
*/
129 # endif
/* __LIBMLDBL_COMPAT
*/
133 extern long double
acosl( long double
) __LIBMLDBL_COMPAT(acosl
);
134 extern long double
asinl( long double
) __LIBMLDBL_COMPAT(asinl
);
135 extern long double
atanl( long double
) __LIBMLDBL_COMPAT(atanl
);
136 extern long double
atan2l( long double
, long double
) __LIBMLDBL_COMPAT(atan2l
);
137 extern long double
cosl( long double
) __LIBMLDBL_COMPAT(cosl
);
138 extern long double
sinl( long double
) __LIBMLDBL_COMPAT(sinl
);
139 extern long double
tanl( long double
) __LIBMLDBL_COMPAT(tanl
);
140 extern long double
acoshl( long double
) __LIBMLDBL_COMPAT(acoshl
);
141 extern long double
asinhl( long double
) __LIBMLDBL_COMPAT(asinhl
);
142 extern long double
atanhl( long double
) __LIBMLDBL_COMPAT(atanhl
);
143 extern long double
coshl( long double
) __LIBMLDBL_COMPAT(coshl
);
144 extern long double
sinhl( long double
) __LIBMLDBL_COMPAT(sinhl
);
145 extern long double
tanhl( long double
) __LIBMLDBL_COMPAT(tanhl
);
146 extern long double
expl( long double
) __LIBMLDBL_COMPAT(expl
);
147 extern long double
exp2l( long double
) __LIBMLDBL_COMPAT(exp2l
);
148 extern long double
expm1l( long double
) __LIBMLDBL_COMPAT(expm1l
);
149 extern long double
logl( long double
) __LIBMLDBL_COMPAT(logl
);
150 extern long double
log10l( long double
) __LIBMLDBL_COMPAT(log10l
);
151 extern long double
log2l( long double
) __LIBMLDBL_COMPAT(log2l
);
152 extern long double
log1pl( long double
) __LIBMLDBL_COMPAT(log1pl
);
153 extern long double
logbl( long double
) __LIBMLDBL_COMPAT(logbl
);
154 extern long double
modfl( long double
, long double
* ) __LIBMLDBL_COMPAT(modfl
);
155 extern long double
ldexpl( long double
, int
) __LIBMLDBL_COMPAT(ldexpl
);
156 extern long double
frexpl( long double
, int
* ) __LIBMLDBL_COMPAT(frexpl
);
157 extern int
ilogbl( long double
) __LIBMLDBL_COMPAT(ilogbl
);
158 extern long double
scalbnl( long double
, int
) __LIBMLDBL_COMPAT(scalbnl
);
159 extern long double
scalblnl( long double
, long int
) __LIBMLDBL_COMPAT(scalblnl
);
160 extern long double
fabsl( long double
) __LIBMLDBL_COMPAT(fabsl
);
161 extern long double
cbrtl( long double
) __LIBMLDBL_COMPAT(cbrtl
);
162 extern long double
hypotl( long double
, long double
) __LIBMLDBL_COMPAT(hypotl
);
163 extern long double
powl( long double
, long double
) __LIBMLDBL_COMPAT(powl
);
164 extern long double
sqrtl( long double
) __LIBMLDBL_COMPAT(sqrtl
);
165 extern long double
erfl( long double
) __LIBMLDBL_COMPAT(erfl
);
166 extern long double
erfcl( long double
) __LIBMLDBL_COMPAT(erfcl
);
167 extern long double
lgammal( long double
) __LIBMLDBL_COMPAT(lgammal
);
168 extern long double
tgammal( long double
) __LIBMLDBL_COMPAT(tgammal
);
169 extern long double
ceill( long double
) __LIBMLDBL_COMPAT(ceill
);
170 extern long double
floorl( long double
) __LIBMLDBL_COMPAT(floorl
);
171 extern long double
nearbyintl( long double
) __LIBMLDBL_COMPAT(nearbyintl
);
172 extern long double
rintl( long double
) __LIBMLDBL_COMPAT(rintl
);
173 extern long int
lrintl( long double
) __LIBMLDBL_COMPAT(lrintl
);
174 extern long long int
llrintl( long double
) __LIBMLDBL_COMPAT(llrintl
);
175 extern long double
roundl( long double
) __LIBMLDBL_COMPAT(roundl
);
176 extern long int
lroundl( long double
) __LIBMLDBL_COMPAT(lroundl
);
177 extern long long int
llroundl( long double
) __LIBMLDBL_COMPAT(llroundl
);
178 extern long double
truncl( long double
) __LIBMLDBL_COMPAT(truncl
);
179 extern long double
fmodl( long double
, long double
) __LIBMLDBL_COMPAT(fmodl
);
180 extern long double
remainderl( long double
, long double
) __LIBMLDBL_COMPAT(remainderl
);
181 extern long double
remquol( long double
, long double
, int
* ) __LIBMLDBL_COMPAT(remquol
);
182 extern long double
copysignl( long double
, long double
) __LIBMLDBL_COMPAT(copysignl
);
183 extern long double
nanl( const char
* ) __LIBMLDBL_COMPAT(nanl
);
184 extern long double
nextafterl( long double
, long double
) __LIBMLDBL_COMPAT(nextafterl
);
185 extern long double
nexttowardl( long double
, long double
) __LIBMLDBL_COMPAT(nexttowardl
);
186 extern long double
fdiml( long double
, long double
) __LIBMLDBL_COMPAT(fdiml
);
187 extern long double
fmaxl( long double
, long double
) __LIBMLDBL_COMPAT(fmaxl
);
188 extern long double
fminl( long double
, long double
) __LIBMLDBL_COMPAT(fminl
);
189 extern long double
fmal( long double
, long double
, long double
) __LIBMLDBL_COMPAT(fmal
);
193 #endif
/* __MATH__
*/
198 * This fixes __FD_ZERO bug for linux
2.x.
y (x
<= 2 && y
<= some n
)
201 hackname
= AAB_fd_zero_asm_posix_types_h
;
202 files
= asm
/posix_types.h
;
203 mach
= 'i[34567]86-*-linux*';
206 bypass
= 'posix_types_64';
209 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper
, not
210 * the start
, so that if #include_next gets another instance of
211 * the wrapper
, this will follow the #include_next chain until
212 * we arrive at the real
<asm
/posix_types.h
>.
214 replace
= <<- _EndOfHeader_
215 /* This file fixes a bug in the __FD_ZERO macro
216 for older versions of the Linux kernel.
*/
217 #ifndef _POSIX_TYPES_H_WRAPPER
218 #include
<features.h
>
219 #include_next
<asm
/posix_types.h
>
221 #if
defined(__FD_ZERO
) && !defined(__GLIBC__
)
223 #define
__FD_ZERO(fdsetp
) \
226 __asm__
__volatile__("cld ; rep ; stosl" \
227 : "=&c" (__d0
), "=&D" (__d1
) \
228 : "a" (0), "0" (__FDSET_LONGS
), \
229 "1" ((__kernel_fd_set *)
(fdsetp
)) :"memory"); \
233 #define _POSIX_TYPES_H_WRAPPER
234 #endif
/* _POSIX_TYPES_H_WRAPPER
*/
239 * This fixes __FD_ZERO bug for glibc
-1.x
242 hackname
= AAB_fd_zero_gnu_types_h
;
244 mach
= 'i[34567]86-*-linux*';
247 * Define _TYPES_H_WRAPPER at the end of the wrapper
, not
248 * the start
, so that if #include_next gets another instance of
249 * the wrapper
, this will follow the #include_next chain until
250 * we arrive at the real
<gnu
/types.h
>.
252 replace
= <<- _EndOfHeader_
253 /* This file fixes a bug in the __FD_ZERO macro present in glibc
1.x.
*/
254 #ifndef _TYPES_H_WRAPPER
255 #include
<features.h
>
256 #include_next
<gnu
/types.h
>
258 #if
defined(__FD_ZERO
) && !defined(__GLIBC__
)
260 # define
__FD_ZERO(fdsetp
) \
263 __asm__
__volatile__("cld ; rep ; stosl" \
264 : "=&c" (__d0
), "=&D" (__d1
) \
265 : "a" (0), "0" (__FDSET_LONGS
), \
266 "1" ((__fd_set *)
(fdsetp
)) :"memory"); \
270 #define _TYPES_H_WRAPPER
271 #endif
/* _TYPES_H_WRAPPER
*/
276 * This fixes __FD_ZERO bug for glibc
-2.0.x
279 hackname
= AAB_fd_zero_selectbits_h
;
280 files
= selectbits.h
;
281 mach
= 'i[34567]86-*-linux*';
284 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper
, not
285 * the start
, so that if #include_next gets another instance of
286 * the wrapper
, this will follow the #include_next chain until
287 * we arrive at the real
<selectbits.h
>.
289 replace
= <<- _EndOfHeader_
290 /* This file fixes a bug in the __FD_ZERO macro present in glibc
2.0.x.
*/
291 #ifndef _SELECTBITS_H_WRAPPER
292 #include
<features.h
>
293 #include_next
<selectbits.h
>
295 #if
defined(__FD_ZERO
) && defined(__GLIBC__
) \\
296 && defined(__GLIBC_MINOR__
) && __GLIBC__
== 2 \\
297 && __GLIBC_MINOR__
== 0
299 #define
__FD_ZERO(fdsetp
) \\
302 __asm__
__volatile__ ("cld; rep; stosl" \\
303 : "=&c" (__d0
), "=&D" (__d1
) \\
304 : "a" (0), "0" (sizeof (__fd_set
) \\
305 / sizeof (__fd_mask
)), \\
306 "1" ((__fd_mask *)
(fdsetp
)) \\
311 #define _SELECTBITS_H_WRAPPER
312 #endif
/* _SELECTBITS_H_WRAPPER
*/
317 * Solaris
<sys
/varargs.h
> is a
DDK (aka kernel
-land
) header providing
318 * the same interface as
<stdarg.h
>. No idea why they couldn
't have just
319 * used the standard header.
322 hackname = AAB_solaris_sys_varargs_h;
323 files = "sys/varargs.h";
324 mach = '*-*-solaris
*';
325 replace = <<- _EndOfHeader_
335 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
336 * declaration on Sun OS
4.x. We must only fix this on Sun OS
4.x
, because
337 * many other systems have similar text but correct versions of the file.
338 * To ensure only Sun
's is fixed, we grep for a likely unique string.
339 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
342 hackname = AAB_sun_memcpy;
344 select = "/\\*\t@\\(#\\)"
345 "(head/memory.h\t50.1\t "
346 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
348 replace = <<- _EndOfHeader_
349 /* This file was generated by fixincludes */
354 extern void *memccpy();
355 extern void *memchr();
356 extern void *memcpy();
357 extern void *memset();
359 extern char *memccpy();
360 extern char *memchr();
361 extern char *memcpy();
362 extern char *memset();
363 #endif /* __STDC__ */
367 #endif /* __memory_h__ */
372 * Fix assert.h on VxWorks:
375 hackname = AAB_vxworks_assert;
377 mach = "*-*-vxworks*";
379 replace = <<- _EndOfHeader_
391 #if defined(__STDC__) || defined(__cplusplus)
392 extern void __assert (const char*);
394 extern void __assert ();
398 #define assert(ign) ((void)0)
401 #define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str)
402 #define ASSERT_STRINGIFY_HELPER(str) #str
404 #define assert(test) ((void) \
405 ((test) ? ((void)0) : \
406 __assert("Assertion failed: " #test ", file " \
407 __FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
418 * Add needed include to regs.h (NOT the gcc header) on VxWorks
422 hackname = AAB_vxworks_regs_vxtypes;
424 mach = "*-*-vxworks*";
426 replace = <<- _EndOfHeader_
429 /* regs.h depends on CPU_FAMILY being properly defined, which
430 is done by vxCpu.h. */
431 #include <types/vxCpu.h>
432 /* regs.h includes a CPU_FAMILY-specific header that requires
433 vxTypesOld.h to already have been included. Those headers
434 contain proper _ASMLANGUAGE guards around their typedefs,
435 but vxTypesOld.h itself does not. So we avoid including
436 vxTypesOld.h from assembly. */
438 #include <types/vxTypesOld.h>
440 #include_next <arch/../regs.h>
446 * This hack makes makes unistd.h more POSIX-compliant on VxWorks
449 hackname = AAB_vxworks_unistd;
451 mach = "*-*-vxworks*";
453 replace = <<- _EndOfHeader_
456 #include_next <unistd.h>
459 #define STDIN_FILENO 0
461 #ifndef STDOUT_FILENO
462 #define STDOUT_FILENO 1
464 #ifndef STDERR_FILENO
465 #define STDERR_FILENO 2
467 #endif /* _UNISTD_H */
472 * assert.h on AIX 7 redefines static_assert as _Static_assert without
476 hackname = aix_assert;
479 select = "#define[ \t]static_assert[ \t]_Static_assert";
481 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
482 test_text = "#define static_assert _Static_assert";
486 * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
487 * which only is provided by AIX xlc C99.
490 hackname = aix_complex;
493 select = "#define[ \t]_Complex_I[ \t]__I";
495 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
496 test_text = "#define _Complex_I __I\n";
500 * On AIX some headers are not properly guarded by 'extern
"C"'.
503 hackname = aix_externc;
509 files = sys/localedef.h;
511 bypass = "extern \"C\"";
513 c_fix_arg = "#ifdef __cplusplus\n"
516 c_fix_arg = "#ifdef __cplusplus\n"
519 test_text = "extern int __n_pthreads;\n";
523 * On AIX sys/socket.h assumes C++.
526 hackname = aix_externcpp1;
528 files = "sys/socket.h";
529 select = "#ifdef __cplusplus";
531 c_fix_arg = "#ifdef __cplusplus\n"
533 test_text = "#ifdef __cplusplus";
538 hackname = aix_externcpp2;
540 files = "sys/socket.h";
541 select = "#else /\\* __cplusplus \\*/";
543 c_fix_arg = "} /* extern \"C++\" */\n"
544 "#else /* __cplusplus */";
545 test_text = "#else /* __cplusplus */";
550 * malloc.h on AIX6 uses XLC++ specific builtin syntax
553 hackname = aix_malloc;
556 select = "#ifdef __cplusplus";
558 c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
559 test_text = "#ifdef __cplusplus";
563 * net/if_arp.h defines a variable fc_softc instead of adding a
564 * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
567 hackname = aix_net_if_arp;
569 files = "net/if_arp.h";
570 select = "^struct fc_softc \\{";
572 c_fix_arg = "typedef struct _fc_softc {";
573 test_text = "struct fc_softc {\n int a;\n};";
577 * Fix AIX definition of NULL for G++.
582 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
583 time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h;
585 select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*";
587 c_fix_arg = <<- _EOFix_
592 #else /* ! __GNUG__ */
594 #endif /* __GNUG__ */
595 #else /* ! __cplusplus */
596 #define NULL ((void *)0)
597 #endif /* __cplusplus */
600 test_text = "# define\tNULL \t(0L) /* typed NULL */";
604 * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER,
605 * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough
609 hackname = aix_once_init_1;
612 select = "#define[ \t]PTHREAD_ONCE_INIT \\\\\n"
615 c_fix_arg = "#define PTHREAD_ONCE_INIT \\\n"
617 test_text = "#define PTHREAD_ONCE_INIT \\\\\n"
622 hackname = aix_once_init_2;
625 select = "[ \t]0 \\\\\n"
628 c_fix_arg = " 0 \\\n"
630 test_text = " 0 \\\\\n"
635 hackname = aix_mutex_initializer_1;
638 select = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n"
641 c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n"
643 test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
648 hackname = aix_cond_initializer_1;
651 select = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n"
654 c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n"
656 test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n"
661 hackname = aix_rwlock_initializer_1;
664 select = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n"
667 c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n"
669 test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
674 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
675 * which violates a requirement of ISO C.
678 hackname = aix_pthread;
680 select = "(#define[\t ][A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
683 test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
684 "{...init stuff...}";
688 * AIX stdint.h fixes.
691 hackname = aix_stdint_1;
693 files = stdint-aix.h, stdint.h;
694 select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
695 "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
697 c_fix_arg = "#define UINT8_MAX (255)\n"
698 "#define UINT16_MAX (65535)";
699 test_text = "#define UINT8_MAX (255U)\n"
700 "#define UINT16_MAX (65535U)";
707 hackname = aix_stdint_2;
709 files = stdint-aix.h, stdint.h;
710 select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
711 "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
712 "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
714 "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
715 "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
716 "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
718 c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
719 "#define INTPTR_MAX 9223372036854775807L\n"
720 "#define UINTPTR_MAX 18446744073709551615UL\n"
722 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
723 "#define INTPTR_MAX 2147483647L\n"
724 "#define UINTPTR_MAX 4294967295UL";
725 test_text = "#define INTPTR_MIN INT64_MIN\n"
726 "#define INTPTR_MAX INT64_MAX\n"
727 "#define UINTPTR_MAX UINT64_MAX\n"
729 "#define INTPTR_MIN INT32_MIN\n"
730 "#define INTPTR_MAX INT32_MAX\n"
731 "#define UINTPTR_MAX UINT32_MAX";
738 hackname = aix_stdint_3;
740 files = stdint-aix.h, stdint.h;
741 select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
742 "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
744 "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
745 "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
747 c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
748 "#define PTRDIFF_MAX 9223372036854775807L\n"
750 "#define PTRDIFF_MIN (-2147483647L - 1)\n"
751 "#define PTRDIFF_MAX 2147483647L";
752 test_text = "#define PTRDIFF_MIN INT64_MIN\n"
753 "#define PTRDIFF_MAX INT64_MAX\n"
755 "#define PTRDIFF_MIN INT32_MIN\n"
756 "#define PTRDIFF_MAX INT32_MAX";
763 hackname = aix_stdint_4;
765 files = stdint-aix.h, stdint.h;
766 select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
768 "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
770 c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
772 "#define SIZE_MAX 4294967295UL";
773 test_text = "#define SIZE_MAX UINT64_MAX\n"
775 "#define SIZE_MAX UINT32_MAX";
782 hackname = aix_stdint_5;
784 files = stdint-aix.h, stdint.h;
785 select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
786 "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
788 c_fix_arg = "#define UINT8_C(c) c\n"
789 "#define UINT16_C(c) c";
790 test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
791 "#define UINT16_C(c) __CONCAT__(c,U)";
795 * stdio.h on AIX defines ferror, clearerr and feof as C++ inline, which
796 produces wrong code with G++.
799 hackname = aix_stdio_inline;
802 select = "#ifdef __cplusplus\\\n"
806 c_fix_arg = "#ifdef __cplusplus\n"
809 "#if (defined(__cplusplus) && defined(__IBMCPP__))\n"
811 test_text = "#ifdef __cplusplus\n}\n\n#ifdef ferror";
815 * stdlib.h on AIX uses #define on malloc and friends.
818 hackname = aix_stdlib_malloc;
821 select = "#define[ \t]+malloc[ \t]+__linux_malloc";
823 c_fix_arg = "extern void *malloc(size_t) __asm__(\"__linux_malloc\");";
824 test_text = "#define malloc __linux_malloc";
828 hackname = aix_stdlib_realloc;
831 select = "#define[ \t]+realloc[ \t]+__linux_realloc";
833 c_fix_arg = "extern void *realloc(void *, size_t) __asm__(\"__linux_realloc\");";
834 test_text = "#define realloc __linux_realloc";
838 hackname = aix_stdlib_calloc;
841 select = "#define[ \t]+calloc[ \t]+__linux_calloc";
843 c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"__linux_calloc\");";
844 test_text = "#define calloc __linux_calloc";
848 hackname = aix_stdlib_valloc;
851 select = "#define[ \t]+valloc[ \t]+__linux_valloc";
853 c_fix_arg = "extern void *valloc(size_t) __asm__(\"__linux_valloc\");";
854 test_text = "#define valloc __linux_valloc";
858 hackname = aix_stdlib_vec_malloc;
861 select = "#define[ \t]+malloc[ \t]+vec_malloc";
863 c_fix_arg = "extern void *malloc(size_t) __asm__(\"vec_malloc\");";
864 test_text = "#define malloc vec_malloc";
868 hackname = aix_stdlib_vec_calloc;
871 select = "#define[ \t]+calloc[ \t]+vec_calloc";
873 c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"vec_calloc\");";
874 test_text = "#define calloc vec_calloc";
878 * stdlib.h on AIX 4.3 declares strtof() with a non-const first argument.
881 hackname = aix_strtof_const;
884 select = "((extern[ \t]+)?float[ \t]+strtof)\\(char \\*, char \\*\\*\\);";
886 c_fix_arg = "%1(const char *, char **);";
887 test_text = "extern float strtof(char *, char **);";
891 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
892 * in an otherwise harmless (and #ifed out) macro definition
895 hackname = aix_sysmachine;
897 files = sys/machine.h;
901 test_text = "#define FOO \\\n"
902 " bar \\ \n baz \\ \n bat";
906 * sys/wait.h on AIX 5.2 defines macros that have both signed and
907 * unsigned types in conditional expressions.
910 hackname = aix_syswait_2;
913 select = '\? (\
(\
(\
(\
(unsigned
[^
)]*\
)[^
)]*\
) >> [^
)]*\
) \
& 0xff\
) : -1)';
915 c_fix_arg = "? (int)%1";
916 test_text = "#define WSTOPSIG(__x) "
917 "(int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
921 * sys/signal.h on some versions of AIX uses volatile in the typedef of
922 * sig_atomic_t, which causes gcc to generate a warning about duplicate
923 * volatile when a sig_atomic_t variable is declared volatile, as
924 * required by ANSI C.
927 hackname = aix_volatile;
929 files = sys/signal.h;
930 select = "typedef volatile int sig_atomic_t";
932 c_fix_arg = "typedef int sig_atomic_t";
933 test_text = "typedef volatile int sig_atomic_t;";
937 * AIX unistd.h defines a static function with an empty parameter list.
940 hackname = aix_unistd;
944 select = "[ \t]+static[ \t]+int[ \t]+getdtablesize\\(\\)";
946 c_fix_arg = "\tstatic int\t\tgetdtablesize(void)";
947 test_text = " static int getdtablesize()";
951 * Fix __assert declaration in assert.h on Alpha OSF/1.
954 hackname = alpha___assert;
956 select = '__assert\
(char \
*, char \
*, int\
)';
958 c_fix_arg = "__assert(const char *, const char *, int)";
959 test_text = 'extern void
__assert(char
*, char
*, int
);';
963 * Fix assert macro in assert.h on Alpha OSF/1.
964 * The superfluous int cast breaks C++.
967 hackname = alpha_assert;
969 select = "(#[ \t]*" 'define assert\
(EX\
).*)\
(\
(int\
) \
(EX\
)\
)';
971 c_fix_arg = "%1(EX)";
972 test_text = '#define
assert(EX
) (((int
) (EX
)) ?
(void
)0 '
973 ': __assert(#EX
, __FILE__
, __LINE__
))';
977 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
980 hackname = alpha_getopt;
983 select = 'getopt\
(int
, char \
*\
[\
], *char \
*\
)';
985 c_fix_arg = "getopt(int, char *const[], const char *)";
986 test_text = 'extern int
getopt(int
, char
*[], char *)
;';
990 * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
993 hackname = alpha_if_semicolon;
995 select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
997 c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
998 test_text = ' struct sockaddr vmif_paddr
/* protocol address
*/';
1002 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
1005 hackname = alpha_parens;
1007 select = '#ifndef\
(__mips64\
)';
1009 c_fix_arg = "#ifndef __mips64";
1010 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
1014 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
1018 hackname = alpha_sbrk;
1020 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
1022 c_fix_arg = "void *sbrk(";
1023 test_text = "extern char* sbrk(ptrdiff_t increment);";
1027 * For C++, avoid any typedef or macro definition of bool,
1028 * and use the built in type instead.
1029 * HP/UX 10.20 also has it in curses_colr/curses.h.
1032 hackname = avoid_bool_define;
1034 files = curses_colr/curses.h;
1038 select = "#[ \t]*define[ \t]+bool[ \t]";
1039 bypass = "__cplusplus";
1042 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1043 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
1045 test_text = "# define bool\t char \n";
1052 hackname = avoid_bool_type;
1054 files = curses_colr/curses.h;
1058 select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
1059 bypass = "__cplusplus";
1062 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1064 test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
1068 * For C++, avoid any typedef definition of wchar_t,
1069 * and use the built in type instead.
1070 * Don't do this for headers that are smart enough to do the right
1071 * thing (recent
[n
]curses.h and Xlib.h
).
1072 * Don
't do it for <linux/nls.h> which is never used from C++ anyway,
1073 * and will be broken by the edit.
1077 hackname = avoid_wchar_t_type;
1079 select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
1080 bypass = "__cplusplus";
1081 bypass = "_LINUX_NLS_H";
1082 bypass = "XFree86: xc/lib/X11/Xlib\\.h";
1085 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1087 test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
1091 * Fix `typedef struct term;' on hppa1.1
-hp
-hpux9.
1094 hackname
= bad_struct_term
;
1096 select
= "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
1098 c_fix_arg
= "struct term;";
1100 test_text
= 'typedef struct term;';
1104 * Fix one other error in this file
:
1105 * a mismatched quote not inside a C comment.
1108 hackname
= badquote
;
1109 files
= sundev
/vuid_event.h
;
1112 c_fix_arg
= "does not";
1114 test_text
= "/* doesn't have matched single quotes */";
1118 * check for broken assert.h that needs stdio.h
1121 hackname
= broken_assert_stdio
;
1124 bypass
= "include.*stdio\\.h";
1126 c_fix_arg
= "#include <stdio.h>\n";
1127 test_text
= "extern FILE* stderr;";
1131 * check for broken assert.h that needs stdlib.h
1134 hackname
= broken_assert_stdlib
;
1136 select
= 'exit *\(|abort *\(';
1137 bypass
= "include.*stdlib\\.h";
1139 c_fix_arg
= "#ifdef __cplusplus\n"
1140 "#include <stdlib.h>\n"
1142 test_text
= "extern void exit ( int );";
1146 * Remove `extern double cabs
' declarations from math.h.
1147 * This conflicts with C99. Discovered on AIX.
1148 * Darwin hides its broken cabs in architecture-specific subdirs.
1151 hackname = broken_cabs;
1152 files = math.h, "architecture/*/math.h";
1153 select = "^extern[ \t]+double[ \t]+cabs";
1155 sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
1156 sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
1158 test_text = "#ifdef __STDC__\n"
1159 "extern double cabs(struct dbl_hypot);\n"
1161 "extern double cabs();\n"
1163 "extern double cabs ( _Complex z );";
1167 * Fixup Darwin's broken check for __builtin_nanf.
1170 hackname
= broken_nan
;
1172 * It is tempting to omit the first
"files" entry. Do not.
1173 * The testing machinery will take the first
"files" entry as the name
1174 * of a test file to play with. It would be a nuisance to have a directory
1175 * with the name
"*".
1177 files
= "architecture/ppc/math.h";
1178 files
= "architecture/*/math.h";
1179 select
= '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)';
1182 c_fix_arg
= "#if 1";
1183 test_text
= "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
1187 * Various systems derived from BSD4.4 contain a macro definition
1188 * for vfscanf that interacts badly with requirements of builtin
-attrs.def.
1189 * Known to be fixed in FreeBSD
5 system headers.
1192 hackname
= bsd_stdio_attrs_conflict
;
1194 mach
= "*-*-*darwin*";
1196 select
= "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
1198 c_fix_arg
= '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n"
1199 '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n"
1200 'int vfscanf(FILE *, const char *, __builtin_va_list) '
1201 '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");';
1202 test_text
= '#define vfscanf __svfscanf';
1206 * Fix various macros used to define ioctl numbers.
1207 * The traditional syntax was
:
1209 * #define
_CTRL(n
, x
) (('n'<<8)+x
)
1210 * #define TCTRLCFOO
_CTRL(T
, 1)
1212 * but this does not work with the C standard
, which disallows macro
1213 * expansion inside strings. We have to rewrite it thus
:
1215 * #define
_CTRL(n
, x
) ((n
<<8)+x
)
1216 * #define TCTRLCFOO
_CTRL('T', 1)
1218 * The select expressions match too much
, but the c_fix code is cautious.
1220 * CTRL might be
: CTRL _CTRL ISCTRL BSD43_CTRL ...
1223 hackname
= ctrl_quotes_def
;
1224 select
= "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
1225 c_fix
= char_macro_def
;
1229 * This is two tests in order to ensure that the
"CTRL(c)" can
1230 * be selected in isolation from the multi
-arg format
1232 test_text
= "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n";
1233 test_text
= "#define _CTRL(c) ('c'&037)";
1237 * Fix various macros used to define ioctl numbers.
1240 hackname
= ctrl_quotes_use
;
1241 select
= "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1242 c_fix
= char_macro_use
;
1244 test_text
= "#define TCTRLFOO BSD43_CTRL(T, 1)";
1248 * sys
/mman.h on HP
/UX is not C
++ ready
,
1249 * even though NO_IMPLICIT_EXTERN_C is defined on HP
/UX.
1251 * rpc
/types.h on OSF1
/2.0 is not C
++ ready
,
1252 * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
1254 * The problem is the declaration of malloc.
1257 hackname
= cxx_unready
;
1259 files
= rpc
/types.h
;
1260 select
= '[^#]+malloc.*;'; /* Catch any form of declaration
1261 not within a macro.
*/
1262 bypass
= '"C"|__BEGIN_DECLS';
1265 c_fix_arg
= "#ifdef __cplusplus\n"
1268 c_fix_arg
= "#ifdef __cplusplus\n"
1271 test_text
= "extern void* malloc( size_t );";
1275 * macOS
10.12 <AvailabilityInternal.h
> uses
__attribute__((availability
))
1279 hackname
= darwin_availabilityinternal
;
1280 mach
= "*-*-darwin*";
1281 files
= AvailabilityInternal.h
;
1282 select
= "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*";
1284 c_fix_arg
= <<- _EOFix_
1285 #if
defined(__has_attribute
)
1286 #if
__has_attribute(availability
)
1296 test_text
= "#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))\n"
1297 "#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))";
1301 * For the AAB_darwin7_9_long_double_funcs fix to be useful
,
1302 * you have to not use
"" includes.
1305 hackname
= darwin_9_long_double_funcs_2
;
1306 mach
= "*-*-darwin7.9*";
1308 select
= '#include[ \t]+\"';
1310 c_fix_arg
= "%1<%2.h>";
1312 c_fix_arg
= '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
1314 test_text
= '#include "architecture/ppc/math.h"';
1318 * On darwin8 and earlier
, mach
-o
/swap.h isn
't properly guarded
1319 * by 'extern
"C"'. On darwin7 some mach/ headers aren't properly guarded.
1322 hackname
= darwin_externc
;
1323 mach
= "*-*-darwin*";
1324 files
= mach
-o
/swap.h
;
1325 files
= mach
/mach_time.h
;
1326 files
= mach
/mach_traps.h
;
1327 files
= mach
/message.h
;
1329 files
= mach
/semaphore.h
;
1330 bypass
= "extern \"C\"";
1331 bypass
= "__BEGIN_DECLS";
1333 c_fix_arg
= "#ifdef __cplusplus\n"
1336 c_fix_arg
= "#ifdef __cplusplus\n"
1339 test_text
= "extern void swap_fat_header();\n";
1343 * AvailabilityMacros.h on Darwin breaks with GCC
4.0, because of
1344 * bad __GNUC__ tests.
1347 hackname
= darwin_gcc4_breakage
;
1348 mach
= "*-*-darwin*";
1349 files
= AvailabilityMacros.h
;
1350 select
= "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
1352 c_fix_arg
= "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
1353 test_text
= "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
1354 "(__GNUC_MINOR__ >= 1)\n";
1358 * Before Mac OS X
10.8 <i386
/setjmp.h
> doesn
't mark longjump noreturn.
1361 hackname = darwin_longjmp_noreturn;
1362 mach = "*-*-darwin*";
1363 files = "i386/setjmp.h";
1365 select = "(.*longjmp\\(.*jmp_buf.*[^)]+\\));";
1367 c_fix_arg = "%1 __attribute__ ((__noreturn__));";
1369 test_text = "void siglongjmp(sigjmp_buf, int);";
1373 * Mac OS X 10.11 <os/trace.h> uses attribute on function definition.
1376 hackname = darwin_os_trace_1;
1377 mach = "*-*-darwin*";
1379 select = "^(_os_trace_verify_printf.*) (__attribute__.*)";
1382 test_text = "_os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2)))";
1386 * Mac OS X 10.1[012] <os/trace.h> os_trace_payload_t typedef uses Blocks
1387 * extension without guard.
1390 hackname = darwin_os_trace_2;
1391 mach = "*-*-darwin*";
1393 select = "typedef.*\\^os_trace_payload_t.*";
1395 c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
1396 test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);";
1400 * In Mac OS X 10.1[012] <os/trace.h>, need to guard users of
1401 * os_trace_payload_t typedef, too.
1404 hackname = darwin_os_trace_3;
1405 mach = "*-*-darwin*";
1407 select = <<- _EOSelect_
1411 _os_trace.*os_trace_payload_t payload);
1414 c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
1415 test_text = <<- _EOText_
1416 __API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0))
1417 OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED
1419 _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload);
1421 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0)
1422 OS_EXPORT OS_NOTHROW
1424 _os_trace_internal(void *dso, uint8_t type, const char *format, const uint8_t *buf, size_t buf_size, os_trace_payload_t payload);
1429 * __private_extern__ doesn't exist in FSF GCC. Even if it did
,
1430 * why would you ever put it in a system header file?
1433 hackname
= darwin_private_extern
;
1434 mach
= "*-*-darwin*";
1435 files
= mach
-o
/dyld.h
;
1436 select
= "__private_extern__ [a-z_]+ _dyld_";
1438 c_fix_arg
= "extern";
1439 c_fix_arg
= "__private_extern__";
1440 test_text
= "__private_extern__ int _dyld_func_lookup(\n"
1441 "const char *dyld_func_name,\n"
1442 "unsigned long *address);\n";
1446 * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
1447 * unsigned constants.
1450 hackname
= darwin_stdint_1
;
1451 mach
= "*-*-darwin*";
1452 files
= stdint
-darwin.h
, stdint.h
;
1454 c_fix_arg
= "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
1455 select
= "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
1456 "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
1457 test_text
= "#define UINT8_C(v) (v ## U)\n"
1458 "#define UINT16_C(v) (v ## U)";
1462 * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
1466 hackname
= darwin_stdint_2
;
1467 mach
= "*-*-darwin*";
1468 files
= stdint
-darwin.h
, stdint.h
;
1470 c_fix_arg
= "#if __WORDSIZE == 64\n"
1471 "#define INTPTR_MAX 9223372036854775807L\n"
1472 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1474 "#define INTPTR_MAX 2147483647L\n"
1475 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1477 select
= "#if __WORDSIZE == 64\n"
1478 "#define INTPTR_MIN[ \t]+INT64_MIN\n"
1479 "#define INTPTR_MAX[ \t]+INT64_MAX\n"
1481 "#define INTPTR_MIN[ \t]+INT32_MIN\n"
1482 "#define INTPTR_MAX[ \t]+INT32_MAX\n"
1484 test_text
= "#if __WORDSIZE == 64\n"
1485 "#define INTPTR_MIN INT64_MIN\n"
1486 "#define INTPTR_MAX INT64_MAX\n"
1488 "#define INTPTR_MIN INT32_MIN\n"
1489 "#define INTPTR_MAX INT32_MAX\n"
1494 * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
1497 hackname
= darwin_stdint_3
;
1498 mach
= "*-*-darwin*";
1499 files
= stdint
-darwin.h
, stdint.h
;
1501 c_fix_arg
= "#if __WORDSIZE == 64\n"
1502 "#define UINTPTR_MAX 18446744073709551615UL\n"
1504 "#define UINTPTR_MAX 4294967295UL\n"
1506 select
= "#if __WORDSIZE == 64\n"
1507 "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
1509 "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
1511 test_text
= "#if __WORDSIZE == 64\n"
1512 "#define UINTPTR_MAX UINT64_MAX\n"
1514 "#define UINTPTR_MAX UINT32_MAX\n"
1519 * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
1522 hackname
= darwin_stdint_4
;
1523 mach
= "*-*-darwin*";
1524 files
= stdint
-darwin.h
, stdint.h
;
1526 c_fix_arg
= "#if __WORDSIZE == 64\n"
1527 "#define SIZE_MAX 18446744073709551615UL\n"
1529 "#define SIZE_MAX 4294967295UL\n"
1531 select
= "#if __WORDSIZE == 64\n"
1532 "#define SIZE_MAX[ \t]+UINT64_MAX\n"
1534 "#define SIZE_MAX[ \t]+UINT32_MAX\n"
1536 test_text
= "#if __WORDSIZE == 64\n"
1537 "#define SIZE_MAX UINT64_MAX\n"
1539 "#define SIZE_MAX UINT32_MAX\n"
1544 * Darwin headers have a stdint.h that defines
{U
,}INTMAX_
{MIN,MAX}
1545 * with a wrong type.
1548 hackname
= darwin_stdint_5
;
1549 mach
= "*-*-darwin*";
1550 files
= stdint
-darwin.h
, stdint.h
;
1552 c_fix_arg
= "#if __WORDSIZE == 64\n"
1553 "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
1554 "#define INTMAX_MAX 9223372036854775807L\n"
1555 "#define UINTMAX_MAX 18446744073709551615UL\n"
1557 "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
1558 "#define INTMAX_MAX 9223372036854775807LL\n"
1559 "#define UINTMAX_MAX 18446744073709551615ULL\n"
1561 select
= "#define INTMAX_MIN[ \t]+INT64_MIN\n"
1562 "#define INTMAX_MAX[ \t]+INT64_MAX\n"
1564 "#define UINTMAX_MAX[ \t]+UINT64_MAX";
1565 test_text
= "#define INTMAX_MIN INT64_MIN\n"
1566 "#define INTMAX_MAX INT64_MAX\n"
1568 "#define UINTMAX_MAX UINT64_MAX";
1572 * Darwin headers have a stdint.h that defines
{U
,}INTMAX_C
1573 * with a wrong type.
1576 hackname
= darwin_stdint_6
;
1577 mach
= "*-*-darwin*";
1578 files
= stdint
-darwin.h
, stdint.h
;
1580 c_fix_arg
= "#if __WORDSIZE == 64\n"
1581 "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
1582 "#define PTRDIFF_MAX 9223372036854775807L\n"
1584 "#define PTRDIFF_MIN (-2147483647 - 1)\n"
1585 "#define PTRDIFF_MAX 2147483647\n"
1587 select
= "#if __WORDSIZE == 64\n"
1588 "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
1589 "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
1591 "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
1592 "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
1594 test_text
= "#if __WORDSIZE == 64\n"
1595 "#define PTRDIFF_MIN INT64_MIN\n"
1596 "#define PTRDIFF_MAX INT64_MAX\n"
1598 "#define PTRDIFF_MIN INT32_MIN\n"
1599 "#define PTRDIFF_MAX INT32_MAX\n"
1604 * Darwin headers have a stdint.h that defines
{U
,}INTMAX_C
1605 * with a wrong type.
1608 hackname
= darwin_stdint_7
;
1609 mach
= "*-*-darwin*";
1610 files
= stdint
-darwin.h
, stdint.h
;
1612 c_fix_arg
= "#if __WORDSIZE == 64\n"
1613 "#define INTMAX_C(v) (v ## L)\n"
1614 "#define UINTMAX_C(v) (v ## UL)\n"
1616 "#define INTMAX_C(v) (v ## LL)\n"
1617 "#define UINTMAX_C(v) (v ## ULL)\n"
1619 select
= "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
1620 "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
1621 test_text
= "#define INTMAX_C(v) (v ## LL)\n"
1622 "#define UINTMAX_C(v) (v ## ULL)";
1625 /* The SDK included with XCode
10.2 has the file
<sys
/ucred.h
> that uses the
1626 C11 _Atomic
keyword (exposing it to C
++ code
). The work
-around here follows
1627 the header in declaring the entity volatile when _Atomic is not available.
1630 hackname
= darwin_ucred__Atomic
;
1631 mach
= "*-*-darwin*";
1632 files
= sys
/ucred.h
;
1635 c_fix_arg
= "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n"
1636 "# define _Atomic volatile\n"
1638 c_fix_arg
= "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n"
1641 test_text
= ""; /* Don
't provide this for wrap fixes. */
1645 * Fix <c_asm.h> on Digital UNIX V4.0:
1646 * It contains a prototype for a DEC C internal asm() function,
1647 * clashing with gcc's asm keyword. So protect this with __DECC.
1650 hackname
= dec_intern_asm
;
1652 sed
= "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1653 sed
= "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
1657 " ... asm stuff ...\n"
1658 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
1662 * Fix typo in
<wchar.h
> on DJGPP
2.03.
1665 hackname
= djgpp_wchar_h
;
1667 select
= "__DJ_wint_t";
1668 bypass
= "sys/djtypes.h";
1670 c_fix_arg
= "%0\n#include <sys/djtypes.h>";
1671 c_fix_arg
= "#include <stddef.h>";
1672 test_text
= "#include <stddef.h>\n"
1673 "extern __DJ_wint_t x;\n";
1677 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1680 hackname
= ecd_cursor
;
1681 files
= "sunwindow/win_lock.h";
1682 files
= "sunwindow/win_cursor.h";
1683 select
= 'ecd\.cursor';
1685 c_fix_arg
= 'ecd_cursor';
1687 test_text
= "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1691 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
1692 * that fails when compiling for SSE
-less
32-bit x86.
1695 hackname
= feraiseexcept_nosse_divbyzero
;
1696 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
1697 files
= bits
/fenv.h
, '*/bits/fenv.h';
1698 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
1699 ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
1700 bypass
= "\"fdivp .*; fwait\"";
1703 c_fix_arg
= <<- _EOText_
1704 # ifdef __SSE_MATH__
1707 %1__asm__
__volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
1708 %1 : "=t" (__f
) : "0" (__f
), "u" (__g
) : "st(1)");
1712 test_text
= <<- _EOText_
1713 __asm__
__volatile__ ("divss %1, %0" : : "x" (__f
), "x" (__g
));
1718 * Incorrect feraiseexcept extern inline in bits
/fenv.h on x86_64
1719 * that fails when compiling for SSE
-less
32-bit x86.
1722 hackname
= feraiseexcept_nosse_invalid
;
1723 mach
= 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
1724 files
= bits
/fenv.h
, '*/bits/fenv.h';
1725 select
= "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
1726 ": \"x\" \\(__f\\)\\);$";
1727 bypass
= "\"fdiv .*; fwait\"";
1730 c_fix_arg
= <<- _EOText_
1731 # ifdef __SSE_MATH__
1734 %1__asm__
__volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
1735 %1 : "=t" (__f
) : "0" (__f
));
1739 test_text
= <<- _EOText_
1740 __asm__
__volatile__ ("divss %0, %0" : : "x" (__f
));
1745 * Between
8/24/1998 and
2/17/2001, FreeBSD system headers presume
1746 * neither the existence of GCC
3 nor its exact feature set yet break
1747 * (by design?
) when __GNUC__ is set beyond
2.
1750 hackname
= freebsd_gcc3_breakage
;
1751 mach
= "*-*-freebsd*";
1752 files
= sys
/cdefs.h
;
1753 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
1754 bypass
= '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
1756 c_fix_arg
= '%0 || __GNUC__ >= 3';
1757 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
1761 * Some releases of FreeBSD
4 and FreeBSD
5.0 and
5.1 system headers presume
1762 * neither the existence of GCC
4 nor its exact feature set yet break
1763 * (by design?
) when __GNUC__ is set beyond
3.
1766 hackname
= freebsd_gcc4_breakage
;
1767 mach
= "*-*-freebsd*";
1768 files
= sys
/cdefs.h
;
1769 select
= '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
1771 c_fix_arg
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
1772 test_text
= '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
1776 * Some versions of glibc don
't expect the C99 inline semantics.
1779 hackname = glibc_c99_inline_1;
1780 files = features.h, '*/features.h
';
1781 select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
1783 c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
1785 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
1786 && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
1787 # define __USE_EXTERN_INLINES 1
1793 * Similar, but a version that didn't have __NO_INLINE__
1796 hackname
= glibc_c99_inline_1a
;
1797 files
= features.h
, '*/features.h';
1798 select
= "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
1799 "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
1801 c_fix_arg
= "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
1803 #if
__GNUC_PREREQ (2, 7) && defined __OPTIMIZE__
&& !defined __OPTIMIZE_SIZE__
1804 # define __USE_EXTERN_INLINES
1
1810 * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
1811 * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
1812 * The remaining glibc_c99_inline_
* fixes deal with some of those headers.
1815 hackname
= glibc_c99_inline_2
;
1816 files
= sys
/stat.h
, '*/sys/stat.h';
1817 select
= "extern __inline__ int";
1818 sed
= "s/extern int \\(stat\\)/"
1819 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1820 "__inline__ int \\1/";
1821 sed
= "s/extern int \\([lf]stat\\)/"
1822 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1823 "__inline__ int \\1/";
1824 sed
= "s/extern int \\(mknod\\)/"
1825 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1826 "__inline__ int \\1/";
1827 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
1828 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1829 "__inline__ int __REDIRECT\\1 (\\2/";
1830 sed
= "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
1831 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1832 "__inline__ int __REDIRECT\\1 (\\2/";
1833 sed
= "s/^extern __inline__ int/"
1834 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1837 extern int
fstat64 (int __fd
, struct stat64
*__buf
) __THROW
__nonnull ((2));
1838 extern __inline__ int
1839 __NTH (fstat64 (int __fd
, struct stat64
*__statbuf
))
1845 * glibc_c99_inline_3
1848 hackname
= glibc_c99_inline_3
;
1849 files
= bits
/string2.h
, '*/bits/string2.h';
1850 select
= "extern __inline";
1851 bypass
= "__extern_inline|__GNU_STDC_INLINE__";
1853 c_fix_arg
= "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
1854 c_fix_arg
= "^# ifdef __cplusplus$";
1857 # define __STRING_INLINE inline
1859 # define __STRING_INLINE extern __inline
1865 * glibc_c99_inline_4
1868 hackname
= glibc_c99_inline_4
;
1869 files
= sys
/sysmacros.h
, '*/sys/sysmacros.h', wchar.h
, '*/wchar.h',
1870 pthread.h
, '*/pthread.h';
1871 bypass
= "__extern_inline|__gnu_inline__";
1872 select
= "(^| )extern __inline";
1874 c_fix_arg
= "%0 __attribute__ ((__gnu_inline__))";
1876 __extension__ extern __inline unsigned int
1877 extern __inline unsigned int
1881 /* glibc
-2.3.5 defines pthread mutex initializers incorrectly
,
1882 * so we replace them with versions that correspond to the
1886 hackname
= glibc_mutex_init
;
1888 select
= '\{ *\{ *0, *\} *\}';
1889 sed
= "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
1890 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
1891 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1892 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
1893 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1894 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
1895 sed
= "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1896 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
1897 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1898 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1899 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1900 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
1901 sed
= "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1902 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1903 sed
= "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
1904 "N;s/^[ \t]*#[ \t]*"
1905 "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
1906 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
1908 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1911 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1913 sed
= "s/{ \\(0, 0, 0, 0, 0, 0, "
1914 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
1915 sed
= "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
1916 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
1918 test_text
= <<- _EOText_
1919 #define PTHREAD_MUTEX_INITIALIZER
\\
1922 # if __WORDSIZE
== 64
1923 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1924 { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1925 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1926 { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1927 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1928 { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1930 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
\\
1931 { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP
} }
1932 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
\\
1933 { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP
} }
1934 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
\\
1935 { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP
} }
1938 # define PTHREAD_RWLOCK_INITIALIZER
\\
1941 # if __WORDSIZE
== 64
1942 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1943 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\
1944 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1946 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
\\
1947 { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
} }
1950 #define PTHREAD_COND_INITIALIZER
{ { 0, } }
1954 /* glibc versions before
2.5 have a version of stdint.h that defines
1955 UINT8_C and UINT16_C to produce unsigned constants
, as do uClibc
1956 versions with stdint.h based on those glibc versions.
*/
1958 hackname
= glibc_stdint
;
1960 select
= "GNU C Library";
1962 c_fix_arg
= "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
1963 c_fix_arg
= "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
1964 test_text
= "/* This file is part of the GNU C Library. */\n"
1965 "# define UINT8_C(c)\tc ## U\n"
1966 "# define UINT16_C(c)\tc ## U";
1969 /* Some versions of glibc have a version of bits
/string2.h that
1970 produces
"value computed is not used" warnings from strncpy
; fix
1971 this definition by using __builtin_strncpy instead as in newer
1974 hackname
= glibc_strncpy
;
1975 files
= bits
/string2.h
, '*/bits/string2.h';
1976 bypass
= "__builtin_strncpy";
1978 c_fix_arg
= "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
1979 c_fix_arg
= "# define strncpy([^\n]*\\\\\n)*[^\n]*";
1981 # define
strncpy(dest
, src
, n
) \
1982 (__extension__ (__builtin_constant_p (src
) && __builtin_constant_p (n
) \\
1983 ?
(strlen (src
) + 1 >= ((size_t
) (n
)) \\
1984 ?
(char *)
memcpy (dest
, src
, n
) \\
1985 : strncpy (dest
, src
, n
)) \\
1986 : strncpy (dest
, src
, n
)))
1991 /* glibc
's tgmath.h relies on an expression that is not an integer
1992 constant expression being treated as it was by GCC 4.4 and
1995 hackname = glibc_tgmath;
1997 select = '\
(\
(\
(type\
) 0.25\
) && \
(\
(type\
) 0.25 - 1\
)\
)';
1998 bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
2000 c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || "
2001 "(__builtin_classify_type ((type) 0) == 9 && "
2002 "__builtin_classify_type (__real__ ((type) 0)) == 8))";
2003 test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
2007 * Fix these files to use the types we think they should for
2008 * ptrdiff_t, size_t, and wchar_t.
2010 * This defines the types in terms of macros predefined by our 'cpp
'.
2011 * This is supposedly necessary for glibc's handling of these types.
2012 * It
's probably not necessary for anyone else, but it doesn't hurt.
2015 hackname
= gnu_types
;
2016 files
= "sys/types.h";
2018 files
= "sys/stdtypes.h";
2022 bypass
= '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
2023 select
= "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
2025 /* The Solaris
10 headers already define these types correctly.
*/
2026 mach
= '*-*-solaris2.1[0-9]*';
2029 test_text
= "typedef long int ptrdiff_t; /* long int */\n"
2030 "typedef uint_t size_t; /* uint_t */\n"
2031 "typedef ushort_t wchar_t; /* ushort_t */";
2035 * Fix HP
& Sony
's use of "../machine/xxx.h"
2036 * to refer to: <machine/xxx.h>
2039 hackname = hp_inline;
2040 files = sys/spinlock.h;
2041 files = machine/machparam.h;
2042 select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
2045 c_fix_arg = "%1<machine
/%2.h
>";
2047 c_fix_arg = "([ \t]*#
[ \t]*include
[ \t]+)" '"\.\.
/machine
/'
2050 test_text = ' # include "..
/machine
/mumble.h
"';
2054 * Check for (...) in C++ code in HP/UX sys/file.h.
2057 hackname = hp_sysfile;
2059 select = "HPUX_SOURCE
";
2062 c_fix_arg = "(struct file
*, ...
)";
2063 c_fix_arg = '\(\.\.\.\)';
2065 test_text = "extern void
foo(...
); /* HPUX_SOURCE
- bad varargs
*/";
2069 * Un-Hide a series of five FP defines from post-1999 compliance GCC:
2070 * FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
2073 hackname = hppa_hpux_fp_macros;
2074 mach = "hppa
*-hp
-hpux11
*";
2076 select = "#
[ \t]*define
[ \t]*FP_NORMAL.
*\n"
2077 "#
[ \t]*define
[ \t]*FP_ZERO.
*\n"
2078 "#
[ \t]*define
[ \t]*FP_INFINITE.
*\n"
2079 "#
[ \t]*define
[ \t]*FP_SUBNORMAL.
*\n"
2080 "#
[ \t]*define
[ \t]*FP_NAN.
*\n";
2082 c_fix_arg = <<- _EOFix_
2083 #endif /* _INCLUDE_HPUX_SOURCE */
2085 #if defined(_INCLUDE_HPUX_SOURCE) || \
2086 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
2089 #ifdef _INCLUDE_HPUX_SOURCE
2094 "# define FP_NORMAL
0\n"
2095 "# define FP_ZERO
1\n"
2096 "# define FP_INFINITE
2\n"
2097 "# define FP_SUBNORMAL
3\n"
2098 "# define FP_NAN
4\n";
2102 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
2103 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
2106 hackname = hpux10_cpp_pow_inline;
2107 files = fixinc-test-limits.h, math.h;
2108 select = <<- END_POW_INLINE
2109 ^# +ifdef +__cplusplus
2111 +inline +double +pow\(double +__d,int +__expon\) +\{
2112 [ ]+return +pow\(__d,\(double\)__expon\);
2123 "# ifdef __cplusplus
\n"
2125 " inline double
pow(double __d
,int __expon
) {\n"
2126 "\t return
pow(__d
,(double
)__expon
);\n"
2128 ' extern "C
"' " {\n"
2134 hackname = hpux11_cpp_pow_inline;
2136 select = " +inline double pow
\\(double d
,int expon
\\) \\{\n"
2137 " +return pow
\\(d
, \\(double
\\)expon
\\);\n"
2143 " inline double
pow(double d
,int expon
) {\n"
2144 " return
pow(d
, (double
)expon
);\n"
2149 * Fix hpux 10.X missing ctype declarations 1
2152 hackname = hpux10_ctype_declarations1;
2154 select = "^#
[ \t]*define _toupper
\\(__c
\\)[ \t]*__toupper
\\(__c
\\)";
2155 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*__tolower
[ \t]*\\(";
2157 c_fix_arg = "#ifdef _PROTOTYPES
\n"
2158 "extern int
__tolower(int
);\n"
2159 "extern int
__toupper(int
);\n"
2160 "#else
/* NOT _PROTOTYPES
*/\n"
2161 "extern int
__tolower();\n"
2162 "extern int
__toupper();\n"
2163 "#endif
/* _PROTOTYPES
*/\n\n"
2166 test_text = "# define
_toupper(__c
) __toupper(__c
)\n";
2170 * Fix hpux 10.X missing ctype declarations 2
2173 hackname = hpux10_ctype_declarations2;
2175 select = "^# if defined
\\(_SB_CTYPE_MACROS
\\) && \\!defined
\\(__lint
\\)";
2176 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*_isalnum
[ \t]*\\(";
2178 c_fix_arg = "%0\n\n"
2179 "#ifdef _PROTOTYPES
\n"
2180 " extern int
_isalnum(int
);\n"
2181 " extern int
_isalpha(int
);\n"
2182 " extern int
_iscntrl(int
);\n"
2183 " extern int
_isdigit(int
);\n"
2184 " extern int
_isgraph(int
);\n"
2185 " extern int
_islower(int
);\n"
2186 " extern int
_isprint(int
);\n"
2187 " extern int
_ispunct(int
);\n"
2188 " extern int
_isspace(int
);\n"
2189 " extern int
_isupper(int
);\n"
2190 " extern int
_isxdigit(int
);\n"
2191 "# else
/* not _PROTOTYPES
*/\n"
2192 " extern int
_isalnum();\n"
2193 " extern int
_isalpha();\n"
2194 " extern int
_iscntrl();\n"
2195 " extern int
_isdigit();\n"
2196 " extern int
_isgraph();\n"
2197 " extern int
_islower();\n"
2198 " extern int
_isprint();\n"
2199 " extern int
_ispunct();\n"
2200 " extern int
_isspace();\n"
2201 " extern int
_isupper();\n"
2202 " extern int
_isxdigit();\n"
2203 "#endif
/* _PROTOTYPES
*/\n";
2205 test_text = "# if
defined(_SB_CTYPE_MACROS
) && !defined(__lint
)\n"
2206 " extern unsigned int
*__SB_masks
;\n";
2210 * Fix hpux 10.X missing stdio declarations
2213 hackname = hpux10_stdio_declarations;
2215 select = "^#
[ \t]*define _iob
[ \t]*__iob
";
2216 bypass = "^
[ \t]*extern
[ \t]*int
[ \t]*vsnprintf
[ \t]*\\(";
2218 c_fix_arg = "%0\n\n"
2219 "# if
defined(__STDC__
) ||
defined(__cplusplus
)\n"
2220 " extern int
snprintf(char
*, size_t
, const char
*, ...
);\n"
2221 " extern int
vsnprintf(char
*, size_t
, const char
*, __va_list
);\n"
2222 "# else
/* not __STDC__
) || __cplusplus
*/\n"
2223 " extern int
snprintf();\n"
2224 " extern int
vsnprintf();\n"
2225 "# endif
/* __STDC__
) || __cplusplus
*/\n";
2227 test_text = "# define _iob __iob
\n";
2231 * The HP-UX stddef.h is replaced by gcc's. It doesn't include sys/stdsyms.h.
2232 * As a result, we need to include sys/stdsyms.h in alloca.h.
2235 hackname = hppa_hpux11_alloca;
2236 mach = "hppa
*-*-hpux11
*";
2238 select = "#ifndef _STDDEF_INCLUDED
";
2240 c_fix_arg = "#ifndef _SYS_STDSYMS_INCLUDED
\n"
2241 "# include
<sys
/stdsyms.h
>\n"
2242 "#endif
/* _SYS_STDSYMS_INCLUDED
*/\n\n"
2245 test_text = "#ifndef _STDDEF_INCLUDED
";
2249 * Make sure hpux defines abs in header.
2252 hackname = hpux11_abs;
2253 mach = "*-hp
-hpux11
*";
2255 select = "ifndef _MATH_INCLUDED
";
2257 c_fix_arg = "if
!defined(_MATH_INCLUDED
) ||
defined(__GNUG__
)";
2258 test_text = "#ifndef _MATH_INCLUDED
";
2262 * Fix hpux11 __LWP_RWLOCK_VALID define
2265 hackname = hpux11_lwp_rwlock_valid;
2266 mach = "*-hp
-hpux11
*";
2267 files = sys/pthread.h;
2268 select = "#define __LWP_RWLOCK_VALID
[ \t]*0x8c91";
2270 c_fix_arg = "#define __LWP_RWLOCK_VALID
-29551";
2271 test_text = "#define __LWP_RWLOCK_VALID
0x8c91";
2278 hackname = hpux11_extern_sendfile;
2279 mach = "*-hp
-hpux11.
[12]*";
2280 files = sys/socket.h;
2281 select = "^
[ \t]*extern sbsize_t sendfile.
*\n.
*, int
\\)\\);\n";
2283 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2284 test_text = " extern sbsize_t sendfile
__((int
, int
, off_t
, bsize_t
,\n"
2285 " const struct iovec
*, int
));\n";
2292 hackname = hpux11_extern_sendpath;
2293 mach = "*-hp
-hpux11.
[12]*";
2294 files = sys/socket.h;
2295 select = "^
[ \t]*extern sbsize_t sendpath.
*\n.
*, int
\\)\\);\n";
2297 c_fix_arg = "#ifndef _APP32_64BIT_OFF_T
\n%0#endif
\n";
2298 test_text = " extern sbsize_t sendpath
__((int
, int
, off_t
, bsize_t
,\n"
2299 " const struct iovec
*, int
));\n";
2303 * Keep HP-UX 11 from stomping on C++ math namespace
2304 * with defines for fabsf.
2307 hackname = hpux11_fabsf;
2308 mach = "*-hp
-hpux11
*";
2310 select = "^
[ \t]*#
[ \t]*define
[ \t]+fabsf
\\(.
*";
2313 c_fix_arg = "#ifndef __cplusplus
\n%0\n#endif
";
2317 "# define
fabsf(x
) ((float
)fabs((double
)(float
)(x
)))\n"
2322 * The definitions for PTHREAD_MUTEX_INITIALIZER and similar initializers
2323 * in pthread.h need to be constant expressions to be standard complient.
2324 * As a result, we need to remove the void * casts in the initializers
2325 * (see hpux11_pthread_const) and to change the __(M|C|RW)POINTER defines
2326 * to use the long type.
2329 hackname = hpux11_pthread_pointer;
2330 mach = "*-hp
-hpux11.
[0-3]*";
2331 files = sys/pthread.h;
2332 select = "(void
[ \t]*\\*)
(m|c|rw
)(_ptr
)";
2335 c_fix_arg = "long
\t%2%3";
2336 test_text = "#define __MPOINTER
\t\tvoid
\t *m_ptr
";
2340 * Remove void pointer cast and fix C99 constant in __POINTER_SET defines.
2343 hackname = hpux11_pthread_const;
2344 mach = "*-hp
-hpux11.
[0-3]*";
2345 files = sys/pthread.h;
2346 select = "^
(#define
[ \t]+__POINTER_SET
[ \t0,]*)
(.
*\\))";
2350 test_text = "#define __POINTER_SET
\t\t((void *)
1LL)";
2354 * Prevent HP-UX 11 from defining __size_t and preventing size_t from
2355 * being defined by having it define _hpux_size_t instead.
2358 hackname = hpux11_size_t;
2359 mach = "*-hp
-hpux11
*";
2360 select = "__size_t
";
2363 c_fix_arg = "_hpux_size_t
";
2366 "#define __size_t size_t
\n"
2367 " extern int
getpwuid_r( char
*, __size_t
, struct passwd
**)
;\n";
2371 * Fix hpux 11.00 broken snprintf declaration
2372 * (third argument is char *, needs to be const char * to prevent
2373 * spurious warnings with -Wwrite-strings or in C++).
2376 hackname = hpux11_snprintf;
2378 select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
2379 ' *(char *\*, *\.\.\.\);)';
2381 c_fix_arg = '%1 const %3';
2383 test_text = "extern int
snprintf(char
*, size_t
, char
*, ...
);\n"
2384 "extern int
snprintf(char
*, __size_t
, char
*, ...
);\n"
2385 "extern int
snprintf(char
*, _hpux_size_t
, char
*, ...
);";
2389 * Fix hpux 11.00 broken vsnprintf declaration
2392 hackname = hpux11_vsnprintf;
2394 select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
2395 'const char \*,) __va__list\);';
2397 c_fix_arg = "%1 __va_list
);";
2399 test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
2404 * Fix missing const in hpux vsscanf declaration
2407 hackname = hpux_vsscanf;
2410 select = '(extern int vsscanf\()char';
2412 c_fix_arg = "%1const char
";
2414 test_text = 'extern int vsscanf(char *, const char *, __va_list);';
2418 * get rid of bogus inline definitions in HP-UX 8.0
2421 hackname = hpux8_bogus_inlines;
2424 bypass = "__GNUG__
";
2425 sed = "s@inline int
abs(int
[a
-z
][a
-z
]*)
{.
*}"
2426 "@extern
\"C
\" int
abs(int
);@
";
2427 sed = "s@inline double
abs(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2428 sed = "s@inline int
sqr(int
[a
-z
][a
-z
]*)
{.
*}@@
";
2429 sed = "s@inline double
sqr(double
[a
-z
][a
-z
]*)
{.
*}@@
";
2430 test_text = "inline int
abs(int v
) { return (v
>=0)?v
:-v
; }\n"
2431 "inline double
sqr(double v
) { return v
**0.5; }";
2438 hackname = hpux_c99_intptr;
2439 mach = "*-hp
-hpux11.3
*";
2440 files = stdint-hpux11.h, stdint.h;
2441 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MAX
[ \t]*"
2442 "INT32_MAX
[ \t]*$@#define
PTRDIFF_MAX (2147483647l)@
";
2443 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*PTRDIFF_MIN
[ \t]*"
2444 "INT32_MIN
[ \t]*$@#define
PTRDIFF_MIN (-PTRDIFF_MAX
- 1)@
";
2445 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MAX
[ \t]*"
2446 "INT32_MAX
[ \t]*$@#define
INTPTR_MAX (2147483647l)@
";
2447 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INTPTR_MIN
[ \t]*"
2448 "INT32_MIN
[ \t]*$@#define
INTPTR_MIN (-INTPTR_MAX
- 1)@
";
2449 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINTPTR_MAX
[ \t]*"
2450 "UINT32_MAX
[ \t]*$@#define
UINTPTR_MAX (4294967295ul)@
";
2451 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*SIZE_MAX
[ \t]*"
2452 "UINT32_MAX
[ \t]*$@#define
SIZE_MAX (4294967295ul)@
";
2453 test_text = "#define PTRDIFF_MAX INT32_MAX
\n"
2454 "#define PTRDIFF_MIN INT32_MIN
\n"
2455 "#define INTPTR_MAX INT32_MAX
\n"
2456 "#define INTPTR_MIN INT32_MIN
\n"
2457 "#define UINTPTR_MAX UINT32_MAX
\n"
2458 "#define SIZE_MAX UINT32_MAX
\n";
2462 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2465 hackname = hpux_c99_inttypes;
2466 mach = "*-hp
-hpux11.
[23]*";
2468 files = stdint-hpux11.h, stdint.h;
2469 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*"
2470 "__CONCAT_U__(__c
)[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2471 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*"
2472 "__CONCAT_U__(__c
)[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2473 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT32_C(__c
)[ \t]*"
2474 "__CONCAT__(__c
,l
)[ \t]*$@#define
INT32_C(__c
) (__c
)@
";
2475 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT32_C(__c
)[ \t].
*$@
"
2476 "#define
UINT32_C(__c
) __CONCAT__(__c
,u
)@
";
2477 test_text = "#define
UINT8_C(__c
) __CONCAT_U__(__c
)\n"
2478 "#define
UINT16_C(__c
) __CONCAT_U__(__c
)\n"
2479 "#define
INT32_C(__c
) __CONCAT__(__c
,l
)\n"
2480 "#define
UINT32_C(__c
) __CONCAT__(__c
,ul
)\n";
2484 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2487 hackname = hpux_c99_inttypes2;
2488 mach = "*-hp
-hpux11.2
*";
2489 files = stdint-hpux11.h, stdint.h;
2490 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT8_C(__c
)[ \t]*"
2491 "((signed char
)(__c
))[ \t]*$@#define
INT8_C(__c
) (__c
)@
";
2492 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT8_C(__c
)[ \t]*"
2493 "((unsigned char
)(__c
))[ \t]*$@#define
UINT8_C(__c
) (__c
)@
";
2494 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*INT16_C(__c
)[ \t]*"
2495 "((short
)(__c
))[ \t]*$@#define
INT16_C(__c
) (__c
)@
";
2496 sed = "s@^
[ \t]*#
[ \t]*define
[ \t]*UINT16_C(__c
)[ \t]*"
2497 "((unsigned short
)(__c
))[ \t]*$@#define
UINT16_C(__c
) (__c
)@
";
2498 test_text = "# define
INT8_C(__c
) ((signed char
)(__c
))\n"
2499 "# define
UINT8_C(__c
) ((unsigned char
)(__c
))\n"
2500 "# define
INT16_C(__c
) ((short
)(__c
))\n"
2501 "# define
UINT16_C(__c
) ((unsigned short
)(__c
))\n";
2505 * Fix hpux broken ctype macros
2508 hackname = hpux_ctype_macros;
2510 select = '((: |\()__SB_masks \? )'
2511 '(__SB_masks\[__(alnum|c)\] & _IS)';
2513 c_fix_arg = "%1(int
)%3";
2515 test_text = ": __SB_masks ? __SB_masks
[__alnum
] & _ISCNTRL
\n"
2516 "# define
isalpha(__c
) (__SB_masks ? __SB_masks
[__c
] & _IS
\n";
2523 hackname = hpux_extern_errno;
2524 mach = "*-hp
-hpux10.
*";
2525 mach = "*-hp
-hpux11.
[0-2]*";
2527 select = "^
[ \t]*extern int errno
;$
";
2529 c_fix_arg = "#ifdef __cplusplus
\n"
2533 "#ifdef __cplusplus
\n"
2536 test_text = " extern int errno
;\n";
2540 * Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
2543 hackname = hpux_htonl;
2544 files = netinet/in.h;
2545 select = "#ifndef _XOPEN_SOURCE_EXTENDED
[ \t]*\n"
2547 " \\* Macros for number representation conversion
\\.
\n"
2551 c_fix_arg = "#if
1\n%1";
2553 test_text = "#ifndef _XOPEN_SOURCE_EXTENDED
\n"
2555 " * Macros for number representation conversion.
\n"
2558 "#define
ntohl(x
) (x
)\n"
2559 "#define
ntohs(x
) (x
)\n"
2560 "#define
htonl(x
) (x
)\n"
2561 "#define
htons(x
) (x
)\n"
2563 "#endif
/* ! _XOPEN_SOURCE_EXTENDED
*/";
2567 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2570 hackname = hpux_imaginary_i;
2571 mach = "ia64
-hp
-hpux11.
*";
2573 select = "^
[ \t]*#
[ \t]*define
[ \t]*_Complex_I.
*";
2575 c_fix_arg = "#define
_Complex_I (__extension__
1.0iF
)";
2576 test_text = "#define
_Complex_I (0.f
+_Imaginary_I
)\n";
2580 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2583 hackname = hpux_inttype_int8_t;
2584 mach = "*-hp
-hpux1
[01].
*";
2585 files = sys/_inttypes.h;
2586 select = "^
[ \t]*typedef
[ \t]*char
[ \t]*int(_least
){0,1}8_t.
*";
2588 c_fix_arg = "typedef signed char int
%18_t
;";
2589 test_text = "typedef char int_least8_t
;\n"
2590 "typedef char int8_t
;\n";
2597 hackname = hpux_long_double;
2598 mach = "*-*-hpux10
*";
2599 mach = "*-*-hpux11.
[012]*";
2601 select = "extern
[ \t]long_double
[ \t]strtold
";
2602 bypass = "long_double_t
";
2603 sed = "/^#
[ \t]*ifndef _LONG_DOUBLE
/,/\\/\\* _LONG_DOUBLE
\\*\\//D
";
2604 sed = "s
/long_double
/long double
/g
";
2606 test_text = "# ifndef _LONG_DOUBLE
\n"
2607 "# define _LONG_DOUBLE
\n"
2608 " typedef struct
{\n"
2609 " unsigned int word1
, word2
, word3
, word4
;\n"
2611 "# endif
/* _LONG_DOUBLE
*/\n"
2612 "extern long_double
strtold(const char
*, char
**)
;\n";
2616 * We cannot use the above rule on 11.31 because it removes the strtold
2617 * definition. ia64 is OK with no hack, PA needs some help.
2620 hackname = hpux_long_double_2;
2621 mach = "hppa
*-*-hpux11.3
*";
2623 select = "#
[ \t]*if
[ \t]*!defined
\\(__ia64
\\) \\|
\\|
"
2624 "defined
\\(_PROTOTYPES
\\) \\|
\\|
"
2625 "defined
\\(_LONG_DOUBLE_STRUCT
\\)";
2627 c_fix_arg = "# if
!defined(_PROTOTYPES
) ||
defined(_LONG_DOUBLE_STRUCT
)";
2629 test_text = "# if
!defined(__ia64
) ||
"
2630 "!defined(_PROTOTYPES
) ||
"
2631 "defined(_LONG_DOUBLE_STRUCT
)\n";
2635 * Add missing braces to pthread initializer defines.
2638 hackname = hpux_pthread_initializers;
2639 mach = "*-hp
-hpux11.
[0-3]*";
2640 files = sys/pthread.h;
2641 sed = "s@^
[ \t]*1, 1, 1, 1,[ \t]*\\\\"
2642 "@
\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@
";
2643 sed = "s@^
[ \t]*1,[ \t]*\\\\"
2645 sed = "/^
[ \t]*0$
/d
";
2646 sed = "s@__PTHREAD_MUTEX_VALID
, 0"
2647 "@
{ __PTHREAD_MUTEX_VALID
, 0 }@
";
2648 sed = "s@^
[ \t]*0, 0, -1, 0,[ \t]*\\\\"
2649 "@
\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@
";
2650 sed = "s@
0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2651 "@
{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2652 sed = "s@^
[ \t]*__LWP_MTX_VALID
, 0, 1, 1, 1, 1,[ \t]*\\\\"
2653 "@
\t{ 0, __LWP_MTX_VALID
}, { 0, 1, 1, 1, 1 },\t\t\t\\\\@
";
2654 sed = "s@^
[ \t]*0, 0[ \t]*\\\\"
2655 "@
\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@
";
2656 sed = "s@__PTHREAD_COND_VALID
, 0"
2657 "@
{ __PTHREAD_COND_VALID
, 0 }@
";
2658 sed = "s@__LWP_COND_VALID
, 0,[ \t]*\\\\"
2659 "@
{ __LWP_COND_VALID
, 0 },\t\t\t\t\t\\\\@
";
2660 sed = "s@__PTHREAD_RWLOCK_VALID
, 0"
2661 "@
{ __PTHREAD_RWLOCK_VALID
, 0 }@
";
2662 sed = "s@__LWP_RWLOCK_VALID
, 0,[ \t]*\\\\"
2663 "@
{ __LWP_RWLOCK_VALID
, 0 },\t\t\t\t\t\\\\@
";
2664 sed = "s@^
[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
2665 "@
\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@
";
2666 test_text = "#define PTHREAD_MUTEX_INITIALIZER
{\t\t\t\t\t\\\\\n"
2667 "\t__PTHREAD_MUTEX_VALID
, 0,\t\t\t\t\t\\\\\n"
2668 "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE
),\t\t\\\\\n"
2669 "\t__SPNLCK_INITIALIZER
,\t\t\t\t\t\t\\\\\n"
2670 "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
2671 "\t0, __LWP_MTX_VALID
, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
2672 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
2677 * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
2678 * type and mpinfou is only defined when _KERNEL is set.
2681 hackname = hpux_spu_info;
2682 mach = "*-hp
-hpux
*";
2684 * It is tempting to omit the first "files
" entry. Do not.
2685 * The testing machinery will take the first "files
" entry as the name
2686 * of a test file to play with. It would be a nuisance to have a directory
2687 * with the name "*".
2689 files = "ia64
/sys
/getppdp.h
";
2690 files = "*/sys
/getppdp.h
";
2691 select = "^.
*extern.
*spu_info.
*";
2694 c_fix_arg = "#ifdef _KERNEL
\n%0\n#endif
";
2696 test_text = "extern union mpinfou spu_info
[];";
2700 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2703 hackname = hpux_stdint_least_fast;
2704 mach = "*-hp
-hpux11.2
*";
2705 files = stdint-hpux11.h, stdint.h;
2707 "^
[ \t]*#
[ \t]*define
[ \t]+UINT_(LEAST|FAST
)64_MAX
[ \t]+ULLONG_MAX
";
2709 c-fix-arg = "# define UINT_
%164_MAX __UINT64_MAX__
";
2710 test-text = "# define UINT_FAST64_MAX ULLONG_MAX
\n"
2711 "# define UINT_LEAST64_MAX ULLONG_MAX
\n";
2715 * Add noreturn attribute to longjmp declarations in hpux <setjmp.h>
2718 hackname = hpux_longjmp;
2719 mach = "*-hp
-hpux
*";
2721 select = "^
[ \t]*extern
[ \t]+void
[ \t]+.
*longjmp
[ \t]*\
(__
\\(\\(.
*int
\\)\\)|
\\(.
*int
\\)|
\\(\\)\
)";
2724 c_fix_arg = "%0 __attribute__ ((__noreturn__
))";
2726 test_text = 'extern void longjmp __((jmp_buf, int));';
2730 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2733 hackname = hpux_systime;
2735 select = "^extern struct sigevent
;";
2738 c_fix_arg = "struct sigevent
;";
2740 test_text = 'extern struct sigevent;';
2744 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
2747 hackname = huge_val_hex;
2748 files = bits/huge_val.h, '*/bits/huge_val.h';
2749 select = "^#
[ \t]*define
[ \t]*HUGE_VAL
[ \t].
*0x1\\.0p.
*";
2750 bypass = "__builtin_huge_val
";
2753 c_fix_arg = "#define
HUGE_VAL (__builtin_huge_val())\n";
2755 test_text = "# define HUGE_VAL
\t(__extension__
0x1.0p2047
)";
2759 * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
2762 hackname = huge_valf_hex;
2763 files = bits/huge_val.h, '*/bits/huge_val.h';
2764 select = "^#
[ \t]*define
[ \t]*HUGE_VALF
[ \t].
*0x1\\.0p.
*";
2765 bypass = "__builtin_huge_valf
";
2768 c_fix_arg = "#define
HUGE_VALF (__builtin_huge_valf())\n";
2770 test_text = "# define
HUGE_VALF (__extension__
0x1.0p255f
)";
2774 * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
2777 hackname = huge_vall_hex;
2778 files = bits/huge_val.h, '*/bits/huge_val.h';
2779 select = "^#
[ \t]*define
[ \t]*HUGE_VALL
[ \t].
*0x1\\.0p.
*";
2780 bypass = "__builtin_huge_vall
";
2783 c_fix_arg = "#define
HUGE_VALL (__builtin_huge_vall())\n";
2785 test_text = "# define
HUGE_VALL (__extension__
0x1.0p32767L
)";
2789 * Fix return type of abort and free
2792 hackname = int_abort_free_and_exit;
2794 select = "int
[ \t]+(abort|free|exit
)[ \t]*\\(";
2795 bypass = "_CLASSIC_ANSI_TYPES
";
2798 c_fix_arg = "void
\t%1(";
2800 test_text = "extern int
abort(int
);\n"
2801 "extern int
free(void*)
;\n"
2802 "extern int
exit(void*)
;";
2806 * Fix various macros used to define ioctl numbers.
2807 * The traditional syntax was:
2809 * #define _IO(n, x) (('n'<<8)+x)
2810 * #define TIOCFOO _IO(T, 1)
2812 * but this does not work with the C standard, which disallows macro
2813 * expansion inside strings. We have to rewrite it thus:
2815 * #define _IO(n, x) ((n<<8)+x)
2816 * #define TIOCFOO _IO('T', 1)
2818 * The select expressions match too much, but the c_fix code is cautious.
2820 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
2823 hackname = io_quotes_def;
2824 select = "define
[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*\\([a
-zA
-Z
][,)]";
2825 c_fix = char_macro_def;
2828 "#define
BSD43__IOWR(n
, x
) (('n'<<8)+x
)\n"
2829 "#define
_IOWN(x
,y
,t
) (_IOC_IN|
(((t
)&_IOCPARM_MASK
)<<16)|
('x'<<8)|y
)\n"
2830 "#define
_IO(x
,y
) ('x'<<8|y
)";
2832 "#define
XX_IO(x
) ('x'<<8|
256)";
2836 * Fix the usage of the ioctl macro numbers.
2839 hackname = io_quotes_use;
2840 select = "define
[ \t]+[A
-Z0
-9_
]+[ \t]+[A
-Z0
-9_
]+IO
[A
-Z
]*[ \t]*"
2842 c_fix = char_macro_use;
2844 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
2845 "#define TIOCFOO \\\\\n"
2846 "BSD43__IOWR(T, 1) /* Some are multi-line */";
2850 * Check for missing ';' in struct
2853 hackname = ip_missing_semi;
2854 files = netinet/ip.h;
2856 sed = "/^struct/,/^};/s/}$/};/";
2862 "}; /* mumbled struct */\n";
2866 * Non-traditional "const" declaration in Irix's limits.h.
2869 hackname
= irix_limits_const
;
2870 files
= fixinc
-test
-limits.h
, limits.h
;
2871 select
= "^extern const ";
2873 c_fix_arg
= "extern __const ";
2874 test_text
= "extern const char limit; /* test limits */";
2878 * IRIX
5.x
's stdio.h declares some functions that take a va_list as
2879 * taking char *. However, GCC uses void * for va_list, so
2880 * calling vfprintf with a va_list fails in C++. */
2882 hackname = irix_stdio_va_list;
2885 select = '/\
* va_list \
*/ char \
*';
2887 c_fix_arg = "__gnuc_va_list";
2889 "extern int printf( const char *, /* va_list */ char * );";
2893 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
2894 * use / * * / to concatenate tokens.
2897 hackname = kandr_concat;
2898 files = "sparc/asm_linkage.h";
2899 files = "sun*/asm_linkage.h";
2900 files = "arm/as_support.h";
2901 files = "arm/mc_type.h";
2902 files = "arm/xcb.h";
2903 files = "dev/chardefmac.h";
2904 files = "dev/ps_irq.h";
2905 files = "dev/screen.h";
2906 files = "dev/scsi.h";
2907 files = "sys/tty.h";
2908 files = "Xm.acorn/XmP.h";
2909 files = bsd43/bsd43_.h;
2913 test_text = "#define __CONCAT__(a,b) a/**/b";
2917 * The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
2918 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
2919 * constant on recent versions of g
++.
2922 hackname
= linux_ia64_ucontext
;
2923 files
= "sys/ucontext.h";
2924 mach
= "ia64-*-linux*";
2925 select
= '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
2926 '->sc_gr\[0\]\) - \(char \*\) 0\)';
2928 c_fix_arg
= "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
2929 test_text
= "# define _SC_GR0_OFFSET\t\\\\\n"
2930 "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
2934 * Remove header file warning from sys
/time.h. Autoconf
's
2935 * AC_HEADER_TIME recommends to include both sys/time.h and time.h
2936 * which causes warning on LynxOS. Remove the warning.
2939 hackname = lynxos_no_warning_in_sys_time_h;
2941 select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
2944 test_text = "#warning Using <time.h> instead of <sys/time.h>";
2948 * Add missing declaration for putenv.
2951 hackname = lynxos_missing_putenv;
2952 mach = '*-*-lynxos
*';
2954 bypass = 'putenv
[ \t]*\\(';
2955 select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2958 "extern int putenv _AP((char *));";
2959 c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2960 test_text = "extern char *getenv _AP((const char *));";
2964 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
2966 * On NetBSD, machine is a symbolic link to an architecture specific
2967 * directory name, so we can't match a specific file name here.
2970 hackname
= machine_ansi_h_va_list
;
2971 select
= "define[ \t]+_BSD_VA_LIST_[ \t]";
2972 bypass
= '__builtin_va_list';
2975 c_fix_arg
= "%1__builtin_va_list";
2976 c_fix_arg
= "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
2978 test_text
= " # define _BSD_VA_LIST_\tchar**";
2982 * Fix non
-ansi machine name defines
2985 hackname
= machine_name
;
2986 c_test
= machine_name
;
2987 c_fix
= machine_name
;
2989 test_text
= "/* MACH_DIFF: */\n"
2990 "#if defined( i386 ) || defined( sparc ) || defined( vax )"
2991 "\n/* no uniform test, so be careful :-) */";
2995 * Some math.h files define struct
exception (it
's in the System V
2996 * Interface Definition), which conflicts with the class exception defined
2997 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
2998 * This is not a great fix, but I haven't been able to think of anything
3002 hackname
= math_exception
;
3004 select
= "struct exception";
3006 * This should be bypassed on __cplusplus
, but some supposedly C
++
3007 * aware headers
, such as Solaris
8 and
9, don
't wrap their struct
3008 * exception either. So currently we bypass only for glibc, based on a
3009 * comment in the fixed glibc header. Ick.
3011 bypass = 'We have a problem when using C\
+\
+|for C\
+\
+, '
3012 '_
[a
-z0
-9A
-Z_
]+_exception
; for C
, exception
';
3013 /* The Solaris 10 headers already get this right. */
3014 mach = '*-*-solaris2.1
[0-9]*';
3018 c_fix_arg = "#ifdef __cplusplus\n"
3019 "#define exception __math_exception\n"
3022 c_fix_arg = "#ifdef __cplusplus\n"
3023 "#undef exception\n"
3026 test_text = "typedef struct exception t_math_exception;";
3030 * This looks pretty broken to me. ``dbl_max_def'' will contain
3031 * "define DBL_MAX " at the start, when what we really want is just
3032 * the value portion. Can't figure out how to write a test case
3033 * for this either
:-(
3036 hackname
= math_huge_val_from_dbl_max
;
3040 * IF HUGE_VAL is defined to be DBL_MAX
*and
* DBL_MAX is _not_ defined
3041 * in math.h
, this fix applies.
3043 select
= "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
3044 bypass
= "define[ \t]+DBL_MAX";
3048 * See if we have a definition for DBL_MAX in float.h.
3049 * If we do
, we will replace the one in math.h with that one.
3052 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
3053 "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
3055 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
3056 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
3057 "s@DBL_MAX@'\"$dbl_max_def@\"\n"
3062 "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
3063 "#define HUGE_VAL DBL_MAX";
3070 hackname
= nested_auth_des
;
3072 select
= '(/\*.*rpc/auth_des\.h>.*)/\*';
3074 c_fix_arg
= "%1*/ /*";
3075 test_text
= "/*#include <rpc/auth_des.h> /* skip this */";
3079 * Some versions of NetBSD don
't expect the C99 inline semantics.
3082 hackname = netbsd_c99_inline_1;
3083 mach = "*-*-netbsd*";
3085 select = "extern __inline int";
3088 c_fix_arg = "extern\n"
3089 "#ifdef __GNUC_STDC_INLINE__\n"
3090 "__attribute__((__gnu_inline__))\n"
3094 test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
3098 * netbsd_c99_inline_2
3101 hackname = netbsd_c99_inline_2;
3102 mach = "*-*-netbsd*";
3104 select = "#define _SIGINLINE extern __inline";
3107 c_fix_arg = <<- _EOArg_
3108 #ifdef __GNUC_STDC_INLINE__
3109 #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
3115 test_text = "#define _SIGINLINE extern __inline";
3119 * NetBSD has a semicolon after the ending '}' for some extern "C".
3122 hackname = netbsd_extra_semicolon;
3123 mach = "*-*-netbsd*";
3124 files = sys/cdefs.h;
3125 select = "#define[ \t]*__END_DECLS[ \t]*};";
3128 c_fix_arg = "#define __END_DECLS }";
3130 test_text = "#define __END_DECLS };";
3134 * newlib's stdint.h has several failures to conform to C99. The fix
3135 * for these removed a comment that can be matched to identify unfixed
3139 hackname
= newlib_stdint_1
;
3140 files
= stdint
-newlib.h
, stdint.h
;
3141 select
= "@todo - Add support for wint_t types";
3142 sed
= "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
3143 sed
= "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
3144 sed
= "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
3145 sed
= "s@#define INT_LEAST32_MIN.*@"
3146 "#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
3147 sed
= "s@#define INT_LEAST32_MAX.*@"
3148 "#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
3149 sed
= "s@#define UINT_LEAST32_MAX.*@"
3150 "#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
3151 sed
= 's@#define INT_FAST\([0-9]*\)_MIN.*@'
3152 '#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
3153 sed
= 's@#define INT_FAST\([0-9]*\)_MAX.*@'
3154 '#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
3155 sed
= 's@#define UINT_FAST\([0-9]*\)_MAX.*@'
3156 '#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
3157 sed
= "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
3158 sed
= "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
3159 sed
= "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
3160 sed
= "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
3161 sed
= "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
3162 test_text
= "/* @todo - Add support for wint_t types. */\n"
3163 "#define INT32_MIN (-2147483647-1)\n"
3164 "#define INT32_MAX 2147483647\n"
3165 "#define UINT32_MAX 4294967295U\n"
3166 "#define INT_LEAST32_MIN (-2147483647-1)\n"
3167 "#define INT_LEAST32_MAX 2147483647\n"
3168 "#define UINT_LEAST32_MAX 4294967295U\n"
3169 "#define INT_FAST8_MIN INT8_MIN\n"
3170 "#define INT_FAST8_MAX INT8_MAX\n"
3171 "#define UINT_FAST8_MAX UINT8_MAX\n"
3172 "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
3173 "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
3174 "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
3175 "#define UINT8_C(x) x##U\n"
3176 "#define UINT16_C(x) x##U";
3183 hackname
= newlib_stdint_2
;
3184 files
= stdint
-newlib.h
, stdint.h
;
3185 select
= "@todo - Add support for wint_t types";
3187 c_fix_arg
= "#define INTMAX_MAX __INTMAX_MAX__\n"
3188 "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
3189 "#define UINTMAX_MAX __UINTMAX_MAX__\n"
3190 "#define WCHAR_MAX __WCHAR_MAX__\n"
3191 "#define WCHAR_MIN __WCHAR_MIN__\n"
3192 "#define WINT_MAX __WINT_MAX__\n"
3193 "#define WINT_MIN __WINT_MIN__\n\n"
3195 c_fix_arg
= '/\*\* Macros for minimum-width integer constant expressions \*/';
3196 test_text
= "/* @todo - Add support for wint_t types. */\n"
3197 "/** Macros for minimum-width integer constant expressions */";
3201 * NeXT
3.2 adds const prefix to some math functions.
3202 * These conflict with the built
-in functions.
3205 hackname
= next_math_prefix
;
3206 files
= ansi
/math.h
;
3207 select
= "^extern[ \t]+double[ \t]+__const__[ \t]";
3210 c_fix_arg
= "extern double %1(";
3211 c_fix_arg
= "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
3213 test_text
= "extern\tdouble\t__const__\tmumble();";
3217 * NeXT
3.2 uses the word
"template" as a parameter for some
3218 * functions. GCC reports an invalid use of a reserved key word
3219 * with the built
-in functions.
3222 hackname
= next_template
;
3224 select
= "[ \t]template\\)";
3228 c_fix_arg
= "\\(([^)]*)[ \t]template\\)";
3229 test_text
= "extern mumble( char * template); /* fix */";
3233 * NeXT
3.2 includes the keyword volatile in the
abort() and
exit()
3234 * function prototypes. That conflicts with the built
-in functions.
3237 hackname
= next_volitile
;
3238 files
= ansi
/stdlib.h
;
3239 select
= "^extern[ \t]+volatile[ \t]+void[ \t]";
3242 c_fix_arg
= "extern void %1(";
3243 c_fix_arg
= "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
3245 test_text
= "extern\tvolatile\tvoid\tabort();";
3249 * NeXT
2.0 defines
'int wait(union wait*)', which conflicts with Posix
.1.
3250 * Note that version
3 of the NeXT system has wait.h in a different directory
,
3251 * so that this code won
't do anything. But wait.h in version 3 has a
3252 * conditional, so it doesn't need this fix. So everything is okay.
3255 hackname
= next_wait_union
;
3258 select
= 'wait\(union wait';
3260 c_fix_arg
= "wait(void";
3261 test_text
= "extern pid_d wait(union wait*);";
3265 * a missing semi
-colon at the end of the nodeent structure definition.
3268 hackname
= nodeent_syntax
;
3269 files
= netdnet
/dnetdb.h
;
3270 select
= "char[ \t]*\\*na_addr[ \t]*$";
3273 test_text
= "char *na_addr\t";
3277 * Fix OpenBSD
's NULL definition.
3280 hackname = openbsd_null_definition;
3281 mach = "*-*-openbsd*";
3282 files = locale.h, stddef.h, stdio.h, string.h,
3283 time.h, unistd.h, wchar.h, sys/param.h;
3284 select = "__GNUG__";
3286 c_fix_arg = "#ifndef NULL\n"
3287 "#ifdef __cplusplus\n"
3289 "#define NULL\t__null\n"
3290 "#else\t /* ! __GNUG__ */\n"
3291 "#define NULL\t0L\n"
3292 "#endif\t /* __GNUG__ */\n"
3293 "#else\t /* ! __cplusplus */\n"
3294 "#define NULL\t((void *)0)\n"
3295 "#endif\t /* __cplusplus */\n"
3296 "#endif\t /* !NULL */";
3298 c_fix_arg = "^#ifndef[ \t]*NULL\n"
3299 "^#ifdef[ \t]*__GNUG__\n"
3300 "^#define[ \t]*NULL[ \t]*__null\n"
3302 "^#define[ \t]*NULL[ \t]*0L\n"
3308 "#define NULL __null\n"
3316 * obstack.h used casts as lvalues.
3318 * We need to change postincrements of casted pointers (which are
3319 * then dereferenced and assigned into) of the form
3321 * *((TYPE*)PTRVAR)++ = (VALUE)
3323 * into expressions like
3325 * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
3327 * which is correct for the cases used in obstack.h since PTRVAR is
3328 * of type char * and the value of the expression is not used.
3331 hackname = obstack_lvalue_cast;
3333 select = '\
*\
(\
(([^
()]*)\
*\
)(.*)\
)\
+\
+ = \
(([^
()]*)\
)';
3335 c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
3336 test_text = "*((void **) (h)->next_free)++ = (aptr)";
3340 * Fix OpenBSD's va_start define.
3343 hackname
= openbsd_va_start
;
3344 mach
= "*-*-openbsd*";
3346 select
= '__builtin_stdarg_start';
3348 c_fix_arg
= __builtin_va_start
;
3350 test_text
= "#define va_start(v,l) __builtin_stdarg_start((v),l)";
3354 * sys
/lc_core.h on some versions of OSF1
/4.x pollutes the namespace by
3355 * defining regex.h related types. This causes libg
++ build and usage
3356 * failures. Fixing this correctly requires checking and modifying
3 files.
3359 hackname
= osf_namespace_a
;
3360 files
= reg_types.h
;
3361 files
= sys
/lc_core.h
;
3362 test
= " -r reg_types.h";
3363 test
= " -r sys/lc_core.h";
3364 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3365 test
= " -z \"`grep __regex_t regex.h`\"";
3369 c_fix_arg
= "reg(ex|off|match)_t";
3371 test_text
= "`touch sys/lc_core.h`"
3372 "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
3373 "extern regex_t re;\n"
3374 "extern regoff_t ro;\n"
3375 "extern regmatch_t rm;\n";
3379 hackname
= osf_namespace_c
;
3381 test
= " -r reg_types.h";
3382 test
= " -r sys/lc_core.h";
3383 test
= " -n \"`grep '} regex_t;' reg_types.h`\"";
3384 test
= " -z \"`grep __regex_t regex.h`\"";
3386 select
= "#include <reg_types\.h>.*";
3389 "typedef __regex_t\tregex_t;\n"
3390 "typedef __regoff_t\tregoff_t;\n"
3391 "typedef __regmatch_t\tregmatch_t;";
3393 test_text
= "#include <reg_types.h>";
3397 * On broken glibc
-2.3.3 systems an array of incomplete structures is
3398 * passed to __sigsetjmp. Fix that to take a pointer instead.
3401 hackname
= pthread_incomplete_struct_argument
;
3403 select
= "struct __jmp_buf_tag";
3405 c_fix_arg
= "%1 *%2%3";
3406 c_fix_arg
= "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) "
3407 "(__env)\\[1\\](.*)$";
3408 test_text
= "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], "
3413 * Fix return type of fread and fwrite on sysV68
3416 hackname
= read_ret_type
;
3418 select
= "extern int\t.*, fread\\(\\), fwrite\\(\\)";
3420 c_fix_arg
= "extern unsigned int fread(), fwrite();\n%1%2";
3421 c_fix_arg
= "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
3423 test_text
= "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
3427 * Fix casts as lvalues in glibc
's <rpc/xdr.h>.
3430 hackname = rpc_xdr_lvalue_cast_a;
3432 select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
3434 c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
3435 test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
3436 "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
3440 * rpc_xdr_lvalue_cast_b
3443 hackname = rpc_xdr_lvalue_cast_b;
3445 select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
3447 c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
3448 test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
3449 "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
3453 * function class(double x) conflicts with C++ keyword on rs/6000
3456 hackname = rs6000_double;
3458 select = '[^a
-zA
-Z_
]class\
(';
3461 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
3462 c_fix_arg = '^.
*[^a
-zA
-Z_
]class\
(.
*';
3464 test_text = "extern int class();";
3468 * Wrong fchmod prototype on RS/6000.
3471 hackname = rs6000_fchmod;
3473 select = 'fchmod\
(char \
*';
3475 c_fix_arg = "fchmod(int";
3476 test_text = "extern int fchmod(char *, mode_t);";
3480 * parameters conflict with C++ new on rs/6000
3483 hackname = rs6000_param;
3487 select = 'rename\
(const char \
*old
, const char \
*new\
)';
3489 c_fix_arg = 'rename(const char
*_old
, const char
*_new
)';
3491 test_text = 'extern int
rename(const char
*old
, const char
*new
);';
3495 * Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
3496 * for C99. This is wrong for C++, which needs many C99 features, but
3497 * only supports __restrict.
3500 hackname = solaris___restrict;
3501 files = sys/feature_tests.h;
3502 select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
3503 mach = "*-*-solaris2*";
3505 c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
3506 "#else\n%0\n#endif";
3507 test_text = "#define _RESTRICT_KYWD restrict";
3511 * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
3512 * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
3513 * and imaginary definitions which are not supported by GCC.
3516 hackname = solaris_complex;
3517 mach = "*-*-solaris2.*";
3519 select = "#define[ \t]_Complex_I[ \t]_Complex_I";
3520 sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
3521 "#define\t_Complex_I\t(__extension__ 1.0iF)/";
3522 sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
3523 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
3524 sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
3525 test_text = "#define _Complex_I _Complex_I\n"
3526 "#define complex _Complex\n"
3527 "#define _Imaginary_I _Imaginary_I\n"
3528 "#define imaginary _Imaginary\n"
3530 "#define I _Imaginary_I";
3534 * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
3535 * extern "C" instead so libstdc++ can use it.
3538 hackname = solaris_complex_cxx;
3539 mach = "*-*-solaris2.*";
3541 sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
3542 "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
3543 sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
3544 "#ifdef\t__cplusplus\\\n}\\\n#endif";
3545 test_text = "#if !defined(__cplusplus)\n"
3546 "#endif /* !defined(__cplusplus) */";
3550 * g++ rejects functions declared with both C and C++ linkage.
3553 hackname = solaris_cxx_linkage;
3554 mach = '*-*-solaris2
*';
3555 files = "iso/stdlib_iso.h";
3556 select = "(#if __cplusplus >= 199711L)\n"
3557 "(extern \"C\\+\\+\" \\{\n)"
3558 "(.*(bsearch|qsort).*)";
3560 c_fix_arg = "%1 && !__GNUG__\n%2%3";
3563 "#if __cplusplus >= 199711L\n"
3564 "extern \"C++\" {\n"
3565 " void *bsearch(const void *, const void *, size_t, size_t,";
3569 * Solaris <iso/stdio_iso.h> doesn't declare getc for C
++ with
3570 * _STRICT_STDC
, but uses it.
3573 hackname
= solaris_getc_strict_stdc
;
3574 mach
= "*-*-solaris2*";
3575 files
= "iso/stdio_iso.h";
3576 select
= "(.*&& )!defined\\(_STRICT_STDC\\)(.*)";
3578 c_fix_arg
= "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2";
3581 "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
3585 * Solaris
<iso
/stdio_iso.h
> should deprecate gets before C11.
3588 hackname
= solaris_gets_c11
;
3589 mach
= "*-*-solaris2*";
3590 files
= "iso/stdio_iso.h";
3591 select
= "(extern char[ \t]*\\*gets\\(char \\*\\));";
3594 c_fix_arg
= "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n"
3595 "%1 __attribute__((__deprecated__));\n"
3598 test_text
= "extern char *gets(char *);";
3602 * Solaris
<iso
/stdio_iso.h
> shouldn
't declare gets for C++14.
3605 hackname = solaris_gets_cxx14;
3606 mach = "*-*-solaris2*";
3607 files = "iso/stdio_iso.h";
3608 select = <<- _EOSelect_
3609 (#if __STDC_VERSION__ < 201112L)
3610 (extern char \*gets\(char \*\) __ATTR_DEPRECATED;)
3613 c_fix_arg = "%1 && __cplusplus < 201402L\n%2";
3615 test_text = <<- _EOText_
3616 #if __STDC_VERSION__ < 201112L
3617 extern char *gets(char *) __ATTR_DEPRECATED;
3622 * Sun Solaris 2 has a version of sys/int_const.h that defines
3623 * UINT8_C and UINT16_C to unsigned constants.
3626 hackname = solaris_int_const;
3627 files = sys/int_const.h;
3628 mach = '*-*-solaris2
*';
3630 c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
3632 "#define\tUINT16_C(c)\t(c)";
3633 select = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
3635 "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
3637 "#define UINT8_C(c) __CONCAT__(c,u)\n"
3639 "#define UINT16_C(c) __CONCAT__(c,u)";
3643 * Sun Solaris 2 has a version of sys/int_limits.h that defines
3644 * UINT8_MAX and UINT16_MAX to unsigned constants.
3647 hackname = solaris_int_limits_1;
3648 files = sys/int_limits.h;
3649 mach = '*-*-solaris2
*';
3651 c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
3652 "#define\tUINT16_MAX\t(65535)";
3653 select = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
3654 "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
3656 "#define UINT8_MAX (255U)\n"
3657 "#define UINT16_MAX (65535U)";
3661 * Sun Solaris 2 has a version of sys/int_limits.h that defines
3662 * INT_FAST16 limits to wrong values for sys/int_types.h.
3665 hackname = solaris_int_limits_2;
3666 files = sys/int_limits.h;
3667 mach = '*-*-solaris2
*';
3669 c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
3670 select = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
3672 "#define INT_FAST16_MAX INT16_MAX\n"
3673 "#define UINT_FAST16_MAX UINT16_MAX\n"
3674 "#define INT_FAST16_MIN INT16_MIN";
3678 * Sun Solaris 2 has a version of sys/int_limits.h that defines
3679 * SIZE_MAX as unsigned long.
3682 hackname = solaris_int_limits_3;
3683 files = sys/int_limits.h;
3684 mach = '*-*-solaris2
*';
3686 c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
3687 select = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
3689 "#define SIZE_MAX 4294967295UL";
3693 * Sun Solaris 10 defines several C99 math macros in terms of
3694 * builtins specific to the Studio compiler, in particular not
3695 * compatible with the GNU compiler.
3698 hackname = solaris_math_1;
3699 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3700 bypass = "__GNUC__";
3701 files = iso/math_c99.h;
3703 c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
3704 c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
3706 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3708 "#define HUGE_VAL __builtin_huge_val\n"
3709 "#undef HUGE_VALF\n"
3710 "#define HUGE_VALF __builtin_huge_valf\n"
3711 "#undef HUGE_VALL\n"
3712 "#define HUGE_VALL __builtin_huge_vall";
3716 * On Solaris 11, if you do isinf(NaN) you'll get a floating point
3717 * exception. Provide an alternative using GCC
's builtin.
3720 hackname = solaris_math_10;
3721 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3722 files = iso/math_c99.h;
3724 c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
3725 c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
3726 "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);"
3728 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
3729 "INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
3730 "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
3731 "\\(-INFINITY\\);[ \t]*\\}\\)";
3733 '#pragma ident
"@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
3735 "#define isinf(x) __extension__( \\\\\n"
3736 " { __typeof(x) __x_i = (x); \\\\\n"
3737 " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
3738 " __x_i == (__typeof(__x_i)) (-INFINITY); })";
3742 * Solaris math INFINITY
3745 hackname = solaris_math_2;
3746 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3747 bypass = "__GNUC__";
3748 files = iso/math_c99.h;
3750 c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
3751 c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
3753 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3755 "#define INFINITY __builtin_infinity";
3762 hackname = solaris_math_3;
3763 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3764 bypass = "__GNUC__";
3765 files = iso/math_c99.h;
3767 c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
3768 c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
3770 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3772 "#define NAN __builtin_nan";
3776 * Solaris math fpclassify
3779 hackname = solaris_math_4;
3780 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3781 bypass = "__GNUC__";
3782 files = iso/math_c99.h;
3784 c_fix_arg = "#define\tfpclassify(x) \\\n"
3785 " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, "
3786 "FP_SUBNORMAL, FP_ZERO, (x))";
3787 c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
3789 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3790 "#undef fpclassify\n"
3791 "#define fpclassify(x) __builtin_fpclassify(x)";
3795 * Solaris math signbit
3798 hackname = solaris_math_8;
3799 select = '@\
(#\
)math_c99\.h
' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
3800 bypass = "__GNUC__";
3801 files = iso/math_c99.h;
3803 c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
3804 "\t\t\t ? __builtin_signbitf(x) \\\n"
3805 "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
3806 "\t\t\t ? __builtin_signbitl(x) \\\n"
3807 "\t\t\t : __builtin_signbit(x))";
3808 c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
3809 test_text = <<- _EOText_
3810 #ident "@(#)math_c99.h 1.9 04/11/01 SMI"
3812 #define signbit(x) __builtin_signbit(x)
3817 * Solaris math comparison macros
3820 hackname = solaris_math_9;
3821 select = '@\
(#\
)math_c99.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3822 bypass = "__GNUC__";
3823 files = iso/math_c99.h;
3825 c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
3826 c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) "
3827 "__builtin_[a-z]+\\(y\\)\\)";
3829 '#ident
"@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
3830 "#undef isgreater\n"
3831 "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
3832 "#undef isgreaterequal\n"
3833 "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
3835 "#define isless(x, y) ((x) __builtin_isless(y))\n"
3836 "#undef islessequal\n"
3837 "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
3838 "#undef islessgreater\n"
3839 "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
3840 "#undef isunordered\n"
3841 "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
3845 * Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing
3849 hackname = solaris_math_11;
3850 select = '@\
(#\
)math_c99\.h
' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ ";
3851 files = iso/math_c99.h;
3853 c_fix_arg = << _EOArg_
3855 #define signbit(x) (sizeof(x) == sizeof(float) \
3856 ? __builtin_signbitf(x) \
3857 : sizeof(x) == sizeof(long double) \
3858 ? __builtin_signbitl(x) \
3859 : __builtin_signbit(x))
3861 c_fix_arg = << _EOArg_
3863 #if defined\(__sparc\)
3864 #define[ ]+signbit\(x\)[ ]+__extension__\( \\
3865 [ ]+\{[ ]*__typeof\(x\)[ ]*__x_s[ ]*=[ ]*\(x\);[ ]*\\
3866 [ ]+\(int\)[ ]*\(\*\(unsigned[ ]*\*\)[ ]*\&__x_s[ ]*>>[ ]*31\);[ ]*\}\)
3867 #elif defined\(__i386\) \|\| defined\(__amd64\)
3868 #define[ ]+signbit\(x\)[ ]+__extension__\( \\
3869 [ ]+\{ __typeof\(x\) __x_s = \(x\); \\
3870 [ ]+\(sizeof \(__x_s\) == sizeof \(float\) \? \\
3871 [ ]+\(int\) \(\*\(unsigned \*\) \&__x_s >> 31\) : \\
3872 [ ]+sizeof \(__x_s\) == sizeof \(double\) \? \\
3873 [ ]+\(int\) \(\(\(unsigned \*\) \&__x_s\)\[1\] >> 31\) : \\
3874 [ ]+\(int\) \(\(\(unsigned short \*\) \&__x_s\)\[4\] >> 15\)\); \}\)
3877 test_text = << _EOText_
3878 /* @(#)math_c99.h 1.14 13/03/27 */
3880 #if defined(__sparc)
3881 #define signbit(x) __extension__( \\
3882 { __typeof(x) __x_s = (x); \\
3883 (int) (*(unsigned *) &__x_s >> 31); })
3884 #elif defined(__i386) || defined(__amd64)
3885 #define signbit(x) __extension__( \\
3886 { __typeof(x) __x_s = (x); \\
3887 (sizeof (__x_s) == sizeof (float) ? \\
3888 (int) (*(unsigned *) &__x_s >> 31) : \\
3889 sizeof (__x_s) == sizeof (double) ? \\
3890 (int) (((unsigned *) &__x_s)[1] >> 31) : \\
3891 (int) (((unsigned short *) &__x_s)[4] >> 15)); })
3897 * Some versions of Solaris 10+ <math.h> #undef libstdc++-internal macros.
3900 hackname = solaris_math_12;
3902 mach = '*-*-solaris2
*';
3903 select = '#undef.
*_GLIBCXX_USE_C99_MATH
';
3904 sed = "/#undef[ \t]*_GLIBCXX_USE_C99_MATH/d";
3905 test_text = << _EOText_
3906 #if __cplusplus >= 201103L
3907 #undef _GLIBCXX_USE_C99_MATH
3908 #undef _GLIBCXX_USE_C99_MATH_TR1
3914 * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
3915 * structure. As such, it need two levels of brackets, but only
3916 * contains one. Wrap the macro definition in an extra layer.
3919 hackname = solaris_once_init_1;
3920 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3922 mach = '*-*-solaris
*';
3924 c_fix_arg = "%1{%2}%3";
3925 c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
3927 '#pragma ident
"@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
3928 "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
3932 * Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the
3933 * posix_spawn declarations, which doesn't work with C
++.
3936 hackname
= solaris_posix_spawn_restrict
;
3938 mach
= '*-*-solaris2*';
3940 c_fix_arg
= "%1*_RESTRICT_KYWD %2%3";
3941 select
= "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
3943 "char *const argv[_RESTRICT_KYWD],\n"
3944 "char *const envp[_RESTRICT_KYWD]);";
3948 * The pow overloads with int were removed in C
++ 2011 DR
550.
3951 hackname
= solaris_pow_int_overload
;
3952 mach
= '*-*-solaris2*';
3953 files
= "iso/math_iso.h";
3954 select
= "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)"
3955 " *\\{[^{}]*\n[^{}]*\\}";
3957 c_fix_arg
= "#if __cplusplus < 201103L\n%0\n#endif";
3960 " inline long double pow(long double __X, int __Y) { return\n"
3961 " __powl(__X, (long double) (__Y)); }";
3965 * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a
"0" for some
3966 * fields of the pthread_rwlock_t structure
, which are of type
3967 * upad64_t
, which itself is typedef
'd to int64_t, but with __STDC__
3968 * defined (e.g. by -ansi) it is a union. So change the initializer
3972 hackname = solaris_rwlock_init_1;
3973 select = '@\
(#\
)pthread.h
' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3975 mach = '*-*-solaris
*';
3977 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3980 "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
3982 c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
3983 "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
3986 '#ident
"@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
3987 "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
3991 * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
3992 * std::__flsbuf, but <iso/stdio_iso.h> uses them.
3995 hackname = solaris_std___filbuf;
3997 mach = '*-*-solaris2
*';
3998 bypass = "using std::__filbuf";
3999 select = "(using std::perror;\n)(#endif)";
4001 c_fix_arg = "%1#ifndef _LP64\n"
4002 "using std::__filbuf;\n"
4003 "using std::__flsbuf;\n"
4006 test_text = "using std::perror;\n"
4011 * Solaris <stdio.h> shouldn't use std
::gets for C
++14.
4014 hackname
= solaris_std_gets_cxx14
;
4015 mach
= "*-*-solaris2*";
4017 select
= "using std::gets;";
4020 c_fix_arg
= "#if __cplusplus < 201402L\n%0\n#endif";
4022 test_text
= "using std::gets;";
4026 * Sun Solaris
8 has what appears to be some gross workaround for
4027 * some old version of their c
++ compiler. G
++ doesn
't want it
4028 * either, but doesn't want to be tied to SunPRO version numbers.
4031 hackname
= solaris_stdio_tag
;
4032 files
= stdio_tag.h
;
4034 select
= '__cplusplus < 54321L';
4035 /* In Solaris
10, the code in stdio_tag.h is conditionalized on
4036 "!defined(__GNUC__)" so we no longer need to fix it.
*/
4037 bypass
= '__GNUC__';
4038 sed
= 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
4040 test_text
= "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
4044 * Solaris
<stdlib.h
> shouldn
't use _Noreturn, breaks with C++.
4047 hackname = solaris_stdlib_noreturn;
4048 mach = "*-*-solaris2*";
4049 files = "iso/stdlib_c99.h";
4050 select = "(extern) _Noreturn (void quick_exit\\(int\\));";
4053 c_fix_arg = "%1 %2 __attribute__((__noreturn__));";
4055 test_text = "extern _Noreturn void quick_exit(int);";
4059 * a missing semi-colon at the end of the statsswtch structure definition.
4062 hackname = statsswtch;
4063 files = rpcsvc/rstat.h;
4064 select = "boottime$";
4066 c_fix_arg = "boottime;";
4067 test_text = "struct statswtch {\n int boottime\n};";
4071 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
4072 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
4076 hackname
= stdio_stdarg_h
;
4078 bypass
= "include.*(stdarg\.h|machine/ansi\.h)";
4080 * On Solaris
10, this fix is unncessary
; <stdio.h
> includes
4081 * <iso
/stdio_iso.h
>, which includes
<sys
/va_list.h
>.
4083 mach
= '*-*-solaris2.1[0-9]*';
4088 c_fix_arg
= "#define __need___va_list\n#include <stdarg.h>\n";
4094 * Don
't use or define the name va_list in stdio.h. This is for
4095 * ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
4096 * of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
4097 * indicate that the header knows what it's doing
-- under SUSv2
,
4098 * stdio.h is required to define va_list
, and we shouldn
't break
4102 hackname = stdio_va_list;
4104 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list
';
4106 * On Solaris 10, the definition in
4107 * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
4108 * there is therefore no need for this fix there.
4110 mach = '*-*-solaris2.1
[0-9]*';
4114 * Use __gnuc_va_list in arg types in place of va_list.
4115 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
4116 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
4117 * trailing parentheses and semicolon save all other systems from this.
4118 * Define
__not_va_list__ (something harmless and unused
)
4119 * instead of va_list.
4120 * Don
't claim to have defined va_list.
4122 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
4123 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
4124 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
4125 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
4126 "s@ va_list@ __not_va_list__@\n"
4127 "s@\\*va_list@*__not_va_list__@\n"
4128 "s@ __va_list)@ __gnuc_va_list)@\n"
4129 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
4130 "@typedef \\1 __not_va_list__;@\n"
4131 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
4132 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
4133 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
4134 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
4135 "s@VA_LIST@DUMMY_VA_LIST@\n"
4136 "s@_Va_LIST@_VA_LIST@";
4137 test_text = "extern void mumble( va_list);";
4141 * Fix headers that use va_list from stdio.h to use the updated
4142 * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
4143 * dealt with elsewhere. The presence of __gnuc_va_list,
4144 * __DJ_va_list, or _G_va_list is taken to indicate that the header
4145 * knows what it's doing.
4148 hackname
= stdio_va_list_clients
;
4156 files
= curses_colr
/curses.h
;
4157 bypass
= '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
4158 /* Don
't fix, if we use va_list from stdarg.h, or if the use is
4159 otherwise protected. */
4160 bypass = 'include
<stdarg\.h
>|#ifdef va_start
';
4163 * Use __gnuc_va_list in arg types in place of va_list.
4164 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
4165 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
4166 * trailing parentheses and semicolon save all other systems from this.
4167 * Define
__not_va_list__ (something harmless and unused
)
4168 * instead of va_list.
4169 * Don
't claim to have defined va_list.
4171 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
4172 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
4173 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
4174 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
4175 "s@ va_list@ __not_va_list__@\n"
4176 "s@\\*va_list@*__not_va_list__@\n"
4177 "s@ __va_list)@ __gnuc_va_list)@\n"
4178 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
4179 "@typedef \\1 __not_va_list__;@\n"
4180 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
4181 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
4182 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
4183 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
4184 "s@VA_LIST@DUMMY_VA_LIST@\n"
4185 "s@_Va_LIST@_VA_LIST@";
4186 test_text = "extern void mumble( va_list);";
4190 * "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
4191 * is "!defined( __STRICT_ANSI__ )"
4194 hackname = strict_ansi_not;
4195 select = "^([ \t]*#[ \t]*if.*)"
4197 "|__STDC__[ \t]*==[ \t]*0"
4198 "|__STDC__[ \t]*!=[ \t]*1"
4199 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
4200 /* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
4201 bypass = 'GNU and MIPS C compilers define __STDC__ differently
';
4202 /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
4203 is not defined by GCC, so it is safe. */
4204 bypass = '__SCO_VERSION__.
*__STDC__
!= 1';
4205 c_test = stdc_0_in_system_headers;
4208 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
4210 test_text = "#if !__STDC__ \n"
4211 "#if __STDC__ == 0\n"
4212 "#if __STDC__ != 1\n"
4213 "#if __STDC__ - 0 == 0"
4214 "/* not std C */\nint foo;\n"
4215 "\n#end-end-end-end-if :-)";
4220 * is "!defined( __STRICT_ANSI__ )" on continued #if-s
4223 hackname = strict_ansi_not_ctd;
4224 files = math.h, limits.h, stdio.h, signal.h,
4225 stdlib.h, sys/signal.h, time.h;
4227 * Starting at the beginning of a line, skip white space and
4228 * a leading "(" or "&&" or "||". One of those must be found.
4229 * Then, zero, one or more copies of a "defined(_FOO_BAR_) &&"
4230 * expression. If these are nested, then they must accumulate
4231 * because we won't match any closing parentheses. Finally
,
4232 * after skipping over all that
, we must then match our suspect
4233 * phrase
: "__STDC__-0==0" with or without white space.
4235 select
= "^([ \t]*" '(\(|&&|\|\|)'
4236 "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
4238 "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
4239 c_test
= stdc_0_in_system_headers
;
4242 c_fix_arg
= "%1 !defined(__STRICT_ANSI__)";
4244 test_text
= "#if 1 && \\\\\n"
4245 "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
4246 "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
4247 "|| __STDC__ - 0 == 0 ) /* not std C */\n"
4252 * "__STDC__!=0" or
"__STDC__==1" or
"__STDC__-0==1"
4253 * is
"defined( __STRICT_ANSI__ )"
4256 hackname
= strict_ansi_only
;
4257 select
= "^([ \t]*#[ \t]*if.*)"
4258 "(__STDC__[ \t]*!=[ \t]*0"
4259 "|__STDC__[ \t]*==[ \t]*1"
4260 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
4261 "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
4262 c_test
= stdc_0_in_system_headers
;
4265 c_fix_arg
= "%1 defined(__STRICT_ANSI__)";
4267 test_text
= "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
4271 * IRIX
4.0.5 <rpc
/xdr.h
> uses struct __file_s
4272 * in prototype without previous definition.
4275 hackname
= struct_file
;
4277 select
= '^.*xdrstdio_create.*struct __file_s';
4279 c_fix_arg
= "struct __file_s;\n%0";
4280 test_text
= "extern void xdrstdio_create( struct __file_s* );";
4284 * IRIX
4.0.5 <rpc
/auth.h
> uses struct sockaddr
4285 * in prototype without previous definition.
4287 * Don
't fix OpenBSD, which uses struct sockaddr_in prototyping the same
4288 * function, and does define it.
4291 hackname = struct_sockaddr;
4293 select = "^.*authdes_create.*struct sockaddr[^_]";
4294 bypass = "<sys/socket\.h>";
4295 bypass = "struct sockaddr;\n";
4297 c_fix_arg = "struct sockaddr;\n%0";
4298 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
4302 * Apply fix this to all OSs since this problem seems to effect
4303 * more than just SunOS.
4306 hackname = sun_auth_proto;
4311 bypass = "__cplusplus";
4313 * Select those files containing '(*name)()'.
4315 select = '\(\*[a-z][a-z_]*\)\(\)';
4318 c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n"
4319 "#else\n%1();%2\n#endif";
4320 c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
4324 " int (*name)(); /* C++ bad */\n"
4329 * Fix bogus #ifdef on SunOS 4.1.
4332 hackname = sun_bogus_ifdef;
4333 files = "hsfs/hsfs_spec.h";
4334 files = "hsfs/iso_spec.h";
4335 select = '#
ifdef(.
*\|\|.*)
';
4337 c_fix_arg = "#if%1";
4339 test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
4343 * Fix the CAT macro in SunOS memvar.h.
4346 hackname = sun_catmacro;
4347 files = pixrect/memvar.h;
4348 select = "^#define[ \t]+CAT\\(a,b\\).*";
4353 "# define CAT(a,b) a##b\n"
4354 "#else\n%0\n#endif";
4357 "#define CAT(a,b)\ta/**/b";
4361 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
4362 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
4365 hackname = sun_malloc;
4367 bypass = "_CLASSIC_ANSI_TYPES";
4369 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
4370 sed = "s/int[ \t][ \t]*free/void\tfree/g";
4371 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
4372 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
4373 sed = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
4376 "typedef char *\tmalloc_t;\n"
4378 "char*\tmalloc();\n"
4379 "char*\tcalloc();\n"
4380 "char*\trealloc();";
4384 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
4387 hackname = sun_rusers_semi;
4388 files = rpcsvc/rusers.h;
4390 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
4391 test_text = "struct mumble\n int _cnt\n};";
4395 * signal.h on SunOS defines signal using (),
4396 * which causes trouble when compiling with g++ -pedantic.
4399 hackname = sun_signal;
4400 files = sys/signal.h;
4402 select = "^void\t" '\
(\
*signal\
(\
)\
)\
(\
);.
*';
4406 "#ifdef __cplusplus\n"
4407 "void\t(*signal(...))(...);\n"
4408 "#else\n%0\n#endif";
4410 test_text = "void\t(*signal())();";
4414 * Correct the return type for strlen in strings.h in SunOS 4.
4417 hackname = sunos_strlen;
4419 select = "int[ \t]*strlen\\(\\);(.*)";
4421 c_fix_arg = "__SIZE_TYPE__ strlen();%1";
4422 test_text = " int\tstrlen(); /* string length */";
4426 * Linux kernel's vt.h breaks C
++
4429 hackname
= suse_linux_vt_cxx
;
4432 select
= "^[ \t]*unsigned int new;";
4434 c_fix_arg
= "unsigned int newev;";
4436 test_text
= " unsigned int new; /* New console (if changing) */";
4440 * Disable apparent native compiler optimization cruft in SVR4.2
<string.h
>
4441 * that is visible to any ANSI compiler using this include. Simply
4442 * delete the lines that #define some string functions to internal forms.
4445 hackname
= svr4_disable_opt
;
4447 select
= '#define.*__std_hdr_';
4448 sed
= '/#define.*__std_hdr_/d';
4449 test_text
= "#define strlen __std_hdr_strlen\n";
4453 * Fix broken decl of getcwd present on some svr4 systems.
4456 hackname
= svr4_getcwd
;
4459 files
= prototypes.h
;
4460 select
= 'getcwd\(char \*, int\)';
4463 c_fix_arg
= "getcwd(char *, size_t)";
4465 test_text
= "extern char* getcwd(char *, int);";
4469 * Fix broken decl of profil present on some svr4 systems.
4472 hackname
= svr4_profil
;
4477 'profil\(unsigned short \*, unsigned int, unsigned int, unsigned int\)';
4479 c_fix_arg
= 'profil(unsigned short *, size_t, int, unsigned int)';
4482 'profil(unsigned short *, unsigned int, unsigned int, unsigned int);';
4486 * Correct types for signal handler constants like SIG_DFL
; they might be
4487 * void (*) (), and should be void (*) (int). C++ doesn't like the
4491 hackname = svr4_sighandler_type;
4492 files = sys/signal.h;
4493 select = 'void *\(\*\)\(\)';
4495 c_fix_arg = "void (*)(int)";
4496 test_text = "#define SIG_DFL (void(*)())0\n"
4497 "#define SIG_IGN (void (*)())0\n";
4501 * Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local
4502 * function 'getrnge' in <regexp.h> before they declare it. For these
4503 * systems add a 'static int' declaration of 'getrnge' into <regexp.h>
4506 * 'getrnge' traditionally manipulates a file-scope global called 'size',
4507 * so put the declaration right after the declaration of 'size'.
4509 * Don't do this if there is already a `static void getrnge' declaration
4510 * present, since this would cause a redeclaration error. Solaris 2.x has
4511 * such a declaration.
4514 hackname = svr4_undeclared_getrnge;
4517 bypass = "static void getrnge";
4520 "static int getrnge ();";
4521 c_fix_arg = "^static int[ \t]+size;";
4522 test_text = "static int size;\n"
4523 "/* stuff which calls getrnge() */\n"
4524 "static getrnge()\n"
4529 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
4530 * in string.h on sysV68
4531 * Correct the return type for strlen in string.h on Lynx.
4532 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
4533 * Add missing const for strdup on OSF/1 V3.0.
4534 * On sysV88 layout is slightly different.
4537 hackname = sysv68_string;
4540 bypass = "_CLASSIC_ANSI_TYPES";
4542 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
4543 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
4544 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
4546 sed = "/^extern char$/N";
4547 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
4549 sed = "/^extern int$/N";
4550 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
4552 sed = "/^\tstrncmp(),$/N";
4553 sed = 's/^\(' "\t" 'strncmp()\),\n\(' "\t" 'strlen(),\)$/'
4554 '\1;' "\\\nextern unsigned int\\\n\\2/";
4557 "extern int strlen();\n"
4559 "extern int ffs(long);\n"
4572 "\tstrlen(), strspn();";
4576 * Fix return type of calloc, malloc, realloc, bsearch and exit
4579 hackname = sysz_stdlib_for_sun;
4581 bypass = "_CLASSIC_ANSI_TYPES";
4583 select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
4585 c_fix_arg = "void *\t%1(";
4588 "extern char*\tcalloc(size_t);\n"
4589 "extern char*\tmalloc(size_t);\n"
4590 "extern char*\trealloc(void*,size_t);\n"
4591 "extern char*\tbsearch(void*,size_t,size_t);\n";
4595 * __thread is now a keyword.
4598 hackname = thread_keyword;
4599 files = "pthread.h";
4600 files = bits/sigthread.h, '*/bits/sigthread.h';
4601 select = "([* ])__thread([,)])";
4603 c_fix_arg = "%1__thr%2";
4606 "extern int pthread_create (pthread_t *__restrict __thread,\n"
4607 "extern int pthread_kill (pthread_t __thread, int __signo);\n"
4608 "extern int pthread_cancel (pthread_t __thread);";
4612 * if the #if says _cplusplus, not the double underscore __cplusplus
4616 hackname = tinfo_cplusplus;
4618 select = "[ \t]_cplusplus";
4621 c_fix_arg = " __cplusplus";
4622 test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
4626 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4629 hackname = ultrix_const;
4631 select = 'perror\( char \*';
4634 c_fix_arg = "%1 const %3 *__";
4635 c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
4636 "[ \t]+(char|void
) \\*__
";
4639 "extern void
perror( char
*__s
);\n"
4640 "extern int
fputs( char
*__s
, FILE *)
;\n"
4641 "extern size_t
fwrite( void
*__ptr
, size_t
, size_t
, FILE *)
;\n"
4642 "extern int
fscanf( FILE
*__stream
, char
*__format
, ...
);\n"
4643 "extern int
scanf( char
*__format
, ...
);\n";
4647 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
4650 hackname = ultrix_const2;
4653 select = '\*fopen\( char \*';
4655 c_fix_arg = "%1( const char
*%3, const char
*";
4656 c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam
))\\("
4657 "[ \t]*char
[ \t]*\\*([^
,]*)
,"
4658 "[ \t]*char
[ \t]*\\*[ \t]*";
4661 "extern FILE
*fopen( char
*__filename
, char
*__type
);\n"
4662 "extern int
sscanf( char
*__s
, char
*__format
, ...
);\n"
4663 "extern FILE
*popen(char
*, char *)
;\n"
4664 "extern char
*tempnam(char
*,char*)
;\n";
4668 * Fix definitions of macros used by va-i960.h in VxWorks header file.
4671 hackname = va_i960_macro;
4672 files = arch/i960/archI960.h;
4673 select = "__(vsiz|vali|vpad|alignof__
)";
4676 c_fix_arg = "__vx
%1";
4679 "extern int __vsiz vsiz
;\n"
4680 "extern int __vali vali
;\n"
4681 "extern int __vpad vpad
;\n"
4682 "#define
__alignof__(x
) ...
";
4686 * On VMS, add missing braces around sigset_t constants.
4689 hackname = vms_add_missing_braces;
4690 select = "(_SIG_
[A
-Z
]+_SET
[ \t]+= \\{)(0x
[0F
]+, 0x
[0F
]+)";
4692 files = "rtldef
/signal.h
";
4695 c_fix_arg = '%1 {%2} ';
4697 test_text = "static const __sigset_t _SIG_EMPTY_SET
= "
4698 "{0x00000000, 0x00000000},\n"
4699 " _SIG_FULL_SET
= {0xFFFFFFFF, 0xFFFFFFFF};\n";
4703 * On VMS, some DEC-C builtins are directly used.
4706 hackname = vms_decc_builtin;
4707 select = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY
)";
4709 files = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
4711 sed = "s@__MEMSET@memset@
";
4712 sed = "s@__MEMMOVE@memmove@
";
4713 sed = "s@__MEMCPY@memcpy@
";
4714 sed = "s@__STRLEN@strlen@
";
4715 sed = "s@__STRCPY@strcpy@
";
4717 test_text = "define
FD_ZERO(__p
) __MEMSET((__p
), 0, sizeof(*(__p)))\n";
4721 * Define __CAN_USE_EXTERN_PREFIX on vms.
4724 hackname = vms_define_can_use_extern_prefix;
4725 files = "rtldef/decc$types.h";
4726 select = "#[ \t]*else\n"
4727 "#[ \t]*if defined\\(__DECCXX\\)\n"
4728 "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n";
4733 "# elif defined (__GNUC__)\n"
4734 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n";
4736 test_text = "# else\n"
4737 "# if defined(__DECCXX)\n"
4738 "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"
4744 * On VMS, disable the use of dec-c string builtins
4747 hackname = vms_disable_decc_string_builtins;
4748 select = "#if !defined\\(__VAX\\)\n";
4750 files = "rtldef/string.h";
4753 c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n";
4755 test_text = "#if !defined(__VAX)\n";
4759 * On VMS, fix incompatible redeclaration of hostalias.
4762 hackname = vms_do_not_redeclare_hostalias;
4763 select = "(void[ \t]+fp_nquery \\(const u_char \\*, int, FILE \\*\\);)\n"
4764 "(__char_ptr32[ \t]+hostalias \\(const char \\*\\);)";
4766 files = "rtldef/resolv.h";
4772 test_text = "void fp_nquery (const u_char *, int, FILE *);\n"
4773 "__char_ptr32
hostalias (const char *)
;\n";
4777 * On VMS, forward declare structure before referencing them in prototypes.
4780 hackname = vms_forward_declare_struct;
4781 select = "(/\\* forward decls for C
\\+\\+ \\*/\n)"
4782 "#ifdef __cplusplus
\n";
4784 files = rtldef/if.h;
4788 "#if
defined (__cplusplus
) ||
defined (__GNUC__
)\n";
4790 test_text = "/* forward decls for C
++ */\n"
4791 "#ifdef __cplusplus
\n"
4797 * On VMS, do not declare getopt and al if pointers are 64 bit.
4800 hackname = vms_no_64bit_getopt;
4801 select = "^
[ \t]*(extern
[ \t]*)?
(int
[ \t]*(getopt|optind|opterr|optopt
)"
4802 "|
(char
\\*optarg
))([ \t]*\\(.
*\\))?
;\n";
4804 files = rtldef/stdio.h, rtldef/unistd.h;
4807 c_fix_arg = <<- _EOArg_
4808 #if __INITIAL_POINTER_SIZE != 64 /* getopt is short ptr only. */
4813 test_text = "int
getopt (int
, char
* const
[], const char *)
;";
4817 * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
4818 * which is not yet fully supported by gcc.
4821 hackname = vms_use_fast_setjmp;
4822 select = "(#
[ \t]*if
[ \t]*defined
\\(__FAST_SETJMP
\\)[ \t]*\\|
\\|
)";
4824 files = rtldef/setjmp.h;
4827 c_fix_arg = "%0 defined (__GNUC__
) ||
";
4829 test_text = "# if
defined(__FAST_SETJMP
) ||
defined(__UNIX_SETJMP
)";
4833 * On VMS, use pragma extern_model instead of VAX-C keywords.
4836 hackname = vms_use_pragma_extern_model;
4837 select = "#if defined
\\(__DECC
\\) \\|
\\| defined
\\(__DECCXX
\\)\n"
4838 "# pragma extern_model __save
\n";
4842 c_fix_arg = "#if
defined(__DECC
) ||
defined(__DECCXX
) ||
defined(__GNUC__
)\n"
4843 "# pragma extern_model __save
\n";
4845 test_text = "#if
defined(__DECC
) ||
defined(__DECCXX
)\n"
4846 "# pragma extern_model __save
\n"
4847 "# pragma extern_model strict_refdef
\n"
4848 " extern struct x zz$yy
;\n"
4849 "# pragma extern_model __restore
\n"
4854 * On VMS, change <resource.h> to <sys/resource.h> to avoid a
4855 * conflict while building gcc. Likewise for <builtins.h>
4858 hackname = vms_use_quoted_include;
4859 select = "(#
[ \t]*include
[ \t]+)<(resource|builtins
)\\.h
>";
4861 files = rtldef/wait.h, starlet_c/pthread.h;
4864 c_fix_arg = '%1<sys/%2.h>';
4866 test_text = "# include
<resource.h
>";
4870 * AIX and Interix headers define NULL to be cast to a void pointer,
4871 * which is illegal in ANSI C++.
4874 hackname = void_null;
4875 files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
4876 time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h;
4877 /* avoid changing C++ friendly NULL */
4878 bypass = __cplusplus;
4880 select = "^#
[ \t]*define
[ \t]+NULL
[ \t]+\\(\\(void
[ \t]*\\*\\)0\\)";
4882 c_fix_arg = <<- _EOFix_
4887 #else /* ! __GNUG__ */
4889 #endif /* __GNUG__ */
4890 #else /* ! __cplusplus */
4891 #define NULL ((void *)0)
4892 #endif /* __cplusplus */
4895 test_text = "# define
\tNULL
\t((void *)
0) /* typed NULL
*/";
4899 * Make VxWorks header which is almost gcc ready fully gcc ready.
4902 hackname = vxworks_gcc_problem;
4903 files = types/vxTypesBase.h;
4904 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__
";
4906 sed = "s
/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__
/"
4909 sed = "/[ \t]size_t
/i
\\\n"
4910 "#ifndef _GCC_SIZE_T
\\\n"
4911 "#define _GCC_SIZE_T
\n";
4913 sed = "/[ \t]size_t
/a
\\\n"
4916 sed = "/[ \t]ptrdiff_t
/i
\\\n"
4917 "#ifndef _GCC_PTRDIFF_T
\\\n"
4918 "#define _GCC_PTRDIFF_T
\n";
4920 sed = "/[ \t]ptrdiff_t
/a
\\\n"
4923 sed = "/[ \t]wchar_t
/i
\\\n"
4924 "#ifndef _GCC_WCHAR_T
\\\n"
4925 "#define _GCC_WCHAR_T
\n";
4927 sed = "/[ \t]wchar_t
/a
\\\n"
4931 "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__
\n"
4932 "typedef unsigned int size_t
;\n"
4933 "typedef long ptrdiff_t
;\n"
4934 "typedef unsigned short wchar_t
;\n"
4935 "#endif
/* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__
*/\n";
4939 * Wrap VxWorks ioctl to keep everything pretty
4942 hackname = vxworks_ioctl_macro;
4944 mach = "*-*-vxworks
*";
4948 "#define
ioctl(fd
, func
, arg
) ioctl(fd
, func
, (int
)(arg
))\n";
4949 c_fix_arg = "extern
[\t ]+int
[\t ]+ioctl
[\t ]*\\([\t ,[:alnum
:]]*\\);";
4951 test_text = "extern int
ioctl ( int asdf1234
, int jkl
, int qwerty
) ;";
4955 * Wrap VxWorks mkdir to be posix compliant
4958 hackname = vxworks_mkdir_macro;
4960 mach = "*-*-vxworks
*";
4964 "#define
mkdir(dir
, ...
) ((void
)0, ##__VA_ARGS__
, (mkdir
)(dir
))\n";
4965 c_fix_arg = "extern
[\t ]+STATUS
[\t ]+mkdir
[\t ]*"
4966 "\\([\t ]*const
[\t ]+char
[\t ]*\\*[\t ]*" /* arg type */
4967 "(|
[_
[:alpha
:]][_
[:alnum
:]]*)
" /* arg name (optional) */
4970 test_text = "extern STATUS
mkdir (const char
* _qwerty
) ;";
4974 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
4977 hackname = vxworks_needs_vxtypes;
4979 select = "uint_t([ \t]+_clocks_per_sec
)";
4981 c_fix_arg = "unsigned int
%1";
4982 test_text = "uint_t
\t_clocks_per_sec
;";
4986 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
4989 hackname = vxworks_needs_vxworks;
4991 test = " -r types
/vxTypesOld.h
";
4992 test = " -n
\"`egrep
'#include' $file`
\"";
4993 test = " -n
\"`egrep ULONG $file`
\"";
4994 select = "#
[ \t]define
[ \t]+__INCstath
";
4996 sed = "/#
[ \t]define
[ \t][ \t]*__INCstath
/a
\\\n"
4997 "#include
<types
/vxTypesOld.h
>\n";
4999 test_text = "`touch types
/vxTypesOld.h`
"
5000 "#include
</dev
/null
> /* ULONG
*/\n"
5001 "# define
\t__INCstath
<sys
/stat.h
>";
5005 * Make it so VxWorks does not include gcc/regs.h accidentally
5008 hackname = vxworks_regs;
5009 mach = "*-*-vxworks
*";
5011 select = "#
[\t ]*include
[\t ]+[<\"]regs.h
[>\"]";
5013 c_fix_arg = "#include
<arch
/..
/regs.h
>";
5015 test_text = "#include
<regs.h
>\n";
5019 * Another bad dependency in VxWorks 5.2 <time.h>.
5022 hackname = vxworks_time;
5024 test = " -r vxWorks.h
";
5026 select = "#
[ \t]*define
[ \t]+VOIDFUNCPTR
[ \t].
*";
5030 "#ifndef __gcc_VOIDFUNCPTR_defined
\n"
5031 "#ifdef __cplusplus
\n"
5032 "typedef
void (*__gcc_VOIDFUNCPTR) (...);\n"
5034 "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
5036 "#define __gcc_VOIDFUNCPTR_defined\n"
5038 "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
5040 test_text = "`touch vxWorks.h`"
5041 "#define VOIDFUNCPTR (void(*)())";
5045 * This hack makes write const-correct on VxWorks
5048 hackname = vxworks_write_const;
5050 mach = "*-*-vxworks*";
5053 c_fix_arg = "extern int write (int, const char*, size_t);";
5054 c_fix_arg = "extern[\t ]+int[\t ]+write[\t ]*\\("
5056 "[\t ]*char[\t ]*\\*[\t ]*,"
5057 "[\t ]*size_t[\t ]*\\)[\t ]*;";
5059 test_text = "extern int write ( int , char * , size_t ) ;";
5063 * This hack ensures the include_next in the fixed unistd.h actually
5064 * finds the system's unistd.h and not the fixed unistd.h again.
5067 hackname = vxworks_iolib_include_unistd;
5069 mach = "*-*-vxworks*";
5070 select = "#include \"unistd.h\"";
5073 c_fix_arg = "#include <unistd.h>";
5075 test_text = "#include \"unistd.h\"";
5079 * There are several name conflicts with C++ reserved words in X11 header
5080 * files. These are fixed in some versions, so don't do the fixes if
5081 * we find __cplusplus in the file. These were found on the RS/6000.
5084 hackname = x11_class;
5085 files = X11/ShellP.h;
5086 bypass = __cplusplus;
5087 select = "^([ \t]*char \\*)class
;(.*)
";
5089 c_fix_arg = "#ifdef __cplusplus
\n%1c_class
;%2\n"
5090 "#else
\n%1class
;%2\n#endif
";
5098 * class in Xm/BaseClassI.h
5101 hackname = x11_class_usage;
5102 files = Xm/BaseClassI.h;
5103 bypass = "__cplusplus
";
5105 select = " class
\\)";
5107 c_fix_arg = " c_class
)";
5109 test_text = "extern
mumble (int class
);\n";
5113 * new in Xm/Traversal.h
5117 files = Xm/Traversal.h;
5118 bypass = __cplusplus;
5120 sed = "/Widget
\told
, new
;/i
\\\n"
5121 "#ifdef __cplusplus
\\\n"
5122 "\\\tWidget
\told
, c_new
;\\\n"
5125 sed = "/Widget
\told
, new
;/a
\\\n"
5128 sed = "s
/Widget new
,/Widget c_new
,/g
";
5131 " Widget
\told
, new
;\n"
5132 "};\nextern
Wedged( Widget new
, Widget old
);";
5136 * Incorrect sprintf declaration in X11/Xmu.h
5139 hackname = x11_sprintf;
5141 files = X11/Xmu/Xmu.h;
5142 select = "^extern char
\\*\tsprintf
\\(\\);$
";
5145 c_fix_arg = "#ifndef __STDC__
\n%0\n#endif
/* !defined __STDC__
*/";
5147 test_text = "extern char
*\tsprintf
();";