]> git.ipfire.org Git - thirdparty/gcc.git/blame - fixincludes/inclhack.def
Add missing docs for feature added by Richard Henderson.
[thirdparty/gcc.git] / fixincludes / inclhack.def
CommitLineData
1f414ac4 1/* -*- Mode: C -*- */
0083c904 2
7a544ce1 3autogen definitions fixincl;
0083c904 4
82c3a53e
BK
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.
5abc1f74 7
7b78a14a
BK
8 This is the sort command:
9
f7cf1c74 10 blocksort output=inclhack.sorted \
7b78a14a 11 pattern='^/\*$' \
7b78a14a
BK
12 trailer='^/\*EOF\*[/]' \
13 input=inclhack.def \
14 key='hackname[ ]*=[ ]*(.*);'
15
82c3a53e
BK
16 Set up a debug test so we can make the templates emit special
17 code while debugging these fixes: */
5abc1f74 18
87ad679b
BK
19#ifdef DEBUG
20FIXINC_DEBUG = yes;
21#endif
5abc1f74 22
246e0bd8
GK
23/*
24 * On Mac OS 10.3.9, the 'long double' functions are available in
25 * libSystem, but are not prototyped in math.h.
26 */
27fix = {
28 hackname = AAB_darwin7_9_long_double_funcs;
29 mach = "*-*-darwin7.9*";
30 files = architecture/ppc/math.h;
31 bypass = "powl";
32 replace = <<- _EndOfHeader_
33/* This file prototypes the long double functions available on Mac OS
34 10.3.9. */
35#ifndef __MATH__
36# include_next <architecture/ppc/math.h>
37# ifndef __LIBMLDBL_COMPAT
38# ifdef __LONG_DOUBLE_128__
39# define __LIBMLDBL_COMPAT(sym) __asm("_" #sym "$LDBL128")
40# else
41# define __LIBMLDBL_COMPAT(sym)
42# endif /* __LONG_DOUBLE_128__ */
43# endif /* __LIBMLDBL_COMPAT */
44# ifdef __cplusplus
45 extern "C" {
46# endif
47 extern long double acosl( long double ) __LIBMLDBL_COMPAT(acosl);
48 extern long double asinl( long double ) __LIBMLDBL_COMPAT(asinl);
49 extern long double atanl( long double ) __LIBMLDBL_COMPAT(atanl);
50 extern long double atan2l( long double, long double ) __LIBMLDBL_COMPAT(atan2l);
51 extern long double cosl( long double ) __LIBMLDBL_COMPAT(cosl);
52 extern long double sinl( long double ) __LIBMLDBL_COMPAT(sinl);
53 extern long double tanl( long double ) __LIBMLDBL_COMPAT(tanl);
54 extern long double acoshl( long double ) __LIBMLDBL_COMPAT(acoshl);
55 extern long double asinhl( long double ) __LIBMLDBL_COMPAT(asinhl);
56 extern long double atanhl( long double ) __LIBMLDBL_COMPAT(atanhl);
57 extern long double coshl( long double ) __LIBMLDBL_COMPAT(coshl);
58 extern long double sinhl( long double ) __LIBMLDBL_COMPAT(sinhl);
59 extern long double tanhl( long double ) __LIBMLDBL_COMPAT(tanhl);
60 extern long double expl( long double ) __LIBMLDBL_COMPAT(expl);
61 extern long double exp2l( long double ) __LIBMLDBL_COMPAT(exp2l);
62 extern long double expm1l( long double ) __LIBMLDBL_COMPAT(expm1l);
63 extern long double logl( long double ) __LIBMLDBL_COMPAT(logl);
64 extern long double log10l( long double ) __LIBMLDBL_COMPAT(log10l);
65 extern long double log2l( long double ) __LIBMLDBL_COMPAT(log2l);
66 extern long double log1pl( long double ) __LIBMLDBL_COMPAT(log1pl);
67 extern long double logbl( long double ) __LIBMLDBL_COMPAT(logbl);
68 extern long double modfl( long double, long double * ) __LIBMLDBL_COMPAT(modfl);
69 extern long double ldexpl( long double, int ) __LIBMLDBL_COMPAT(ldexpl);
70 extern long double frexpl( long double, int * ) __LIBMLDBL_COMPAT(frexpl);
71 extern int ilogbl( long double ) __LIBMLDBL_COMPAT(ilogbl);
72 extern long double scalbnl( long double, int ) __LIBMLDBL_COMPAT(scalbnl);
73 extern long double scalblnl( long double, long int ) __LIBMLDBL_COMPAT(scalblnl);
74 extern long double fabsl( long double ) __LIBMLDBL_COMPAT(fabsl);
75 extern long double cbrtl( long double ) __LIBMLDBL_COMPAT(cbrtl);
76 extern long double hypotl( long double, long double ) __LIBMLDBL_COMPAT(hypotl);
77 extern long double powl( long double, long double ) __LIBMLDBL_COMPAT(powl);
78 extern long double sqrtl( long double ) __LIBMLDBL_COMPAT(sqrtl);
79 extern long double erfl( long double ) __LIBMLDBL_COMPAT(erfl);
80 extern long double erfcl( long double ) __LIBMLDBL_COMPAT(erfcl);
81 extern long double lgammal( long double ) __LIBMLDBL_COMPAT(lgammal);
82 extern long double tgammal( long double ) __LIBMLDBL_COMPAT(tgammal);
83 extern long double ceill( long double ) __LIBMLDBL_COMPAT(ceill);
84 extern long double floorl( long double ) __LIBMLDBL_COMPAT(floorl);
85 extern long double nearbyintl( long double ) __LIBMLDBL_COMPAT(nearbyintl);
86 extern long double rintl( long double ) __LIBMLDBL_COMPAT(rintl);
87 extern long int lrintl( long double ) __LIBMLDBL_COMPAT(lrintl);
88 extern long long int llrintl( long double ) __LIBMLDBL_COMPAT(llrintl);
89 extern long double roundl( long double ) __LIBMLDBL_COMPAT(roundl);
90 extern long int lroundl( long double ) __LIBMLDBL_COMPAT(lroundl);
91 extern long long int llroundl( long double ) __LIBMLDBL_COMPAT(llroundl);
92 extern long double truncl( long double ) __LIBMLDBL_COMPAT(truncl);
93 extern long double fmodl( long double, long double) __LIBMLDBL_COMPAT(fmodl);
94 extern long double remainderl( long double, long double ) __LIBMLDBL_COMPAT(remainderl);
95 extern long double remquol( long double, long double, int * ) __LIBMLDBL_COMPAT(remquol);
96 extern long double copysignl( long double, long double ) __LIBMLDBL_COMPAT(copysignl);
97 extern long double nanl( const char * ) __LIBMLDBL_COMPAT(nanl);
98 extern long double nextafterl( long double, long double ) __LIBMLDBL_COMPAT(nextafterl);
99 extern long double nexttowardl( long double, long double ) __LIBMLDBL_COMPAT(nexttowardl);
100 extern long double fdiml( long double, long double ) __LIBMLDBL_COMPAT(fdiml);
101 extern long double fmaxl( long double, long double ) __LIBMLDBL_COMPAT(fmaxl);
102 extern long double fminl( long double, long double ) __LIBMLDBL_COMPAT(fminl);
103 extern long double fmal( long double, long double, long double ) __LIBMLDBL_COMPAT(fmal);
104# ifdef __cplusplus
105 }
106# endif
107#endif /* __MATH__ */
108_EndOfHeader_;
109};
110
111
112/*
113 * ... and for the previous fix to be useful, you have to not use ""
114 * includes.
115 */
116fix = {
117 hackname = AAB_darwin7_9_long_double_funcs_2;
118 mach = "*-*-darwin7.9*";
119 files = math.h;
120 select = '#include[ \t]+\"';
121 c_fix = format;
122 c_fix_arg = "%1<%2.h>";
123
124 c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
125
126 test_text = '#include "architecture/ppc/math.h"';
127};
128
129
8aeb3b0e 130/*
d7eb5a45 131 * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
8aeb3b0e
BK
132 */
133fix = {
d7eb5a45 134 hackname = AAB_fd_zero_asm_posix_types_h;
8aeb3b0e 135 files = asm/posix_types.h;
57119aa9 136 mach = 'i[34567]86-*-linux*';
d7eb5a45 137 bypass = '} while';
8aeb3b0e
BK
138
139 /*
140 * Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
141 * the start, so that if #include_next gets another instance of
142 * the wrapper, this will follow the #include_next chain until
143 * we arrive at the real <asm/posix_types.h>.
144 */
b0588013 145 replace = <<- _EndOfHeader_
b5639a49
BK
146 /* This file fixes a bug in the __FD_ZERO macro
147 for older versions of the Linux kernel. */
148 #ifndef _POSIX_TYPES_H_WRAPPER
149 #include <features.h>
150 #include_next <asm/posix_types.h>
151
152 #if defined(__FD_ZERO) && !defined(__GLIBC__)
153 #undef __FD_ZERO
154 #define __FD_ZERO(fdsetp) \
155 do { \
156 int __d0, __d1; \
157 __asm__ __volatile__("cld ; rep ; stosl" \
158 : "=&c" (__d0), "=&D" (__d1) \
159 : "a" (0), "0" (__FDSET_LONGS), \
160 "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \
161 } while (0)
162 #endif
163
164 #define _POSIX_TYPES_H_WRAPPER
165 #endif /* _POSIX_TYPES_H_WRAPPER */
b0588013 166 _EndOfHeader_;
8aeb3b0e
BK
167};
168
169
170/*
171 * This fixes __FD_ZERO bug for glibc-1.x
172 */
173fix = {
d7eb5a45 174 hackname = AAB_fd_zero_gnu_types_h;
8aeb3b0e 175 files = gnu/types.h;
57119aa9 176 mach = 'i[34567]86-*-linux*';
8aeb3b0e
BK
177
178 /*
179 * Define _TYPES_H_WRAPPER at the end of the wrapper, not
180 * the start, so that if #include_next gets another instance of
181 * the wrapper, this will follow the #include_next chain until
182 * we arrive at the real <gnu/types.h>.
183 */
b0588013
BK
184 replace = <<- _EndOfHeader_
185 /* This file fixes a bug in the __FD_ZERO macro present in glibc 1.x. */
186 #ifndef _TYPES_H_WRAPPER
187 #include <features.h>
188 #include_next <gnu/types.h>
189
190 #if defined(__FD_ZERO) && !defined(__GLIBC__)
191 #undef __FD_ZERO
7673b71c
BK
192 # define __FD_ZERO(fdsetp) \
193 do { \
194 int __d0, __d1; \
195 __asm__ __volatile__("cld ; rep ; stosl" \
196 : "=&c" (__d0), "=&D" (__d1) \
197 : "a" (0), "0" (__FDSET_LONGS), \
198 "1" ((__fd_set *) (fdsetp)) :"memory"); \
b0588013
BK
199 } while (0)
200 #endif
8aeb3b0e 201
b0588013
BK
202 #define _TYPES_H_WRAPPER
203 #endif /* _TYPES_H_WRAPPER */
204 _EndOfHeader_;
8aeb3b0e
BK
205};
206
207
208/*
209 * This fixes __FD_ZERO bug for glibc-2.0.x
210 */
211fix = {
d7eb5a45 212 hackname = AAB_fd_zero_selectbits_h;
8aeb3b0e 213 files = selectbits.h;
57119aa9 214 mach = 'i[34567]86-*-linux*';
8aeb3b0e
BK
215
216 /*
217 * Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not
218 * the start, so that if #include_next gets another instance of
219 * the wrapper, this will follow the #include_next chain until
220 * we arrive at the real <selectbits.h>.
221 */
b0588013
BK
222 replace = <<- _EndOfHeader_
223 /* This file fixes a bug in the __FD_ZERO macro present in glibc 2.0.x. */
224 #ifndef _SELECTBITS_H_WRAPPER
225 #include <features.h>
226 #include_next <selectbits.h>
227
228 #if defined(__FD_ZERO) && defined(__GLIBC__) \\
229 && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 \\
230 && __GLIBC_MINOR__ == 0
231 #undef __FD_ZERO
232 #define __FD_ZERO(fdsetp) \\
233 do { \\
234 int __d0, __d1; \\
235 __asm__ __volatile__ ("cld; rep; stosl" \\
d7eb5a45
ZW
236 : "=&c" (__d0), "=&D" (__d1) \\
237 : "a" (0), "0" (sizeof (__fd_set) \\
238 / sizeof (__fd_mask)), \\
239 "1" ((__fd_mask *) (fdsetp)) \\
240 : "memory"); \\
b0588013
BK
241 } while (0)
242 #endif
8aeb3b0e 243
b0588013
BK
244 #define _SELECTBITS_H_WRAPPER
245 #endif /* _SELECTBITS_H_WRAPPER */
246 _EndOfHeader_;
8aeb3b0e
BK
247};
248
249
157c4da2
BK
250/*
251 * Solaris <sys/varargs.h> is a DDK (aka kernel-land) header providing
252 * the same interface as <stdarg.h>. No idea why they couldn't have just
253 * used the standard header.
254 */
255fix = {
256 hackname = AAB_solaris_sys_varargs_h;
257 files = "sys/varargs.h";
258 mach = '*-*-solaris*';
b0588013
BK
259 replace = <<- _EndOfHeader_
260 #ifdef __STDC__
261 #include <stdarg.h>
262 #else
263 #include <varargs.h>
264 #endif
265 _EndOfHeader_;
157c4da2
BK
266};
267
268
b51207a4
ZW
269/*
270 * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
271 * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
272 * many other systems have similar text but correct versions of the file.
273 * To ensure only Sun's is fixed, we grep for a likely unique string.
274 * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
275 */
276fix = {
277 hackname = AAB_sun_memcpy;
278 files = memory.h;
b0588013 279 select = "/\\*\t@\\(#\\)"
b51207a4
ZW
280 "(head/memory.h\t50.1\t "
281 "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
282
b0588013
BK
283 replace = <<- _EndOfHeader_
284 /* This file was generated by fixincludes */
285 #ifndef __memory_h__
286 #define __memory_h__
b51207a4 287
b0588013
BK
288 #ifdef __STDC__
289 extern void *memccpy();
290 extern void *memchr();
291 extern void *memcpy();
292 extern void *memset();
293 #else
294 extern char *memccpy();
295 extern char *memchr();
296 extern char *memcpy();
297 extern char *memset();
298 #endif /* __STDC__ */
b51207a4 299
b0588013 300 extern int memcmp();
b51207a4 301
b0588013
BK
302 #endif /* __memory_h__ */
303 _EndOfHeader;
b51207a4
ZW
304};
305
306
7b78a14a
BK
307/*
308 * Completely replace <sys/varargs.h> with a file that includes gcc's
309 * stdarg.h or varargs.h files as appropriate.
310 */
311#ifdef SVR4
312fix = {
313 hackname = AAB_svr4_no_varargs;
314 files = sys/varargs.h;
315 replace = "/* This file was generated by fixincludes. */\n"
316 "#ifndef _SYS_VARARGS_H\n"
317 "#define _SYS_VARARGS_H\n\n"
057c56df 318
7b78a14a
BK
319 "#ifdef __STDC__\n"
320 "#include <stdarg.h>\n"
321 "#else\n"
322 "#include <varargs.h>\n"
323 "#endif\n\n"
057c56df 324
7b78a14a
BK
325 "#endif /* _SYS_VARARGS_H */\n";
326};
327#endif
328
329
86765ca0 330/*
791996d1
NN
331 * Completely replace <sys/byteorder.h> with a file that implements gcc's
332 * optimized byteswapping. (The original probably implemented some
333 * incompatible optimized byteswapping.)
86765ca0
RL
334 */
335fix = {
336 hackname = AAB_svr4_replace_byteorder;
b0588013
BK
337 mach = "*-*-sysv4*";
338 mach = "i[34567]86-*-sysv5*";
de0656cf 339 mach = "i[34567]86-*-sco3.2v5*";
b0588013
BK
340 mach = "i[34567]86-*-udk*";
341 mach = "i[34567]86-*-solaris2.[0-4]";
342 mach = "powerpcle-*-solaris2.[0-4]";
343 mach = "sparc-*-solaris2.[0-4]";
791996d1 344 mach = "i[34567]86-sequent-ptx*";
86765ca0 345 files = sys/byteorder.h;
b0588013
BK
346 replace = <<- _EndOfHeader_
347 #ifndef _SYS_BYTEORDER_H
348 #define _SYS_BYTEORDER_H
86765ca0 349
b0588013
BK
350 /* Functions to convert `short' and `long' quantities from host byte order
351 to (internet) network byte order (i.e. big-endian).
86765ca0 352
b0588013 353 Written by Ron Guilmette (rfg@ncd.com).
86765ca0 354
b0588013 355 This isn't actually used by GCC. It is installed by fixinc.svr4.
86765ca0 356
b0588013 357 For big-endian machines these functions are essentially no-ops.
86765ca0 358
b0588013
BK
359 For little-endian machines, we define the functions using specialized
360 asm sequences in cases where doing so yields better code (e.g. i386). */
86765ca0 361
b0588013
BK
362 #if !defined (__GNUC__) && !defined (__GNUG__)
363 #error You lose! This file is only useful with GNU compilers.
364 #endif
86765ca0 365
b0588013
BK
366 #ifndef __BYTE_ORDER__
367 /* Byte order defines. These are as defined on UnixWare 1.1, but with
368 double underscores added at the front and back. */
369 #define __LITTLE_ENDIAN__ 1234
370 #define __BIG_ENDIAN__ 4321
371 #define __PDP_ENDIAN__ 3412
372 #endif
86765ca0 373
b0588013
BK
374 #ifdef __STDC__
375 static __inline__ unsigned long htonl (unsigned long);
376 static __inline__ unsigned short htons (unsigned int);
377 static __inline__ unsigned long ntohl (unsigned long);
378 static __inline__ unsigned short ntohs (unsigned int);
379 #endif /* defined (__STDC__) */
86765ca0 380
b0588013 381 #if defined (__i386__)
86765ca0 382
b0588013
BK
383 #ifndef __BYTE_ORDER__
384 #define __BYTE_ORDER__ __LITTLE_ENDIAN__
385 #endif
86765ca0 386
b0588013 387 /* Convert a host long to a network long. */
86765ca0 388
b0588013
BK
389 /* We must use a new-style function definition, so that this will also
390 be valid for C++. */
391 static __inline__ unsigned long
392 htonl (unsigned long __arg)
393 {
394 register unsigned long __result;
86765ca0 395
b0588013
BK
396 __asm__ ("xchg%B0 %b0,%h0
397 ror%L0 $16,%0
398 xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
399 return __result;
400 }
86765ca0 401
b0588013 402 /* Convert a host short to a network short. */
86765ca0 403
b0588013
BK
404 static __inline__ unsigned short
405 htons (unsigned int __arg)
406 {
407 register unsigned short __result;
86765ca0 408
b0588013
BK
409 __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
410 return __result;
411 }
86765ca0 412
b0588013 413 #elif (defined (__ns32k__) || defined (__vax__) || defined (__arm__))
86765ca0 414
b0588013
BK
415 #ifndef __BYTE_ORDER__
416 #define __BYTE_ORDER__ __LITTLE_ENDIAN__
417 #endif
86765ca0 418
b0588013
BK
419 /* For other little-endian machines, using C code is just as efficient as
420 using assembly code. */
86765ca0 421
b0588013 422 /* Convert a host long to a network long. */
86765ca0 423
b0588013
BK
424 static __inline__ unsigned long
425 htonl (unsigned long __arg)
426 {
427 register unsigned long __result;
86765ca0 428
b0588013
BK
429 __result = (__arg >> 24) & 0x000000ff;
430 __result |= (__arg >> 8) & 0x0000ff00;
431 __result |= (__arg << 8) & 0x00ff0000;
432 __result |= (__arg << 24) & 0xff000000;
433 return __result;
434 }
86765ca0 435
b0588013 436 /* Convert a host short to a network short. */
86765ca0 437
b0588013
BK
438 static __inline__ unsigned short
439 htons (unsigned int __arg)
440 {
441 register unsigned short __result;
86765ca0 442
b0588013
BK
443 __result = (__arg << 8) & 0xff00;
444 __result |= (__arg >> 8) & 0x00ff;
445 return __result;
446 }
86765ca0 447
b0588013 448 #else /* must be a big-endian machine */
86765ca0 449
b0588013
BK
450 #ifndef __BYTE_ORDER__
451 #define __BYTE_ORDER__ __BIG_ENDIAN__
452 #endif
86765ca0 453
b0588013 454 /* Convert a host long to a network long. */
86765ca0 455
b0588013
BK
456 static __inline__ unsigned long
457 htonl (unsigned long __arg)
458 {
459 return __arg;
460 }
86765ca0 461
b0588013 462 /* Convert a host short to a network short. */
86765ca0 463
b0588013
BK
464 static __inline__ unsigned short
465 htons (unsigned int __arg)
466 {
467 return __arg;
468 }
86765ca0 469
b0588013 470 #endif /* big-endian */
86765ca0 471
b0588013 472 /* Convert a network long to a host long. */
86765ca0 473
b0588013
BK
474 static __inline__ unsigned long
475 ntohl (unsigned long __arg)
476 {
477 return htonl (__arg);
478 }
86765ca0 479
b0588013 480 /* Convert a network short to a host short. */
86765ca0 481
b0588013
BK
482 static __inline__ unsigned short
483 ntohs (unsigned int __arg)
484 {
485 return htons (__arg);
486 }
487 #endif
488 _EndOfHeader_;
86765ca0
RL
489};
490
057c56df 491
b51207a4
ZW
492/*
493 * Cancel out ansi_compat.h on Ultrix. Replace it with an empty file.
494 */
495fix = {
496 hackname = AAB_ultrix_ansi_compat;
497 files = ansi_compat.h;
498 select = ULTRIX;
499 replace = "/* This file intentionally left blank. */\n";
500};
501
502
a7fc602f
DA
503/*
504 * The Ultrix 4.3 file limits.h is a symbolic link to sys/limits.h.
505 * Replace limits.h with a file that includes sys/limits.h.
506 */
507fix = {
508 hackname = AAB_ultrix_limits;
509 files = limits.h;
510 mach = "*-*-ultrix4.3";
b0588013
BK
511 replace = <<- _EndOfHeader_
512 #ifndef _LIMITS_INCLUDED
513 #define _LIMITS_INCLUDED
514 #include <sys/limits.h>
515 #endif /* _LIMITS_INCLUDED */
516 _EndOfHeader_;
a7fc602f
DA
517};
518
519
520/*
521 * The ULTRIX 4.3 version of memory.h duplicates definitions
522 * present in strings.h. Replace memory.h with a file that includes
523 * strings.h to prevent problems from multiple inclusion.
524 */
525fix = {
526 hackname = AAB_ultrix_memory;
527 files = memory.h;
528 mach = "*-*-ultrix4.3";
b0588013
BK
529 replace = <<- _EndOfHeader_
530 #ifndef _MEMORY_INCLUDED
531 #define _MEMORY_INCLUDED
532 #include <strings.h>
533 #endif /* _MEMORY_INCLUDED */
534 _EndOfHeader_;
a7fc602f
DA
535};
536
537
538/*
539 * The Ultrix 4.3 file string.h is a symbolic link to strings.h.
540 * Replace string.h link with a file that includes strings.h to prevent
541 * problems from multiple inclusion.
542 */
543fix = {
544 hackname = AAB_ultrix_string;
545 files = string.h;
546 mach = "*-*-ultrix4.3";
b0588013
BK
547 replace = <<- _EndOfHeader_
548 #ifndef _STRING_INCLUDED
549 #define _STRING_INCLUDED
550 #include <strings.h>
551 #endif /* _STRING_INCLUDED */
552 _EndOfHeader_;
a7fc602f
DA
553};
554
555
2c82e043
GK
556/*
557 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
558 * which violates a requirement of ISO C.
559 */
560fix = {
561 hackname = aix_pthread;
562 files = "pthread.h";
563 select = "(#define [A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
564 c_fix = format;
565 c_fix_arg = "%1 %2";
d0650b61
BK
566 test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
567 "{...init stuff...}";
2c82e043
GK
568};
569
570
571/*
572 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
573 * in an otherwise harmless (and #ifed out) macro definition
574 */
575fix = {
576 hackname = aix_sysmachine;
577 files = sys/machine.h;
578 select = "\\\\ +\n";
579 c_fix = format;
580 c_fix_arg = "\\\n";
581 test_text = "#define FOO \\\n"
582 " bar \\ \n baz \\ \n bat";
583};
584
585
0083c904 586/*
99d05d99
BK
587 * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the
588 * definition of struct rusage, so the prototype added by fixproto fails.
0083c904
BK
589 */
590fix = {
7a544ce1
BK
591 hackname = aix_syswait;
592 files = sys/wait.h;
88acf854 593 select = "^extern pid_t wait3\\(\\);\n";
7a544ce1 594 select = "bos325,";
88acf854
BK
595 c_fix = format;
596 c_fix_arg = "struct rusage;\n%0";
99d05d99
BK
597 test_text = "/* bos325, */\n"
598 "extern pid_t wait3();\n"
599 "\t/* pid_t wait3(int *, int, struct rusage *); */";
0083c904
BK
600};
601
602
d3535e80
RS
603/*
604 * sys/wait.h on AIX 5.2 defines macros that have both signed and
605 * unsigned types in conditional expressions.
606 */
607fix = {
608 hackname = aix_syswait_2;
609 files = sys/wait.h;
610 select = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)';
611 c_fix = format;
612 c_fix_arg = "? (int)%1";
613 test_text = "#define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
614};
615
616
0083c904
BK
617/*
618 * sys/signal.h on some versions of AIX uses volatile in the typedef of
619 * sig_atomic_t, which causes gcc to generate a warning about duplicate
620 * volatile when a sig_atomic_t variable is declared volatile, as
621 * required by ANSI C.
622 */
623fix = {
7a544ce1
BK
624 hackname = aix_volatile;
625 files = sys/signal.h;
626 select = "typedef volatile int sig_atomic_t";
99d05d99
BK
627 c_fix = format;
628 c_fix_arg = "typedef int sig_atomic_t";
7a544ce1 629 test_text = "typedef volatile int sig_atomic_t;";
0083c904
BK
630};
631
632
a88072eb
RO
633/*
634 * Fix __assert declaration in assert.h on Alpha OSF/1.
635 */
636fix = {
637 hackname = alpha___assert;
638 files = "assert.h";
639 select = '__assert\(char \*, char \*, int\)';
640 c_fix = format;
641 c_fix_arg = "__assert(const char *, const char *, int)";
642 test_text = 'extern void __assert(char *, char *, int);';
643};
644
645
f8dc212b 646/*
fb2c2608 647 * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 headers.
f8dc212b
RO
648 */
649fix = {
650 hackname = alpha___extern_prefix;
fb2c2608
RO
651 select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n(#[ \t]*pragma[ \t]*extern_prefix.*)";
652
653 mach = "alpha*-dec-osf*";
654 c_fix = format;
655 c_fix_arg = "%1 (defined(__DECC) || defined(__PRAGMA_EXTERN_PREFIX))\n%3";
656
657 test_text = "#ifdef __DECC\n"
658 "#pragma extern_prefix \"_P\"\n"
659 "# if defined(__DECC)\n"
660 "# pragma extern_prefix \"_E\"\n"
661 "# if !defined(_LIBC_POLLUTION_H_) && defined(__DECC)\n"
662 "# pragma extern_prefix \"\"";
663};
664
665
666/*
667 * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 <standards.h>.
668 */
669fix = {
670 hackname = alpha___extern_prefix_standards;
671 files = standards.h;
672 select = ".*!defined\\(_LIBC_POLLUTION_H_\\) && !defined\\(__DECC\\)";
673
674 mach = "alpha*-dec-osf*";
675 c_fix = format;
676 c_fix_arg = "%0 && !defined(__PRAGMA_EXTERN_PREFIX)";
677
678 test_text = "#if (_ISO_C_SOURCE>=19990L) && !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
679};
680
681
682/*
683 * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/mount.h> and
684 * <sys/stat.h>. The tests for __DECC are special in various ways, so
685 * alpha__extern_prefix cannot be used.
686 */
687fix = {
688 hackname = alpha___extern_prefix_sys_stat;
f8dc212b 689 files = sys/stat.h;
fb2c2608 690 files = sys/mount.h;
f8dc212b
RO
691 select = "#[ \t]*if[ \t]*defined\\(__DECC\\)";
692
693 mach = "alpha*-dec-osf5*";
694 c_fix = format;
695 c_fix_arg = "%0 || defined(__PRAGMA_EXTERN_PREFIX)";
696
697 test_text = "# if defined(__DECC)";
698};
699
700
aaa4d130
RO
701/*
702 * Fix assert macro in assert.h on Alpha OSF/1.
703 * The superfluous int cast breaks C++.
704 */
705fix = {
706 hackname = alpha_assert;
707 files = "assert.h";
708 select = '(#define assert\(EX\).*)\(\(int\) \(EX\)\)';
709 c_fix = format;
710 c_fix_arg = "%1(EX)";
711 test_text = '#define assert(EX) (((int) (EX)) ? (void)0 : __assert(#EX, __FILE__, __LINE__))';
712};
713
714
f6c930a3
RO
715/*
716 * Fix #defines under Alpha OSF/1:
717 * The following files contain '#pragma extern_prefix "_FOO"' followed by
718 * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
719 * statements is to reduce namespace pollution. While these macros work
720 * properly in most cases, they don't allow you to take a pointer to the
721 * "something" being modified. To get around this limitation, change these
722 * statements to be of the form '#define something _FOOsomething'.
723 *
724 * sed ain't egrep, lesson 2463: sed can use self-referential
725 * regular expressions. In the substitute expression below,
726 * "\\1" and "\\2" refer to subexpressions found earlier in the
727 * same match. So, we continue to use sed. "extern_prefix" will
728 * be a rare match anyway...
729 */
730fix = {
731 hackname = alpha_bad_lval;
732
733 select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
734 mach = "alpha*-dec-osf*";
735
736 sed =
737 "s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
738 "\\(_.*\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
739
740 test_text = '#pragma extern_prefix "_FOO"'"\n"
741 "#define something(x,y,z) _FOOsomething(x,y,z)\n"
742 "#define mumble _FOOmumble";
743};
744
745
0083c904
BK
746/*
747 * Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
748 */
749fix = {
7a544ce1
BK
750 hackname = alpha_getopt;
751 files = "stdio.h";
752 files = "stdlib.h";
753 select = 'getopt\(int, char \*\[\], *char \*\)';
99d05d99
BK
754 c_fix = format;
755 c_fix_arg = "getopt(int, char *const[], const char *)";
7a544ce1 756 test_text = 'extern int getopt(int, char *[], char *);';
0083c904
BK
757};
758
759
4f923eb8 760/*
8f34d1e9 761 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
0083c904
BK
762 */
763fix = {
7a544ce1
BK
764 hackname = alpha_parens;
765 files = sym.h;
766 select = '#ifndef\(__mips64\)';
99d05d99
BK
767 c_fix = format;
768 c_fix_arg = "#ifndef __mips64";
7a544ce1 769 test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
0083c904
BK
770};
771
772
2a4e8ebc
RO
773/*
774 * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX <pthread.h>.
775 */
776fix = {
777 hackname = alpha_pthread;
778 files = pthread.h;
fb2c2608 779 select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)|def _PTHREAD_ENV_DECC)(.*))\n"
2a4e8ebc
RO
780 "(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
781
782 mach = "alpha*-dec-osf*";
783 c_fix = format;
fb2c2608 784 c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 || defined (__PRAGMA_EXTERN_PREFIX)\n%5";
2a4e8ebc
RO
785
786 test_text = "# if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC)\n"
fb2c2608
RO
787 "# define _PTHREAD_USE_PTDNAM_\n"
788 "# endif\n"
789 "# ifdef _PTHREAD_ENV_DECC\n"
2a4e8ebc
RO
790 "# define _PTHREAD_USE_PTDNAM_\n"
791 "# endif";
792};
793
794
821281db
RO
795/*
796 * Recognize GCC in Tru64 UNIX V5.1B <pthread.h>.
797 */
798fix = {
799 hackname = alpha_pthread_gcc;
800 files = pthread.h;
801 select = "#else\n# error <pthread.h>: unrecognized compiler.";
802
803 mach = "alpha*-dec-osf*";
804 c_fix = format;
805 c_fix_arg = "#elif defined (__GNUC__)\n"
806 "# define _PTHREAD_ENV_GCC\n"
807 "%0";
808
809 test_text = "# define _PTHREAD_ENV_INTELC\n"
810 "#else\n"
811 "# error <pthread.h>: unrecognized compiler.\n"
812 "#endif";
813};
814
1fda9d7b
RS
815/*
816 * Compaq Tru64 v5.1 defines all of its PTHREAD_*_INITIALIZER macros
817 * incorrectly, specifying less fields in the initializers than are
818 * defined in the corresponding structure types. Use of these macros
819 * in user code results in spurious warnings.
820 */
821fix = {
822 hackname = alpha_pthread_init;
823 files = pthread.h;
743348ea
RS
824 select = ' \* @\(#\).RCSfile: pthread\.h,v \$'
825 ' .Revision: 1\.1\.33\.21 \$ \(DEC\)'
826 ' .Date: 2000/08/15 15:30:13 \$';
1fda9d7b
RS
827 mach = "alpha*-dec-osf*";
828 sed = "s@MVALID\\(.*\\)A}@MVALID\\1A, 0, 0, 0, 0, 0, 0 }@\n"
829 "s@MVALID\\(.*\\)_}@MVALID\\1_, 0, 0, 0, 0 }@\n"
830 "s@CVALID\\(.*\\)A}@CVALID\\1A, 0, 0, 0, 0 }@\n"
831 "s@CVALID\\(.*\\)_}@CVALID\\1_, 0, 0 }@\n"
832 "s@WVALID\\(.*\\)A}@WVALID\\1A, 0, 0, 0, 0, 0, 0, 0, 0, 0 }@\n"
833 "s@WVALID\\(.*\\)_}@WVALID\\1_, 0, 0, 0, 0, 0, 0, 0 }@\n";
834 test_text = "/*\n"
743348ea
RS
835 " * @(#)_RCSfile: pthread.h,v \\$ "
836 "_Revision: 1.1.33.21 \\$ (DEC) "
837 "_Date: 2000/08/15 15:30:13 \\$\n"
1fda9d7b
RS
838 " */\n"
839"#ifndef _PTHREAD_NOMETER_STATIC\n"
840"# define PTHREAD_MUTEX_INITIALIZER \\\n"
841" {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA}\n"
842"# define PTHREAD_COND_INITIALIZER \\\n"
843" {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA}\n"
844"# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \\\n"
845" {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}\n"
846"# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \\\n"
847" {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}\n"
848"#else\n"
849"# define PTHREAD_MUTEX_INITIALIZER {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA}\n"
850"# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \\\n"
851" {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}\n"
852"# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \\\n"
853" {0, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}\n"
854"#endif\n\n"
855"#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA}\n"
856"#define PTHREAD_RWLOCK_INITWITHNAME_NP(_n_,_a_) \\\n"
857" {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA, _n_, _a_}\n";
858};
821281db 859
0083c904
BK
860/*
861 * Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
c3a5b1e9 862 * And OpenBSD.
0083c904
BK
863 */
864fix = {
865 hackname = alpha_sbrk;
866 files = unistd.h;
867 select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
99d05d99
BK
868 c_fix = format;
869 c_fix_arg = "void *sbrk(";
7a544ce1 870 test_text = "extern char* sbrk(ptrdiff_t increment);";
0083c904
BK
871};
872
873
f502cbff
RO
874/*
875 * Change external names of wcstok/wcsftime via asm instead of macros on
876 * Tru64 UNIX V4.0.
877 */
878fix = {
879 hackname = alpha_wchar;
880 files = wchar.h;
881
882 mach = "alpha*-dec-osf4*";
883 select = "#define wcstok wcstok_r";
884 sed = "s@#define wcstok wcstok_r@extern wchar_t *wcstok __((wchar_t *, const wchar_t *, wchar_t **)) __asm__(\"wcstok_r\");@";
885 sed = "s@#define wcsftime __wcsftime_isoc@extern size_t wcsftime __((wchar_t *, size_t, const wchar_t *, const struct tm *)) __asm__(\"__wcsftime_isoc\");@";
886 test_text = "#define wcstok wcstok_r\n"
887 "#define wcsftime __wcsftime_isoc";
888};
889
890
0083c904
BK
891/*
892 * For C++, avoid any typedef or macro definition of bool,
893 * and use the built in type instead.
8f34d1e9 894 * HP/UX 10.20 also has it in curses_colr/curses.h.
0083c904
BK
895 */
896fix = {
cd64831f
BK
897 hackname = avoid_bool_define;
898 files = curses.h;
899 files = curses_colr/curses.h;
900 files = term.h;
901 files = tinfo.h;
5c0d5b94 902
cd64831f 903 select = "#[ \t]*define[ \t]+bool[ \t]";
bf66f7b0 904 bypass = "__cplusplus";
0083c904 905
cd64831f
BK
906 c_fix = format;
907 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
908 c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
26e2e81d 909
cd64831f
BK
910 test_text = "# define bool\t char \n";
911};
fbc35bc1 912
b0588013 913
cd64831f
BK
914fix = {
915 hackname = avoid_bool_type;
916 files = curses.h;
917 files = curses_colr/curses.h;
918 files = term.h;
919 files = tinfo.h;
fbc35bc1 920
cd64831f 921 select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
bf66f7b0 922 bypass = "__cplusplus";
fbc35bc1 923
cd64831f
BK
924 c_fix = format;
925 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
fbc35bc1 926
56a77e1e 927 test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
0083c904
BK
928};
929
b0588013 930
8b4c8a86
MM
931/*
932 * For C++, avoid any typedef definition of wchar_t,
933 * and use the built in type instead.
5ded58d0
ZW
934 * Don't do this for headers that are smart enough to do the right
935 * thing (recent [n]curses.h and Xlib.h).
936 * Don't do it for <linux/nls.h> which is never used from C++ anyway,
937 * and will be broken by the edit.
8b4c8a86
MM
938 */
939
940fix = {
941 hackname = avoid_wchar_t_type;
942
943 select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
4146d8d0 944 bypass = "__cplusplus";
5ded58d0
ZW
945 bypass = "_LINUX_NLS_H";
946 bypass = "XFree86: xc/lib/X11/Xlib\\.h";
8b4c8a86
MM
947
948 c_fix = format;
949 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
8b4c8a86 950
56a77e1e 951 test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
8b4c8a86 952};
0083c904 953
b0588013 954
79589c4d
BK
955/*
956 * Fix `typedef struct term;' on hppa1.1-hp-hpux9.
957 */
958fix = {
cd64831f
BK
959 hackname = bad_struct_term;
960 files = curses.h;
961 select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;";
962 c_fix = format;
963 c_fix_arg = "struct term;";
964
79589c4d
BK
965 test_text = 'typedef struct term;';
966};
967
968
969/*
970 * Fix one other error in this file:
971 * a mismatched quote not inside a C comment.
972 */
973fix = {
cd64831f
BK
974 hackname = badquote;
975 files = sundev/vuid_event.h;
976 select = "doesn't";
977 c_fix = format;
978 c_fix_arg = "does not";
979
79589c4d
BK
980 test_text = "/* doesn't have matched single quotes */";
981};
982
983
0083c904
BK
984/*
985 * check for broken assert.h that needs stdio.h
986 */
987fix = {
ba8fcfc3
BK
988 hackname = broken_assert_stdio;
989 files = assert.h;
990 select = stderr;
991 bypass = "include.*stdio\\.h";
992 c_fix = wrap;
993 c_fix_arg = "#include <stdio.h>\n";
7a544ce1 994 test_text = "extern FILE* stderr;";
0083c904
BK
995};
996
997
998/*
999 * check for broken assert.h that needs stdlib.h
1000 */
1001fix = {
ba8fcfc3
BK
1002 hackname = broken_assert_stdlib;
1003 files = assert.h;
1004 select = 'exit *\(|abort *\(';
1005 bypass = "include.*stdlib\\.h";
1006 c_fix = wrap;
1007 c_fix_arg = "#ifdef __cplusplus\n"
1008 "#include <stdlib.h>\n"
1009 "#endif\n";
7a544ce1 1010 test_text = "extern void exit ( int );";
0083c904
BK
1011};
1012
1013
72b9c7fb
BK
1014/*
1015 * Remove `extern double cabs' declarations from math.h.
526aba28 1016 * This conflicts with C99. Discovered on AIX.
11f4453b
RO
1017 * IRIX 5 and IRIX 6 before 6.5.18 (where C99 support was introduced)
1018 * declares cabs() to take a struct __cabs_s argument.
7021bb50
KG
1019 * SunOS4 has its cabs() declaration followed by a comment which
1020 * terminates on the following line.
93b8a7a8 1021 * Darwin hides its broken cabs in architecture-specific subdirs.
72b9c7fb
BK
1022 */
1023fix = {
1024 hackname = broken_cabs;
93b8a7a8
NN
1025 files = "math.h";
1026 files = "architecture/ppc/math.h";
1027 files = "architecture/i386/math.h";
11f4453b 1028 select = "^extern[ \t]+double[ \t]+cabs";
cd64831f
BK
1029
1030 c_fix = format;
1031 c_fix_arg = "";
93b8a7a8 1032 c_fix_arg = "^extern[ \t]+double[ \t]+cabs[ \t]*\\([^\\)]*\\);";
cd64831f 1033
7a544ce1 1034 test_text = "#ifdef __STDC__\n"
a1c63101 1035 "extern double cabs(struct dbl_hypot);\n"
7a544ce1 1036 "#else\n"
a1c63101 1037 "extern double cabs();\n"
7021bb50 1038 "#endif\n"
93b8a7a8 1039 "extern double cabs ( _Complex z );\n"
7021bb50 1040 "extern double cabs(); /* This is a comment\n"
11f4453b
RO
1041 " and it ends here. */\n"
1042 "extern double cabs(struct __cabs_s);";
72b9c7fb
BK
1043};
1044
1045
8882ac3a
BK
1046/*
1047 * Various systems derived from BSD4.4 contain a macro definition
1048 * for vfscanf that interacts badly with requirements of builtin-attrs.def.
1049 * Known to be fixed in FreeBSD 5 system headers.
1050 */
1051fix = {
1052 hackname = bsd_stdio_attrs_conflict;
1053 mach = *-*-*bsd*;
1054 mach = *-*-*darwin*;
1055 files = stdio.h;
1056 select = "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
1057 c_fix = format;
1058 c_fix_arg = '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n"
1059 '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n"
1060 'int vfscanf(FILE *, const char *, __builtin_va_list) '
1061 '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");';
1062 test_text = '#define vfscanf __svfscanf';
1063};
1064
1065
79589c4d
BK
1066/*
1067 * Fix various macros used to define ioctl numbers.
1068 * The traditional syntax was:
1069 *
1070 * #define _CTRL(n, x) (('n'<<8)+x)
1071 * #define TCTRLCFOO _CTRL(T, 1)
1072 *
1073 * but this does not work with the C standard, which disallows macro
1074 * expansion inside strings. We have to rewrite it thus:
1075 *
1076 * #define _CTRL(n, x) ((n<<8)+x)
1077 * #define TCTRLCFOO _CTRL('T', 1)
1078 *
1079 * The select expressions match too much, but the c_fix code is cautious.
1080 *
1081 * CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
1082 */
1083fix = {
1084 hackname = ctrl_quotes_def;
cf6d5133 1085 select = "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
79589c4d
BK
1086 c_fix = char_macro_def;
1087 c_fix_arg = "CTRL";
33002945
BK
1088
1089 /*
1090 * This is two tests in order to ensure that the "CTRL(c)" can
1091 * be selected in isolation from the multi-arg format
1092 */
1093 test_text = "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n";
1094 test_text = "#define _CTRL(c) ('c'&037)";
79589c4d
BK
1095};
1096
1097fix = {
1098 hackname = ctrl_quotes_use;
1099 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
1100 c_fix = char_macro_use;
1101 c_fix_arg = "CTRL";
22e50c5b 1102 test_text = "#define TCTRLFOO BSD43_CTRL(T, 1)";
79589c4d
BK
1103};
1104
1105
1106/*
1107 * sys/mman.h on HP/UX is not C++ ready,
1108 * even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
1109 *
cd64831f
BK
1110 * rpc/types.h on OSF1/2.0 is not C++ ready,
1111 * even though NO_IMPLICIT_EXTERN_C is defined for the alpha.
1112 *
1113 * The problem is the declaration of malloc.
79589c4d
BK
1114 */
1115fix = {
1116 hackname = cxx_unready;
1117 files = sys/mman.h;
1118 files = rpc/types.h;
1119 select = '[^#]+malloc.*;'; /* Catch any form of declaration
1120 not within a macro. */
1121 bypass = '"C"|__BEGIN_DECLS';
1122
1123 c_fix = wrap;
1124 c_fix_arg = "#ifdef __cplusplus\n"
1125 "extern \"C\" {\n"
1126 "#endif\n";
1127 c_fix_arg = "#ifdef __cplusplus\n"
1128 "}\n"
1129 "#endif\n";
1130 test_text = "extern void* malloc( size_t );";
1131};
1132
1133
005c1a13
GK
1134/*
1135 * AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of
1136 * bad __GNUC__ tests.
1137 */
1138
1139fix = {
1140 hackname = darwin_gcc4_breakage;
1141 mach = "*-*-darwin*";
1142 files = AvailabilityMacros.h;
1143 select = "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
1144 c_fix = format;
1145 c_fix_arg = "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
1146 test_text = "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
1147 "(__GNUC_MINOR__ >= 1)\n";
1148};
1149
1150
9c081754
BK
1151/*
1152 * __private_extern__ doesn't exist in FSF GCC. Even if it did,
1153 * why would you ever put it in a system header file?
1154 */
3afbff37
GK
1155fix = {
1156 hackname = darwin_private_extern;
1157 mach = "*-*-darwin*";
1158 files = mach-o/dyld.h;
1159 select = "__private_extern__ [a-z_]+ _dyld_";
1160 c_fix = format;
1161 c_fix_arg = "extern";
1162 c_fix_arg = "__private_extern__";
1163 test_text = "__private_extern__ int _dyld_func_lookup(\n"
1164 "const char *dyld_func_name,\n"
1165 "unsigned long *address);\n";
1166};
1167
1168
8f34d1e9
BK
1169/*
1170 * Fix <c_asm.h> on Digital UNIX V4.0:
1171 * It contains a prototype for a DEC C internal asm() function,
1172 * clashing with gcc's asm keyword. So protect this with __DECC.
1173 */
1174fix = {
1175 hackname = dec_intern_asm;
1176 files = c_asm.h;
adc8046e
AO
1177 sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1178 sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
8f34d1e9 1179 "#endif\n";
7a544ce1
BK
1180 test_text =
1181 "float fasm {\n"
1182 " ... asm stuff ...\n"
1183 "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
8f34d1e9
BK
1184};
1185
1186
6822468a
LB
1187/*
1188 * Fix typo in <wchar.h> on DJGPP 2.03.
1189 */
1190fix = {
1191 hackname = djgpp_wchar_h;
1192 file = wchar.h;
1193 select = "__DJ_wint_t";
1194 bypass = "sys/djtypes.h";
1195 c_fix = format;
1196 c_fix_arg = "%0\n#include <sys/djtypes.h>";
1197 c_fix_arg = "#include <stddef.h>";
11e2040a
BK
1198 test_text = "#include <stddef.h>\n"
1199 "extern __DJ_wint_t x;\n";
6822468a
LB
1200};
1201
b0588013 1202
0083c904
BK
1203/*
1204 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1205 */
1206fix = {
cd64831f
BK
1207 hackname = ecd_cursor;
1208 files = "sunwindow/win_lock.h";
1209 files = "sunwindow/win_cursor.h";
1210 select = 'ecd\.cursor';
1211 c_fix = format;
1212 c_fix_arg = 'ecd_cursor';
1213
7a544ce1 1214 test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
0083c904
BK
1215};
1216
8aeb3b0e 1217
793146e3
BK
1218/*
1219 * math.h on SunOS 4 puts the declaration of matherr before the definition
1220 * of struct exception, so the prototype (added by fixproto) causes havoc.
1221 * This must appear before the math_exception fix.
1222 */
1223fix = {
1224 hackname = exception_structure;
1225 files = math.h;
1226
1227 /* If matherr has a prototype already, the header needs no fix. */
61fec9ff 1228 bypass = 'matherr.*(struct exception|__MATH_EXCEPTION|[ \t]*__FP_EXCEPTION[ \t]*\*[ \t]*)';
793146e3
BK
1229 select = matherr;
1230
1231 c_fix = wrap;
1232 c_fix_arg = "struct exception;\n";
1233
1234 test_text = "extern int matherr();";
1235};
1236
1237
89647e8a
LR
1238/*
1239 * Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume
1240 * neither the existence of GCC 3 nor its exact feature set yet break
1241 * (by design?) when __GNUC__ is set beyond 2.
1242 */
1243fix = {
1244 hackname = freebsd_gcc3_breakage;
1245 mach = *-*-freebsd*;
1246 files = sys/cdefs.h;
1247 select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
1248 bypass = '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
1249 c_fix = format;
1250 c_fix_arg = '%0 || __GNUC__ >= 3';
1251 test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
1252};
1253
1254
28785dde
LR
1255/*
1256 * Some releases of FreeBSD 4 and FreeBSD 5.0 and 5.1 system headers presume
1257 * neither the existence of GCC 4 nor its exact feature set yet break
1258 * (by design?) when __GNUC__ is set beyond 3.
1259 */
1260fix = {
1261 hackname = freebsd_gcc4_breakage;
1262 mach = *-*-freebsd*;
1263 files = sys/cdefs.h;
1264 select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
1265 c_fix = format;
1266 c_fix_arg = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
1267 test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
1268};
1269
1270
7b78a14a 1271/*
d5d16b5f
NN
1272 * Fix these files to use the types we think they should for
1273 * ptrdiff_t, size_t, and wchar_t.
1274 *
1275 * This defines the types in terms of macros predefined by our 'cpp'.
1276 * This is supposedly necessary for glibc's handling of these types.
1277 * It's probably not necessary for anyone else, but it doesn't hurt.
7b78a14a
BK
1278 */
1279fix = {
1280 hackname = gnu_types;
1281 files = "sys/types.h";
1282 files = "stdlib.h";
1283 files = "sys/stdtypes.h";
1284 files = "stddef.h";
1285 files = "memory.h";
1286 files = "unistd.h";
1287 bypass = '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
1288 select = "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
1289 c_fix = gnu_type;
9fcc7481
MM
1290 /* The Solaris 10 headers already define these types correctly. */
1291 mach = '*-*-solaris2.1[0-9]*';
1292 not_machine = true;
7b78a14a
BK
1293
1294 test_text = "typedef long int ptrdiff_t; /* long int */\n"
1295 "typedef uint_t size_t; /* uint_t */\n"
1296 "typedef ushort_t wchar_t; /* ushort_t */";
1297};
1298
1299
0083c904 1300/*
687262b1
BK
1301 * Fix HP & Sony's use of "../machine/xxx.h"
1302 * to refer to: <machine/xxx.h>
0083c904
BK
1303 */
1304fix = {
cd64831f
BK
1305 hackname = hp_inline;
1306 files = sys/spinlock.h;
1307 files = machine/machparam.h;
1308 select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/';
1309
1310 c_fix = format;
1311 c_fix_arg = "%1<machine/%2.h>";
1312
1313 c_fix_arg = "([ \t]*#[ \t]*include[ \t]+)" '"\.\./machine/'
1314 '([a-z]+)\.h"';
1315
1316 test_text = ' # include "../machine/mumble.h"';
0083c904
BK
1317};
1318
1319
1320/*
1321 * Check for (...) in C++ code in HP/UX sys/file.h.
1322 */
1323fix = {
7a544ce1
BK
1324 hackname = hp_sysfile;
1325 files = sys/file.h;
1326 select = "HPUX_SOURCE";
cd64831f
BK
1327
1328 c_fix = format;
1329 c_fix_arg = "(struct file *, ...)";
1330 c_fix_arg = '\(\.\.\.\)';
1331
88acf854 1332 test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
0083c904
BK
1333};
1334
1335
5ffd49b8 1336/*
eb559363 1337 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
5ffd49b8
JDA
1338 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
1339 */
1340fix = {
1341 hackname = hpux10_cpp_pow_inline;
907cb30e 1342 files = fixinc-test-limits.h, math.h;
5ffd49b8
JDA
1343 select = <<- END_POW_INLINE
1344 ^# +ifdef +__cplusplus
ab747408
ZW
1345 +\}
1346 +inline +double +pow\(double +__d,int +__expon\) +\{
5ffd49b8 1347 [ ]+return +pow\(__d,\(double\)__expon\);
ab747408
ZW
1348 +\}
1349 +extern +"C" +\{
5ffd49b8
JDA
1350 #else
1351 # +endif
1352 END_POW_INLINE;
1353
1354 c_fix = format;
1355 c_fix_arg = "";
1356
1357 test_text =
1358 "# ifdef __cplusplus\n"
1359 " }\n"
1360 " inline double pow(double __d,int __expon) {\n"
1361 "\t return pow(__d,(double)__expon);\n"
1362 " }\n"
1363 ' extern "C"' " {\n"
1364 "#else\n"
1365 "# endif";
1366};
1367
eb559363
BK
1368fix = {
1369 hackname = hpux11_cpp_pow_inline;
1370 files = math.h;
ab747408 1371 select = " +inline double pow\\(double d,int expon\\) \\{\n"
eb559363 1372 " +return pow\\(d, \\(double\\)expon\\);\n"
ab747408 1373 " +\\}\n";
eb559363
BK
1374 c_fix = format;
1375 c_fix_arg = "";
1376
1377 test_text =
1378 " inline double pow(double d,int expon) {\n"
1379 " return pow(d, (double)expon);\n"
1380 " }\n";
1381};
5ffd49b8 1382
34b3b0f6 1383
05e9e0a5
BK
1384/*
1385 * Fix hpux 10.X missing ctype declarations 1
1386 */
1387fix = {
1388 hackname = hpux10_ctype_declarations1;
1389 files = ctype.h;
1390 select = "^#[ \t]*define _toupper\\(__c\\)[ \t]*__toupper\\(__c\\)";
1391 bypass = "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\(";
1392 c_fix = format;
1393 c_fix_arg = "#ifdef _PROTOTYPES\n"
1394 "extern int __tolower(int);\n"
1395 "extern int __toupper(int);\n"
1396 "#else /* NOT _PROTOTYPES */\n"
1397 "extern int __tolower();\n"
1398 "extern int __toupper();\n"
1399 "#endif /* _PROTOTYPES */\n\n"
1400 "%0\n";
1401
1402 test_text = "# define _toupper(__c) __toupper(__c)\n";
1403};
1404
1405
1406/*
1407 * Fix hpux 10.X missing ctype declarations 2
1408 */
1409fix = {
1410 hackname = hpux10_ctype_declarations2;
1411 files = ctype.h;
1412 select = "^# if defined\\(_SB_CTYPE_MACROS\\) && \\!defined\\(__lint\\)";
1413 bypass = "^[ \t]*extern[ \t]*int[ \t]*_isalnum[ \t]*\\(";
1414 c_fix = format;
1415 c_fix_arg = "%0\n\n"
1416 "#ifdef _PROTOTYPES\n"
1417 " extern int _isalnum(int);\n"
1418 " extern int _isalpha(int);\n"
1419 " extern int _iscntrl(int);\n"
1420 " extern int _isdigit(int);\n"
1421 " extern int _isgraph(int);\n"
1422 " extern int _islower(int);\n"
1423 " extern int _isprint(int);\n"
1424 " extern int _ispunct(int);\n"
1425 " extern int _isspace(int);\n"
1426 " extern int _isupper(int);\n"
1427 " extern int _isxdigit(int);\n"
1428 "# else /* not _PROTOTYPES */\n"
1429 " extern int _isalnum();\n"
1430 " extern int _isalpha();\n"
1431 " extern int _iscntrl();\n"
1432 " extern int _isdigit();\n"
1433 " extern int _isgraph();\n"
1434 " extern int _islower();\n"
1435 " extern int _isprint();\n"
1436 " extern int _ispunct();\n"
1437 " extern int _isspace();\n"
1438 " extern int _isupper();\n"
1439 " extern int _isxdigit();\n"
1440 "#endif /* _PROTOTYPES */\n";
1441
1442 test_text = "# if defined(_SB_CTYPE_MACROS) && !defined(__lint)\n"
1443 " extern unsigned int *__SB_masks;\n";
1444};
1445
1446
4b60eb3b
JDA
1447/*
1448 * Fix hpux 10.X missing stdio declarations
1449 */
1450fix = {
1451 hackname = hpux10_stdio_declarations;
1452 files = stdio.h;
1453 select = "^#[ \t]*define _iob[ \t]*__iob";
1454 bypass = "^[ \t]*extern[ \t]*int[ \t]*vsnprintf[ \t]*\\(";
1455 c_fix = format;
1456 c_fix_arg = "%0\n\n"
1457 "# if defined(__STDC__) || defined(__cplusplus)\n"
1458 " extern int snprintf(char *, size_t, const char *, ...);\n"
1459 " extern int vsnprintf(char *, size_t, const char *, __va_list);\n"
1460 "# else /* not __STDC__) || __cplusplus */\n"
1461 " extern int snprintf();\n"
1462 " extern int vsnprintf();\n"
1463 "# endif /* __STDC__) || __cplusplus */\n";
1464
1465 test_text = "# define _iob __iob\n";
1466};
1467
1468
f7cf1c74
BK
1469/*
1470 * Make sure hpux defines abs in header.
1471 */
1472fix = {
1473 hackname = hpux11_abs;
1474 mach = ia64-hp-hpux11*;
1475 files = stdlib.h;
1476 select = "ifndef _MATH_INCLUDED";
1477 c_fix = format;
1478 c_fix_arg = "if !defined(_MATH_INCLUDED) || defined(__GNUG__)";
1479// sed = "s/ifndef _MATH_INCLUDED/if !defined(_MATH_INCLUDED) || defined(__GNUG__)/";
1480 test_text = "#ifndef _MATH_INCLUDED";
1481};
1482
1483
2dc693ee
BK
1484/*
1485 * Keep HP-UX 11 from stomping on C++ math namespace
1486 * with defines for fabsf.
1487 */
1488fix = {
1489 hackname = hpux11_fabsf;
1490 files = math.h;
1491 select = "^[ \t]*#[ \t]*define[ \t]+fabsf\\(.*";
1492 bypass = "__cplusplus";
1493
1494 c_fix = format;
1495 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
1496
1497 test_text =
1498 "#ifdef _PA_RISC\n"
1499 "# define fabsf(x) ((float)fabs((double)(float)(x)))\n"
1500 "#endif";
1501};
1502
1503
34b3b0f6
JM
1504/*
1505 * Prevent HP-UX 11 from defining __size_t and preventing size_t from
1506 * being defined by having it define _hpux_size_t instead.
1507 */
1508fix = {
1509 hackname = hpux11_size_t;
b5639a49
BK
1510 mach = "*-hp-hpux11*";
1511 select = "__size_t";
34b3b0f6
JM
1512
1513 c_fix = format;
1514 c_fix_arg = "_hpux_size_t";
34b3b0f6
JM
1515
1516 test_text =
1517 "#define __size_t size_t\n"
1518 " extern int getpwuid_r( char *, __size_t, struct passwd **);\n";
1519};
1520
1521
11f9a0ed
BK
1522/*
1523 * Fix hpux 11.00 broken snprintf declaration
1524 * (third argument is char *, needs to be const char * to prevent
1525 * spurious warnings with -Wwrite-strings or in C++).
1526 */
1527fix = {
1528 hackname = hpux11_snprintf;
1529 files = stdio.h;
1530 select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
1531 ' *(char *\*, *\.\.\.\);)';
1532 c_fix = format;
1533 c_fix_arg = '%1 const %3';
1534
1535 test_text = "extern int snprintf(char *, size_t, char *, ...);\n"
1536 "extern int snprintf(char *, __size_t, char *, ...);\n"
1537 "extern int snprintf(char *, _hpux_size_t, char *, ...);";
1538};
1539
1540
d7eb5a45 1541/*
7b78a14a 1542 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
abf7cec7
GRK
1543 * of UINT32_C has undefined behavior according to ISO/ANSI:
1544 * the arguments to __CONCAT__ are not macro expanded before the
1545 * concatination happens so the trailing ')' in the first argument
1546 * is concatinated with the 'l' in the second argument creating an
1547 * invalid pp token. The behavior of invalid pp tokens is undefined.
1548 * GCC does not handle these invalid tokens the way the HP compiler does.
1549 * This problem will potentially occur anytime macros are used in the
7b78a14a 1550 * arguments to __CONCAT__. A general solution to this problem would be to
abf7cec7
GRK
1551 * insert another layer of macro between __CONCAT__ and its use
1552 * in UINT32_C. An example of this solution can be found in the C standard.
1553 * A more specific solution, the one used here, is to change the UINT32_C
1554 * macro to not used macros in the arguments to __CONCAT__.
1555 */
abf7cec7
GRK
1556fix = {
1557 hackname = hpux11_uint32_c;
1558 files = inttypes.h;
7a544ce1
BK
1559 select = "^#define UINT32_C\\(__c\\)[ \t]*"
1560 "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
79589c4d 1561 c_fix = format;
7a544ce1 1562 c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
79589c4d
BK
1563 test_text =
1564 "#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
1565 "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
abf7cec7 1566};
0083c904 1567
cd64831f 1568
2026dcf9 1569/*
05e9e0a5 1570 * Fix hpux 11.00 broken vsnprintf declaration
2026dcf9
JDA
1571 */
1572fix = {
05e9e0a5
BK
1573 hackname = hpux11_vsnprintf;
1574 files = stdio.h;
1575 select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
1576 'const char \*,) __va__list\);';
2026dcf9 1577 c_fix = format;
05e9e0a5 1578 c_fix_arg = "%1 __va_list);";
2026dcf9 1579
05e9e0a5
BK
1580 test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
1581 ' __va__list);';
2026dcf9
JDA
1582};
1583
1584
1585/*
05e9e0a5 1586 * get rid of bogus inline definitions in HP-UX 8.0
2026dcf9
JDA
1587 */
1588fix = {
05e9e0a5
BK
1589 hackname = hpux8_bogus_inlines;
1590 files = math.h;
1591 select = inline;
793387fa 1592 bypass = "__GNUG__";
05e9e0a5
BK
1593 sed = "s@inline int abs(int [a-z][a-z]*) {.*}"
1594 "@extern \"C\" int abs(int);@";
1595 sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
1596 sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@";
1597 sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@";
1598 test_text = "inline int abs(int v) { return (v>=0)?v:-v; }\n"
1599 "inline double sqr(double v) { return v**0.5; }";
2026dcf9
JDA
1600};
1601
1602
1603/*
1604 * Fix hpux broken ctype macros
1605 */
1606fix = {
1607 hackname = hpux_ctype_macros;
1608 files = ctype.h;
1609 select = '((: |\()__SB_masks \? )'
1610 '(__SB_masks\[__(alnum|c)\] & _IS)';
1611 c_fix = format;
1612 c_fix_arg = "%1(int)%3";
1613
1614 test_text = ": __SB_masks ? __SB_masks[__alnum] & _ISCNTRL\n"
1615 "# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n";
1616};
1617
1618
7fbdc950
JM
1619/*
1620 * Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
1621 */
1622fix = {
1623 hackname = hpux_htonl;
1624 files = netinet/in.h;
1625 select = "#ifndef _XOPEN_SOURCE_EXTENDED\n"
1626 "(/\\*\n"
1627 " \\* Macros for number representation conversion\\.\n"
1628 " \\*/\n"
1629 "#ifndef ntohl)";
1630 c_fix = format;
1631 c_fix_arg = "#if 1\n%1";
1632
1633 test_text = "#ifndef _XOPEN_SOURCE_EXTENDED\n"
1634 "/*\n"
1635 " * Macros for number representation conversion.\n"
1636 " */\n"
1637 "#ifndef ntohl\n"
1638 "#define ntohl(x) (x)\n"
1639 "#define ntohs(x) (x)\n"
1640 "#define htonl(x) (x)\n"
1641 "#define htons(x) (x)\n"
1642 "#endif\n"
1643 "#endif /* ! _XOPEN_SOURCE_EXTENDED */";
1644};
1645
1646
55105156 1647/*
05e9e0a5 1648 * HP-UX long_double
55105156
BK
1649 */
1650fix = {
05e9e0a5
BK
1651 hackname = hpux_long_double;
1652 files = stdlib.h;
1653 select = "extern[ \t]long_double[ \t]strtold";
1654 bypass = "long_double_t";
1655 sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
1656 sed = "s/long_double/long double/g";
55105156 1657
05e9e0a5
BK
1658 test_text = "# ifndef _LONG_DOUBLE\n"
1659 "# define _LONG_DOUBLE\n"
1660 " typedef struct {\n"
1661 " unsigned int word1, word2, word3, word4;\n"
1662 " } long_double;\n"
1663 "# endif /* _LONG_DOUBLE */\n"
1664 "extern long_double strtold(const char *, char **);\n";
cd64831f
BK
1665};
1666
1667
0083c904 1668/*
7b78a14a 1669 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
0083c904
BK
1670 */
1671fix = {
7b78a14a
BK
1672 hackname = hpux_systime;
1673 files = sys/time.h;
1674 select = "^extern struct sigevent;";
0083c904 1675
7b78a14a
BK
1676 c_fix = format;
1677 c_fix_arg = "struct sigevent;";
1678
1679 test_text = 'extern struct sigevent;';
1680};
1681
1682
1683/*
1684 * Fix return type of abort and free
1685 */
1686fix = {
1687 hackname = int_abort_free_and_exit;
1688 files = stdlib.h;
1689 select = "int[ \t]+(abort|free|exit)[ \t]*\\(";
793387fa 1690 bypass = "_CLASSIC_ANSI_TYPES";
7a544ce1 1691
79589c4d 1692 c_fix = format;
7b78a14a
BK
1693 c_fix_arg = "void\t%1(";
1694
1695 test_text = "extern int abort(int);\n"
1696 "extern int free(void*);\n"
1697 "extern int exit(void*);";
0083c904
BK
1698};
1699
cd64831f 1700
0083c904 1701/*
99d05d99
BK
1702 * Fix various macros used to define ioctl numbers.
1703 * The traditional syntax was:
1704 *
1705 * #define _IO(n, x) (('n'<<8)+x)
1706 * #define TIOCFOO _IO(T, 1)
1707 *
5c0d5b94
ZW
1708 * but this does not work with the C standard, which disallows macro
1709 * expansion inside strings. We have to rewrite it thus:
99d05d99
BK
1710 *
1711 * #define _IO(n, x) ((n<<8)+x)
1712 * #define TIOCFOO _IO('T', 1)
1713 *
5c0d5b94
ZW
1714 * The select expressions match too much, but the c_fix code is cautious.
1715 *
1716 * _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
0083c904
BK
1717 */
1718fix = {
99d05d99 1719 hackname = io_quotes_def;
cf6d5133 1720 select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\([a-zA-Z][,)]";
99d05d99 1721 c_fix = char_macro_def;
4c6d912f 1722 c_fix_arg = "IO";
cd64831f
BK
1723 test_text =
1724 "#define BSD43__IOWR(n, x) (('n'<<8)+x)\n"
1725 "#define _IOWN(x,y,t) (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)\n"
1726 "#define _IO(x,y) ('x'<<8|y)";
33002945
BK
1727 test_text =
1728 "#define XX_IO(x) ('x'<<8|256)";
0083c904
BK
1729};
1730
5c0d5b94 1731fix = {
99d05d99
BK
1732 hackname = io_quotes_use;
1733 select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*"
1734 "\\( *[^,']";
1735 c_fix = char_macro_use;
4c6d912f 1736 c_fix_arg = "IO";
22e50c5b
BK
1737 test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
1738 "#define TIOCFOO \\\\\n"
1739 "BSD43__IOWR(T, 1) /* Some are multi-line */";
5c0d5b94 1740};
0083c904
BK
1741
1742
0083c904 1743/*
79589c4d 1744 * Check for missing ';' in struct
0083c904
BK
1745 */
1746fix = {
79589c4d
BK
1747 hackname = ip_missing_semi;
1748 files = netinet/ip.h;
1749 select = "}$";
1750 sed = "/^struct/,/^};/s/}$/};/";
1751 test_text=
1752 "struct mumble {\n"
1753 " union {\n"
1754 " int x;\n"
1755 " }\n"
1756 "}; /* mumbled struct */\n";
0083c904
BK
1757};
1758
94cc6036 1759
d0efead7
BK
1760/*
1761 * IRIX 6.5.1[89] <internal/sgimacros.h> unconditionally defines
1762 * __restrict as restrict iff __c99. This is wrong for C++, which
1763 * needs many C99 features, but only supports __restrict.
1764 */
1765fix = {
1766 hackname = irix___restrict;
1767 files = internal/sgimacros.h;
1768 select = "(#ifdef __c99\n)(#[ \t]*define __restrict restrict)";
1769
1770 mach = "mips-sgi-irix6.5";
1771 c_fix = format;
1772 c_fix_arg = "%1"
1773 "# ifndef __cplusplus\n%2\n# endif";
1774
1775 test_text = "#ifdef __c99\n# define __restrict restrict";
1776};
1777
e0704143
RS
1778/*
1779 * IRIX 6.5.22 <internal/math_core.h> uses the SGI c99 __generic() intrinsic
1780 * to define the fpclasify, isfinite, isinf, isnan, isnormal and signbit
1781 * functions.
1782 *
1783 * This was probably introduced around IRIX 6.5.18
1784 */
1785fix = {
1786 hackname = irix___generic1;
1787 files = internal/math_core.h;
1788 mach = "mips-sgi-irix6.5";
1789 select = "#define ([a-z]+)\\(x\\) *__generic.*";
1790
1791 c_fix = format;
1792 c_fix_arg = "extern int %1(double);\n"
1793 "extern int %1f(float);\n"
1794 "extern int %1l(long double);\n"
1795 "#define %1(x) (sizeof(x) == sizeof(double) ? _%1(x) \\\n"
1796 " : sizeof(x) == sizeof(float) ? _%1f(x) \\\n"
1797 " : _%1l(x))\n";
1798
1799 test_text =
1800 "#define isnan(x) __generic(x,,, _isnan, _isnanf, _isnanl,,,)(x)\n";
1801};
1802
1803
1804/* Likewise <internal/math_core.h> on IRIX 6.5.19 and later uses the SGI
1805 compiler's __generic intrinsic to define isgreater, isgreaterequal,
1806 isless, islessequal, islessgreater and isunordered functions. */
1807fix = {
1808 hackname = irix___generic2;
1809 files = internal/math_core.h;
1810 mach = "mips-sgi-irix6.5";
1811 select = "#define ([a-z]+)\\(x,y\\) *__generic.*";
1812
1813 c_fix = format;
1814 c_fix_arg = "#define %1(x,y) \\\n"
1815 " ((sizeof(x)<=4 && sizeof(y)<=4) ? _%1f(x,y) \\\n"
1816 " : (sizeof(x)<=8 && sizeof(y)<=8) ? _%1(x,y) \\\n"
1817 " : _%1l(x,y))\n";
1818
1819 test_text =
1820 "#define isless(x,y) __generic(x,y,, _isless, _islessf, _islessl,,,)(x,y)";
1821};
1822
1823
94cc6036
BK
1824/*
1825 * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
1826 * that causes the assembly preprocessor to complain about an
1827 * unterminated character constant.
1828 */
1829fix = {
79589c4d
BK
1830 hackname = irix_asm_apostrophe;
1831 files = sys/asm.h;
94cc6036 1832
79589c4d
BK
1833 select = "^[ \t]*#.*[Ww]e're";
1834 c_fix = format;
1835 c_fix_arg = "%1 are";
1836 c_fix_arg = "^([ \t]*#.*[Ww]e)'re";
1837 test_text = "\t# and we're on vacation";
94cc6036
BK
1838};
1839
0083c904 1840
7b78a14a
BK
1841/*
1842 * Non-traditional "const" declaration in Irix's limits.h.
1843 */
1844fix = {
1845 hackname = irix_limits_const;
1846 files = fixinc-test-limits.h, limits.h;
1847 select = "^extern const ";
1848 c_fix = format;
1849 c_fix_arg = "extern __const ";
1850 test_text = "extern const char limit; /* test limits */";
1851};
1852
1853
f23147fe
RO
1854/*
1855 * IRIX 6.5.1[78] <sys/socket.h> has a broken definition of socklen_t.
1856 * Various socket function prototypes use different types instead,
1857 * depending on the API in use (BSD, XPG4/5), but the socklen_t
1858 * definition doesn't reflect this (SGI Bug Id 864477, fixed in
1859 * IRIX 6.5.19).
1860 */
1861fix = {
1862 hackname = irix_socklen_t;
1863 files = sys/socket.h;
1864 select = "(#define _SOCKLEN_T\n)(typedef u_int32_t socklen_t;)";
1865
1866 mach = "mips-sgi-irix6.5";
1867 c_fix = format;
1868 c_fix_arg = "%1"
1869 "#if _NO_XOPEN4 && _NO_XOPEN5\n"
1870 "typedef int socklen_t;\n"
1871 "#else\n"
1872 "%2\n"
1873 "#endif /* _NO_XOPEN4 && _NO_XOPEN5 */";
1874
1875 test_text = "#define _SOCKLEN_T\ntypedef u_int32_t socklen_t;";
1876};
1877
3b3a1054 1878/*
1a78e5a7
RO
1879 * IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
1880 * some functions that take a va_list as
7b78a14a 1881 * taking char *. However, GCC uses void * for va_list, so
3b3a1054
BK
1882 * calling vfprintf with a va_list fails in C++. */
1883fix = {
1884 hackname = irix_stdio_va_list;
1885 files = stdio.h;
1a78e5a7 1886 files = internal/stdio_core.h;
3b3a1054 1887
9a557707 1888 select = '/\* va_list \*/ char \*';
3b3a1054 1889 c_fix = format;
9a557707 1890 c_fix_arg = "__gnuc_va_list";
11e2040a
BK
1891 test_text =
1892 "extern int printf( const char *, /* va_list */ char * );";
3b3a1054
BK
1893};
1894
1895
f23147fe
RO
1896/*
1897 * IRIX 6.5.19 <internal/wchar_core.h> provides the XPG4 variant of
1898 * wcsftime by default. ISO C99 requires the XPG5 variant instead.
1899 */
1900fix = {
1901 hackname = irix_wcsftime;
1902 files = internal/wchar_core.h;
1903 select = "#if _NO_XOPEN5\n(extern size_t[ \t]+wcsftime.*const char \*.*)";
1904
1905 mach = "mips-sgi-irix6.5";
1906 c_fix = format;
1907 c_fix_arg = "#if _NO_XOPEN5 && !defined(__c99)\n%1";
1908
1909 test_text = "#if _NO_XOPEN5\n"
1910 "extern size_t wcsftime(wchar_t *, __SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, const struct tm *);";
1911};
1912
0083c904 1913/*
79589c4d 1914 * Fixing ISC fmod declaration
0083c904
BK
1915 */
1916fix = {
79589c4d
BK
1917 hackname = isc_fmod;
1918 files = math.h;
1919 select = 'fmod\(double\)';
1920 c_fix = format;
1921 c_fix_arg = "fmod(double, double)";
1922 test_text = "extern double fmod(double);";
0083c904
BK
1923};
1924
1925
7b78a14a
BK
1926/*
1927 * On Interactive Unix 2.2, certain traditional Unix definitions
1928 * (notably getc and putc in stdio.h) are omitted if __STDC__ is
1929 * defined, not just if _POSIX_SOURCE is defined. This makes it
1930 * impossible to compile any nontrivial program except with -posix.
1931 */
1932fix = {
1933 hackname = isc_omits_with_stdc;
1934
1935 files = "stdio.h";
1936 files = "math.h";
1937 files = "ctype.h";
1938 files = "sys/limits.h";
1939 files = "sys/fcntl.h";
1940 files = "sys/dirent.h";
1941
1942 select = '!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)';
1943 c_fix = format;
1944 c_fix_arg = '!defined(_POSIX_SOURCE)';
1945 test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
1946 "\nint foo;\n#endif";
1947};
1948
1949
0083c904
BK
1950/*
1951 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
1952 * use / * * / to concatenate tokens.
1953 */
1954fix = {
1955 hackname = kandr_concat;
1956 files = "sparc/asm_linkage.h";
1957 files = "sun3/asm_linkage.h";
1958 files = "sun3x/asm_linkage.h";
1959 files = "sun4/asm_linkage.h";
1960 files = "sun4c/asm_linkage.h";
1961 files = "sun4m/asm_linkage.h";
1962 files = "sun4c/debug/asm_linkage.h";
1963 files = "sun4m/debug/asm_linkage.h";
1964 files = "arm/as_support.h";
1965 files = "arm/mc_type.h";
1966 files = "arm/xcb.h";
1967 files = "dev/chardefmac.h";
1968 files = "dev/ps_irq.h";
1969 files = "dev/screen.h";
1970 files = "dev/scsi.h";
1971 files = "sys/tty.h";
1972 files = "Xm.acorn/XmP.h";
1973 files = bsd43/bsd43_.h;
1974 select = '/\*\*/';
79589c4d
BK
1975 c_fix = format;
1976 c_fix_arg = '##';
1977 test_text = "#define __CONCAT__(a,b) a/**/b";
0083c904
BK
1978};
1979
1980
f7cf1c74
BK
1981/*
1982 * Fix libc1 _G_va_list definition, used in declarations of several
1983 * more-or-less standard functions, for example vasprintf.
1984 */
1985fix = {
1986 hackname = libc1_G_va_list;
1987 files = _G_config.h;
1988 mach = '*-*-linux*libc1';
1989 select = 'typedef void \* _G_va_list;';
1990 c_fix = format;
1991 c_fix_arg = "typedef __builtin_va_list _G_va_list;";
d7521977 1992 test_text = 'typedef void * _G_va_list;';
f7cf1c74
BK
1993};
1994
1995
4f923eb8
BK
1996/*
1997 * GNU libc1 string.h does not prototype memcpy and memcmp for gcc
687262b1
BK
1998 * versions > 1. This fix will open up the declaration for all
1999 * versions of GCC and for g++.
4f923eb8 2000 */
62a37b6f
HPN
2001fix = {
2002 hackname = libc1_ifdefd_memx;
2003
2004 /* The string.h result is overwritten by AAB_ultrix_string when doing
2005 "make check" and will fail. Therefore, we add the following kludgery
2006 to insert the test_text into the special testing header. :-} */
2007 files = testing.h;
2008 files = string.h;
2009
2010 c_fix = format;
2011 select = "' is a built-in function for gcc 2\\.x\\. \\*/";
2012 bypass = __cplusplus;
4f923eb8
BK
2013 c_fix_arg = "%1";
2014 c_fix_arg =
2015 '/\* `mem...\' is a built-in function for gcc 2\.x\. \*/' "\n"
2016 '#if defined\(__STDC__\) && __GNUC__ < 2' "\n"
2017 "(/\\* .* \\*/\n"
2018 "extern [a-z_]+ mem.*(\n[^#].*)*;)\n"
2019 "#endif";
62a37b6f
HPN
2020
2021 test_text =
2022 "/* \\`memcpy' is a built-in function for gcc 2.x. */\n"
2023 "#if defined(__STDC__) && __GNUC__ < 2\n"
2024 "/* Copy N bytes of SRC to DEST. */\n"
2025 "extern __ptr_t memcpy __P ((__ptr_t __dest, __const __ptr_t __src,\n"
2026 " size_t __n));\n"
2027 "#endif";
2028};
2029
2030
fa71a5c3
RS
2031/* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
2032 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
2033 * constant on recent versions of g++.
2034 */
2035fix = {
2036 hackname = linux_ia64_ucontext;
2037 files = "sys/ucontext.h";
2038 mach = "ia64-*-linux*";
2039 select = '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
2040 '->sc_gr\[0\]\) - \(char \*\) 0\)';
2041 c_fix = format;
2042 c_fix_arg = "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
2043 test_text = "# define _SC_GR0_OFFSET\t\\\\\n"
2044 "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
2045};
2046
2047
88f505f6
NN
2048/*
2049 * Apparently some SVR4 systems typedef longlong_t to long ?
2050 */
2051#ifdef SVR4
2052fix = {
2053 hackname = longlong_t;
2054 select = "typedef[ \t]+(unsigned[ \t]+)?long[ \t]+(u_)?longlong_t";
2055 c_fix = format;
2056 c_fix_arg = "typedef %1long long %2longlong_t";
2057 test_text = "typedef long longlong_t\n"
2058 "typedef unsigned long u_longlong_t";
2059};
2060#endif
2061
d635c707
AN
2062/*
2063 * Remove header file warning from sys/time.h. Autoconf's
2064 * AC_HEADER_TIME recommends to include both sys/time.h and time.h
2065 * which causes warning on LynxOS. Remove the warning.
0083c904
BK
2066 */
2067fix = {
d635c707
AN
2068 hackname = lynxos_no_warning_in_sys_time_h;
2069 files = sys/time.h;
2070 select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
79589c4d
BK
2071 c_fix = format;
2072 c_fix_arg = "";
d635c707 2073 test_text = "#warning Using <time.h> instead of <sys/time.h>";
0083c904
BK
2074};
2075
2076
d635c707
AN
2077/*
2078 * Add missing declaration for putenv.
0083c904
BK
2079 */
2080fix = {
d635c707
AN
2081 hackname = lynxos_missing_putenv;
2082 mach = '*-*-lynxos*';
2083 files = stdlib.h;
2084 bypass = 'putenv[ \t]*\\(';
2085 select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
79589c4d 2086 c_fix = format;
d635c707
AN
2087 c_fix_arg = "%0\n"
2088 "extern int putenv _AP((char *));";
2089 c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2090 test_text = "extern char *getenv _AP((const char *));";
0083c904
BK
2091};
2092
2093
3be1fb72
ZW
2094/*
2095 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
7b78a14a 2096 *
1435059e
RE
2097 * On NetBSD, machine is a symbolic link to an architecture specific
2098 * directory name, so we can't match a specific file name here.
3be1fb72
ZW
2099 */
2100fix = {
2101 hackname = machine_ansi_h_va_list;
a8228686 2102 select = "define[ \t]+_BSD_VA_LIST_[ \t]";
3be1fb72
ZW
2103 bypass = '__builtin_va_list';
2104
a8228686
BK
2105 c_fix = format;
2106 c_fix_arg = "%1__builtin_va_list";
2107 c_fix_arg = "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
2108
2109 test_text = " # define _BSD_VA_LIST_\tchar**";
3be1fb72
ZW
2110};
2111
2112
0083c904 2113/*
8f34d1e9 2114 * Fix non-ansi machine name defines
0083c904
BK
2115 */
2116fix = {
99d05d99
BK
2117 hackname = machine_name;
2118 c_test = machine_name;
2119 c_fix = machine_name;
cb8d5168 2120
a8228686 2121 test_text = "/* MACH_DIFF: */\n"
cb8d5168 2122 "#if defined( i386 ) || defined( sparc ) || defined( vax )"
a8228686 2123 "\n/* no uniform test, so be careful :-) */";
0083c904
BK
2124};
2125
2126
2127/*
a401fd60 2128 * Some math.h files define struct exception (it's in the System V
793146e3
BK
2129 * Interface Definition), which conflicts with the class exception defined
2130 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
2131 * This is not a great fix, but I haven't been able to think of anything
2132 * better. Note that we have to put the #ifdef/#endif blocks at beginning
78a0d70c
ZW
2133 * and end of file, because fixproto runs after us and may insert
2134 * additional references to struct exception.
0083c904
BK
2135 */
2136fix = {
ba8fcfc3
BK
2137 hackname = math_exception;
2138 files = math.h;
2139 select = "struct exception";
793146e3
BK
2140 /*
2141 * This should be bypassed on __cplusplus, but some supposedly C++ C++
2142 * aware headers, such as Solaris 8 and 9, don't wrap their struct
2143 * exception either. So currently we bypass only for glibc, based on a
2144 * comment in the fixed glibc header. Ick.
2145 */
61fec9ff 2146 bypass = 'We have a problem when using C\+\+|for C\+\+, _[a-z0-9A-Z_]+_exception; for C, exception';
ba8fcfc3
BK
2147 c_fix = wrap;
2148
2149 c_fix_arg = "#ifdef __cplusplus\n"
2150 "#define exception __math_exception\n"
2151 "#endif\n";
2152
2153 c_fix_arg = "#ifdef __cplusplus\n"
2154 "#undef exception\n"
2155 "#endif\n";
2156
2157 test_text = "typedef struct exception t_math_exception;";
0083c904
BK
2158};
2159
a8228686
BK
2160
2161/*
2162 * This looks pretty broken to me. ``dbl_max_def'' will contain
2163 * "define DBL_MAX " at the start, when what we really want is just
2164 * the value portion. Can't figure out how to write a test case
2165 * for this either :-(
2166 */
0083c904 2167fix = {
d7eb5a45 2168 hackname = math_huge_val_from_dbl_max;
0083c904 2169 files = math.h;
687262b1 2170
8f34d1e9 2171 /*
d7eb5a45
ZW
2172 * IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined
2173 * in math.h, this fix applies.
8f34d1e9 2174 */
687262b1
BK
2175 select = "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
2176 bypass = "define[ \t]+DBL_MAX";
0083c904 2177
d7eb5a45 2178 shell =
8f34d1e9 2179 /*
d7eb5a45
ZW
2180 * See if we have a definition for DBL_MAX in float.h.
2181 * If we do, we will replace the one in math.h with that one.
8f34d1e9 2182 */
0083c904 2183
8f34d1e9 2184 "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
687262b1 2185 "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
0083c904 2186
d7eb5a45
ZW
2187 "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
2188 "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
687262b1 2189 "s@DBL_MAX@'\"$dbl_max_def@\"\n"
d7eb5a45
ZW
2190 "\telse cat\n"
2191 "\tfi";
687262b1
BK
2192
2193 test_text =
2194 "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
2195 "#define HUGE_VAL DBL_MAX";
0083c904
BK
2196};
2197
a8228686 2198
7b78a14a
BK
2199/*
2200 * nested comment
2201 */
2202fix = {
2203 hackname = nested_auth_des;
2204 files = rpc/rpc.h;
2205 select = '(/\*.*rpc/auth_des\.h>.*)/\*';
2206 c_fix = format;
2207 c_fix_arg = "%1*/ /*";
2208 test_text = "/*#include <rpc/auth_des.h> /* skip this */";
2209};
2210
2211
79589c4d
BK
2212/*
2213 * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
2214 */
2215fix = {
2216 hackname = nested_motorola;
2217 mach = "m68k-motorola-sysv*";
79589c4d 2218 files = sys/limits.h;
c1fd153e 2219 files = limits.h;
687262b1
BK
2220 select = "max # bytes atomic in write|error value returned by Math lib";
2221
79589c4d
BK
2222 sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
2223 "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
2224 sed = "s@\\(/\\*#define\tHUGE_VAL\t3.[0-9e+]* \\)"
2225 "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
687262b1
BK
2226
2227 test_text =
2228 "#undef PIPE_BUF /* max # bytes atomic in write to a\n"
2229 "\t\t/* PIPE */\n"
2230 "/*#define\tHUGE_VAL\t3.9e+9 /*error value returned by Math lib*/";
79589c4d
BK
2231};
2232
2233
2234/*
2235 * Fixing nested comments in ISC <sys/limits.h>
2236 */
2237fix = {
2238 hackname = nested_sys_limits;
2239 files = sys/limits.h;
2240 select = CHILD_MAX;
2241 sed = "/CHILD_MAX/s,/\\* Max, Max,";
2242 sed = "/OPEN_MAX/s,/\\* Max, Max,";
2243 test_text = "/*\n#define CHILD_MAX 20 /* Max, Max, ... */ /*\n"
2244 "#define OPEN_MAX 20 /* Max, Max, ... */\n";
2245};
2246
0083c904 2247
3edc4b23
KW
2248/*
2249 * NetBSD has a semicolon after the ending '}' for some extern "C".
2250 */
2251fix = {
2252 hackname = netbsd_extra_semicolon;
2253 mach = *-*-netbsd*;
2254 files = sys/cdefs.h;
2255 select = "#define[ \t]*__END_DECLS[ \t]*};";
2256
2257 c_fix = format;
2258 c_fix_arg = "#define __END_DECLS }";
2259
2260 test_text = "#define __END_DECLS };";
2261};
2262
2263
0083c904
BK
2264/*
2265 * NeXT 3.2 adds const prefix to some math functions.
2266 * These conflict with the built-in functions.
2267 */
2268fix = {
a8228686
BK
2269 hackname = next_math_prefix;
2270 files = ansi/math.h;
2271 select = "^extern[ \t]+double[ \t]+__const__[ \t]";
2272
2273 c_fix = format;
2274 c_fix_arg = "extern double %1(";
2275 c_fix_arg = "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
0083c904 2276
a8228686 2277 test_text = "extern\tdouble\t__const__\tmumble();";
0083c904
BK
2278};
2279
2280
2281/*
2282 * NeXT 3.2 uses the word "template" as a parameter for some
2283 * functions. GCC reports an invalid use of a reserved key word
a8228686 2284 * with the built-in functions.
0083c904
BK
2285 */
2286fix = {
2287 hackname = next_template;
2288 files = bsd/libc.h;
a8228686 2289 select = "[ \t]template\\)";
0083c904 2290
a8228686
BK
2291 c_fix = format;
2292 c_fix_arg = "(%1)";
2293 c_fix_arg = "\\(([^)]*)[ \t]template\\)";
2294 test_text = "extern mumble( char * template); /* fix */";
0083c904
BK
2295};
2296
2297
2298/*
2299 * NeXT 3.2 includes the keyword volatile in the abort() and exit()
2300 * function prototypes. That conflicts with the built-in functions.
2301 */
2302fix = {
2303 hackname = next_volitile;
2304 files = ansi/stdlib.h;
a8228686
BK
2305 select = "^extern[ \t]+volatile[ \t]+void[ \t]";
2306
2307 c_fix = format;
2308 c_fix_arg = "extern void %1(";
2309 c_fix_arg = "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
0083c904 2310
a8228686 2311 test_text = "extern\tvolatile\tvoid\tabort();";
0083c904
BK
2312};
2313
2314
2315/*
2316 * NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
2317 * Note that version 3 of the NeXT system has wait.h in a different directory,
2318 * so that this code won't do anything. But wait.h in version 3 has a
2319 * conditional, so it doesn't need this fix. So everything is okay.
2320 */
2321fix = {
cb8d5168
BK
2322 hackname = next_wait_union;
2323 files = sys/wait.h;
0083c904 2324
cb8d5168
BK
2325 select = 'wait\(union wait';
2326 c_fix = format;
2327 c_fix_arg = "wait(void";
2328 test_text = "extern pid_d wait(union wait*);";
0083c904
BK
2329};
2330
2331
2332/*
2333 * a missing semi-colon at the end of the nodeent structure definition.
2334 */
2335fix = {
cb8d5168
BK
2336 hackname = nodeent_syntax;
2337 files = netdnet/dnetdb.h;
2338 select = "char[ \t]*\\*na_addr[ \t]*$";
2339 c_fix = format;
2340 c_fix_arg = "%0;";
2341 test_text = "char *na_addr\t";
0083c904
BK
2342};
2343
2344
dc70e81d
JM
2345/*
2346 * obstack.h used casts as lvalues.
2347 *
2348 * We need to change postincrements of casted pointers (which are
2349 * then dereferenced and assigned into) of the form
2350 *
2351 * *((TYPE*)PTRVAR)++ = (VALUE)
2352 *
2353 * into expressions like
2354 *
2355 * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
2356 *
2357 * which is correct for the cases used in obstack.h since PTRVAR is
2358 * of type char * and the value of the expression is not used.
2359 */
2360fix = {
2361 hackname = obstack_lvalue_cast;
2362 files = obstack.h;
2363 select = '\*\(\(([^()]*)\*\)(.*)\)\+\+ = \(([^()]*)\)';
2364 c_fix = format;
2365 c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
2366 test_text = "*((void **) (h)->next_free)++ = (aptr)";
2367};
2368
2369
0083c904
BK
2370/*
2371 * sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
2372 * defining regex.h related types. This causes libg++ build and usage
2373 * failures. Fixing this correctly requires checking and modifying 3 files.
2374 */
2375fix = {
2376 hackname = osf_namespace_a;
2377 files = reg_types.h;
2378 files = sys/lc_core.h;
8f34d1e9
BK
2379 test = " -r reg_types.h";
2380 test = " -r sys/lc_core.h";
2381 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
2382 test = " -z \"`grep __regex_t regex.h`\"";
0083c904 2383
cb8d5168
BK
2384 c_fix = format;
2385 c_fix_arg = "__%0";
bec7ddd7 2386 c_fix_arg = "reg(ex|off|match)_t";
cb8d5168 2387
5d7d28c2 2388 test_text = "`touch sys/lc_core.h`"
cb8d5168
BK
2389 "typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
2390 "extern regex_t re;\n"
2391 "extern regoff_t ro;\n"
2392 "extern regmatch_t rm;\n";
0083c904
BK
2393};
2394
2395fix = {
cb8d5168 2396 hackname = osf_namespace_c;
0083c904 2397 files = regex.h;
8f34d1e9
BK
2398 test = " -r reg_types.h";
2399 test = " -r sys/lc_core.h";
2400 test = " -n \"`grep '} regex_t;' reg_types.h`\"";
2401 test = " -z \"`grep __regex_t regex.h`\"";
2402
cb8d5168
BK
2403 select = "#include <reg_types\.h>.*";
2404 c_fix = format;
2405 c_fix_arg = "%0\n"
2406 "typedef __regex_t\tregex_t;\n"
2407 "typedef __regoff_t\tregoff_t;\n"
2408 "typedef __regmatch_t\tregmatch_t;";
2409
2410 test_text = "#include <reg_types.h>";
0083c904
BK
2411};
2412
2413
2414/*
2415 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
2416 * The original ones fail if uninitialized externs are not common.
2417 * This is the default for all ANSI standard C++ compilers.
2418 */
2419fix = {
cb8d5168
BK
2420 hackname = pthread_page_size;
2421 files = pthread.h;
2422 select = "^int __page_size";
2423 c_fix = format;
2424 c_fix_arg = "extern %0";
2425 test_text = "int __page_size;";
0083c904
BK
2426};
2427
14bfd7c7
RG
2428/*
2429 * On broken glibc-2.3.3 systems an array of incomplete structures is
2430 * passed to __sigsetjmp. Fix that to take a pointer instead.
2431 */
2432fix = {
2433 hackname = pthread_incomplete_struct_argument;
2434 files = pthread.h;
2435 select = "struct __jmp_buf_tag";
2436 c_fix = format;
2437 c_fix_arg = "%1 *%2%3";
2438 c_fix_arg = "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) (__env)\\[1\\](.*)$";
2439 test_text = "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask);";
2440};
0083c904 2441
228e7b62
NN
2442/*
2443 * On DYNIX/ptx, sys/mc_param.h has an embedded asm for the cpuid instruction
2444 * on the P5. This is not used by anything else so we ifdef it out.
2445 * Current GCC doesn't seem to complain about the asm, though.
2446 */
2447#ifdef PTX
2448fix = {
2449 hackname = ptx_sys_mc_param_h;
2450 files = sys/mc_param.h;
2451 sed = "/__asm/,/}/{"
2452 "/__asm/i\\\n"
2453 "#if !defined (__GNUC__) && !defined (__GNUG__)\n"
2454 "/}/a\\\n"
2455 "#endif\n"
2456 "}";
2457 test_text = "__asm\n"
2458 "int _CPUID()\n"
2459 "{\n"
2460 " non-GNU assembly here\n"
2461 "}";
2462};
2463#endif
2464
2465
0083c904
BK
2466/*
2467 * Fix return type of fread and fwrite on sysV68
2468 */
0083c904
BK
2469fix = {
2470 hackname = read_ret_type;
2471 files = stdio.h;
d71ef9d4 2472 select = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
cb8d5168
BK
2473 c_fix = format;
2474 c_fix_arg = "extern unsigned int fread(), fwrite();\n%1%2";
2475 c_fix_arg = "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
2476
2477 test_text = "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
0083c904 2478};
0083c904
BK
2479
2480
6ed6a1b9
JM
2481/*
2482 * Fix casts as lvalues in glibc's <rpc/xdr.h>.
2483 */
2484fix = {
2485 hackname = rpc_xdr_lvalue_cast_a;
2486 files = rpc/xdr.h;
2487 select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
2488 c_fix = format;
2489 c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
2490 test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
2491 "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
2492};
2493
2494
2495fix = {
2496 hackname = rpc_xdr_lvalue_cast_b;
2497 files = rpc/xdr.h;
2498 select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
2499 c_fix = format;
2500 c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
2501 test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
2502 "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
2503};
2504
2505
0083c904 2506/*
7b78a14a 2507 * function class(double x) conflicts with C++ keyword on rs/6000
0083c904
BK
2508 */
2509fix = {
cb8d5168
BK
2510 hackname = rs6000_double;
2511 files = math.h;
2512 select = '[^a-zA-Z_]class\(';
2513
2514 c_fix = format;
2515 c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
2516 c_fix_arg = '^.*[^a-zA-Z_]class\(.*';
2517
2518 test_text = "extern int class();";
0083c904
BK
2519};
2520
2521
2522/*
2523 * Wrong fchmod prototype on RS/6000.
2524 */
2525fix = {
cb8d5168
BK
2526 hackname = rs6000_fchmod;
2527 files = sys/stat.h;
2528 select = 'fchmod\(char \*';
2529 c_fix = format;
2530 c_fix_arg = "fchmod(int";
2531 test_text = "extern int fchmod(char *, mode_t);";
0083c904
BK
2532};
2533
2534
2535/*
7b78a14a 2536 * parameters conflict with C++ new on rs/6000
0083c904
BK
2537 */
2538fix = {
cb8d5168
BK
2539 hackname = rs6000_param;
2540 files = "stdio.h";
2541 files = "unistd.h";
0083c904 2542
cb8d5168
BK
2543 select = 'rename\(const char \*old, const char \*new\)';
2544 c_fix = format;
2545 c_fix_arg = 'rename(const char *_old, const char *_new)';
2546
2547 test_text = 'extern int rename(const char *old, const char *new);';
0083c904
BK
2548};
2549
057c56df 2550
de0656cf
KJ
2551/*
2552 * On OpenServer and on UnixWare 7, <math.h> uses the native compiler
2553 * __builtin_generic. We fix that usage to use the GCC equivalent.
2554 * It also has a plethora of inline functions that conflict with libstdc++.
2555 */
2556fix = {
2557 hackname = sco_math;
2558 files = math.h;
2559 files = ansi/math.h;
2560 files = posix/math.h;
2561 files = xpg4/math.h;
2562 files = xpg4v2/math.h;
2563 files = xpg4plus/math.h;
2564 files = ods_30_compat/math.h;
2565 files = oldstyle/math.h;
2566 select = "inline double abs";
492d5b4f 2567 bypass = "__GNUG__";
de0656cf
KJ
2568 sed = "/#define.*__fp_class(a) \\\\/i\\\n"
2569 "#ifndef __GNUC__\n";
2570 sed =
2571"/.*__builtin_generic/a\\\n"
2572"#else\\\n"
2573"#define __fp_class(a) \\\\\\\n"
2574" __builtin_choose_expr(__builtin_types_compatible_p(typeof(a),long double),\\\\\\\n"
2575" __fpclassifyl(a), \\\\\\\n"
2576" __builtin_choose_expr(__builtin_types_compatible_p(typeof(a), float), \\\\\\\n"
2577" __fpclassifyf(a),__fpclassify(a)))\\\n"
2578"#endif";
2579
2580 sed = "/extern \"C\\+\\+\"/N;"
2581 "/inline double abs/i\\\n"
2582 "#ifndef __GNUC__\n";
2583 sed = "/inline long double trunc/N;"
2584 "/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n"
2585 "#endif /* ! __GNUC__ */";
2586
2587 test_text =
2588 "#define __fp_class(a) \\\\\n"
2589 " __builtin_generic(a,\"ld:__fplcassifyl;f:__fpclassifyf;:__fpclassify\")\n";
2590
2591};
2592
057c56df 2593
de0656cf
KJ
2594/*
2595 * On SCO OpenServer prior to 5.0.7UP1, <sys/regset.h> and <ieeefp.h>
2596 * have a clash on struct _fpstate and struct fpstate.
2597 */
2598fix = {
2599 hackname = sco_regset;
2600 files = sys/regset.h;
2601 mach = "*-*-sco3.2v5*";
2602 select = "(struct[ \t]+.*)fpstate";
2603 c_fix = format;
2604 c_fix_arg = "%1rsfpstate";
2605
2606 test_text =
2607 "union u_fps {\n"
2608 " struct\tfpstate\n"
2609 " {\n"
2610 " int whatever;\n"
2611 " }\n"
2612 "};\n"
2613 "union _u_fps {\n"
2614 " struct _fpstate\n"
2615 " {\n"
2616 " int whatever;\n"
2617 " }\n"
2618 "};\n";
2619};
0083c904 2620
057c56df 2621
4c188026 2622/*
7b78a14a 2623 * The static functions lstat() and fchmod() in <sys/stat.h>
4c188026
BK
2624 * cause G++ grief since they're not wrapped in "if __cplusplus".
2625 *
2626 * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
2627 * tiny static wrappers that aren't C++ safe.
2628 */
2629fix = {
2630 hackname = sco_static_func;
2631 files = sys/stat.h;
2632 mach = "i?86-*-sco3.2*";
2633 select = "^static int";
2634
2635 sed = "/^static int/i\\\n"
2636 "#if __cplusplus\\\n"
2637 "extern \"C\" {\\\n"
2638 "#endif /* __cplusplus */";
2639
2640 sed = "/^}$/a\\\n"
2641 "#if __cplusplus\\\n"
2642 " }\\\n"
2643 "#endif /* __cplusplus */";
cb8d5168
BK
2644
2645 test_text =
2646 "#ifdef __STDC__\n"
2647 "static int\tstat(const char *__f, struct stat *__p) {\n"
2648 "\treturn __stat32(__f, __p);\n"
34fcb7c8 2649 "}\n\n# else /* !__STDC__ THIS FAILS ON BSD SYSTEMS */\n"
cb8d5168
BK
2650
2651 "static int\tstat(__f, __p)\n"
2652 "\tchar *__f;\n"
2653 "\tstruct stat *__p;\n"
2654 "{\n"
2655 "\treturn __stat32(__f, __p);\n"
2656 "}\n"
2657 "#endif";
4c188026
BK
2658};
2659
2660
2661/*
2662 * Fix prototype declaration of utime in sys/times.h.
2663 * In 3.2v4.0 the const is missing.
2664 */
2665fix = {
cb8d5168
BK
2666 hackname = sco_utime;
2667 files = sys/times.h;
2668 mach = "i?86-*-sco3.2v4*";
2669
2670 select = '\(const char \*, struct utimbuf \*\);';
2671 c_fix = format;
2672 c_fix_arg = '(const char *, const struct utimbuf *);';
2673
2674 test_text = "extern int utime(const char *, struct utimbuf *);";
4c188026
BK
2675};
2676
925a4487
EB
2677/*
2678 * Sun Solaris 10 defines several C99 math macros in terms of
2679 * builtins specific to the Studio compiler, in particular not
2680 * compatible with the GNU compiler.
2681 */
2682fix = {
2683 hackname = solaris_math_1;
2684 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2685 bypass = "__GNUC__";
2686 files = iso/math_c99.h;
2687 c_fix = format;
2688 c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
2689 c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
2690 test_text =
2691 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2692 "#undef HUGE_VAL\n"
2693 "#define HUGE_VAL __builtin_huge_val\n"
2694 "#undef HUGE_VALF\n"
2695 "#define HUGE_VALF __builtin_huge_valf\n"
2696 "#undef HUGE_VALL\n"
2697 "#define HUGE_VALL __builtin_huge_vall";
2698};
2699
2700fix = {
2701 hackname = solaris_math_2;
2702 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2703 bypass = "__GNUC__";
2704 files = iso/math_c99.h;
2705 c_fix = format;
2706 c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
2707 c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
2708 test_text =
2709 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2710 "#undef INFINITY\n"
2711 "#define INFINITY __builtin_infinity";
2712};
2713
2714fix = {
2715 hackname = solaris_math_3;
2716 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2717 bypass = "__GNUC__";
2718 files = iso/math_c99.h;
2719 c_fix = format;
2720 c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
2721 c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
2722 test_text =
2723 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2724 "#undef NAN\n"
2725 "#define NAN __builtin_nan";
2726};
2727
2728fix = {
2729 hackname = solaris_math_4;
2730 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2731 bypass = "__GNUC__";
2732 files = iso/math_c99.h;
2733 c_fix = format;
2734 c_fix_arg = "#define\tfpclassify(x) \\\n"
2735 " __extension__ ({ __typeof(x) __x_fp = (x); \\\n"
2736 "\t\t isnan(__x_fp) \\\n"
2737 "\t\t ? FP_NAN \\\n"
2738 "\t\t : isinf(__x_fp) \\\n"
2739 "\t\t ? FP_INFINITE \\\n"
2740 "\t\t : isnormal(__x_fp) \\\n"
2741 "\t\t\t ? FP_NORMAL \\\n"
2742 "\t\t\t : __x_fp == 0.0 \\\n"
2743 "\t\t\t ? FP_ZERO \\\n"
2744 "\t\t\t : FP_SUBNORMAL; })";
2745 c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
2746 test_text =
2747 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2748 "#undef fpclassify\n"
2749 "#define fpclassify(x) __builtin_fpclassify(x)";
2750};
2751
2752fix = {
2753 hackname = solaris_math_5;
2754 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2755 bypass = "__GNUC__";
2756 files = iso/math_c99.h;
2757 c_fix = format;
2758 c_fix_arg = "#define\tisfinite(x) \\\n"
2759 " __extension__ ({ __typeof (x) __x_f = (x); \\\n"
2760 "\t\t __builtin_expect(!isnan(__x_f - __x_f), 1); })";
2761 c_fix_arg = "^#define[ \t]+isfinite\\(x\\)[ \t]+__builtin_isfinite\\(x\\)";
2762 test_text =
2763 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2764 "#undef isfinite\n"
2765 "#define isfinite(x) __builtin_isfinite(x)";
2766};
2767
2768fix = {
2769 hackname = solaris_math_6;
2770 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2771 bypass = "__GNUC__";
2772 files = iso/math_c99.h;
2773 c_fix = format;
2774 c_fix_arg = "#define\tisinf(x) \\\n"
2775 " __extension__ ({ __typeof (x) __x_i = (x); \\\n"
2776 "\t\t __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); })";
2777 c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__builtin_isinf\\(x\\)";
2778 test_text =
2779 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2780 "#undef isinf\n"
2781 "#define isinf(x) __builtin_isinf(x)";
2782};
2783
2784fix = {
2785 hackname = solaris_math_7;
2786 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2787 bypass = "__GNUC__";
2788 files = iso/math_c99.h;
2789 c_fix = format;
2790 c_fix_arg = "#define\tisnormal(x) \\\n"
2791 " __extension__ ({ __typeof(x) __x_n = (x); \\\n"
2792 "\t\t if (__x_n < 0.0) __x_n = -__x_n; \\\n"
2793 "\t\t __builtin_expect(isfinite(__x_n) \\\n"
2794 "\t\t\t\t && (sizeof(__x_n) == sizeof(float) \\\n"
2795 "\t\t\t\t\t ? __x_n >= __FLT_MIN__ \\\n"
2796 "\t\t\t\t\t : sizeof(__x_n) == sizeof(long double) \\\n"
2797 "\t\t\t\t\t ? __x_n >= __LDBL_MIN__ \\\n"
2798 "\t\t\t\t\t : __x_n >= __DBL_MIN__), 1); })";
2799 c_fix_arg = "^#define[ \t]+isnormal\\(x\\)[ \t]+__builtin_isnormal\\(x\\)";
2800 test_text =
2801 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2802 "#undef isnormal\n"
2803 "#define isnormal(x) __builtin_isnormal(x)";
2804};
2805
2806fix = {
2807 hackname = solaris_math_8;
2808 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2809 bypass = "__GNUC__";
2810 files = iso/math_c99.h;
2811 c_fix = format;
2812 c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
2813 "\t\t\t ? __builtin_signbitf(x) \\\n"
2814 "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
2815 "\t\t\t ? __builtin_signbitl(x) \\\n"
2816 "\t\t\t : __builtin_signbit(x))";
2817 c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
2818 test_text =
2819 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2820 "#undef signbit\n"
2821 "#define signbit(x) __builtin_signbit(x)";
2822};
2823
2824fix = {
2825 hackname = solaris_math_9;
2826 select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2827 bypass = "__GNUC__";
2828 files = iso/math_c99.h;
2829 c_fix = format;
2830 c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
2831 c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)";
2832 test_text =
2833 '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
2834 "#undef isgreater\n"
2835 "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
2836 "#undef isgreaterequal\n"
2837 "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
2838 "#undef isless\n"
2839 "#define isless(x, y) ((x) __builtin_isless(y))\n"
2840 "#undef islessequal\n"
2841 "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
2842 "#undef islessgreater\n"
2843 "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
2844 "#undef isunordered\n"
2845 "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
2846};
4c188026 2847
7a9cdb10 2848/*
ce4a8f7d
ACY
2849 * Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER
2850 * incorrectly, so we replace them with versions that correspond to
2851 * the definition. We also explicitly name this fix "1" and the next
2852 * fix "2" because this one does not deal with the last field. This
2853 * fix needs to run before the next.
7a9cdb10
DD
2854 */
2855fix = {
2856 hackname = solaris_mutex_init_1;
ce4a8f7d 2857 select = '@\(#\)pthread.h' "[ \t]+1.1[0-9][ \t]+9[567]/[0-9/]+ SMI";
7a9cdb10
DD
2858 files = pthread.h;
2859 sed = "/define[ \t]*PTHREAD_MUTEX_INI/s/{0, 0,/{{{0}, 0}, {{{0}}},/\n"
2860 "/define[ \t]*PTHREAD_COND_INI/s/{0,/{{{0},0},/";
2861 test_text =
2862 '#ident "@(#)pthread.h 1.16 97/05/05 SMI"'"\n"
2863 "#define PTHREAD_MUTEX_INITIALIZER\t{0, 0, 0}\n"
2864 "#define PTHREAD_COND_INITIALIZER\t{0, 0} /* */\n";
2865};
2866
2867
1f98d85e 2868/*
eb559363 2869 * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
1f98d85e
WB
2870 * "0" for the last field of the pthread_mutex_t structure, which is
2871 * of type upad64_t, which itself is typedef'd to int64_t, but with
2872 * __STDC__ defined (e.g. by -ansi) it is a union. So change the
2873 * initializer to "{0}" instead
2874 */
2875fix = {
7a9cdb10 2876 hackname = solaris_mutex_init_2;
907cb30e
BK
2877 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2878 files = pthread.h;
2879 c_fix = format;
2880 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
2881 "%0\n"
2882 "#else\n"
2883 "%1, {0}}%3\n"
2884 "#endif";
78ff95dc
ZW
2885 c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+\\{.*)"
2886 ",[ \t]*0\\}" "(|[ \t].*)$";
907cb30e
BK
2887 test_text =
2888 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
2889 "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
2890 "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
2891 "#define PTHREAD_RWLOCK_INITIALIZER\t"
2892 "{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
1f98d85e
WB
2893};
2894
2895
6bf1ffe1
EB
2896/*
2897 * Solaris 2.5.1 and 2.6 use an outdated prototype for send & recv
2898 * in sys/socket.h. This is corrected in Solaris 7 and up.
2899 */
2900fix = {
2901 hackname = solaris_socket;
2902 files = sys/socket.h;
2903 select = '@\(#\)socket.h' "[ \t]+1.[123][0-9][ \t]+9[567]/[0-9/]+ SMI";
2904 c_fix = format;
2905 c_fix_arg = "extern int %1(int, %2void *, int, int);";
2906 c_fix_arg = '^extern int (recv|send)\(int,'
2907 ' (const )*char '
2908 '\*, int, int\);';
2909
2910 test_text = '#ident "@(#)socket.h 1.30 97/01/20 SMI"'"\n"
2911 "extern int recv(int, char *, int, int);\n"
2912 "extern int send(int, const char *, int, int);";
2913};
2914
2915
fba39eaf
RH
2916/*
2917 * Solaris 2.8 has what appears to be some gross workaround for
2918 * some old version of their c++ compiler. G++ doesn't want it
2919 * either, but doesn't want to be tied to SunPRO version numbers.
2920 */
2921fix = {
2922 hackname = solaris_stdio_tag;
2923 files = stdio_tag.h;
2924
2925 select = '__cplusplus < 54321L';
9fcc7481
MM
2926 /* In Solaris 10, the code in stdio_tag.h is conditionalized on
2927 "!defined(__GNUC__)" so we no longer need to fix it. */
2928 bypass = '__GNUC__';
fba39eaf
RH
2929 sed = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
2930
abaa8559 2931 test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
fba39eaf
RH
2932};
2933
6bf1ffe1
EB
2934
2935/*
2936 * Sun Solaris 2.5.1 doesn't define 'getpagesize' in <unistd.h>, as is done
2937 * on Solaris 2.6 and up.
2938 */
2939fix = {
2940 hackname = solaris_unistd;
2941 files = unistd.h;
2942 select = '@\(#\)unistd.h' "[ \t]+1.3[0-9][ \t]+9[567]/[0-9/]+ SMI";
2943 bypass = "getpagesize";
2944 c_fix = format;
2945 c_fix_arg = "extern int getpagesize();\n%0";
2946 c_fix_arg = '^extern (pid_t|int) getpgid\(.*\);';
2947 test_text = '#ident "@(#)unistd.h 1.33 95/08/28 SMI"'"\n"
2948 "extern pid_t getpgid(pid_t);\n"
2949 "extern int getpgid();";
2950};
2951
2952
d8af0868
RO
2953/*
2954 * <widec.h> until Solaris 2.5.1 defines macros for a couple of <wchar.h>
2955 * functions, breaking their prototypes if that file is included afterwards.
2956 * Include <wchar.h> early to avoid this issue, as is done on Solaris 2.6
2957 * and up.
2958 */
2959fix = {
2960 hackname = solaris_widec;
2961 files = widec.h;
51ac684e
RO
2962 mach = '*-*-solaris2.[0-5]';
2963 mach = '*-*-solaris2.[0-5].*';
d8af0868
RO
2964 bypass = "include.*wchar\\.h";
2965 select = "#include <euc.h>";
2966 c_fix = format;
2967 c_fix_arg = "%0\n#include <wchar.h>";
2968 test_text = "#include <euc.h>";
2969};
2970
cb8d5168 2971
0083c904
BK
2972/*
2973 * a missing semi-colon at the end of the statsswtch structure definition.
2974 */
2975fix = {
cb8d5168
BK
2976 hackname = statsswtch;
2977 files = rpcsvc/rstat.h;
2978 select = "boottime$";
2979 c_fix = format;
2980 c_fix_arg = "boottime;";
2981 test_text = "struct statswtch {\n int boottime\n};";
0083c904
BK
2982};
2983
2984
3be1fb72
ZW
2985/*
2986 * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
2987 * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
2988 * OK too.
2989 */
2990fix = {
2991 hackname = stdio_stdarg_h;
2992 files = stdio.h;
2993 bypass = "include.*(stdarg\.h|machine/ansi\.h)";
9fcc7481
MM
2994 /*
2995 * On Solaris 10, this fix is unncessary; <stdio.h> includes
2996 * <iso/stdio_iso.h>, which includes <sys/va_list.h>.
2997 */
5fabfd4c 2998 mach = '*-*-solaris2.1[0-9]*';
9fcc7481 2999 not_machine = true;
3be1fb72 3000
ba8fcfc3 3001 c_fix = wrap;
3be1fb72 3002
ba8fcfc3
BK
3003 c_fix_arg = "#define __need___va_list\n#include <stdarg.h>\n";
3004
3005 test_text = "";
3be1fb72
ZW
3006};
3007
3008
0083c904 3009/*
d1ea4593
MS
3010 * Don't use or define the name va_list in stdio.h. This is for
3011 * ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
3012 * of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
3013 * indicate that the header knows what it's doing -- under SUSv2,
3014 * stdio.h is required to define va_list, and we shouldn't break
3015 * that. On IRIX 6.5, internal/wchar_core.h used to get its
3016 * definition of va_list from stdio.h. Since this doesn't happen any
3017 * longer, use __gnuc_va_list there, too.
0083c904
BK
3018 */
3019fix = {
3020 hackname = stdio_va_list;
3021 files = stdio.h;
1a78e5a7
RO
3022 files = internal/stdio_core.h;
3023 files = internal/wchar_core.h;
40d05429 3024 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
9fcc7481
MM
3025 /*
3026 * On Solaris 10, the definition in
3027 * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
3028 * there is therefore no need for this fix there.
3029 */
5fabfd4c 3030 mach = '*-*-solaris2.1[0-9]*';
9fcc7481 3031 not_machine = true;
40d05429
MS
3032
3033 /*
3034 * Use __gnuc_va_list in arg types in place of va_list.
3035 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3036 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
3037 * trailing parentheses and semicolon save all other systems from this.
3038 * Define __not_va_list__ (something harmless and unused)
3039 * instead of va_list.
3040 * Don't claim to have defined va_list.
3041 */
3042 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3043 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3044 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3045 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3046 "s@ va_list@ __not_va_list__@\n"
3047 "s@\\*va_list@*__not_va_list__@\n"
3048 "s@ __va_list)@ __gnuc_va_list)@\n"
3049 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3050 "@typedef \\1 __not_va_list__;@\n"
3051 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3052 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3053 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3054 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3055 "s@VA_LIST@DUMMY_VA_LIST@\n"
3056 "s@_Va_LIST@_VA_LIST@";
3057 test_text = "extern void mumble( va_list);";
3058};
3059
3060
3061/*
3062 * Fix headers that use va_list from stdio.h to use the updated
3063 * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
3064 * dealt with elsewhere. The presence of __gnuc_va_list,
3065 * __DJ_va_list, or _G_va_list is taken to indicate that the header
3066 * knows what it's doing.
3067 */
3068fix = {
3069 hackname = stdio_va_list_clients;
a5252c84
JDA
3070 files = com_err.h;
3071 files = cps.h;
3072 files = curses.h;
3073 files = krb5.h;
3074 files = lc_core.h;
3075 files = pfmt.h;
3076 files = wchar.h;
3077 files = curses_colr/curses.h;
5ded58d0 3078 bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
40d05429
MS
3079 /* Don't fix, if we use va_list from stdarg.h, or if the use is
3080 otherwise protected. */
3081 bypass = 'include <stdarg\.h>|#ifdef va_start';
0083c904
BK
3082
3083 /*
3084 * Use __gnuc_va_list in arg types in place of va_list.
6d638aac
RO
3085 * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
3086 * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
0083c904 3087 * trailing parentheses and semicolon save all other systems from this.
3be1fb72
ZW
3088 * Define __not_va_list__ (something harmless and unused)
3089 * instead of va_list.
0083c904
BK
3090 * Don't claim to have defined va_list.
3091 */
871a3122 3092 sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
1a78e5a7 3093 "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3be1fb72 3094 "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
6d638aac 3095 "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3be1fb72
ZW
3096 "s@ va_list@ __not_va_list__@\n"
3097 "s@\\*va_list@*__not_va_list__@\n"
3098 "s@ __va_list)@ __gnuc_va_list)@\n"
2260b683
BK
3099 "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3100 "@typedef \\1 __not_va_list__;@\n"
0fca111b 3101 "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3be1fb72 3102 "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
631099c9 3103 "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3be1fb72
ZW
3104 "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3105 "s@VA_LIST@DUMMY_VA_LIST@\n"
3106 "s@_Va_LIST@_VA_LIST@";
687262b1 3107 test_text = "extern void mumble( va_list);";
0083c904
BK
3108};
3109
3110
7b78a14a
BK
3111/*
3112 * "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
3113 * is "!defined( __STRICT_ANSI__ )"
3114 */
3115fix = {
3116 hackname = strict_ansi_not;
3117 select = "^([ \t]*#[ \t]*if.*)"
3118 "(!__STDC__"
3119 "|__STDC__[ \t]*==[ \t]*0"
3120 "|__STDC__[ \t]*!=[ \t]*1"
b5639a49 3121 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
8f2e963b
LR
3122 /* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
3123 bypass = 'GNU and MIPS C compilers define __STDC__ differently';
5ded58d0
ZW
3124 /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
3125 is not defined by GCC, so it is safe. */
3126 bypass = '__SCO_VERSION__.*__STDC__ != 1';
7b78a14a
BK
3127 c_test = stdc_0_in_system_headers;
3128
3129 c_fix = format;
b5639a49 3130 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
7b78a14a
BK
3131
3132 test_text = "#if !__STDC__ \n"
3133 "#if __STDC__ == 0\n"
3134 "#if __STDC__ != 1\n"
3135 "#if __STDC__ - 0 == 0"
3136 "/* not std C */\nint foo;\n"
3137 "\n#end-end-end-end-if :-)";
3138};
3139
3140/*
3141 * "__STDC__-0==0"
3142 * is "!defined( __STRICT_ANSI__ )" on continued #if-s
3143 */
3144fix = {
3145 hackname = strict_ansi_not_ctd;
b5639a49
BK
3146 files = math.h, limits.h, stdio.h, signal.h,
3147 stdlib.h, sys/signal.h, time.h;
3148 /*
3149 * Starting at the beginning of a line, skip white space and
3150 * a leading "(" or "&&" or "||". One of those must be found.
3151 * Then, zero, one or more copies of a "defined(_FOO_BAR_) &&"
3152 * expression. If these are nested, then they must accumulate
3153 * because we won't match any closing parentheses. Finally,
3154 * after skipping over all that, we must then match our suspect
3155 * phrase: "__STDC__-0==0" with or without white space.
3156 */
3157 select = "^([ \t]*" '(\(|&&|\|\|)'
3158 "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
3159 "[ \t(]*)"
3160 "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
7b78a14a
BK
3161 c_test = stdc_0_in_system_headers;
3162
3163 c_fix = format;
b5639a49 3164 c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
7b78a14a 3165
b5639a49
BK
3166 test_text = "#if 1 && \\\\\n"
3167 "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
3168 "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
3169 "|| __STDC__ - 0 == 0 ) /* not std C */\n"
3170 "int foo;\n#endif";
7b78a14a
BK
3171};
3172
b5639a49 3173
7b78a14a
BK
3174/*
3175 * "__STDC__!=0" or "__STDC__==1" or "__STDC__-0==1"
3176 * is "defined( __STRICT_ANSI__ )"
3177 */
3178fix = {
3179 hackname = strict_ansi_only;
3180 select = "^([ \t]*#[ \t]*if.*)"
3181 "(__STDC__[ \t]*!=[ \t]*0"
3182 "|__STDC__[ \t]*==[ \t]*1"
3183 "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
b5639a49 3184 "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
7b78a14a
BK
3185 c_test = stdc_0_in_system_headers;
3186
3187 c_fix = format;
b5639a49 3188 c_fix_arg = "%1 defined(__STRICT_ANSI__)";
7b78a14a
BK
3189
3190 test_text = "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
3191};
3192
3193
79589c4d
BK
3194/*
3195 * IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
3196 * in prototype without previous definition.
3197 */
3198fix = {
3199 hackname = struct_file;
3200 files = rpc/xdr.h;
3201 select = '^.*xdrstdio_create.*struct __file_s';
3202 c_fix = format;
3203 c_fix_arg = "struct __file_s;\n%0";
3204 test_text = "extern void xdrstdio_create( struct __file_s* );";
3205};
3206
3207
3208/*
3209 * IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
3210 * in prototype without previous definition.
3b57c563
NN
3211 *
3212 * Don't fix OpenBSD, which uses struct sockaddr_in prototyping the same
3213 * function, and does define it.
79589c4d
BK
3214 */
3215fix = {
3216 hackname = struct_sockaddr;
3217 files = rpc/auth.h;
3b57c563 3218 select = "^.*authdes_create.*struct sockaddr[^_]";
79589c4d 3219 bypass = "<sys/socket\.h>";
3b57c563 3220 bypass = "struct sockaddr;\n";
79589c4d
BK
3221 c_fix = format;
3222 c_fix_arg = "struct sockaddr;\n%0";
3223 test_text = "extern AUTH* authdes_create( struct sockaddr* );";
3224};
3225
3226
4c188026
BK
3227/*
3228 * Apply fix this to all OSs since this problem seems to effect
3229 * more than just SunOS.
3230 */
3231fix = {
3232 hackname = sun_auth_proto;
3233 files = rpc/auth.h;
3234 files = rpc/clnt.h;
3235 files = rpc/svc.h;
3236 files = rpc/xdr.h;
793387fa 3237 bypass = "__cplusplus";
4c188026
BK
3238 /*
3239 * Select those files containing '(*name)()'.
3240 */
cb8d5168 3241 select = '\(\*[a-z][a-z_]*\)\(\)';
4c188026 3242
cb8d5168
BK
3243 c_fix = format;
3244 c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n"
3245 "#else\n%1();%2\n#endif";
3246 c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
4c188026 3247
cb8d5168
BK
3248 test_text =
3249 "struct auth_t {\n"
3250 " int (*name)(); /* C++ bad */\n"
3251 "};";
0083c904
BK
3252};
3253
3254
3255/*
3256 * Fix bogus #ifdef on SunOS 4.1.
3257 */
3258fix = {
cb8d5168
BK
3259 hackname = sun_bogus_ifdef;
3260 files = "hsfs/hsfs_spec.h";
3261 files = "hsfs/iso_spec.h";
3262 select = '#ifdef(.*\|\|.*)';
3263 c_fix = format;
3264 c_fix_arg = "#if%1";
3265
3266 test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
0083c904
BK
3267};
3268
3269
3270/*
3271 * Fix the CAT macro in SunOS memvar.h.
3272 */
3273fix = {
cb8d5168
BK
3274 hackname = sun_catmacro;
3275 files = pixrect/memvar.h;
3276 select = "^#define[ \t]+CAT\\(a,b\\).*";
3277 c_fix = format;
0083c904 3278
cb8d5168
BK
3279 c_fix_arg =
3280 "#ifdef __STDC__\n"
3281 "# define CAT(a,b) a##b\n"
3282 "#else\n%0\n#endif";
3283
3284 test_text =
3285 "#define CAT(a,b)\ta/**/b";
0083c904
BK
3286};
3287
3288
3289/*
3290 * Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
3291 * Also fix return type of {m,re}alloc in <malloc.h> on sysV68
3292 */
3293fix = {
3294 hackname = sun_malloc;
3295 files = malloc.h;
793387fa 3296 bypass = "_CLASSIC_ANSI_TYPES";
0083c904
BK
3297
3298 sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
3299 sed = "s/int[ \t][ \t]*free/void\tfree/g";
3300 sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
3301 sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
93a718f6 3302 sed = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
cb8d5168
BK
3303
3304 test_text =
3305 "typedef char *\tmalloc_t;\n"
3306 "int \tfree();\n"
3307 "char*\tmalloc();\n"
93a718f6 3308 "char*\tcalloc();\n"
cb8d5168 3309 "char*\trealloc();";
0083c904
BK
3310};
3311
3312
0083c904
BK
3313/*
3314 * Check for yet more missing ';' in struct (in SunOS 4.0.x)
3315 */
3316fix = {
3317 hackname = sun_rusers_semi;
3318 files = rpcsvc/rusers.h;
3319 select = "_cnt$";
3320 sed = "/^struct/,/^};/s/_cnt$/_cnt;/";
cb8d5168 3321 test_text = "struct mumble\n int _cnt\n};";
0083c904
BK
3322};
3323
3324
3325/*
3326 * signal.h on SunOS defines signal using (),
3327 * which causes trouble when compiling with g++ -pedantic.
3328 */
3329fix = {
3330 hackname = sun_signal;
3331 files = sys/signal.h;
3332 files = signal.h;
cb8d5168 3333 select = "^void\t" '\(\*signal\(\)\)\(\);.*';
0083c904 3334
cb8d5168
BK
3335 c_fix = format;
3336 c_fix_arg =
3337 "#ifdef __cplusplus\n"
3338 "void\t(*signal(...))(...);\n"
3339 "#else\n%0\n#endif";
0083c904 3340
cb8d5168 3341 test_text = "void\t(*signal())();";
0083c904
BK
3342};
3343
3344
0083c904
BK
3345/*
3346 * Correct the return type for strlen in strings.h in SunOS 4.
3347 */
3348fix = {
3349 hackname = sunos_strlen;
3350 files = strings.h;
cb8d5168
BK
3351 select = "int[ \t]*strlen\\(\\);(.*)";
3352 c_fix = format;
3353 c_fix_arg = "__SIZE_TYPE__ strlen();%1";
3354 test_text = " int\tstrlen(); /* string length */";
0083c904
BK
3355};
3356
3357
0083c904
BK
3358/*
3359 * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
3360 * that is visible to any ANSI compiler using this include. Simply
3361 * delete the lines that #define some string functions to internal forms.
3362 */
0083c904
BK
3363fix = {
3364 hackname = svr4_disable_opt;
3365 files = string.h;
3366 select = '#define.*__std_hdr_';
3367 sed = '/#define.*__std_hdr_/d';
de0656cf 3368 test_text = "#define strlen __std_hdr_strlen\n";
0083c904 3369};
86765ca0 3370
057c56df 3371
0083c904
BK
3372/*
3373 * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
86765ca0
RL
3374 * On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
3375 * but we still "hijack" it and redirect it to the GNU byteorder.h..
0083c904 3376 */
86765ca0 3377#ifdef SVR5
0083c904
BK
3378fix = {
3379 hackname = svr4_endian;
3380 files = sys/endian.h;
86765ca0
RL
3381#ifdef LATER
3382 /*
3383 * since we emit our own sys/byteorder.h,
3384 * this fix can never be applied to that file.
3385 */
3386 files = sys/byteorder.h;
3387#endif
0083c904
BK
3388 bypass = '__GNUC__';
3389
3390 sed = "/#\tifdef\t__STDC__/i\\\n"
3391 "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
3392
3393 sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
3394
3395 sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
3396 "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
3397};
86765ca0
RL
3398#endif /* SVR5 */
3399
0083c904
BK
3400
3401/*
3402 * Remove useless extern keyword from struct forward declarations
3403 * in <sys/stream.h> and <sys/strsubr.h>
3404 */
3405#ifdef SVR4
3406fix = {
3407 hackname = svr4_extern_struct;
3408 files = sys/stream.h;
3409 files = sys/strsubr.h;
3410 select = 'extern struct [a-z_]*;';
3411 sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
3412};
3413#endif
3414
3415/*
3416 * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
3417 * systems the file <ftw.h> contains extern declarations of these
3418 * functions followed by explicitly `static' definitions of these
3419 * functions... and that's not allowed according to ANSI C. (Note
3420 * however that on Solaris, this header file glitch has been pre-fixed by
3421 * Sun. In the Solaris version of <ftw.h> there are no static
3422 * definitions of any function so we don't need to do any of this stuff
3423 * when on Solaris.
3424 */
3425#ifdef SVR4
3426#ifndef SOLARIS
3427fix = {
3428 hackname = svr4_ftw;
3429 files = ftw.h;
3430 select = '^extern int ftw\(const';
3431
3432 sed = '/^extern int ftw(const/i' "\\\n"
3433 "#if !defined(_STYPES)\\\n"
3434 "static\\\n"
3435 "#else\\\n"
3436 "extern\\\n"
3437 "#endif";
3438 sed = 's/extern \(int ftw(const.*\)$/\1/';
3439 sed = "/^extern int nftw/i\\\n"
3440 "#if defined(_STYPES)\\\n"
3441 "static\\\n"
3442 "#else\\\n"
3443 "extern\\\n"
3444 "#endif";
3445 sed = 's/extern \(int nftw.*\)$/\1/';
3446 sed = "/^extern int ftw(),/c\\\n"
3447 "#if !defined(_STYPES)\\\n"
3448 "static\\\n"
3449 "#else\\\n"
3450 "extern\\\n"
3451 "#endif\\\n"
3452 " int ftw();\\\n"
3453 "#if defined(_STYPES)\\\n"
3454 "static\\\n"
3455 "#else\\\n"
3456 "extern\\\n"
3457 "#endif\\\n"
3458 " int nftw();";
3459};
3460#endif
3461#endif
3462
3463
3464/*
3465 * Fix broken decl of getcwd present on some svr4 systems.
3466 */
0083c904
BK
3467fix = {
3468 hackname = svr4_getcwd;
3469 files = stdlib.h;
3470 files = unistd.h;
4c188026 3471 files = prototypes.h;
0083c904
BK
3472 select = 'getcwd\(char \*, int\)';
3473
cb8d5168
BK
3474 c_fix = format;
3475 c_fix_arg = "getcwd(char *, size_t)";
3476
3477 test_text = "extern char* getcwd(char *, int);";
0083c904 3478};
4c188026 3479
0083c904
BK
3480
3481/*
825d7d64
NN
3482 * Wrap some files on System V r4 and DYNIX/ptx systems with
3483 * #ifdef _KERNEL, presumably to prevent kernel headers from
3484 * leaking into userspace. This may not be necessary at all,
3485 * but it was in the old scripts, so it seems safest to keep it for now.
3486 */
3487fix = {
3488 /* Can't name this with _kernel, or the test case will hit the bypass! */
3489 hackname = svr4_krnl;
3490 /* Since I'm rather unsure about the validity of this, limit it
3491 * to the specific systems it was operating on before. It should
3492 * also be bypassed for i?86-*-sysv4.3uw2, by that rule, but I didn't
3493 * see an easy way to do that. Hopefully it will be harmless
3494 * in any case. -- Nathanael */
3495 mach = '*-*-sysv4*';
3496 mach = 'i?86-sequent-ptx*';
0083c904
BK
3497 files = fs/rfs/rf_cache.h;
3498 files = sys/erec.h;
3499 files = sys/err.h;
3500 files = sys/char.h;
3501 files = sys/getpages.h;
3502 files = sys/map.h;
3503 files = sys/cmn_err.h;
3504 files = sys/kdebugger.h;
825d7d64
NN
3505
3506 /* This bypass will match _KERNEL, __KERNEL, __KERNEL__, etc.
3507 * It will also match SVR4_KERNEL_CHECK, which means that the
3508 * testsuite case will always be bypassed. Which is fine with me. */
0083c904 3509 bypass = '_KERNEL';
ba8fcfc3 3510
825d7d64 3511 c_fix = wrap;
ba8fcfc3
BK
3512 c_fix_arg = "#ifdef _KERNEL\n";
3513 c_fix_arg = "#endif /* _KERNEL */\n";
825d7d64
NN
3514
3515 /* There's no reasonable test for this given that we don't know exactly
3516 * what problem inspired it in the first place. */
ba8fcfc3 3517 test_text = "";
0083c904 3518};
825d7d64 3519
0083c904
BK
3520
3521/*
3522 * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
3523 * tend to conflict with the compiler's own definition of this symbol. (We
3524 * will use the compiler's definition.)
3525 * Likewise __sparc, for Solaris, and __i860, and a few others
3526 * (guessing it is necessary for all of them).
3527 */
3528#ifdef SVR4
3529fix = {
3530 hackname = svr4_mach_defines;
3531 files = ieeefp.h;
b0588013
BK
3532 select = "#define[ \t]*__(i386|mips|sparc|m88k|m68k)[ \t]";
3533 sed = "/#define[ \t]*__\\(i386|mips|sparc|m88k|m68k\\)[ \t]/d";
0083c904
BK
3534};
3535#endif
3536
86765ca0 3537
0083c904
BK
3538/*
3539 * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
86765ca0 3540 * They are declared as non-static then immediately redeclared as static.
0083c904 3541 */
86765ca0 3542#ifdef SVR5
0083c904
BK
3543fix = {
3544 hackname = svr4_mkdev;
3545 files = sys/mkdev.h;
86765ca0 3546 select = '^static';
0083c904 3547
cb8d5168
BK
3548 sed = "/^dev_t makedev(/s/^/static /";
3549 sed = "/^major_t major(/s/^/static /";
3550 sed = "/^minor_t minor(/s/^/static /";
0083c904 3551};
86765ca0
RL
3552#endif /* SVR5 */
3553
0083c904
BK
3554
3555/*
3556 * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
3557 * Also fix types of array initializers.
3558 */
3559#ifdef SVR4
3560fix = {
3561 hackname = svr4_netcspace;
3562 files = sys/netcspace.h;
3563 select = 'NC_NPI_RAW';
3564 sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
3565 sed = 's/NC_/(unsigned long) NC_/';
3566};
3567#endif
3568
3569/*
3570 * Fix reference to NMSZ in <sys/adv.h>.
3571 */
3572#ifdef SVR4
3573fix = {
3574 hackname = svr4_nmsz;
3575 files = sys/adv.h;
3576 select = '\[NMSZ\]';
3577 sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
3578};
3579#endif
3580
4c188026 3581
c2f523ea
NN
3582/*
3583 * Some SVR4 systems supposedly use these non-ANSI preprocessor directives.
3584 */
3585#ifdef SVR4
3586fix = {
3587 hackname = svr4_preproc_lint_on;
3588 select = '#lint\(on\)';
3589 c_fix = format;
3590 c_fix_arg = 'defined(lint)';
3591 test_text = "#if #lint(on)";
3592};
3593fix = {
3594 hackname = svr4_preproc_lint_off;
3595 select = '#lint\(off\)';
3596 c_fix = format;
3597 c_fix_arg = '!defined(lint)';
3598 test_text = "#if #lint(off)";
3599};
3600fix = {
3601 hackname = svr4_preproc_machine;
3602 select = '#(machine|system|cpu)\(([^)]*)\)';
3603 c_fix = format;
3604 c_fix_arg = 'defined(__%1__)';
3605 test_text = "#if #machine(i386) || #system(vax) || #cpu(sparc)";
3606};
3607#endif
3608
3609
0083c904
BK
3610/*
3611 * Fix broken decl of profil present on some svr4 systems.
3612 */
0083c904
BK
3613fix = {
3614 hackname = svr4_profil;
3615 files = stdlib.h;
3616 files = unistd.h;
3617
cb8d5168
BK
3618 select =
3619 'profil\(unsigned short \*, unsigned int, unsigned int, unsigned int\)';
553cba65
RO
3620 /* The fix is wrong on IRIX 5/6 and creates a conflict with another
3621 prototype in <sys/profil.h>. */
3622 bypass = 'Silicon Graphics';
cb8d5168
BK
3623 c_fix = format;
3624 c_fix_arg = 'profil(unsigned short *, size_t, int, unsigned int)';
3625
3626 test_text =
3627 'profil(unsigned short *, unsigned int, unsigned int, unsigned int);';
0083c904 3628};
4c188026 3629
0083c904
BK
3630
3631/*
3632 * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
3633 */
3634#ifdef SVR4
3635fix = {
3636 hackname = svr4_proto_form;
3637 files = sys/stat.h;
3638 select = 'const extern';
3639
3640 sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
3641 "s/(.*)\\n/( /\n"
3642 "s/;\\n/, /\n"
3643 "s/;$/)/\n" "}";
3644
3645 sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
3646 "s/(.*)\\n/( /\n"
3647 "s/;\\n/, /\n"
3648 "s/;$/)/\n" "}";
3649
3650 sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
3651 "s/(.*)\\n/( /\n"
3652 "s/;\\n/, /\n"
3653 "s/;$/)/\n" "}";
3654
3655 sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
3656 "s/(.*)\\n/( /\n"
3657 "s/;\\n/, /g\n"
3658 "s/;$/)/\n" "}";
3659
3660 sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
3661 sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
3662 sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
3663 sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
3664 sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
3665 sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
3666};
3667#endif
3668
3669/*
3670 * Add a prototyped declaration of mmap to <sys/mman.h>.
3671 */
3672#ifdef SVR4
3673fix = {
3674 hackname = svr4_proto_mmap;
3675 files = sys/mman.h;
3676 select = '^extern caddr_t mmap();$';
3677 sed = '/^extern caddr_t mmap();$/c' "\\\n"
3678 "#ifdef __STDC__\\\n"
3679 "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
3680 "#else /* !defined(__STDC__) */\\\n"
3681 "extern caddr_t mmap ();\\\n"
3682 "#endif /* !defined(__STDC__) */\\\n";
3683};
3684#endif
3685
3686/*
3687 * Add a #define of _SIGACTION_ into <sys/signal.h>.
3688 */
3689#ifdef SVR4
3690fix = {
3691 hackname = svr4_sigaction;
3692 files = sys/signal.h;
3693 sed = "/^struct sigaction {/i\\\n"
3694 "#define _SIGACTION_";
3695 sed = 's/(void *(\*)())/(void (*)(int))/';
3696};
3697#endif
3698
1d109416
NN
3699
3700/*
3701 * Correct types for signal handler constants like SIG_DFL; they might be
3702 * void (*) (), and should be void (*) (int). C++ doesn't like the
3703 * old style.
3704 */
3705fix = {
3706 hackname = svr4_sighandler_type;
3707 files = sys/signal.h;
3708 select = 'void *\(\*\)\(\)';
3709 c_fix = format;
3710 c_fix_arg = "void (*)(int)";
3711 test_text = "#define SIG_DFL (void(*)())0\n"
3712 "#define SIG_IGN (void (*)())0\n";
3713};
3714
0083c904
BK
3715/*
3716 * Put storage class at start of decl, to avoid warning.
3717 */
3718#ifdef SVR4
3719fix = {
3720 hackname = svr4_storage_class;
3721 files = rpc/types.h;
3722 select = 'const extern';
3723 sed = 's/const extern/extern const/g';
3724};
3725#endif
3726
86765ca0 3727
76d2e2c5
NN
3728/*
3729 * Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local
3730 * function 'getrnge' in <regexp.h> before they declare it. For these
3731 * systems add a 'static int' declaration of 'getrnge' into <regexp.h>
3732 * early on.
3733 *
3734 * 'getrnge' traditionally manipulates a file-scope global called 'size',
3735 * so put the declaration right after the declaration of 'size'.
3736 *
3737 * Don't do this if there is already a `static void getrnge' declaration
3738 * present, since this would cause a redeclaration error. Solaris 2.x has
3739 * such a declaration.
3740 */
3741fix = {
3742 hackname = svr4_undeclared_getrnge;
3743 files = regexp.h;
3744 select = "getrnge";
3745 bypass = "static void getrnge";
3746 c_fix = format;
3747 c_fix_arg = "%0\n"
3748 "static int getrnge ();";
3749 c_fix_arg = "^static int[ \t]+size;";
3750 test_text = "static int size;\n"
3751 "/* stuff which calls getrnge() */\n"
3752 "static getrnge()\n"
3753 "{}";
3754};
3755
3756
7b78a14a 3757/*
86765ca0
RL
3758 * Like svr4_mach_defines, but with newfangled syntax.
3759 * Source lines are of #define __i386 #machine(i386). Delete them.
3760 */
3761#ifdef SVR5
3762fix = {
3763 hackname = svr5_mach_defines;
3764 files = ieeefp.h;
3765 select = "#define[ \t]*__i386.*\(i386\)";
3766 sed = "/#define[ \t]*__i386.*/d";
3767};
3768#endif /* SVR5 */
3769
4c188026 3770
0083c904 3771/*
3be1fb72
ZW
3772 * Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
3773 * in string.h on sysV68
3774 * Correct the return type for strlen in string.h on Lynx.
3775 * Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
3776 * Add missing const for strdup on OSF/1 V3.0.
3777 * On sysV88 layout is slightly different.
0083c904
BK
3778 */
3779fix = {
3780 hackname = sysv68_string;
687262b1 3781 files = testing.h;
0083c904 3782 files = string.h;
793387fa 3783 bypass = "_CLASSIC_ANSI_TYPES";
0083c904
BK
3784
3785 sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
3786 sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
3787 sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
687262b1 3788
0083c904
BK
3789 sed = "/^extern char$/N";
3790 sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
687262b1 3791
f4306baa
EZ
3792 sed = "/^extern int$/N";
3793 sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
3794
0083c904 3795 sed = "/^\tstrncmp(),$/N";
687262b1
BK
3796 sed = 's/^\(' "\t" 'strncmp()\),\n\(' "\t" 'strlen(),\)$/'
3797 '\1;' "\\\nextern unsigned int\\\n\\2/";
3798
687262b1
BK
3799 test_text =
3800 "extern int strlen();\n"
3801
3802 "extern int ffs(long);\n"
3803
3804 "extern char\n"
3805 "\t*memccpy(),\n"
3806 "\tmemcpy();\n"
3807
3808 "extern int\n"
f4306baa 3809 "\tstrcmp(),\n"
687262b1
BK
3810 "\tstrncmp(),\n"
3811 "\tstrlen(),\n"
3812 "\tstrspn();\n"
3813
3814 "extern int\n"
3815 "\tstrlen(), strspn();";
0083c904
BK
3816};
3817
3818
3819/*
cb8d5168 3820 * Fix return type of calloc, malloc, realloc, bsearch and exit
0083c904
BK
3821 */
3822fix = {
3823 hackname = sysz_stdlib_for_sun;
0083c904 3824 files = stdlib.h;
492d5b4f 3825 bypass = "_CLASSIC_ANSI_TYPES";
0083c904 3826
cb8d5168
BK
3827 select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
3828 c_fix = format;
3829 c_fix_arg = "void *\t%1(";
3830
3831 test_text =
3832 "extern char*\tcalloc(size_t);\n"
3833 "extern char*\tmalloc(size_t);\n"
3834 "extern char*\trealloc(void*,size_t);\n"
3835 "extern char*\tbsearch(void*,size_t,size_t);\n";
0083c904
BK
3836};
3837
3838
3d78f2e9
RH
3839/*
3840 * __thread is now a keyword.
3841 */
3842fix = {
021c1f34
BK
3843 hackname = thread_keyword;
3844 files = "pthread.h";
3845 files = "bits/sigthread.h";
5d83269d 3846 select = "([* ])__thread([,)])";
021c1f34 3847 c_fix = format;
5d83269d 3848 c_fix_arg = "%1__thr%2";
3d78f2e9 3849
d5bcfcce
RH
3850 test_text =
3851 "extern int pthread_create (pthread_t *__restrict __thread,\n"
8dc02d7f
RH
3852 "extern int pthread_kill (pthread_t __thread, int __signo);\n"
3853 "extern int pthread_cancel (pthread_t __thread);";
3d78f2e9
RH
3854};
3855
0083c904 3856/*
d7eb5a45
ZW
3857 * if the #if says _cplusplus, not the double underscore __cplusplus
3858 * that it should be
0083c904
BK
3859 */
3860fix = {
3861 hackname = tinfo_cplusplus;
3862 files = tinfo.h;
d7eb5a45 3863 select = "[ \t]_cplusplus";
5d7d28c2
BK
3864
3865 c_fix = format;
3866 c_fix_arg = " __cplusplus";
3867 test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
0083c904
BK
3868};
3869
3870
55105156
BK
3871/*
3872 * function parameter to atexit is missing "void" on VAX Ultrix 4.3.
3873 */
3874fix = {
3875 hackname = ultrix_atexit_param;
3876 files = stdlib.h;
3877 select = 'atexit\(.*\(\)';
3878
3879 c_fix = format;
3880 c_fix_arg = "atexit( void (*__func)( void )";
3881
3882 test_text = "int atexit( void (*__func)() );\n";
3883};
3884
3885
0083c904
BK
3886/*
3887 * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
0083c904
BK
3888 */
3889fix = {
3890 hackname = ultrix_atof_param;
3891 files = math.h;
d7eb5a45 3892 select = "atof\\([ \t]*char";
0083c904 3893
a7fc602f
DA
3894 c_fix = format;
3895 c_fix_arg = "atof(const char";
3896
3897 test_text = "extern double atof( char *__nptr);\n";
0083c904
BK
3898};
3899
3900
3901/*
3902 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
3903 */
3904fix = {
5d7d28c2
BK
3905 hackname = ultrix_const;
3906 files = stdio.h;
3907 select = 'perror\( char \*';
3908
3909 c_fix = format;
3910 c_fix_arg = "%1 const %3 *__";
3911 c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
3912 "[ \t]+(char|void) \\*__";
3913
3914 test_text =
3915 "extern void perror( char *__s );\n"
3916 "extern int fputs( char *__s, FILE *);\n"
3917 "extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
3918 "extern int fscanf( FILE *__stream, char *__format, ...);\n"
3919 "extern int scanf( char *__format, ...);\n";
3920};
3921
3922
3923/*
3924 * parameters not const on DECstation Ultrix V4.0 and OSF/1.
3925 */
3926fix = {
3927 hackname = ultrix_const2;
3928 files = stdio.h;
3929
3930 select = '\*fopen\( char \*';
3931 c_fix = format;
3932 c_fix_arg = "%1( const char *%3, const char *";
3933 c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
3934 "[ \t]*char[ \t]*\\*([^,]*),"
3935 "[ \t]*char[ \t]*\\*[ \t]*";
0083c904 3936
5d7d28c2
BK
3937 test_text =
3938 "extern FILE *fopen( char *__filename, char *__type );\n"
3939 "extern int sscanf( char *__s, char *__format, ...);\n"
3940 "extern FILE *popen(char *, char *);\n"
3941 "extern char *tempnam(char*,char*);\n";
0083c904
BK
3942};
3943
3944
4b60eb3b
JDA
3945/*
3946 * parameters not const on Ultrix V4.3.
3947 */
3948fix = {
3949 hackname = ultrix_const3;
3950 files = stdio.h;
3951 select = 'fdopen\( .*, char \*';
3952
3953 c_fix = format;
3954 c_fix_arg = "%1 const %3 *__";
3955 c_fix_arg = "([ \t*](fdopen)\\(.*)"
3956 "[ \t]+(char|void) \\*__";
3957
3958 test_text =
3959 "extern FILE * fdopen( int __filedes, char *__type );\n";
3960};
3961
3962
0083c904 3963/*
79589c4d
BK
3964 * Ultrix V4.[35] puts the declaration of uname before the definition
3965 * of struct utsname, so the prototype (added by fixproto) causes havoc.
0083c904
BK
3966 */
3967fix = {
79589c4d
BK
3968 hackname = ultrix_fix_fixproto;
3969 files = sys/utsname.h;
3970 select = ULTRIX;
a7fc602f
DA
3971
3972 c_fix = format;
3973 c_fix_arg = "struct utsname;\n%0";
5b39f702 3974 c_fix_arg = "^[ \t]*extern[ \t]*int[ \t]*uname\\(\\);";
5d7d28c2
BK
3975
3976 test_text =
3977 "/* ULTRIX's uname */\nextern\tint\tuname();";
0083c904
BK
3978};
3979
3980
3981/*
79589c4d 3982 * Check for bad #ifdef line (in Ultrix 4.1)
0083c904
BK
3983 */
3984fix = {
79589c4d 3985 hackname = ultrix_ifdef;
a7fc602f 3986 select = "^#ifdef KERNEL[ \t]+&&";
79589c4d 3987 files = sys/file.h;
a7fc602f
DA
3988
3989 c_fix = format;
3990 c_fix_arg = "#if defined(KERNEL) &&";
5d7d28c2
BK
3991
3992 test_text =
3993 "#ifdef KERNEL\t&& defined( mumbojumbo )\nint oops;\n#endif";
0083c904
BK
3994};
3995
3996
4b60eb3b
JDA
3997/*
3998 * Add once-only latch to Ultrix V4.3 locale.h.
3999 */
4000fix = {
4001 hackname = ultrix_locale;
4002 files = locale.h;
4003 select = "@\\(#\\)locale\\.h.*6\\.1.*\\(ULTRIX\\)";
4004 c_fix = wrap;
4005 test_text =
4006 "@(#)locale.h 6.1 (ULTRIX)\n";
4007};
4008
4009
a7fc602f
DA
4010/*
4011 * Strip "|| CC$gfloat" from Ultrix math headers.
4012 */
4013fix = {
c1fd153e
BK
4014 hackname = ultrix_math_ifdef;
4015 files = sys/limits.h;
4016 files = float.h;
4017 files = math.h;
4018 select = "^(#if.*)\\|\\|[ \t]+CC\\$[a-z]+";
4019 c_fix = format;
4020 c_fix_arg = "%1";
4021
a7fc602f
DA
4022 test_text = '#if defined(__GFLOAT) || CC\$gfloat';
4023};
4024
4025
4026/*
4027 * Avoid nested comments on Ultrix 4.3.
4028 */
4029fix = {
4030 hackname = ultrix_nested_ioctl;
4031 files = sys/ioctl.h;
4032 select = "^/\\* #define SIOCSCREEN";
4033 sed = "/^\\/\\* #define SIOCSCREEN/s@/\\* screend@*//* screend@";
4034 test_text =
4035 "/* #define SIOCSCREENON _IOWR('i', 49, int)"
4036 "/* screend, net/gw_screen.h */\n";
4037};
4038
4039
4040fix = {
4041 hackname = ultrix_nested_svc;
4042 files = rpc/svc.h;
4043 select = "^ \\*[ \t]*int protocol; */\\*";
4044 sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
4045 test_text =
4046 " *\tint protocol; /* like TCP or UDP\n";
4047};
4048
4049
4050/*
4051 * Add missing prototype for lstat and define for S_ISLNK
4052 * in Ultrix V4.3 sys/stat.h.
4053 */
4054fix = {
4055 hackname = ultrix_stat;
4056 files = sys/stat.h;
4057 select = "@\\(#\\)stat\\.h.*6\\.1.*\\(ULTRIX\\)";
4058 sed = "/^#define[ \t]S_IFPORT[ \t]*S_IFIFO$/a\\\n"
4059 "\\\n"
4060 "/* macro to test for symbolic link */\\\n"
4061 "#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)\\\n"
4062 "\n";
4063 sed = "/^[ \t]*fstat(),$/a\\\n"
4064 "\tlstat(),\n";
4065 test_text =
4066 "@(#)stat.h 6.1 (ULTRIX)\n"
4067 "#define S_IFPORT S_IFIFO\n"
34fcb7c8 4068 "\tfstat(),\n/* THE INSERTION LINE FAILS ON BSD SYSTEMS */";
a7fc602f
DA
4069};
4070
4071
0083c904
BK
4072/*
4073 * Check for superfluous `static' (in Ultrix 4.2)
4074 * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
4075 */
4076fix = {
4077 hackname = ultrix_static;
4078 files = machine/cpu.h;
4079 select = '#include "r[34]_cpu';
4080 sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
4081 sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
4082 sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
a7fc602f
DA
4083 test_text =
4084 "static struct tlb_pid_state {\n"
4085 "#include \"r3_cpu.h\"\n";
4086};
4087
4088
4b60eb3b
JDA
4089/*
4090 * Add missing declarations to Ultrix V4.3 stdlib.h.
4091 */
4092fix = {
4093 hackname = ultrix_stdlib;
4094 files = stdlib.h;
4095 select = "@\\(#\\)stdlib\\.h.*6\\.1.*\\(ULTRIX\\)";
4096
4097 sed = "/^char.*getenv( const char .* );.*$/a\\\n"
4098 "int\t\tsetenv( const char *__name, const char *__val, int __ovrwrt );\\\n"
4099 "void\t\tunsetenv( const char *__name );\\\n"
4100 "int\t\tputenv( char *__s );\n";
4101
4102 sed = "/^char.*getenv();.*$/a\\\n"
4103 "int\tsetenv();\\\n"
4104 "void\tunsetenv();\\\n"
4105 "int\tputenv();\n";
4106
4107 test_text =
4108 "@(#)stdlib.h 6.1 (ULTRIX)\n"
4109 "char * getenv( const char *__name );\n"
4110 "char *getenv();\n";
4111};
4112
4113
a7fc602f
DA
4114/*
4115 * Add once-only latch to Ultrix V4.3 strings.h.
4116 */
4117fix = {
4118 hackname = ultrix_strings;
4119 files = strings.h;
4120 select = "@\\(#\\)strings\\.h.*6\\.1.*\\(ULTRIX\\)";
4121 c_fix = wrap;
4122 test_text =
4123 "@(#)strings.h 6.1 (ULTRIX)\n";
0083c904
BK
4124};
4125
4126
4b60eb3b
JDA
4127/*
4128 * Add missing declarations to Ultrix V4.3 strings.h.
4129 */
4130fix = {
4131 hackname = ultrix_strings2;
4132 files = strings.h;
4133 select = "@\\(#\\)strings\\.h.*6\\.1.*\\(ULTRIX\\)";
4134
4135 sed = "/^.*strncmp( const .* );.*/a\\\n"
4136 "\\\n"
4137 "extern int\\\n"
4138 "\tstrcasecmp( const char *__s1, const char *__s2),\\\n"
4139 "\tstrncasecmp( const char *__s1, const char *__s2, size_t __n );\n";
4140
4141 sed = "/^.*strncmp();.*/a\\\n"
4142 "extern int\\\n"
4143 "\tstrcasecmp(),\\\n"
4144 "\tstrncasecmp();\n";
4145
4146 test_text =
4147 "@(#)strings.h 6.1 (ULTRIX)\n"
4148 "\tstrncmp( const char *__s1, const char *__s2, size_t __n );\n"
4149 "\tstrncmp();\n";
4150};
4151
4152
4153/*
4154 * Add missing declarations to Ultrix V4.3 sys/time.h.
4155 */
4156fix = {
4157 hackname = ultrix_sys_time;
4158 files = sys/time.h;
4159 select = "@\\(#\\)time\\.h.*6\\.1.*\\(ULTRIX\\)";
4160
4161 sed = "/^extern.*time_t.*time( time_t .* );.*$/a\\\n"
4162 "\\\n"
4163 "extern int adjtime(struct timeval *, struct timeval *);\\\n"
4164 "extern int getitimer(int, struct itimerval *);\\\n"
4165 "extern int setitimer(int, struct itimerval *, struct itimerval *);\\\n"
4166 "extern int gettimeofday(struct timeval *, struct timezone *);\\\n"
4167 "extern int settimeofday(struct timeval *, struct timezone *);\\\n"
4168 "extern void profil(const void *, size_t, size_t, unsigned int);\\\n"
4169 "extern int stime(const time_t *);\\\n"
4170 "extern int utimes(const char *, const struct timeval[2]);\\\n"
4171 "extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);\n";
4172
4173 sed = "/^extern.*double.*difftime();.*$/a\\\n"
4174 "extern\tint adjtime();\\\n"
4175 "extern\tint getitimer();\\\n"
4176 "extern\tint setitimer();\\\n"
4177 "extern\tint gettimeofday();\\\n"
4178 "extern\tint settimeofday();\\\n"
4179 "extern\tvoid profil();\\\n"
4180 "extern\tint stime();\\\n"
4181 "extern\tint utimes();\\\n"
4182 "extern\tint select();\n";
4183
4184 test_text =
4185 "@(#)time.h 6.1 (ULTRIX)\n"
4186 "extern time_t time( time_t *__tloc );\n"
4187 "extern double difftime();\n";
4188};
4189
4190
4191/*
4192 * Add missing declarations to Ultrix V4.3 unistd.h.
4193 */
4194fix = {
4195 hackname = ultrix_unistd;
4196 files = unistd.h;
4197 select = "@\\(#\\)unistd\\.h.*6\\.1.*\\(ULTRIX\\)";
4198
4199 sed = "/^[ \t]*getgroups(),.*$/a\\\n"
4200 "\tgetpagesize(),\n";
4201
4202 sed = "/^[ \t]*fork(),.*$/a\\\n"
4203 "\tvfork(),\n";
4204
4205 test_text =
4206 "@(#)unistd.h 6.1 (ULTRIX)\n"
4207 "\tgetgroups(),\n"
4208 "\tfork(),\n";
4209};
4210
4211
30102605
RH
4212/*
4213 * On Cray Unicos/Mk some standard headers use the C99 keyword "restrict"
4214 * which must be replaced by __restrict__ for GCC.
4215 */
4216fix = {
4217 hackname = unicosmk_restrict;
4218 files = stdio.h;
4219 files = stdlib.h;
4220 files = wchar.h;
4221 mach = "*-*-unicosmk*";
4222 select = "(\\*[ \t]*)restrict([ \t]+)";
4223
4224 c_fix = format;
4225 c_fix_arg = "%1__restrict__%2";
4226
4227 test_text = "void f (char * restrict x);";
4228};
0083c904 4229
86765ca0
RL
4230/*
4231 * If arpa/inet.h prototypes are incompatible with the ones we just
4232 * installed in <sys/byteorder.h>, just remove the protos.
4233 * Because of this close association, this patch must be applied only
4234 * on those systems where the replacement byteorder header is installed.
4235 */
4236fix = {
687262b1 4237 hackname = uw7_byteorder_fix;
86765ca0
RL
4238 files = arpa/inet.h;
4239 select = "in_port_t";
eb559363 4240 test = "-f sys/byteorder.h";
86765ca0
RL
4241#ifndef SVR5
4242 mach = "*-*-sysv4*";
22e50c5b
BK
4243 mach = "i?86-*-sysv5*";
4244 mach = "i?86-*-udk*";
4245 mach = "i?86-*-solaris2.[0-4]";
86765ca0
RL
4246 mach = "powerpcle-*-solaris2.[0-4]";
4247 mach = "sparc-*-solaris2.[0-4]";
4248#endif /* SVR5 */
687262b1
BK
4249
4250 c_fix = format;
4251 c_fix_arg = "";
eb559363 4252 c_fix_arg = "^extern.*[ \t](htons|ntohs).*\\(in_port_t\\).*;";
687262b1 4253
eb559363
BK
4254 test_text = "extern in_port_t\thtons __P((in_port_t));\n"
4255 "extern in_port_t\tntohs __P((in_port_t));"
687262b1 4256 "`[ ! -d $DESTDIR/sys ] && mkdir $DESTDIR/sys\n"
eb559363 4257 "echo '/* DUMMY */' >> sys/byteorder.h`";
86765ca0
RL
4258};
4259
4260
0083c904
BK
4261/*
4262 * Fix definitions of macros used by va-i960.h in VxWorks header file.
4263 */
4264fix = {
5d7d28c2
BK
4265 hackname = va_i960_macro;
4266 files = arch/i960/archI960.h;
4267 select = "__(vsiz|vali|vpad|alignof__)";
4268
4269 c_fix = format;
4270 c_fix_arg = "__vx%1";
4271
4272 test_text =
4273 "extern int __vsiz vsiz;\n"
4274 "extern int __vali vali;\n"
4275 "extern int __vpad vpad;\n"
4276 "#define __alignof__(x) ...";
0083c904
BK
4277};
4278
4279
4280/*
bf66f7b0 4281 * AIX and Interix headers define NULL to be cast to a void pointer,
0083c904
BK
4282 * which is illegal in ANSI C++.
4283 */
4284fix = {
5d7d28c2
BK
4285 hackname = void_null;
4286 files = curses.h;
4287 files = dbm.h;
4288 files = locale.h;
4289 files = stdio.h;
4290 files = stdlib.h;
4291 files = string.h;
4292 files = time.h;
4293 files = unistd.h;
4294 files = sys/dir.h;
4295 files = sys/param.h;
4296 files = sys/types.h;
31eec874
MS
4297 /* avoid changing C++ friendly NULL */
4298 bypass = __cplusplus;
5d7d28c2
BK
4299 select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
4300 c_fix = format;
4301 c_fix_arg = "#define NULL 0";
4302 test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
0083c904
BK
4303};
4304
4305
4306/*
4307 * Make VxWorks header which is almost gcc ready fully gcc ready.
4308 */
4309fix = {
4310 hackname = vxworks_gcc_problem;
4311 files = types/vxTypesBase.h;
4312 select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
4313
4314 sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
4315 "#if 1/";
4316
4317 sed = "/[ \t]size_t/i\\\n"
4318 "#ifndef _GCC_SIZE_T\\\n"
4319 "#define _GCC_SIZE_T\n";
4320
4321 sed = "/[ \t]size_t/a\\\n"
4322 "#endif\n";
4323
4324 sed = "/[ \t]ptrdiff_t/i\\\n"
4325 "#ifndef _GCC_PTRDIFF_T\\\n"
4326 "#define _GCC_PTRDIFF_T\n";
4327
4328 sed = "/[ \t]ptrdiff_t/a\\\n"
4329 "#endif\n";
4330
4331 sed = "/[ \t]wchar_t/i\\\n"
4332 "#ifndef _GCC_WCHAR_T\\\n"
4333 "#define _GCC_WCHAR_T\n";
4334
4335 sed = "/[ \t]wchar_t/a\\\n"
4336 "#endif\n";
5d7d28c2
BK
4337
4338 test_text =
4339 "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
4340 "typedef unsigned int size_t;\n"
4341 "typedef long ptrdiff_t;\n"
4342 "typedef unsigned short wchar_t;\n"
4343 "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
0083c904
BK
4344};
4345
4346
4347/*
4348 * Fix VxWorks <time.h> to not require including <vxTypes.h>.
4349 */
4350fix = {
5d7d28c2
BK
4351 hackname = vxworks_needs_vxtypes;
4352 files = time.h;
4353 select = "uint_t([ \t]+_clocks_per_sec)";
4354 c_fix = format;
4355 c_fix_arg = "unsigned int%1";
7a544ce1 4356 test_text = "uint_t\t_clocks_per_sec;";
0083c904
BK
4357};
4358
4359
4360/*
4361 * Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
4362 */
4363fix = {
4364 hackname = vxworks_needs_vxworks;
4365 files = sys/stat.h;
8f34d1e9
BK
4366 test = " -r types/vxTypesOld.h";
4367 test = " -n \"`egrep '#include' $file`\"";
4368 test = " -n \"`egrep ULONG $file`\"";
5d7d28c2 4369 select = "#[ \t]define[ \t]+__INCstath";
0083c904
BK
4370
4371 sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
4372 "#include <types/vxTypesOld.h>\n";
5d7d28c2
BK
4373
4374 test_text = "`touch types/vxTypesOld.h`"
4375 "#include </dev/null> /* ULONG */\n"
4376 "# define\t__INCstath <sys/stat.h>";
0083c904
BK
4377};
4378
4379
4380/*
4381 * Another bad dependency in VxWorks 5.2 <time.h>.
4382 */
4383fix = {
4384 hackname = vxworks_time;
4385 files = time.h;
8f34d1e9 4386 test = " -r vxWorks.h";
0083c904 4387
5d7d28c2
BK
4388 select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
4389 c_fix = format;
4390
4391 c_fix_arg =
4392 "#ifndef __gcc_VOIDFUNCPTR_defined\n"
4393 "#ifdef __cplusplus\n"
4394 "typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
4395 "#else\n"
4396 "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
4397 "#endif\n"
4398 "#define __gcc_VOIDFUNCPTR_defined\n"
4399 "#endif\n"
4400 "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
4401
4402 test_text = "`touch vxWorks.h`"
4403 "#define VOIDFUNCPTR (void(*)())";
0083c904
BK
4404};
4405
4406
cace4f93
MM
4407/*
4408 * WindISS math.h headers include bogus extern declarations of
4409 * numerous math functions that conflict with libstdc++-v3.
4410 */
4411fix = {
4412 hackname = windiss_math1;
4413 files = math.h;
4414 mach = "*-*-windiss";
4415 sed = "s|inline long double cosl.*|#ifndef __GNUC__|";
4416
4417 test_text = "inline long double cosl(long double);";
4418};
4419
4420fix = {
4421 hackname = windiss_math2;
4422 files = math.h;
4423 mach = "*-*-windiss";
4424 sed = "s|/\\* long double declarations \\*/|"
4425 "#endif /* __GNUC__ */|";
4426
4427 test_text = "/* long double declarations */";
4428};
4429
4430/*
4431 * WindISS headers include "diab/va_list.h" instead of "stdarg.h"
4432 */
4433fix = {
c297b764 4434 select = '(#include.*)diab/va_list.h';
cace4f93
MM
4435 hackname = windiss_valist;
4436 sed = "s|diab/va_list.h|stdarg.h|";
4437 mach = "*-*-windiss";
4438
4439 test_text = "#include <diab/va_list.h>";
4440};
4441
0083c904
BK
4442/*
4443 * There are several name conflicts with C++ reserved words in X11 header
4444 * files. These are fixed in some versions, so don't do the fixes if
4445 * we find __cplusplus in the file. These were found on the RS/6000.
4446 */
4447fix = {
c1fd153e
BK
4448 hackname = x11_class;
4449 files = X11/ShellP.h;
4450 bypass = __cplusplus;
4451 select = "^([ \t]*char \\*)class;(.*)";
4452 c_fix = format;
4453 c_fix_arg = "#ifdef __cplusplus\n%1c_class;%2\n"
4454 "#else\n%1class;%2\n#endif";
7a544ce1
BK
4455 test_text =
4456 "struct {\n"
4457 " char *class;\n"
4458 "} mumble;\n";
0083c904
BK
4459};
4460
4461
4462/*
4463 * class in Xm/BaseClassI.h
4464 */
4465fix = {
4466 hackname = x11_class_usage;
4467 files = Xm/BaseClassI.h;
4468 bypass = "__cplusplus";
5d7d28c2
BK
4469
4470 select = " class\\)";
4471 c_fix = format;
4472 c_fix_arg = " c_class)";
4473
7a544ce1 4474 test_text = "extern mumble (int class);\n";
0083c904
BK
4475};
4476
4477
4478/*
4479 * new in Xm/Traversal.h
4480 */
4481fix = {
4482 hackname = x11_new;
4483 files = Xm/Traversal.h;
4484 bypass = __cplusplus;
4485
4486 sed = "/Widget\told, new;/i\\\n"
4487 "#ifdef __cplusplus\\\n"
4488 "\tWidget\told, c_new;\\\n"
4489 "#else\n";
4490
4491 sed = "/Widget\told, new;/a\\\n"
4492 "#endif\n";
4493
4494 sed = "s/Widget new,/Widget c_new,/g";
7a544ce1
BK
4495 test_text =
4496 "struct wedge {\n"
34fcb7c8 4497 " Widget\told, new; /* fixinc check FAILS ON BSD */\n"
7a544ce1 4498 "};\nextern Wedged( Widget new, Widget old );";
0083c904
BK
4499};
4500
4501
4502/*
4503 * Incorrect sprintf declaration in X11/Xmu.h
4504 */
4505fix = {
4506 hackname = x11_sprintf;
b51207a4
ZW
4507 files = X11/Xmu.h;
4508 files = X11/Xmu/Xmu.h;
5d7d28c2
BK
4509 select = "^extern char \\*\tsprintf\\(\\);$";
4510
4511 c_fix = format;
4512 c_fix_arg = "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
b51207a4 4513
7a544ce1 4514 test_text = "extern char *\tsprintf();";
0083c904
BK
4515};
4516
0083c904 4517/*EOF*/