OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [fixincludes/] [inclhack.def] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* -*- Mode: C -*-  */
2
 
3
autogen definitions fixincl;
4
 
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.
7
 
8
   This is the sort command:
9
 
10
   blocksort output=inclhack.sorted \
11
          pattern='^/\*$' \
12
          trailer='^/\*EOF\*[/]' \
13
          input=inclhack.def \
14
          key='hackname[        ]*=[    ]*(.*);'
15
 
16
   Set up a debug test so we can make the templates emit special
17
   code while debugging these fixes:  */
18
 
19
#ifdef DEBUG
20
FIXINC_DEBUG = yes;
21
#endif
22
 
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
 */
27
fix = {
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 
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
 */
116
fix = {
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
 
130
/*
131
 *  This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
132
 */
133
fix = {
134
    hackname = AAB_fd_zero_asm_posix_types_h;
135
    files    = asm/posix_types.h;
136
    mach     = 'i[34567]86-*-linux*';
137
    bypass   = '} while';
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 .
144
     */
145
    replace  = <<-  _EndOfHeader_
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 
150
         #include_next 
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 */
166
        _EndOfHeader_;
167
};
168
 
169
 
170
/*
171
 *  This fixes __FD_ZERO bug for glibc-1.x
172
 */
173
fix = {
174
    hackname = AAB_fd_zero_gnu_types_h;
175
    files    = gnu/types.h;
176
    mach     = 'i[34567]86-*-linux*';
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 .
183
     */
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 
188
        #include_next 
189
 
190
        #if defined(__FD_ZERO) && !defined(__GLIBC__)
191
        #undef __FD_ZERO
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"); \
199
          } while (0)
200
        #endif
201
 
202
        #define _TYPES_H_WRAPPER
203
        #endif /* _TYPES_H_WRAPPER */
204
        _EndOfHeader_;
205
};
206
 
207
 
208
/*
209
 *  This fixes __FD_ZERO bug for glibc-2.0.x
210
 */
211
fix = {
212
    hackname = AAB_fd_zero_selectbits_h;
213
    files    = selectbits.h;
214
    mach     = 'i[34567]86-*-linux*';
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 .
221
     */
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 
226
          #include_next 
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" \\
236
                        : "=&c" (__d0), "=&D" (__d1) \\
237
                        : "a" (0), "0" (sizeof (__fd_set) \\
238
                                        / sizeof (__fd_mask)), \\
239
                          "1" ((__fd_mask *) (fdsetp)) \\
240
                        : "memory"); \\
241
              } while (0)
242
          #endif
243
 
244
          #define _SELECTBITS_H_WRAPPER
245
        #endif /* _SELECTBITS_H_WRAPPER */
246
        _EndOfHeader_;
247
};
248
 
249
 
250
/*
251
 * Solaris  is a DDK (aka kernel-land) header providing
252
 * the same interface as .  No idea why they couldn't have just
253
 * used the standard header.
254
 */
255
fix = {
256
    hackname = AAB_solaris_sys_varargs_h;
257
    files    = "sys/varargs.h";
258
    mach     = '*-*-solaris*';
259
    replace  = <<-  _EndOfHeader_
260
        #ifdef __STDC__
261
          #include 
262
        #else
263
          #include 
264
        #endif
265
        _EndOfHeader_;
266
};
267
 
268
 
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
 */
276
fix = {
277
    hackname = AAB_sun_memcpy;
278
    files    = memory.h;
279
    select   = "/\\*\t@\\(#\\)"
280
             "(head/memory.h\t50.1\t "
281
             "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/";
282
 
283
    replace = <<-  _EndOfHeader_
284
        /* This file was generated by fixincludes */
285
        #ifndef __memory_h__
286
          #define __memory_h__
287
 
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__ */
299
 
300
          extern int memcmp();
301
 
302
        #endif /* __memory_h__ */
303
        _EndOfHeader;
304
};
305
 
306
 
307
/*
308
 *  Completely replace  with a file that includes gcc's
309
 *  stdarg.h or varargs.h files as appropriate.
310
 */
311
#ifdef SVR4
312
fix = {
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"
318
 
319
               "#ifdef __STDC__\n"
320
               "#include \n"
321
               "#else\n"
322
               "#include \n"
323
               "#endif\n\n"
324
 
325
               "#endif  /* _SYS_VARARGS_H */\n";
326
};
327
#endif
328
 
329
 
330
/*
331
 *  Completely replace  with a file that implements gcc's
332
 *  optimized byteswapping.  (The original probably implemented some
333
 *  incompatible optimized byteswapping.)
334
 */
335
fix = {
336
    hackname = AAB_svr4_replace_byteorder;
337
    mach     = "*-*-sysv4*";
338
    mach     = "i[34567]86-*-sysv5*";
339
    mach     = "i[34567]86-*-sco3.2v5*";
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]";
344
    mach     = "i[34567]86-sequent-ptx*";
345
    files    = sys/byteorder.h;
346
    replace  = <<-  _EndOfHeader_
347
        #ifndef _SYS_BYTEORDER_H
348
        #define _SYS_BYTEORDER_H
349
 
350
        /* Functions to convert `short' and `long' quantities from host byte order
351
           to (internet) network byte order (i.e. big-endian).
352
 
353
           Written by Ron Guilmette (rfg@ncd.com).
354
 
355
           This isn't actually used by GCC.  It is installed by fixinc.svr4.
356
 
357
           For big-endian machines these functions are essentially no-ops.
358
 
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).  */
361
 
362
        #if !defined (__GNUC__) && !defined (__GNUG__)
363
          #error You lose!  This file is only useful with GNU compilers.
364
        #endif
365
 
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
373
 
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__) */
380
 
381
        #if defined (__i386__)
382
 
383
          #ifndef __BYTE_ORDER__
384
            #define __BYTE_ORDER__ __LITTLE_ENDIAN__
385
          #endif
386
 
387
          /* Convert a host long to a network long.  */
388
 
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;
395
 
396
            __asm__ ("xchg%B0 %b0,%h0
397
                  ror%L0 $16,%0
398
                  xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
399
            return __result;
400
          }
401
 
402
          /* Convert a host short to a network short.  */
403
 
404
          static __inline__ unsigned short
405
          htons (unsigned int __arg)
406
          {
407
            register unsigned short __result;
408
 
409
            __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
410
            return __result;
411
          }
412
 
413
        #elif (defined (__ns32k__) || defined (__vax__) || defined (__arm__))
414
 
415
          #ifndef __BYTE_ORDER__
416
            #define __BYTE_ORDER__ __LITTLE_ENDIAN__
417
          #endif
418
 
419
          /* For other little-endian machines, using C code is just as efficient as
420
             using assembly code.  */
421
 
422
          /* Convert a host long to a network long.  */
423
 
424
          static __inline__ unsigned long
425
          htonl (unsigned long __arg)
426
          {
427
            register unsigned long __result;
428
 
429
            __result = (__arg >> 24) & 0x000000ff;
430
            __result |= (__arg >> 8) & 0x0000ff00;
431
            __result |= (__arg << 8) & 0x00ff0000;
432
            __result |= (__arg << 24) & 0xff000000;
433
            return __result;
434
          }
435
 
436
          /* Convert a host short to a network short.  */
437
 
438
          static __inline__ unsigned short
439
          htons (unsigned int __arg)
440
          {
441
            register unsigned short __result;
442
 
443
            __result = (__arg << 8) & 0xff00;
444
            __result |= (__arg >> 8) & 0x00ff;
445
            return __result;
446
          }
447
 
448
        #else /* must be a big-endian machine */
449
 
450
          #ifndef __BYTE_ORDER__
451
            #define __BYTE_ORDER__ __BIG_ENDIAN__
452
          #endif
453
 
454
          /* Convert a host long to a network long.  */
455
 
456
          static __inline__ unsigned long
457
          htonl (unsigned long __arg)
458
          {
459
            return __arg;
460
          }
461
 
462
          /* Convert a host short to a network short.  */
463
 
464
          static __inline__ unsigned short
465
          htons (unsigned int __arg)
466
          {
467
            return __arg;
468
          }
469
 
470
        #endif /* big-endian */
471
 
472
        /* Convert a network long to a host long.  */
473
 
474
        static __inline__ unsigned long
475
        ntohl (unsigned long __arg)
476
        {
477
          return htonl (__arg);
478
        }
479
 
480
        /* Convert a network short to a host short.  */
481
 
482
        static __inline__ unsigned short
483
        ntohs (unsigned int __arg)
484
        {
485
          return htons (__arg);
486
        }
487
        #endif
488
        _EndOfHeader_;
489
};
490
 
491
 
492
/*
493
 *  Cancel out ansi_compat.h on Ultrix.  Replace it with an empty file.
494
 */
495
fix = {
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
 
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
 */
507
fix = {
508
    hackname = AAB_ultrix_limits;
509
    files    = limits.h;
510
    mach     = "*-*-ultrix4.3";
511
    replace  = <<-  _EndOfHeader_
512
        #ifndef _LIMITS_INCLUDED
513
          #define _LIMITS_INCLUDED
514
          #include 
515
        #endif /* _LIMITS_INCLUDED */
516
        _EndOfHeader_;
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
 */
525
fix = {
526
    hackname = AAB_ultrix_memory;
527
    files    = memory.h;
528
    mach     = "*-*-ultrix4.3";
529
    replace  = <<-  _EndOfHeader_
530
        #ifndef _MEMORY_INCLUDED
531
          #define _MEMORY_INCLUDED
532
          #include 
533
        #endif /* _MEMORY_INCLUDED */
534
        _EndOfHeader_;
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
 */
543
fix = {
544
    hackname = AAB_ultrix_string;
545
    files    = string.h;
546
    mach     = "*-*-ultrix4.3";
547
    replace  = <<-  _EndOfHeader_
548
        #ifndef _STRING_INCLUDED
549
          #define _STRING_INCLUDED
550
          #include 
551
        #endif /* _STRING_INCLUDED */
552
        _EndOfHeader_;
553
};
554
 
555
 
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
 */
560
fix = {
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";
566
    test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
567
                "{...init stuff...}";
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
 */
575
fix = {
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
 
586
/*
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.
589
 */
590
fix = {
591
    hackname  = aix_syswait;
592
    files     = sys/wait.h;
593
    select    = "^extern pid_t wait3\\(\\);\n";
594
    select    = "bos325,";
595
    c_fix     = format;
596
    c_fix_arg = "struct rusage;\n%0";
597
    test_text = "/* bos325, */\n"
598
    "extern pid_t wait3();\n"
599
    "\t/* pid_t wait3(int *, int, struct rusage *); */";
600
};
601
 
602
 
603
/*
604
 *  sys/wait.h on AIX 5.2 defines macros that have both signed and
605
 *  unsigned types in conditional expressions.
606
 */
607
fix = {
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
 
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
 */
623
fix = {
624
    hackname  = aix_volatile;
625
    files     = sys/signal.h;
626
    select    = "typedef volatile int sig_atomic_t";
627
    c_fix     = format;
628
    c_fix_arg = "typedef int sig_atomic_t";
629
    test_text = "typedef volatile int sig_atomic_t;";
630
};
631
 
632
 
633
/*
634
 *  Fix __assert declaration in assert.h on Alpha OSF/1.
635
 */
636
fix = {
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
 
646
/*
647
 *  Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 headers.
648
 */
649
fix = {
650
    hackname  = alpha___extern_prefix;
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 .
668
 */
669
fix = {
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  and
684
 *  .  The tests for __DECC are special in various ways, so
685
 *  alpha__extern_prefix cannot be used.
686
 */
687
fix = {
688
    hackname  = alpha___extern_prefix_sys_stat;
689
    files     = sys/stat.h;
690
    files     = sys/mount.h;
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
 
701
/*
702
 *  Fix assert macro in assert.h on Alpha OSF/1.
703
 *  The superfluous int cast breaks C++.
704
 */
705
fix = {
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
 
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
 */
730
fix = {
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
 
746
/*
747
 *  Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
748
 */
749
fix = {
750
    hackname  = alpha_getopt;
751
    files     = "stdio.h";
752
    files     = "stdlib.h";
753
    select    = 'getopt\(int, char \*\[\], *char \*\)';
754
    c_fix     = format;
755
    c_fix_arg = "getopt(int, char *const[], const char *)";
756
    test_text = 'extern int getopt(int, char *[], char *);';
757
};
758
 
759
 
760
/*
761
 * Remove erroneous parentheses in sym.h on Alpha OSF/1.
762
 */
763
fix = {
764
    hackname  = alpha_parens;
765
    files     = sym.h;
766
    select    = '#ifndef\(__mips64\)';
767
    c_fix     = format;
768
    c_fix_arg = "#ifndef __mips64";
769
    test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
770
};
771
 
772
 
773
/*
774
 *  Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX .
775
 */
776
fix = {
777
    hackname  = alpha_pthread;
778
    files     = pthread.h;
779
    select    = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)|def _PTHREAD_ENV_DECC)(.*))\n"
780
                "(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
781
 
782
    mach      = "alpha*-dec-osf*";
783
    c_fix     = format;
784
    c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 || defined (__PRAGMA_EXTERN_PREFIX)\n%5";
785
 
786
    test_text = "#  if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC)\n"
787
                "#   define _PTHREAD_USE_PTDNAM_\n"
788
                "#  endif\n"
789
                "#  ifdef _PTHREAD_ENV_DECC\n"
790
                "#   define _PTHREAD_USE_PTDNAM_\n"
791
                "#  endif";
792
};
793
 
794
 
795
/*
796
 *  Recognize GCC in Tru64 UNIX V5.1B .
797
 */
798
fix = {
799
    hackname  = alpha_pthread_gcc;
800
    files     = pthread.h;
801
    select    = "#else\n# error : 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 : unrecognized compiler.\n"
812
                "#endif";
813
};
814
 
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
 */
821
fix = {
822
    hackname  = alpha_pthread_init;
823
    files     = pthread.h;
824
    select    = ' \* @\(#\).RCSfile: pthread\.h,v \$'
825
                ' .Revision: 1\.1\.33\.21 \$ \(DEC\)'
826
                ' .Date: 2000/08/15 15:30:13 \$';
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"
835
                " * @(#)_RCSfile: pthread.h,v \\$ "
836
                "_Revision: 1.1.33.21 \\$ (DEC) "
837
                "_Date: 2000/08/15 15:30:13 \\$\n"
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
};
859
 
860
/*
861
 *  Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
862
 *  And OpenBSD.
863
 */
864
fix = {
865
    hackname = alpha_sbrk;
866
    files    = unistd.h;
867
    select   = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\(";
868
    c_fix     = format;
869
    c_fix_arg = "void *sbrk(";
870
    test_text = "extern char* sbrk(ptrdiff_t increment);";
871
};
872
 
873
 
874
/*
875
 *  Change external names of wcstok/wcsftime via asm instead of macros on
876
 *  Tru64 UNIX V4.0.
877
 */
878
fix = {
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
 
891
/*
892
 *  For C++, avoid any typedef or macro definition of bool,
893
 *  and use the built in type instead.
894
 *  HP/UX 10.20 also has it in curses_colr/curses.h.
895
 */
896
fix = {
897
    hackname  = avoid_bool_define;
898
    files     = curses.h;
899
    files     = curses_colr/curses.h;
900
    files     = term.h;
901
    files     = tinfo.h;
902
 
903
    select    = "#[ \t]*define[ \t]+bool[ \t]";
904
    bypass    = "__cplusplus";
905
 
906
    c_fix     = format;
907
    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
908
    c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*";
909
 
910
    test_text = "# define bool\t char \n";
911
};
912
 
913
 
914
fix = {
915
    hackname = avoid_bool_type;
916
    files    = curses.h;
917
    files    = curses_colr/curses.h;
918
    files    = term.h;
919
    files    = tinfo.h;
920
 
921
    select    = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
922
    bypass    = "__cplusplus";
923
 
924
    c_fix     = format;
925
    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
926
 
927
    test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
928
};
929
 
930
 
931
/*
932
 *  For C++, avoid any typedef definition of wchar_t,
933
 *  and use the built in type instead.
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  which is never used from C++ anyway,
937
 *  and will be broken by the edit.
938
 */
939
 
940
fix = {
941
    hackname = avoid_wchar_t_type;
942
 
943
    select    = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
944
    bypass    = "__cplusplus";
945
    bypass    = "_LINUX_NLS_H";
946
    bypass    = "XFree86: xc/lib/X11/Xlib\\.h";
947
 
948
    c_fix     = format;
949
    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
950
 
951
    test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
952
};
953
 
954
 
955
/*
956
 *  Fix `typedef struct term;' on hppa1.1-hp-hpux9.
957
 */
958
fix = {
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
 
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
 */
973
fix = {
974
    hackname  = badquote;
975
    files     = sundev/vuid_event.h;
976
    select    = "doesn't";
977
    c_fix     = format;
978
    c_fix_arg = "does not";
979
 
980
    test_text = "/* doesn't have matched single quotes */";
981
};
982
 
983
 
984
/*
985
 *  check for broken assert.h that needs stdio.h
986
 */
987
fix = {
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 \n";
994
    test_text = "extern FILE* stderr;";
995
};
996
 
997
 
998
/*
999
 *  check for broken assert.h that needs stdlib.h
1000
 */
1001
fix = {
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 \n"
1009
                "#endif\n";
1010
    test_text = "extern void exit ( int );";
1011
};
1012
 
1013
 
1014
/*
1015
 *  Remove `extern double cabs' declarations from math.h.
1016
 *  This conflicts with C99.  Discovered on AIX.
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.
1019
 *  SunOS4 has its cabs() declaration followed by a comment which
1020
 *  terminates on the following line.
1021
 *  Darwin hides its broken cabs in architecture-specific subdirs.
1022
 */
1023
fix = {
1024
    hackname = broken_cabs;
1025
    files    = "math.h";
1026
    files    = "architecture/ppc/math.h";
1027
    files    = "architecture/i386/math.h";
1028
    select   = "^extern[ \t]+double[ \t]+cabs";
1029
 
1030
    c_fix     = format;
1031
    c_fix_arg = "";
1032
    c_fix_arg = "^extern[ \t]+double[ \t]+cabs[ \t]*\\([^\\)]*\\);";
1033
 
1034
    test_text = "#ifdef __STDC__\n"
1035
                "extern     double   cabs(struct dbl_hypot);\n"
1036
                "#else\n"
1037
                "extern     double   cabs();\n"
1038
                "#endif\n"
1039
                "extern double cabs ( _Complex z );\n"
1040
                "extern double cabs(); /* This is a comment\n"
1041
                "                         and it ends here. */\n"
1042
                "extern double  cabs(struct __cabs_s);";
1043
};
1044
 
1045
 
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
 */
1051
fix = {
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
 
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
 */
1083
fix = {
1084
    hackname  = ctrl_quotes_def;
1085
    select    = "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]";
1086
    c_fix     = char_macro_def;
1087
    c_fix_arg = "CTRL";
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)";
1095
};
1096
 
1097
fix = {
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";
1102
    test_text = "#define TCTRLFOO BSD43_CTRL(T, 1)";
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
 *
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.
1114
 */
1115
fix = {
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
 
1134
/*
1135
 * AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of
1136
 * bad __GNUC__ tests.
1137
 */
1138
 
1139
fix = {
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
 
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
 */
1155
fix = {
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
 
1169
/*
1170
 *  Fix  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
 */
1174
fix = {
1175
    hackname = dec_intern_asm;
1176
    files    = c_asm.h;
1177
    sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n";
1178
    sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n"
1179
          "#endif\n";
1180
    test_text =
1181
    "float fasm {\n"
1182
    "    ... asm stuff ...\n"
1183
    "};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
1184
};
1185
 
1186
 
1187
/*
1188
 * Fix typo in  on DJGPP 2.03.
1189
 */
1190
fix = {
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 ";
1197
    c_fix_arg = "#include ";
1198
    test_text = "#include \n"
1199
                "extern __DJ_wint_t x;\n";
1200
};
1201
 
1202
 
1203
/*
1204
 * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
1205
 */
1206
fix = {
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
 
1214
    test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1215
};
1216
 
1217
 
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
 */
1223
fix = {
1224
    hackname  = exception_structure;
1225
    files     = math.h;
1226
 
1227
    /*  If matherr has a prototype already, the header needs no fix.  */
1228
    bypass    = 'matherr.*(struct exception|__MATH_EXCEPTION|[ \t]*__FP_EXCEPTION[ \t]*\*[ \t]*)';
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
 
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
 */
1243
fix = {
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
 
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
 */
1260
fix = {
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
 
1271
/*
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.
1278
 */
1279
fix = {
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;
1290
    /* The Solaris 10 headers already define these types correctly.  */
1291
    mach   = '*-*-solaris2.1[0-9]*';
1292
    not_machine = true;
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
 
1300
/*
1301
 *  Fix HP & Sony's use of "../machine/xxx.h"
1302
 *  to refer to:  
1303
 */
1304
fix = {
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";
1312
 
1313
    c_fix_arg = "([ \t]*#[ \t]*include[ \t]+)"  '"\.\./machine/'
1314
                '([a-z]+)\.h"';
1315
 
1316
    test_text = ' # include "../machine/mumble.h"';
1317
};
1318
 
1319
 
1320
/*
1321
 *  Check for (...) in C++ code in HP/UX sys/file.h.
1322
 */
1323
fix = {
1324
    hackname  = hp_sysfile;
1325
    files     = sys/file.h;
1326
    select    = "HPUX_SOURCE";
1327
 
1328
    c_fix     = format;
1329
    c_fix_arg = "(struct file *, ...)";
1330
    c_fix_arg = '\(\.\.\.\)';
1331
 
1332
    test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
1333
};
1334
 
1335
 
1336
/*
1337
 * Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
1338
 * math.h to prevent clash with define in c_std/bits/std_cmath.h.
1339
 */
1340
fix = {
1341
    hackname  = hpux10_cpp_pow_inline;
1342
    files     = fixinc-test-limits.h, math.h;
1343
    select    = <<-     END_POW_INLINE
1344
        ^# +ifdef +__cplusplus
1345
         +\}
1346
         +inline +double +pow\(double +__d,int +__expon\) +\{
1347
        [       ]+return +pow\(__d,\(double\)__expon\);
1348
         +\}
1349
         +extern +"C" +\{
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
 
1368
fix = {
1369
     hackname  = hpux11_cpp_pow_inline;
1370
     files     = math.h;
1371
     select    = " +inline double pow\\(double d,int expon\\) \\{\n"
1372
                 " +return pow\\(d, \\(double\\)expon\\);\n"
1373
                 " +\\}\n";
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
};
1382
 
1383
 
1384
/*
1385
 *  Fix hpux 10.X missing ctype declarations 1
1386
 */
1387
fix = {
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
 */
1409
fix = {
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
 
1447
/*
1448
 *  Fix hpux 10.X missing stdio declarations
1449
 */
1450
fix = {
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
 
1469
/*
1470
 *  Make sure hpux defines abs in header.
1471
 */
1472
fix = {
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
 
1484
/*
1485
 *  Keep HP-UX 11 from stomping on C++ math namespace
1486
 *  with defines for fabsf.
1487
 */
1488
fix = {
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
 
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
 */
1508
fix = {
1509
    hackname  = hpux11_size_t;
1510
    mach      = "*-hp-hpux11*";
1511
    select    = "__size_t";
1512
 
1513
    c_fix     = format;
1514
    c_fix_arg = "_hpux_size_t";
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
 
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
 */
1527
fix = {
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
 
1541
/*
1542
 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
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
1550
 * arguments to __CONCAT__.  A general solution to this problem would be to
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
 */
1556
fix = {
1557
    hackname = hpux11_uint32_c;
1558
    files    = inttypes.h;
1559
    select   = "^#define UINT32_C\\(__c\\)[ \t]*"
1560
                         "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
1561
    c_fix    = format;
1562
    c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
1563
    test_text =
1564
    "#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
1565
    "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
1566
};
1567
 
1568
 
1569
/*
1570
 *  Fix hpux 11.00 broken vsnprintf declaration
1571
 */
1572
fix = {
1573
    hackname = hpux11_vsnprintf;
1574
    files    = stdio.h;
1575
    select   = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, '
1576
                                     'const char \*,) __va__list\);';
1577
    c_fix     = format;
1578
    c_fix_arg = "%1 __va_list);";
1579
 
1580
    test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,'
1581
                                     ' __va__list);';
1582
};
1583
 
1584
 
1585
/*
1586
 *  get rid of bogus inline definitions in HP-UX 8.0
1587
 */
1588
fix = {
1589
    hackname = hpux8_bogus_inlines;
1590
    files    = math.h;
1591
    select   = inline;
1592
    bypass   = "__GNUG__";
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; }";
1600
};
1601
 
1602
 
1603
/*
1604
 *  Fix hpux broken ctype macros
1605
 */
1606
fix = {
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
 
1619
/*
1620
 *  Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
1621
 */
1622
fix = {
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
 
1647
/*
1648
 * HP-UX long_double
1649
 */
1650
fix = {
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";
1657
 
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";
1665
};
1666
 
1667
 
1668
/*
1669
 *  Fix hpux10.20  to avoid invalid forward decl
1670
 */
1671
fix = {
1672
    hackname = hpux_systime;
1673
    files    = sys/time.h;
1674
    select   = "^extern struct sigevent;";
1675
 
1676
    c_fix     = format;
1677
    c_fix_arg = "struct sigevent;";
1678
 
1679
    test_text = 'extern struct sigevent;';
1680
};
1681
 
1682
 
1683
/*
1684
 *  Wrap spu_info in ifdef _KERNEL.  GCC cannot handle an array of unknown
1685
 *  type and mpinfou is only defined when _KERNEL is set.
1686
 */
1687
fix = {
1688
    hackname = hpux_spu_info;
1689
    mach     = "*-hp-hpux*";
1690
    files    = ia64/sys/getppdp.h;
1691
    select   = "^.*extern.*spu_info.*";
1692
 
1693
    c_fix     = format;
1694
    c_fix_arg = "#ifdef _KERNEL\n%0\n#endif";
1695
 
1696
    test_text = "extern union mpinfou spu_info[];";
1697
};
1698
 
1699
 
1700
/*
1701
 *  Fix glibc definition of HUGE_VAL in terms of hex floating point constant
1702
 */
1703
fix = {
1704
    hackname  = huge_val_hex;
1705
    files     = bits/huge_val.h;
1706
    select    = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
1707
    bypass    = "__builtin_huge_val";
1708
 
1709
    c_fix     = format;
1710
    c_fix_arg = "#define HUGE_VAL (__builtin_huge_val())\n";
1711
 
1712
    test_text = "# define HUGE_VAL\t(__extension__ 0x1.0p2047)";
1713
};
1714
 
1715
 
1716
/*
1717
 *  Fix glibc definition of HUGE_VALF in terms of hex floating point constant
1718
 */
1719
fix = {
1720
    hackname  = huge_valf_hex;
1721
    files     = bits/huge_val.h;
1722
    select    = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
1723
    bypass    = "__builtin_huge_valf";
1724
 
1725
    c_fix     = format;
1726
    c_fix_arg = "#define HUGE_VALF (__builtin_huge_valf())\n";
1727
 
1728
    test_text = "#  define HUGE_VALF (__extension__ 0x1.0p255f)";
1729
};
1730
 
1731
 
1732
/*
1733
 *  Fix glibc definition of HUGE_VALL in terms of hex floating point constant
1734
 */
1735
fix = {
1736
    hackname  = huge_vall_hex;
1737
    files     = bits/huge_val.h;
1738
    select    = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
1739
    bypass    = "__builtin_huge_vall";
1740
 
1741
    c_fix     = format;
1742
    c_fix_arg = "#define HUGE_VALL (__builtin_huge_vall())\n";
1743
 
1744
    test_text = "#  define HUGE_VALL (__extension__ 0x1.0p32767L)";
1745
};
1746
 
1747
 
1748
/*
1749
 *  Fix return type of abort and free
1750
 */
1751
fix = {
1752
    hackname  = int_abort_free_and_exit;
1753
    files     = stdlib.h;
1754
    select    = "int[ \t]+(abort|free|exit)[ \t]*\\(";
1755
    bypass    = "_CLASSIC_ANSI_TYPES";
1756
 
1757
    c_fix     = format;
1758
    c_fix_arg = "void\t%1(";
1759
 
1760
    test_text = "extern int abort(int);\n"
1761
                "extern int free(void*);\n"
1762
                "extern int exit(void*);";
1763
};
1764
 
1765
 
1766
/*
1767
 *  Fix various macros used to define ioctl numbers.
1768
 *  The traditional syntax was:
1769
 *
1770
 *    #define _IO(n, x) (('n'<<8)+x)
1771
 *    #define TIOCFOO _IO(T, 1)
1772
 *
1773
 *  but this does not work with the C standard, which disallows macro
1774
 *  expansion inside strings.  We have to rewrite it thus:
1775
 *
1776
 *    #define _IO(n, x) ((n<<8)+x)
1777
 *    #define TIOCFOO  _IO('T', 1)
1778
 *
1779
 *  The select expressions match too much, but the c_fix code is cautious.
1780
 *
1781
 *  _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
1782
 */
1783
fix = {
1784
    hackname  = io_quotes_def;
1785
    select    = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\([a-zA-Z][,)]";
1786
    c_fix     = char_macro_def;
1787
    c_fix_arg = "IO";
1788
    test_text =
1789
    "#define BSD43__IOWR(n, x) (('n'<<8)+x)\n"
1790
    "#define _IOWN(x,y,t)  (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)\n"
1791
    "#define _IO(x,y)      ('x'<<8|y)";
1792
    test_text =
1793
    "#define XX_IO(x)        ('x'<<8|256)";
1794
};
1795
 
1796
fix = {
1797
    hackname  = io_quotes_use;
1798
    select    = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*"
1799
                "\\( *[^,']";
1800
    c_fix     = char_macro_use;
1801
    c_fix_arg = "IO";
1802
    test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n"
1803
                "#define TIOCFOO \\\\\n"
1804
                "BSD43__IOWR(T, 1) /* Some are multi-line */";
1805
};
1806
 
1807
 
1808
/*
1809
 *  Check for missing ';' in struct
1810
 */
1811
fix = {
1812
    hackname = ip_missing_semi;
1813
    files    = netinet/ip.h;
1814
    select   = "}$";
1815
    sed      = "/^struct/,/^};/s/}$/};/";
1816
    test_text=
1817
    "struct mumble {\n"
1818
    "  union {\n"
1819
    "    int x;\n"
1820
    "  }\n"
1821
    "}; /* mumbled struct */\n";
1822
};
1823
 
1824
 
1825
/*
1826
 *  IRIX 6.5.1[89]  unconditionally defines
1827
 *  __restrict as restrict iff __c99.  This is wrong for C++, which
1828
 *  needs many C99 features, but only supports __restrict.
1829
 */
1830
fix = {
1831
    hackname  = irix___restrict;
1832
    files     = internal/sgimacros.h;
1833
    select    = "(#ifdef __c99\n)(#[ \t]*define __restrict restrict)";
1834
 
1835
    mach      = "mips-sgi-irix6.5";
1836
    c_fix     = format;
1837
    c_fix_arg = "%1"
1838
                "#  ifndef __cplusplus\n%2\n#  endif";
1839
 
1840
    test_text = "#ifdef __c99\n#  define __restrict restrict";
1841
};
1842
 
1843
/*
1844
 * IRIX 6.5.22  uses the SGI c99 __generic() intrinsic
1845
 * to define the fpclasify, isfinite, isinf, isnan, isnormal and signbit
1846
 * functions.
1847
 *
1848
 * This was probably introduced around IRIX 6.5.18
1849
 */
1850
fix = {
1851
    hackname  = irix___generic1;
1852
    files     = internal/math_core.h;
1853
    mach      = "mips-sgi-irix6.5";
1854
    select    = "#define ([a-z]+)\\(x\\) *__generic.*";
1855
 
1856
    c_fix     = format;
1857
    c_fix_arg = "extern int %1(double);\n"
1858
                "extern int %1f(float);\n"
1859
                "extern int %1l(long double);\n"
1860
                "#define %1(x) (sizeof(x) == sizeof(double) ? _%1(x) \\\n"
1861
                "               : sizeof(x) == sizeof(float) ? _%1f(x) \\\n"
1862
                "               : _%1l(x))\n";
1863
 
1864
    test_text =
1865
      "#define isnan(x) __generic(x,,, _isnan, _isnanf, _isnanl,,,)(x)\n";
1866
};
1867
 
1868
 
1869
/* Likewise  on IRIX 6.5.19 and later uses the SGI
1870
   compiler's __generic intrinsic to define isgreater, isgreaterequal,
1871
   isless, islessequal, islessgreater and isunordered functions.  */
1872
fix = {
1873
    hackname  = irix___generic2;
1874
    files     = internal/math_core.h;
1875
    mach      = "mips-sgi-irix6.5";
1876
    select    = "#define ([a-z]+)\\(x,y\\) *__generic.*";
1877
 
1878
    c_fix     = format;
1879
    c_fix_arg = "#define %1(x,y) \\\n"
1880
                "  ((sizeof(x)<=4 && sizeof(y)<=4) ? _%1f(x,y) \\\n"
1881
                "   : (sizeof(x)<=8 && sizeof(y)<=8) ? _%1(x,y) \\\n"
1882
                "   : _%1l(x,y))\n";
1883
 
1884
    test_text =
1885
      "#define isless(x,y)         __generic(x,y,, _isless, _islessf, _islessl,,,)(x,y)";
1886
};
1887
 
1888
 
1889
/*
1890
 *  IRIX 5.2's  contains an asm comment with a contraction
1891
 *  that causes the assembly preprocessor to complain about an
1892
 *  unterminated character constant.
1893
 */
1894
fix = {
1895
    hackname  = irix_asm_apostrophe;
1896
    files     = sys/asm.h;
1897
 
1898
    select    = "^[ \t]*#.*[Ww]e're";
1899
    c_fix     = format;
1900
    c_fix_arg = "%1 are";
1901
    c_fix_arg = "^([ \t]*#.*[Ww]e)'re";
1902
    test_text = "\t# and we're on vacation";
1903
};
1904
 
1905
 
1906
/*
1907
 *  Non-traditional "const" declaration in Irix's limits.h.
1908
 */
1909
fix = {
1910
    hackname    = irix_limits_const;
1911
    files       = fixinc-test-limits.h, limits.h;
1912
    select      = "^extern const ";
1913
    c_fix       = format;
1914
    c_fix_arg   = "extern __const ";
1915
    test_text   = "extern const char limit; /* test limits */";
1916
};
1917
 
1918
 
1919
/*
1920
 *  IRIX 6.5.1[78]  has a broken definition of socklen_t.
1921
 *  Various socket function prototypes use different types instead,
1922
 *  depending on the API in use (BSD, XPG4/5), but the socklen_t
1923
 *  definition doesn't reflect this (SGI Bug Id 864477, fixed in
1924
 *  IRIX 6.5.19).
1925
 */
1926
fix = {
1927
    hackname  = irix_socklen_t;
1928
    files     = sys/socket.h;
1929
    select    = "(#define _SOCKLEN_T\n)(typedef u_int32_t socklen_t;)";
1930
 
1931
    mach      = "mips-sgi-irix6.5";
1932
    c_fix     = format;
1933
    c_fix_arg = "%1"
1934
                "#if _NO_XOPEN4 && _NO_XOPEN5\n"
1935
                "typedef int socklen_t;\n"
1936
                "#else\n"
1937
                "%2\n"
1938
                "#endif /* _NO_XOPEN4 && _NO_XOPEN5 */";
1939
 
1940
    test_text = "#define _SOCKLEN_T\ntypedef u_int32_t socklen_t;";
1941
};
1942
 
1943
/*
1944
 *  IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
1945
 *  some functions that take a va_list as
1946
 *  taking char *.  However, GCC uses void * for va_list, so
1947
 *  calling vfprintf with a va_list fails in C++.  */
1948
fix = {
1949
    hackname  = irix_stdio_va_list;
1950
    files     = stdio.h;
1951
    files     = internal/stdio_core.h;
1952
 
1953
    select = '/\* va_list \*/ char \*';
1954
    c_fix  = format;
1955
    c_fix_arg = "__gnuc_va_list";
1956
    test_text =
1957
    "extern int printf( const char *, /* va_list */ char * );";
1958
};
1959
 
1960
 
1961
/*
1962
 *  IRIX 6.5.19  provides the XPG4 variant of
1963
 *  wcsftime by default.  ISO C99 requires the XPG5 variant instead.
1964
 */
1965
fix = {
1966
    hackname  = irix_wcsftime;
1967
    files     = internal/wchar_core.h;
1968
    select    = "#if _NO_XOPEN5\n(extern size_t[ \t]+wcsftime.*const char \*.*)";
1969
 
1970
    mach      = "mips-sgi-irix6.5";
1971
    c_fix     = format;
1972
    c_fix_arg = "#if _NO_XOPEN5 && !defined(__c99)\n%1";
1973
 
1974
    test_text = "#if _NO_XOPEN5\n"
1975
                "extern size_t          wcsftime(wchar_t *, __SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, const struct tm *);";
1976
};
1977
 
1978
/*
1979
 * Fixing ISC fmod declaration
1980
 */
1981
fix = {
1982
    hackname  = isc_fmod;
1983
    files     = math.h;
1984
    select    = 'fmod\(double\)';
1985
    c_fix     = format;
1986
    c_fix_arg = "fmod(double, double)";
1987
    test_text = "extern double  fmod(double);";
1988
};
1989
 
1990
 
1991
/*
1992
 *  On Interactive Unix 2.2, certain traditional Unix definitions
1993
 *  (notably getc and putc in stdio.h) are omitted if __STDC__ is
1994
 *  defined, not just if _POSIX_SOURCE is defined.  This makes it
1995
 *  impossible to compile any nontrivial program except with -posix.
1996
 */
1997
fix = {
1998
    hackname = isc_omits_with_stdc;
1999
 
2000
    files     = "stdio.h";
2001
    files     = "math.h";
2002
    files     = "ctype.h";
2003
    files     = "sys/limits.h";
2004
    files     = "sys/fcntl.h";
2005
    files     = "sys/dirent.h";
2006
 
2007
    select    = '!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)';
2008
    c_fix     = format;
2009
    c_fix_arg = '!defined(_POSIX_SOURCE)';
2010
    test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
2011
                "\nint foo;\n#endif";
2012
};
2013
 
2014
 
2015
/*
2016
 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
2017
 * use / * * / to concatenate tokens.
2018
 */
2019
fix = {
2020
    hackname = kandr_concat;
2021
    files  = "sparc/asm_linkage.h";
2022
    files  = "sun3/asm_linkage.h";
2023
    files  = "sun3x/asm_linkage.h";
2024
    files  = "sun4/asm_linkage.h";
2025
    files  = "sun4c/asm_linkage.h";
2026
    files  = "sun4m/asm_linkage.h";
2027
    files  = "sun4c/debug/asm_linkage.h";
2028
    files  = "sun4m/debug/asm_linkage.h";
2029
    files  = "arm/as_support.h";
2030
    files  = "arm/mc_type.h";
2031
    files  = "arm/xcb.h";
2032
    files  = "dev/chardefmac.h";
2033
    files  = "dev/ps_irq.h";
2034
    files  = "dev/screen.h";
2035
    files  = "dev/scsi.h";
2036
    files  = "sys/tty.h";
2037
    files  = "Xm.acorn/XmP.h";
2038
    files  = bsd43/bsd43_.h;
2039
    select = '/\*\*/';
2040
    c_fix     = format;
2041
    c_fix_arg = '##';
2042
    test_text = "#define __CONCAT__(a,b) a/**/b";
2043
};
2044
 
2045
 
2046
/*
2047
 *  Fix libc1 _G_va_list definition, used in declarations of several
2048
 *  more-or-less standard functions, for example vasprintf.
2049
 */
2050
fix = {
2051
    hackname = libc1_G_va_list;
2052
    files    = _G_config.h;
2053
    mach     = '*-*-linux*libc1';
2054
    select   = 'typedef void \* _G_va_list;';
2055
    c_fix     = format;
2056
    c_fix_arg = "typedef __builtin_va_list _G_va_list;";
2057
    test_text = 'typedef void * _G_va_list;';
2058
};
2059
 
2060
 
2061
/*
2062
 *  GNU libc1 string.h does not prototype memcpy and memcmp for gcc
2063
 *  versions > 1.  This fix will open up the declaration for all
2064
 *  versions of GCC and for g++.
2065
 */
2066
fix = {
2067
    hackname  = libc1_ifdefd_memx;
2068
 
2069
    /* The string.h result is overwritten by AAB_ultrix_string when doing
2070
       "make check" and will fail.  Therefore, we add the following kludgery
2071
       to insert the test_text into the special testing header.  :-}  */
2072
    files     = testing.h;
2073
    files     = string.h;
2074
 
2075
    c_fix     = format;
2076
    select    = "' is a built-in function for gcc 2\\.x\\. \\*/";
2077
    bypass    = __cplusplus;
2078
    c_fix_arg = "%1";
2079
    c_fix_arg =
2080
       '/\* `mem...\' is a built-in function for gcc 2\.x\. \*/' "\n"
2081
       '#if defined\(__STDC__\) && __GNUC__ < 2'                 "\n"
2082
       "(/\\* .* \\*/\n"
2083
       "extern [a-z_]+ mem.*(\n[^#].*)*;)\n"
2084
       "#endif";
2085
 
2086
    test_text =
2087
    "/* \\`memcpy' is a built-in function for gcc 2.x. */\n"
2088
    "#if defined(__STDC__) && __GNUC__ < 2\n"
2089
    "/* Copy N bytes of SRC to DEST.  */\n"
2090
    "extern __ptr_t memcpy __P ((__ptr_t __dest, __const __ptr_t __src,\n"
2091
    "                         size_t __n));\n"
2092
    "#endif";
2093
};
2094
 
2095
 
2096
/* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
2097
 * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
2098
 * constant on recent versions of g++.
2099
 */
2100
fix = {
2101
    hackname = linux_ia64_ucontext;
2102
    files = "sys/ucontext.h";
2103
    mach = "ia64-*-linux*";
2104
    select = '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
2105
             '->sc_gr\[0\]\) - \(char \*\) 0\)';
2106
    c_fix = format;
2107
    c_fix_arg = "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
2108
    test_text = "# define _SC_GR0_OFFSET\t\\\\\n"
2109
        "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
2110
};
2111
 
2112
 
2113
/*
2114
 * Apparently some SVR4 systems typedef longlong_t to long ?
2115
 */
2116
#ifdef SVR4
2117
fix = {
2118
    hackname  = longlong_t;
2119
    select    = "typedef[ \t]+(unsigned[ \t]+)?long[ \t]+(u_)?longlong_t";
2120
    c_fix     = format;
2121
    c_fix_arg = "typedef %1long long %2longlong_t";
2122
    test_text = "typedef long longlong_t\n"
2123
                "typedef unsigned long u_longlong_t";
2124
};
2125
#endif
2126
 
2127
/*
2128
 *  Remove header file warning from sys/time.h.  Autoconf's
2129
 *  AC_HEADER_TIME recommends to include both sys/time.h and time.h
2130
 *  which causes warning on LynxOS.  Remove the warning.
2131
 */
2132
fix = {
2133
    hackname  = lynxos_no_warning_in_sys_time_h;
2134
    files     = sys/time.h;
2135
    select    = "#warning[ \t]+Using  instead of ";
2136
    c_fix     = format;
2137
    c_fix_arg = "";
2138
    test_text = "#warning Using  instead of ";
2139
};
2140
 
2141
 
2142
/*
2143
 *  Add missing declaration for putenv.
2144
 */
2145
fix = {
2146
    hackname  = lynxos_missing_putenv;
2147
    mach      = '*-*-lynxos*';
2148
    files     = stdlib.h;
2149
    bypass    = 'putenv[ \t]*\\(';
2150
    select    = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2151
    c_fix     = format;
2152
    c_fix_arg = "%0\n"
2153
        "extern int putenv                              _AP((char *));";
2154
    c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
2155
    test_text = "extern char *getenv    _AP((const char *));";
2156
};
2157
 
2158
 
2159
/*
2160
 * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
2161
 *
2162
 * On NetBSD, machine is a symbolic link to an architecture specific
2163
 * directory name, so we can't match a specific file name here.
2164
 */
2165
fix = {
2166
    hackname = machine_ansi_h_va_list;
2167
    select   = "define[ \t]+_BSD_VA_LIST_[ \t]";
2168
    bypass   = '__builtin_va_list';
2169
 
2170
    c_fix     = format;
2171
    c_fix_arg = "%1__builtin_va_list";
2172
    c_fix_arg = "(define[ \t]+_BSD_VA_LIST_[ \t]+).*";
2173
 
2174
    test_text = " # define _BSD_VA_LIST_\tchar**";
2175
};
2176
 
2177
 
2178
/*
2179
 *  Fix non-ansi machine name defines
2180
 */
2181
fix = {
2182
    hackname  = machine_name;
2183
    c_test    = machine_name;
2184
    c_fix     = machine_name;
2185
 
2186
    test_text = "/* MACH_DIFF: */\n"
2187
    "#if defined( i386 ) || defined( sparc ) || defined( vax )"
2188
    "\n/* no uniform test, so be careful  :-) */";
2189
};
2190
 
2191
 
2192
/*
2193
 *  Some math.h files define struct exception (it's in the System V
2194
 *  Interface Definition), which conflicts with the class exception defined
2195
 *  in the C++ file std/stdexcept.h.  We redefine it to __math_exception.
2196
 *  This is not a great fix, but I haven't been able to think of anything
2197
 *  better.  Note that we have to put the #ifdef/#endif blocks at beginning
2198
 *  and end of file, because fixproto runs after us and may insert
2199
 *  additional references to struct exception.
2200
 */
2201
fix = {
2202
    hackname  = math_exception;
2203
    files     = math.h;
2204
    select    = "struct exception";
2205
    /*
2206
     * This should be bypassed on __cplusplus, but some supposedly C++ C++
2207
     * aware headers, such as Solaris 8 and 9, don't wrap their struct
2208
     * exception either.  So currently we bypass only for glibc, based on a
2209
     * comment in the fixed glibc header.  Ick.
2210
     */
2211
    bypass    = 'We have a problem when using C\+\+|for C\+\+, _[a-z0-9A-Z_]+_exception; for C, exception';
2212
    c_fix     = wrap;
2213
 
2214
    c_fix_arg = "#ifdef __cplusplus\n"
2215
                "#define exception __math_exception\n"
2216
                "#endif\n";
2217
 
2218
    c_fix_arg = "#ifdef __cplusplus\n"
2219
                "#undef exception\n"
2220
                "#endif\n";
2221
 
2222
    test_text = "typedef struct exception t_math_exception;";
2223
};
2224
 
2225
 
2226
/*
2227
 *  This looks pretty broken to me.  ``dbl_max_def'' will contain
2228
 *  "define DBL_MAX " at the start, when what we really want is just
2229
 *  the value portion.  Can't figure out how to write a test case
2230
 *  for this either  :-(
2231
 */
2232
fix = {
2233
    hackname = math_huge_val_from_dbl_max;
2234
    files    = math.h;
2235
 
2236
    /*
2237
     * IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined
2238
     * in math.h, this fix applies.
2239
     */
2240
    select   = "define[ \t]+HUGE_VAL[ \t]+DBL_MAX";
2241
    bypass   = "define[ \t]+DBL_MAX";
2242
 
2243
    shell    =
2244
    /*
2245
     *  See if we have a definition for DBL_MAX in float.h.
2246
     *  If we do, we will replace the one in math.h with that one.
2247
     */
2248
 
2249
    "\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h "
2250
                   "| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n"
2251
 
2252
    "\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n"
2253
    "\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/"
2254
                        "s@DBL_MAX@'\"$dbl_max_def@\"\n"
2255
    "\telse cat\n"
2256
    "\tfi";
2257
 
2258
    test_text =
2259
    "`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n"
2260
    "#define HUGE_VAL DBL_MAX";
2261
};
2262
 
2263
 
2264
/*
2265
 *  nested comment
2266
 */
2267
fix = {
2268
    hackname  = nested_auth_des;
2269
    files     = rpc/rpc.h;
2270
    select    = '(/\*.*rpc/auth_des\.h>.*)/\*';
2271
    c_fix     = format;
2272
    c_fix_arg = "%1*/ /*";
2273
    test_text = "/*#include  /* skip this */";
2274
};
2275
 
2276
 
2277
/*
2278
 * Fix nested comments in Motorola's  and 
2279
 */
2280
fix = {
2281
    hackname = nested_motorola;
2282
    mach     = "m68k-motorola-sysv*";
2283
    files    = sys/limits.h;
2284
    files    = limits.h;
2285
    select   = "max # bytes atomic in write|error value returned by Math lib";
2286
 
2287
    sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
2288
                   "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
2289
    sed = "s@\\(/\\*#define\tHUGE_VAL\t3.[0-9e+]* \\)"
2290
          "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
2291
 
2292
    test_text =
2293
    "#undef PIPE_BUF /* max # bytes atomic in write to a\n"
2294
    "\t\t/* PIPE */\n"
2295
    "/*#define\tHUGE_VAL\t3.9e+9 /*error value returned by Math lib*/";
2296
};
2297
 
2298
 
2299
/*
2300
 * Fixing nested comments in ISC 
2301
 */
2302
fix = {
2303
    hackname = nested_sys_limits;
2304
    files  = sys/limits.h;
2305
    select = CHILD_MAX;
2306
    sed    = "/CHILD_MAX/s,/\\* Max, Max,";
2307
    sed    = "/OPEN_MAX/s,/\\* Max, Max,";
2308
    test_text = "/*\n#define CHILD_MAX 20 /* Max, Max, ... */ /*\n"
2309
                "#define OPEN_MAX  20 /* Max, Max, ... */\n";
2310
};
2311
 
2312
 
2313
/*
2314
 * NetBSD has a semicolon after the ending '}' for some extern "C".
2315
 */
2316
fix = {
2317
    hackname  = netbsd_extra_semicolon;
2318
    mach      = *-*-netbsd*;
2319
    files     = sys/cdefs.h;
2320
    select    = "#define[ \t]*__END_DECLS[ \t]*};";
2321
 
2322
    c_fix     = format;
2323
    c_fix_arg = "#define __END_DECLS }";
2324
 
2325
    test_text = "#define __END_DECLS };";
2326
};
2327
 
2328
 
2329
/*
2330
 *  NeXT 3.2 adds const prefix to some math functions.
2331
 *  These conflict with the built-in functions.
2332
 */
2333
fix = {
2334
    hackname  = next_math_prefix;
2335
    files     = ansi/math.h;
2336
    select    = "^extern[ \t]+double[ \t]+__const__[ \t]";
2337
 
2338
    c_fix     = format;
2339
    c_fix_arg = "extern double %1(";
2340
    c_fix_arg = "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\(";
2341
 
2342
    test_text = "extern\tdouble\t__const__\tmumble();";
2343
};
2344
 
2345
 
2346
/*
2347
 *  NeXT 3.2 uses the word "template" as a parameter for some
2348
 *  functions. GCC reports an invalid use of a reserved key word
2349
 *  with the built-in functions.
2350
 */
2351
fix = {
2352
    hackname = next_template;
2353
    files    = bsd/libc.h;
2354
    select   = "[ \t]template\\)";
2355
 
2356
    c_fix     = format;
2357
    c_fix_arg = "(%1)";
2358
    c_fix_arg = "\\(([^)]*)[ \t]template\\)";
2359
    test_text = "extern mumble( char * template); /* fix */";
2360
};
2361
 
2362
 
2363
/*
2364
 *  NeXT 3.2 includes the keyword volatile in the abort() and  exit()
2365
 *  function prototypes. That conflicts with the  built-in functions.
2366
 */
2367
fix = {
2368
    hackname = next_volitile;
2369
    files    = ansi/stdlib.h;
2370
    select   = "^extern[ \t]+volatile[ \t]+void[ \t]";
2371
 
2372
    c_fix     = format;
2373
    c_fix_arg = "extern void %1(";
2374
    c_fix_arg = "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\(";
2375
 
2376
    test_text = "extern\tvolatile\tvoid\tabort();";
2377
};
2378
 
2379
 
2380
/*
2381
 *  NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
2382
 *  Note that version 3 of the NeXT system has wait.h in a different directory,
2383
 *  so that this code won't do anything.  But wait.h in version 3 has a
2384
 *  conditional, so it doesn't need this fix.  So everything is okay.
2385
 */
2386
fix = {
2387
    hackname  = next_wait_union;
2388
    files     = sys/wait.h;
2389
 
2390
    select    = 'wait\(union wait';
2391
    c_fix     = format;
2392
    c_fix_arg = "wait(void";
2393
    test_text = "extern pid_d wait(union wait*);";
2394
};
2395
 
2396
 
2397
/*
2398
 *  a missing semi-colon at the end of the nodeent structure definition.
2399
 */
2400
fix = {
2401
    hackname  = nodeent_syntax;
2402
    files     = netdnet/dnetdb.h;
2403
    select    = "char[ \t]*\\*na_addr[ \t]*$";
2404
    c_fix     = format;
2405
    c_fix_arg = "%0;";
2406
    test_text = "char *na_addr\t";
2407
};
2408
 
2409
 
2410
/*
2411
 *  obstack.h used casts as lvalues.
2412
 *
2413
 *  We need to change postincrements of casted pointers (which are
2414
 *  then dereferenced and assigned into) of the form
2415
 *
2416
 *    *((TYPE*)PTRVAR)++ = (VALUE)
2417
 *
2418
 *  into expressions like
2419
 *
2420
 *    ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
2421
 *
2422
 *  which is correct for the cases used in obstack.h since PTRVAR is
2423
 *  of type char * and the value of the expression is not used.
2424
 */
2425
fix = {
2426
    hackname  = obstack_lvalue_cast;
2427
    files     = obstack.h;
2428
    select    = '\*\(\(([^()]*)\*\)(.*)\)\+\+ = \(([^()]*)\)';
2429
    c_fix     = format;
2430
    c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
2431
    test_text = "*((void **) (h)->next_free)++ = (aptr)";
2432
};
2433
 
2434
 
2435
/*
2436
 *  sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
2437
 *  defining regex.h related types.  This causes libg++ build and usage
2438
 *  failures.  Fixing this correctly requires checking and modifying 3 files.
2439
 */
2440
fix = {
2441
    hackname = osf_namespace_a;
2442
    files    = reg_types.h;
2443
    files    = sys/lc_core.h;
2444
    test     = " -r reg_types.h";
2445
    test     = " -r sys/lc_core.h";
2446
    test     = " -n \"`grep '} regex_t;' reg_types.h`\"";
2447
    test     = " -z \"`grep __regex_t regex.h`\"";
2448
 
2449
    c_fix     = format;
2450
    c_fix_arg = "__%0";
2451
    c_fix_arg = "reg(ex|off|match)_t";
2452
 
2453
    test_text = "`touch sys/lc_core.h`"
2454
    "typedef struct {\n  int stuff, mo_suff;\n} regex_t;\n"
2455
    "extern regex_t    re;\n"
2456
    "extern regoff_t   ro;\n"
2457
    "extern regmatch_t rm;\n";
2458
};
2459
 
2460
fix = {
2461
    hackname = osf_namespace_c;
2462
    files    = regex.h;
2463
    test     = " -r reg_types.h";
2464
    test     = " -r sys/lc_core.h";
2465
    test     = " -n \"`grep '} regex_t;' reg_types.h`\"";
2466
    test     = " -z \"`grep __regex_t regex.h`\"";
2467
 
2468
    select    = "#include .*";
2469
    c_fix     = format;
2470
    c_fix_arg = "%0\n"
2471
                "typedef __regex_t\tregex_t;\n"
2472
                "typedef __regoff_t\tregoff_t;\n"
2473
                "typedef __regmatch_t\tregmatch_t;";
2474
 
2475
    test_text = "#include ";
2476
};
2477
 
2478
 
2479
/*
2480
 *  Fix __page_size* declarations in pthread.h AIX 4.1.[34].
2481
 *  The original ones fail if uninitialized externs are not common.
2482
 *  This is the default for all ANSI standard C++ compilers.
2483
 */
2484
fix = {
2485
    hackname  = pthread_page_size;
2486
    files     = pthread.h;
2487
    select    = "^int __page_size";
2488
    c_fix     = format;
2489
    c_fix_arg = "extern %0";
2490
    test_text = "int __page_size;";
2491
};
2492
 
2493
/*
2494
 * On broken glibc-2.3.3 systems an array of incomplete structures is
2495
 * passed to __sigsetjmp.  Fix that to take a pointer instead.
2496
 */
2497
fix = {
2498
    hackname  = pthread_incomplete_struct_argument;
2499
    files     = pthread.h;
2500
    select    = "struct __jmp_buf_tag";
2501
    c_fix     = format;
2502
    c_fix_arg = "%1 *%2%3";
2503
    c_fix_arg = "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) (__env)\\[1\\](.*)$";
2504
    test_text = "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask);";
2505
};
2506
 
2507
/*
2508
 * On DYNIX/ptx, sys/mc_param.h has an embedded asm for the cpuid instruction
2509
 * on the P5. This is not used by anything else so we ifdef it out.
2510
 * Current GCC doesn't seem to complain about the asm, though.
2511
 */
2512
#ifdef PTX
2513
fix = {
2514
    hackname  = ptx_sys_mc_param_h;
2515
    files     = sys/mc_param.h;
2516
    sed       = "/__asm/,/}/{"
2517
                  "/__asm/i\\\n"
2518
                  "#if !defined (__GNUC__) && !defined (__GNUG__)\n"
2519
                  "/}/a\\\n"
2520
                  "#endif\n"
2521
                "}";
2522
    test_text = "__asm\n"
2523
                "int _CPUID()\n"
2524
                "{\n"
2525
                "   non-GNU assembly here\n"
2526
                "}";
2527
};
2528
#endif
2529
 
2530
 
2531
/*
2532
 *  Fix return type of fread and fwrite on sysV68
2533
 */
2534
fix = {
2535
    hackname = read_ret_type;
2536
    files    = stdio.h;
2537
    select   = "extern int\t.*, fread\\(\\), fwrite\\(\\)";
2538
    c_fix     = format;
2539
    c_fix_arg = "extern unsigned int fread(), fwrite();\n%1%2";
2540
    c_fix_arg = "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)";
2541
 
2542
    test_text = "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
2543
};
2544
 
2545
 
2546
/*
2547
 *  Fix casts as lvalues in glibc's .
2548
 */
2549
fix = {
2550
    hackname  = rpc_xdr_lvalue_cast_a;
2551
    files     = rpc/xdr.h;
2552
    select    = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
2553
    c_fix     = format;
2554
    c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
2555
    test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
2556
                "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
2557
};
2558
 
2559
 
2560
fix = {
2561
    hackname  = rpc_xdr_lvalue_cast_b;
2562
    files     = rpc/xdr.h;
2563
    select    = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
2564
    c_fix     = format;
2565
    c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
2566
    test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
2567
                "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
2568
};
2569
 
2570
 
2571
/*
2572
 *  function class(double x) conflicts with C++ keyword on rs/6000
2573
 */
2574
fix = {
2575
    hackname  = rs6000_double;
2576
    files     = math.h;
2577
    select    = '[^a-zA-Z_]class\(';
2578
 
2579
    c_fix     = format;
2580
    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
2581
    c_fix_arg = '^.*[^a-zA-Z_]class\(.*';
2582
 
2583
    test_text = "extern int class();";
2584
};
2585
 
2586
 
2587
/*
2588
 *  Wrong fchmod prototype on RS/6000.
2589
 */
2590
fix = {
2591
    hackname  = rs6000_fchmod;
2592
    files     = sys/stat.h;
2593
    select    = 'fchmod\(char \*';
2594
    c_fix     = format;
2595
    c_fix_arg = "fchmod(int";
2596
    test_text = "extern int fchmod(char *, mode_t);";
2597
};
2598
 
2599
 
2600
/*
2601
 *  parameters conflict with C++ new on rs/6000
2602
 */
2603
fix = {
2604
    hackname  = rs6000_param;
2605
    files     = "stdio.h";
2606
    files     = "unistd.h";
2607
 
2608
    select    = 'rename\(const char \*old, const char \*new\)';
2609
    c_fix     = format;
2610
    c_fix_arg = 'rename(const char *_old, const char *_new)';
2611
 
2612
    test_text = 'extern int rename(const char *old, const char *new);';
2613
};
2614
 
2615
 
2616
/*
2617
 *  On OpenServer and on UnixWare 7,  uses the native compiler
2618
 *  __builtin_generic. We fix that usage to use the GCC equivalent.
2619
 * It also has a plethora of inline functions that conflict with libstdc++.
2620
 */
2621
fix = {
2622
    hackname = sco_math;
2623
    files    = math.h;
2624
    files    = ansi/math.h;
2625
    files    = posix/math.h;
2626
    files    = xpg4/math.h;
2627
    files    = xpg4v2/math.h;
2628
    files    = xpg4plus/math.h;
2629
    files    = ods_30_compat/math.h;
2630
    files    = oldstyle/math.h;
2631
    select   = "inline double abs";
2632
    bypass   = "__GNUG__";
2633
    sed      = "/#define.*__fp_class(a) \\\\/i\\\n"
2634
               "#ifndef __GNUC__\n";
2635
    sed      =
2636
"/.*__builtin_generic/a\\\n"
2637
"#else\\\n"
2638
"#define __fp_class(a) \\\\\\\n"
2639
"  __builtin_choose_expr(__builtin_types_compatible_p(typeof(a),long double),\\\\\\\n"
2640
"   __fpclassifyl(a), \\\\\\\n"
2641
"    __builtin_choose_expr(__builtin_types_compatible_p(typeof(a), float), \\\\\\\n"
2642
"      __fpclassifyf(a),__fpclassify(a)))\\\n"
2643
"#endif";
2644
 
2645
    sed      = "/extern \"C\\+\\+\"/N;"
2646
               "/inline double abs/i\\\n"
2647
               "#ifndef __GNUC__\n";
2648
    sed      = "/inline long double trunc/N;"
2649
               "/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n"
2650
               "#endif /* ! __GNUC__ */";
2651
 
2652
    test_text =
2653
    "#define __fp_class(a) \\\\\n"
2654
    " __builtin_generic(a,\"ld:__fplcassifyl;f:__fpclassifyf;:__fpclassify\")\n";
2655
 
2656
};
2657
 
2658
 
2659
/*
2660
 *  On SCO OpenServer prior to 5.0.7UP1,  and 
2661
 *  have a clash on struct _fpstate and struct fpstate.
2662
 */
2663
fix = {
2664
    hackname = sco_regset;
2665
    files    = sys/regset.h;
2666
    mach     = "*-*-sco3.2v5*";
2667
    select   = "(struct[ \t]+.*)fpstate";
2668
    c_fix     = format;
2669
    c_fix_arg = "%1rsfpstate";
2670
 
2671
    test_text =
2672
    "union u_fps {\n"
2673
    "    struct\tfpstate\n"
2674
    "    {\n"
2675
    "       int whatever;\n"
2676
    "    }\n"
2677
    "};\n"
2678
    "union _u_fps {\n"
2679
    "    struct _fpstate\n"
2680
    "    {\n"
2681
    "       int whatever;\n"
2682
    "    }\n"
2683
    "};\n";
2684
};
2685
 
2686
 
2687
/*
2688
 *  The static functions lstat() and fchmod() in 
2689
 *  cause G++ grief since they're not wrapped in "if __cplusplus".
2690
 *
2691
 *  On SCO OpenServer 5.0.0 through (at least) 5.0.5  contains
2692
 *  tiny static wrappers that aren't C++ safe.
2693
 */
2694
fix = {
2695
    hackname = sco_static_func;
2696
    files    = sys/stat.h;
2697
    mach     = "i?86-*-sco3.2*";
2698
    select   = "^static int";
2699
 
2700
    sed      = "/^static int/i\\\n"
2701
               "#if __cplusplus\\\n"
2702
               "extern \"C\" {\\\n"
2703
               "#endif /* __cplusplus */";
2704
 
2705
    sed      = "/^}$/a\\\n"
2706
               "#if __cplusplus\\\n"
2707
               " }\\\n"
2708
               "#endif /* __cplusplus */";
2709
 
2710
    test_text =
2711
    "#ifdef __STDC__\n"
2712
    "static int\tstat(const char *__f, struct stat *__p) {\n"
2713
    "\treturn __stat32(__f, __p);\n"
2714
    "}\n\n#  else /* !__STDC__ THIS FAILS ON BSD SYSTEMS */\n"
2715
 
2716
    "static int\tstat(__f, __p)\n"
2717
    "\tchar *__f;\n"
2718
    "\tstruct stat *__p;\n"
2719
    "{\n"
2720
    "\treturn __stat32(__f, __p);\n"
2721
    "}\n"
2722
    "#endif";
2723
};
2724
 
2725
 
2726
/*
2727
 *  Fix prototype declaration of utime in sys/times.h.
2728
 *  In 3.2v4.0 the const is missing.
2729
 */
2730
fix = {
2731
    hackname  = sco_utime;
2732
    files     = sys/times.h;
2733
    mach      = "i?86-*-sco3.2v4*";
2734
 
2735
    select    = '\(const char \*, struct utimbuf \*\);';
2736
    c_fix     = format;
2737
    c_fix_arg = '(const char *, const struct utimbuf *);';
2738
 
2739
    test_text = "extern int utime(const char *, struct utimbuf *);";
2740
};
2741
 
2742
/*
2743
 * Sun Solaris 10 defines several C99 math macros in terms of
2744
 * builtins specific to the Studio compiler, in particular not
2745
 * compatible with the GNU compiler.
2746
 */
2747
fix = {
2748
    hackname = solaris_math_1;
2749
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2750
    bypass = "__GNUC__";
2751
    files = iso/math_c99.h;
2752
    c_fix = format;
2753
    c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
2754
    c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
2755
    test_text =
2756
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2757
    "#undef     HUGE_VAL\n"
2758
    "#define    HUGE_VAL        __builtin_huge_val\n"
2759
    "#undef     HUGE_VALF\n"
2760
    "#define    HUGE_VALF       __builtin_huge_valf\n"
2761
    "#undef     HUGE_VALL\n"
2762
    "#define    HUGE_VALL       __builtin_huge_vall";
2763
};
2764
 
2765
fix = {
2766
    hackname = solaris_math_2;
2767
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2768
    bypass = "__GNUC__";
2769
    files = iso/math_c99.h;
2770
    c_fix = format;
2771
    c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
2772
    c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
2773
    test_text =
2774
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2775
    "#undef     INFINITY\n"
2776
    "#define    INFINITY        __builtin_infinity";
2777
};
2778
 
2779
fix = {
2780
    hackname = solaris_math_3;
2781
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2782
    bypass = "__GNUC__";
2783
    files = iso/math_c99.h;
2784
    c_fix = format;
2785
    c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
2786
    c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
2787
    test_text =
2788
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2789
    "#undef     NAN\n"
2790
    "#define    NAN     __builtin_nan";
2791
};
2792
 
2793
fix = {
2794
    hackname = solaris_math_4;
2795
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2796
    bypass = "__GNUC__";
2797
    files = iso/math_c99.h;
2798
    c_fix = format;
2799
    c_fix_arg = "#define\tfpclassify(x) \\\n"
2800
                "  __extension__ ({ __typeof(x) __x_fp = (x); \\\n"
2801
                "\t\t   isnan(__x_fp) \\\n"
2802
                "\t\t     ? FP_NAN \\\n"
2803
                "\t\t     : isinf(__x_fp) \\\n"
2804
                "\t\t       ? FP_INFINITE \\\n"
2805
                "\t\t       : isnormal(__x_fp) \\\n"
2806
                "\t\t\t ? FP_NORMAL \\\n"
2807
                "\t\t\t : __x_fp == 0.0 \\\n"
2808
                "\t\t\t   ? FP_ZERO \\\n"
2809
                "\t\t\t   : FP_SUBNORMAL; })";
2810
    c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
2811
    test_text =
2812
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2813
    "#undef     fpclassify\n"
2814
    "#define    fpclassify(x)   __builtin_fpclassify(x)";
2815
};
2816
 
2817
fix = {
2818
    hackname = solaris_math_5;
2819
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2820
    bypass = "__GNUC__";
2821
    files = iso/math_c99.h;
2822
    c_fix = format;
2823
    c_fix_arg = "#define\tisfinite(x) \\\n"
2824
                "  __extension__ ({ __typeof (x) __x_f = (x); \\\n"
2825
                "\t\t   __builtin_expect(!isnan(__x_f - __x_f), 1); })";
2826
    c_fix_arg = "^#define[ \t]+isfinite\\(x\\)[ \t]+__builtin_isfinite\\(x\\)";
2827
    test_text =
2828
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2829
    "#undef     isfinite\n"
2830
    "#define    isfinite(x)     __builtin_isfinite(x)";
2831
};
2832
 
2833
fix = {
2834
    hackname = solaris_math_6;
2835
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2836
    bypass = "__GNUC__";
2837
    files = iso/math_c99.h;
2838
    c_fix = format;
2839
    c_fix_arg = "#define\tisinf(x) \\\n"
2840
                "  __extension__ ({ __typeof (x) __x_i = (x); \\\n"
2841
                "\t\t   __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); })";
2842
    c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__builtin_isinf\\(x\\)";
2843
    test_text =
2844
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2845
    "#undef     isinf\n"
2846
    "#define    isinf(x)        __builtin_isinf(x)";
2847
};
2848
 
2849
fix = {
2850
    hackname = solaris_math_7;
2851
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2852
    bypass = "__GNUC__";
2853
    files = iso/math_c99.h;
2854
    c_fix = format;
2855
    c_fix_arg = "#define\tisnormal(x) \\\n"
2856
                "  __extension__ ({ __typeof(x) __x_n = (x); \\\n"
2857
                "\t\t   if (__x_n < 0.0) __x_n = -__x_n; \\\n"
2858
                "\t\t   __builtin_expect(isfinite(__x_n) \\\n"
2859
                "\t\t\t\t    && (sizeof(__x_n) == sizeof(float) \\\n"
2860
                "\t\t\t\t\t  ? __x_n >= __FLT_MIN__ \\\n"
2861
                "\t\t\t\t\t  : sizeof(__x_n) == sizeof(long double) \\\n"
2862
                "\t\t\t\t\t    ? __x_n >= __LDBL_MIN__ \\\n"
2863
                "\t\t\t\t\t    : __x_n >= __DBL_MIN__), 1); })";
2864
    c_fix_arg = "^#define[ \t]+isnormal\\(x\\)[ \t]+__builtin_isnormal\\(x\\)";
2865
    test_text =
2866
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2867
    "#undef     isnormal\n"
2868
    "#define    isnormal(x)     __builtin_isnormal(x)";
2869
};
2870
 
2871
fix = {
2872
    hackname = solaris_math_8;
2873
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2874
    bypass = "__GNUC__";
2875
    files = iso/math_c99.h;
2876
    c_fix = format;
2877
    c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
2878
                "\t\t\t   ? __builtin_signbitf(x) \\\n"
2879
                "\t\t\t   : sizeof(x) == sizeof(long double) \\\n"
2880
                "\t\t\t     ? __builtin_signbitl(x) \\\n"
2881
                "\t\t\t     : __builtin_signbit(x))";
2882
    c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
2883
    test_text =
2884
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2885
    "#undef     signbit\n"
2886
    "#define    signbit(x)      __builtin_signbit(x)";
2887
};
2888
 
2889
fix = {
2890
    hackname = solaris_math_9;
2891
    select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2892
    bypass = "__GNUC__";
2893
    files = iso/math_c99.h;
2894
    c_fix = format;
2895
    c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
2896
    c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)";
2897
    test_text =
2898
    '#ident     "@(#)math_c99.h 1.9     04/11/01 SMI"'"\n"
2899
    "#undef     isgreater\n"
2900
    "#define    isgreater(x, y)         ((x) __builtin_isgreater(y))\n"
2901
    "#undef     isgreaterequal\n"
2902
    "#define    isgreaterequal(x, y)    ((x) __builtin_isgreaterequal(y))\n"
2903
    "#undef     isless\n"
2904
    "#define    isless(x, y)            ((x) __builtin_isless(y))\n"
2905
    "#undef     islessequal\n"
2906
    "#define    islessequal(x, y)       ((x) __builtin_islessequal(y))\n"
2907
    "#undef     islessgreater\n"
2908
    "#define    islessgreater(x, y)     ((x) __builtin_islessgreater(y))\n"
2909
    "#undef     isunordered\n"
2910
    "#define    isunordered(x, y)       ((x) __builtin_isunordered(y))";
2911
};
2912
 
2913
/*
2914
 *  Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER
2915
 *  incorrectly, so we replace them with versions that correspond to
2916
 *  the definition.  We also explicitly name this fix "1" and the next
2917
 *  fix "2" because this one does not deal with the last field.  This
2918
 *  fix needs to run before the next.
2919
 */
2920
fix = {
2921
    hackname = solaris_mutex_init_1;
2922
    select = '@\(#\)pthread.h' "[ \t]+1.1[0-9][ \t]+9[567]/[0-9/]+ SMI";
2923
    files = pthread.h;
2924
    sed   = "/define[ \t]*PTHREAD_MUTEX_INI/s/{0, 0,/{{{0}, 0}, {{{0}}},/\n"
2925
            "/define[ \t]*PTHREAD_COND_INI/s/{0,/{{{0},0},/";
2926
    test_text =
2927
    '#ident "@(#)pthread.h  1.16    97/05/05 SMI"'"\n"
2928
    "#define PTHREAD_MUTEX_INITIALIZER\t{0, 0, 0}\n"
2929
    "#define PTHREAD_COND_INITIALIZER\t{0, 0} /* */\n";
2930
};
2931
 
2932
 
2933
/*
2934
 * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
2935
 * "0" for the last field of the pthread_mutex_t structure, which is
2936
 * of type upad64_t, which itself is typedef'd to int64_t, but with
2937
 * __STDC__ defined (e.g. by -ansi) it is a union. So change the
2938
 * initializer to "{0}" instead
2939
 */
2940
fix = {
2941
    hackname = solaris_mutex_init_2;
2942
    select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
2943
    files = pthread.h;
2944
    c_fix = format;
2945
    c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
2946
                "%0\n"
2947
                "#else\n"
2948
                "%1, {0}}%3\n"
2949
                "#endif";
2950
    c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+\\{.*)"
2951
                ",[ \t]*0\\}" "(|[ \t].*)$";
2952
    test_text =
2953
    '#ident "@(#)pthread.h  1.26  98/04/12 SMI"'"\n"
2954
    "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
2955
    "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
2956
    "#define PTHREAD_RWLOCK_INITIALIZER\t"
2957
             "{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
2958
};
2959
 
2960
 
2961
/*
2962
 * Solaris 2.5.1 and 2.6 use an outdated prototype for send & recv
2963
 * in sys/socket.h.  This is corrected in Solaris 7 and up.
2964
 */
2965
fix = {
2966
    hackname = solaris_socket;
2967
    files = sys/socket.h;
2968
    select = '@\(#\)socket.h' "[ \t]+1.[123][0-9][ \t]+9[567]/[0-9/]+ SMI";
2969
    c_fix = format;
2970
    c_fix_arg = "extern int %1(int, %2void *, int, int);";
2971
    c_fix_arg = '^extern int (recv|send)\(int,'
2972
                ' (const )*char '
2973
                '\*, int, int\);';
2974
 
2975
    test_text = '#ident   "@(#)socket.h   1.30    97/01/20 SMI"'"\n"
2976
                "extern int recv(int, char *, int, int);\n"
2977
                "extern int send(int, const char *, int, int);";
2978
};
2979
 
2980
 
2981
/*
2982
 * Solaris 2.8 has what appears to be some gross workaround for
2983
 * some old version of their c++ compiler.  G++ doesn't want it
2984
 * either, but doesn't want to be tied to SunPRO version numbers.
2985
 */
2986
fix = {
2987
    hackname = solaris_stdio_tag;
2988
    files    = stdio_tag.h;
2989
 
2990
    select   = '__cplusplus < 54321L';
2991
    /* In Solaris 10, the code in stdio_tag.h is conditionalized on
2992
       "!defined(__GNUC__)" so we no longer need to fix it.  */
2993
    bypass   = '__GNUC__';
2994
    sed      = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
2995
 
2996
    test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
2997
};
2998
 
2999
 
3000
/*
3001
 * Sun Solaris 2.5.1 doesn't define 'getpagesize' in , as is done
3002
 * on Solaris 2.6 and up.
3003
 */
3004
fix = {
3005
    hackname  = solaris_unistd;
3006
    files = unistd.h;
3007
    select = '@\(#\)unistd.h' "[ \t]+1.3[0-9][ \t]+9[567]/[0-9/]+ SMI";
3008
    bypass = "getpagesize";
3009
    c_fix = format;
3010
    c_fix_arg = "extern int getpagesize();\n%0";
3011
    c_fix_arg = '^extern (pid_t|int) getpgid\(.*\);';
3012
    test_text = '#ident "@(#)unistd.h   1.33    95/08/28 SMI"'"\n"
3013
                "extern pid_t getpgid(pid_t);\n"
3014
                "extern int getpgid();";
3015
};
3016
 
3017
 
3018
/*
3019
 *  until Solaris 2.5.1 defines macros for a couple of 
3020
 * functions, breaking their prototypes if that file is included afterwards.
3021
 * Include  early to avoid this issue, as is done on Solaris 2.6
3022
 * and up.
3023
 */
3024
fix = {
3025
    hackname  = solaris_widec;
3026
    files     = widec.h;
3027
    mach      = '*-*-solaris2.[0-5]';
3028
    mach      = '*-*-solaris2.[0-5].*';
3029
    bypass    = "include.*wchar\\.h";
3030
    select    = "#include ";
3031
    c_fix     = format;
3032
    c_fix_arg = "%0\n#include ";
3033
    test_text = "#include ";
3034
};
3035
 
3036
 
3037
/*
3038
 *  a missing semi-colon at the end of the statsswtch structure definition.
3039
 */
3040
fix = {
3041
    hackname  = statsswtch;
3042
    files     = rpcsvc/rstat.h;
3043
    select    = "boottime$";
3044
    c_fix     = format;
3045
    c_fix_arg = "boottime;";
3046
    test_text = "struct statswtch {\n  int boottime\n};";
3047
};
3048
 
3049
 
3050
/*
3051
 *  Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
3052
 *  On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
3053
 *  OK too.
3054
 */
3055
fix = {
3056
    hackname = stdio_stdarg_h;
3057
    files    = stdio.h;
3058
    bypass   = "include.*(stdarg\.h|machine/ansi\.h)";
3059
    /*
3060
     * On Solaris 10, this fix is unncessary;  includes
3061
     * , which includes .
3062
      */
3063
    mach     = '*-*-solaris2.1[0-9]*';
3064
    not_machine = true;
3065
 
3066
    c_fix     = wrap;
3067
 
3068
    c_fix_arg = "#define __need___va_list\n#include \n";
3069
 
3070
    test_text = "";
3071
};
3072
 
3073
 
3074
/*
3075
 *  Don't use or define the name va_list in stdio.h.  This is for
3076
 *  ANSI.  Note _BSD_VA_LIST_ is dealt with elsewhere.  The presence
3077
 *  of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
3078
 *  indicate that the header knows what it's doing -- under SUSv2,
3079
 *  stdio.h is required to define va_list, and we shouldn't break
3080
 *  that.  On IRIX 6.5, internal/wchar_core.h used to get its
3081
 *  definition of va_list from stdio.h.  Since this doesn't happen any
3082
 *  longer, use __gnuc_va_list there, too.
3083
 */
3084
fix = {
3085
    hackname = stdio_va_list;
3086
    files    = stdio.h;
3087
    files    = internal/stdio_core.h;
3088
    files    = internal/wchar_core.h;
3089
    bypass   = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
3090
    /*
3091
     * On Solaris 10, the definition in
3092
     *  is guarded appropriately by the _XPG4 feature macro;
3093
     * there is therefore no need for this fix there.
3094
     */
3095
    mach = '*-*-solaris2.1[0-9]*';
3096
    not_machine = true;
3097
 
3098
    /*
3099
     * Use __gnuc_va_list in arg types in place of va_list.
3100
     * On 386BSD use __gnuc_va_list instead of _VA_LIST_.  On Tru64 UNIX V5.1A
3101
     * use __gnuc_va_list instead of __VA_LIST__.  We're hoping the
3102
     * trailing parentheses and semicolon save all other systems from this.
3103
     * Define __not_va_list__ (something harmless and unused)
3104
     * instead of va_list.
3105
     * Don't claim to have defined va_list.
3106
     */
3107
    sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3108
          "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3109
          "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3110
          "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3111
          "s@ va_list@ __not_va_list__@\n"
3112
          "s@\\*va_list@*__not_va_list__@\n"
3113
          "s@ __va_list)@ __gnuc_va_list)@\n"
3114
          "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3115
           "@typedef \\1 __not_va_list__;@\n"
3116
          "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3117
          "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3118
          "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3119
          "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3120
          "s@VA_LIST@DUMMY_VA_LIST@\n"
3121
          "s@_Va_LIST@_VA_LIST@";
3122
    test_text = "extern void mumble( va_list);";
3123
};
3124
 
3125
 
3126
/*
3127
 *  Fix headers that use va_list from stdio.h to use the updated
3128
 *  va_list from the stdio_va_list change.  Note _BSD_VA_LIST_ is
3129
 *  dealt with elsewhere.  The presence of __gnuc_va_list,
3130
 *  __DJ_va_list, or _G_va_list is taken to indicate that the header
3131
 *  knows what it's doing.
3132
 */
3133
fix = {
3134
    hackname = stdio_va_list_clients;
3135
    files    = com_err.h;
3136
    files    = cps.h;
3137
    files    = curses.h;
3138
    files    = krb5.h;
3139
    files    = lc_core.h;
3140
    files    = pfmt.h;
3141
    files    = wchar.h;
3142
    files    = curses_colr/curses.h;
3143
    bypass   = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
3144
    /* Don't fix, if we use va_list from stdarg.h, or if the use is
3145
       otherwise protected.  */
3146
    bypass   = 'include |#ifdef va_start';
3147
 
3148
    /*
3149
     * Use __gnuc_va_list in arg types in place of va_list.
3150
     * On 386BSD use __gnuc_va_list instead of _VA_LIST_.  On Tru64 UNIX V5.1A
3151
     * use __gnuc_va_list instead of __VA_LIST__.  We're hoping the
3152
     * trailing parentheses and semicolon save all other systems from this.
3153
     * Define __not_va_list__ (something harmless and unused)
3154
     * instead of va_list.
3155
     * Don't claim to have defined va_list.
3156
     */
3157
    sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
3158
          "s@(va_list)&@(__gnuc_va_list)\\&@\n"
3159
          "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
3160
          "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
3161
          "s@ va_list@ __not_va_list__@\n"
3162
          "s@\\*va_list@*__not_va_list__@\n"
3163
          "s@ __va_list)@ __gnuc_va_list)@\n"
3164
          "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
3165
           "@typedef \\1 __not_va_list__;@\n"
3166
          "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
3167
          "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
3168
          "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
3169
          "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
3170
          "s@VA_LIST@DUMMY_VA_LIST@\n"
3171
          "s@_Va_LIST@_VA_LIST@";
3172
    test_text = "extern void mumble( va_list);";
3173
};
3174
 
3175
 
3176
/*
3177
 *  "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
3178
 *  is "!defined( __STRICT_ANSI__ )"
3179
 */
3180
fix = {
3181
    hackname = strict_ansi_not;
3182
    select   = "^([ \t]*#[ \t]*if.*)"
3183
               "(!__STDC__"
3184
               "|__STDC__[ \t]*==[ \t]*0"
3185
               "|__STDC__[ \t]*!=[ \t]*1"
3186
               "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
3187
    /* Tru64 UNIX V4.0F/V5.1  supports GCC usage of __STDC__. */
3188
    bypass = 'GNU and MIPS C compilers define __STDC__ differently';
3189
    /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
3190
       is not defined by GCC, so it is safe.  */
3191
    bypass = '__SCO_VERSION__.*__STDC__ != 1';
3192
    c_test   = stdc_0_in_system_headers;
3193
 
3194
    c_fix     = format;
3195
    c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
3196
 
3197
    test_text = "#if !__STDC__ \n"
3198
                "#if __STDC__ == 0\n"
3199
                "#if __STDC__ != 1\n"
3200
                "#if __STDC__ - 0 == 0"
3201
               "/* not std C */\nint foo;\n"
3202
               "\n#end-end-end-end-if :-)";
3203
};
3204
 
3205
/*
3206
 *  "__STDC__-0==0"
3207
 *  is "!defined( __STRICT_ANSI__ )" on continued #if-s
3208
 */
3209
fix = {
3210
    hackname = strict_ansi_not_ctd;
3211
    files    = math.h, limits.h, stdio.h, signal.h,
3212
               stdlib.h, sys/signal.h, time.h;
3213
    /*
3214
     * Starting at the beginning of a line, skip white space and
3215
     * a leading "(" or "&&" or "||".  One of those must be found.
3216
     * Then, zero, one or more copies of a "defined(_FOO_BAR_) &&"
3217
     * expression.  If these are nested, then they must accumulate
3218
     * because we won't match any closing parentheses.  Finally,
3219
     * after skipping over all that, we must then match our suspect
3220
     * phrase:  "__STDC__-0==0" with or without white space.
3221
     */
3222
    select   = "^([ \t]*" '(\(|&&|\|\|)'
3223
               "([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*"
3224
               "[ \t(]*)"
3225
               "(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)";
3226
    c_test   = stdc_0_in_system_headers;
3227
 
3228
    c_fix     = format;
3229
    c_fix_arg = "%1 !defined(__STRICT_ANSI__)";
3230
 
3231
    test_text = "#if 1 && \\\\\n"
3232
               "&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n"
3233
               "( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n"
3234
               "|| __STDC__ - 0 == 0 ) /* not std C */\n"
3235
               "int foo;\n#endif";
3236
};
3237
 
3238
 
3239
/*
3240
 *  "__STDC__!=0" or "__STDC__==1" or "__STDC__-0==1"
3241
 *  is "defined( __STRICT_ANSI__ )"
3242
 */
3243
fix = {
3244
    hackname = strict_ansi_only;
3245
    select   = "^([ \t]*#[ \t]*if.*)"
3246
               "(__STDC__[ \t]*!=[ \t]*0"
3247
               "|__STDC__[ \t]*==[ \t]*1"
3248
               "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
3249
               "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)";
3250
    c_test   = stdc_0_in_system_headers;
3251
 
3252
    c_fix     = format;
3253
    c_fix_arg = "%1 defined(__STRICT_ANSI__)";
3254
 
3255
    test_text = "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
3256
};
3257
 
3258
 
3259
/*
3260
 *  IRIX 4.0.5  uses struct __file_s
3261
 *  in prototype without previous definition.
3262
 */
3263
fix = {
3264
    hackname  = struct_file;
3265
    files     = rpc/xdr.h;
3266
    select    = '^.*xdrstdio_create.*struct __file_s';
3267
    c_fix     = format;
3268
    c_fix_arg = "struct __file_s;\n%0";
3269
    test_text = "extern void xdrstdio_create( struct __file_s* );";
3270
};
3271
 
3272
 
3273
/*
3274
 *  IRIX 4.0.5  uses struct sockaddr
3275
 *  in prototype without previous definition.
3276
 *
3277
 *  Don't fix OpenBSD, which uses struct sockaddr_in prototyping the same
3278
 *  function, and does define it.
3279
 */
3280
fix = {
3281
    hackname  = struct_sockaddr;
3282
    files     = rpc/auth.h;
3283
    select    = "^.*authdes_create.*struct sockaddr[^_]";
3284
    bypass    = "";
3285
    bypass    = "struct sockaddr;\n";
3286
    c_fix     = format;
3287
    c_fix_arg = "struct sockaddr;\n%0";
3288
    test_text = "extern AUTH* authdes_create( struct sockaddr* );";
3289
};
3290
 
3291
 
3292
/*
3293
 *  Apply fix this to all OSs since this problem seems to effect
3294
 *  more than just SunOS.
3295
 */
3296
fix = {
3297
    hackname = sun_auth_proto;
3298
    files    = rpc/auth.h;
3299
    files    = rpc/clnt.h;
3300
    files    = rpc/svc.h;
3301
    files    = rpc/xdr.h;
3302
    bypass   = "__cplusplus";
3303
    /*
3304
     *  Select those files containing '(*name)()'.
3305
     */
3306
    select    = '\(\*[a-z][a-z_]*\)\(\)';
3307
 
3308
    c_fix     = format;
3309
    c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n"
3310
                "#else\n%1();%2\n#endif";
3311
    c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)';
3312
 
3313
    test_text =
3314
    "struct auth_t {\n"
3315
    "    int (*name)(); /* C++ bad */\n"
3316
    "};";
3317
};
3318
 
3319
 
3320
/*
3321
 *  Fix bogus #ifdef on SunOS 4.1.
3322
 */
3323
fix = {
3324
    hackname  = sun_bogus_ifdef;
3325
    files     = "hsfs/hsfs_spec.h";
3326
    files     = "hsfs/iso_spec.h";
3327
    select    = '#ifdef(.*\|\|.*)';
3328
    c_fix     = format;
3329
    c_fix_arg = "#if%1";
3330
 
3331
    test_text = "#ifdef  __i386__ || __vax__ || __sun4c__";
3332
};
3333
 
3334
 
3335
/*
3336
 *  Fix the CAT macro in SunOS memvar.h.
3337
 */
3338
fix = {
3339
    hackname  = sun_catmacro;
3340
    files     = pixrect/memvar.h;
3341
    select    = "^#define[ \t]+CAT\\(a,b\\).*";
3342
    c_fix     = format;
3343
 
3344
    c_fix_arg =
3345
    "#ifdef __STDC__\n"
3346
    "#  define CAT(a,b) a##b\n"
3347
    "#else\n%0\n#endif";
3348
 
3349
    test_text =
3350
    "#define CAT(a,b)\ta/**/b";
3351
};
3352
 
3353
 
3354
/*
3355
 *  Fix return type of free and {c,m,re}alloc in  on SunOS 4.1.
3356
 *  Also fix return type of {m,re}alloc in  on sysV68
3357
 */
3358
fix = {
3359
    hackname = sun_malloc;
3360
    files    = malloc.h;
3361
    bypass   = "_CLASSIC_ANSI_TYPES";
3362
 
3363
    sed   = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
3364
    sed   = "s/int[ \t][ \t]*free/void\tfree/g";
3365
    sed   = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g";
3366
    sed   = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g";
3367
    sed   = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g";
3368
 
3369
    test_text =
3370
    "typedef char *\tmalloc_t;\n"
3371
    "int \tfree();\n"
3372
    "char*\tmalloc();\n"
3373
    "char*\tcalloc();\n"
3374
    "char*\trealloc();";
3375
};
3376
 
3377
 
3378
/*
3379
 *  Check for yet more missing ';' in struct (in SunOS 4.0.x)
3380
 */
3381
fix = {
3382
    hackname = sun_rusers_semi;
3383
    files    = rpcsvc/rusers.h;
3384
    select   = "_cnt$";
3385
    sed      = "/^struct/,/^};/s/_cnt$/_cnt;/";
3386
    test_text = "struct mumble\n  int _cnt\n};";
3387
};
3388
 
3389
 
3390
/*
3391
 *  signal.h on SunOS defines signal using (),
3392
 *  which causes trouble when compiling with g++ -pedantic.
3393
 */
3394
fix = {
3395
    hackname = sun_signal;
3396
    files    = sys/signal.h;
3397
    files    = signal.h;
3398
    select   = "^void\t" '\(\*signal\(\)\)\(\);.*';
3399
 
3400
    c_fix     = format;
3401
    c_fix_arg =
3402
          "#ifdef __cplusplus\n"
3403
          "void\t(*signal(...))(...);\n"
3404
          "#else\n%0\n#endif";
3405
 
3406
    test_text = "void\t(*signal())();";
3407
};
3408
 
3409
 
3410
/*
3411
 *  Correct the return type for strlen in strings.h in SunOS 4.
3412
 */
3413
fix = {
3414
    hackname = sunos_strlen;
3415
    files    = strings.h;
3416
    select   = "int[ \t]*strlen\\(\\);(.*)";
3417
    c_fix     = format;
3418
    c_fix_arg = "__SIZE_TYPE__ strlen();%1";
3419
    test_text = " int\tstrlen(); /* string length */";
3420
};
3421
 
3422
 
3423
/*
3424
 *  Disable apparent native compiler optimization cruft in SVR4.2 
3425
 *  that is visible to any ANSI compiler using this include.  Simply
3426
 *  delete the lines that #define some string functions to internal forms.
3427
 */
3428
fix = {
3429
    hackname = svr4_disable_opt;
3430
    files    = string.h;
3431
    select   = '#define.*__std_hdr_';
3432
    sed      = '/#define.*__std_hdr_/d';
3433
    test_text = "#define strlen __std_hdr_strlen\n";
3434
};
3435
 
3436
 
3437
/*
3438
 *  Conditionalize some of  on __GNUC__ and __GNUG__.
3439
 *  On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
3440
 *  but we still "hijack" it and redirect it to the GNU byteorder.h..
3441
 */
3442
#ifdef SVR5
3443
fix = {
3444
    hackname = svr4_endian;
3445
    files    = sys/endian.h;
3446
#ifdef LATER
3447
    /*
3448
     * since we emit our own sys/byteorder.h,
3449
     * this fix can never be applied to that file.
3450
     */
3451
    files    = sys/byteorder.h;
3452
#endif
3453
    bypass   = '__GNUC__';
3454
 
3455
    sed      = "/#\tifdef\t__STDC__/i\\\n"
3456
               "#   if !defined (__GNUC__) && !defined (__GNUG__)\n";
3457
 
3458
    sed      = "/#\t\tinclude\t/s/\t\t/   /";
3459
 
3460
    sed      = "/#   include\t/i\\\n"
3461
               "#   endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
3462
};
3463
#endif /* SVR5 */
3464
 
3465
 
3466
/*
3467
 *  Remove useless extern keyword from struct forward declarations
3468
 *  in  and 
3469
 */
3470
#ifdef SVR4
3471
fix = {
3472
    hackname = svr4_extern_struct;
3473
    files    = sys/stream.h;
3474
    files    = sys/strsubr.h;
3475
    select   = 'extern struct [a-z_]*;';
3476
    sed      = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
3477
};
3478
#endif
3479
 
3480
/*
3481
 *  Fix declarations of `ftw' and `nftw' in .  On some/most SVR4
3482
 *  systems the file  contains extern declarations of these
3483
 *  functions followed by explicitly `static' definitions of these
3484
 *  functions... and that's not allowed according to ANSI C.  (Note
3485
 *  however that on Solaris, this header file glitch has been pre-fixed by
3486
 *  Sun.  In the Solaris version of  there are no static
3487
 *  definitions of any function so we don't need to do any of this stuff
3488
 *  when on Solaris.
3489
 */
3490
#ifdef SVR4
3491
#ifndef SOLARIS
3492
fix = {
3493
    hackname = svr4_ftw;
3494
    files    = ftw.h;
3495
    select   = '^extern int ftw\(const';
3496
 
3497
    sed = '/^extern int ftw(const/i' "\\\n"
3498
            "#if !defined(_STYPES)\\\n"
3499
            "static\\\n"
3500
            "#else\\\n"
3501
            "extern\\\n"
3502
            "#endif";
3503
    sed = 's/extern \(int ftw(const.*\)$/\1/';
3504
    sed = "/^extern int nftw/i\\\n"
3505
            "#if defined(_STYPES)\\\n"
3506
            "static\\\n"
3507
            "#else\\\n"
3508
            "extern\\\n"
3509
            "#endif";
3510
    sed = 's/extern \(int nftw.*\)$/\1/';
3511
    sed = "/^extern int ftw(),/c\\\n"
3512
            "#if !defined(_STYPES)\\\n"
3513
            "static\\\n"
3514
            "#else\\\n"
3515
            "extern\\\n"
3516
            "#endif\\\n"
3517
            "  int ftw();\\\n"
3518
            "#if defined(_STYPES)\\\n"
3519
            "static\\\n"
3520
            "#else\\\n"
3521
            "extern\\\n"
3522
            "#endif\\\n"
3523
            "  int nftw();";
3524
};
3525
#endif
3526
#endif
3527
 
3528
 
3529
/*
3530
 *   Fix broken decl of getcwd present on some svr4 systems.
3531
 */
3532
fix = {
3533
    hackname = svr4_getcwd;
3534
    files    = stdlib.h;
3535
    files    = unistd.h;
3536
    files    = prototypes.h;
3537
    select   = 'getcwd\(char \*, int\)';
3538
 
3539
    c_fix     = format;
3540
    c_fix_arg = "getcwd(char *, size_t)";
3541
 
3542
    test_text = "extern char* getcwd(char *, int);";
3543
};
3544
 
3545
 
3546
/*
3547
 *  Wrap some files on System V r4 and DYNIX/ptx systems with
3548
 *  #ifdef _KERNEL, presumably to prevent kernel headers from
3549
 *  leaking into userspace.  This may not be necessary at all,
3550
 *  but it was in the old scripts, so it seems safest to keep it for now.
3551
 */
3552
fix = {
3553
    /* Can't name this with _kernel, or the test case will hit the bypass! */
3554
    hackname = svr4_krnl;
3555
    /* Since I'm rather unsure about the validity of this, limit it
3556
     * to the specific systems it was operating on before.  It should
3557
     * also be bypassed for i?86-*-sysv4.3uw2, by that rule, but I didn't
3558
     * see an easy way to do that.  Hopefully it will be harmless
3559
     * in any case. -- Nathanael */
3560
    mach     = '*-*-sysv4*';
3561
    mach     = 'i?86-sequent-ptx*';
3562
    files    = fs/rfs/rf_cache.h;
3563
    files    = sys/erec.h;
3564
    files    = sys/err.h;
3565
    files    = sys/char.h;
3566
    files    = sys/getpages.h;
3567
    files    = sys/map.h;
3568
    files    = sys/cmn_err.h;
3569
    files    = sys/kdebugger.h;
3570
 
3571
    /* This bypass will match _KERNEL, __KERNEL, __KERNEL__, etc.
3572
     * It will also match SVR4_KERNEL_CHECK, which means that the
3573
     * testsuite case will always be bypassed.  Which is fine with me. */
3574
    bypass   = '_KERNEL';
3575
 
3576
    c_fix     = wrap;
3577
    c_fix_arg = "#ifdef _KERNEL\n";
3578
    c_fix_arg = "#endif /* _KERNEL */\n";
3579
 
3580
    /* There's no reasonable test for this given that we don't know exactly
3581
     * what problem inspired it in the first place. */
3582
    test_text = "";
3583
};
3584
 
3585
 
3586
/*
3587
 *  Delete any #defines of `__i386' which may be present in .  They
3588
 *  tend to conflict with the compiler's own definition of this symbol.  (We
3589
 *  will use the compiler's definition.)
3590
 *  Likewise __sparc, for Solaris, and __i860, and a few others
3591
 *  (guessing it is necessary for all of them).
3592
 */
3593
#ifdef SVR4
3594
fix = {
3595
    hackname = svr4_mach_defines;
3596
    files    = ieeefp.h;
3597
    select   = "#define[ \t]*__(i386|mips|sparc|m88k|m68k)[ \t]";
3598
    sed      = "/#define[ \t]*__\\(i386|mips|sparc|m88k|m68k\\)[ \t]/d";
3599
};
3600
#endif
3601
 
3602
 
3603
/*
3604
 *  Fix declarations of `makedev', `major', and `minor' in .
3605
 *  They are declared as non-static then immediately redeclared as static.
3606
 */
3607
#ifdef SVR5
3608
fix = {
3609
    hackname = svr4_mkdev;
3610
    files    = sys/mkdev.h;
3611
    select   = '^static';
3612
 
3613
    sed      = "/^dev_t makedev(/s/^/static /";
3614
    sed      = "/^major_t major(/s/^/static /";
3615
    sed      = "/^minor_t minor(/s/^/static /";
3616
};
3617
#endif /* SVR5 */
3618
 
3619
 
3620
/*
3621
 *  Fix reference to NC_NPI_RAW in .
3622
 *  Also fix types of array initializers.
3623
 */
3624
#ifdef SVR4
3625
fix = {
3626
    hackname = svr4_netcspace;
3627
    files    = sys/netcspace.h;
3628
    select   = 'NC_NPI_RAW';
3629
    sed      = 's/NC_NPI_RAW/NC_TPI_RAW/g';
3630
    sed      = 's/NC_/(unsigned long) NC_/';
3631
};
3632
#endif
3633
 
3634
/*
3635
 *  Fix reference to NMSZ in .
3636
 */
3637
#ifdef SVR4
3638
fix = {
3639
    hackname = svr4_nmsz;
3640
    files    = sys/adv.h;
3641
    select   = '\[NMSZ\]';
3642
    sed      = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
3643
};
3644
#endif
3645
 
3646
 
3647
/*
3648
 * Some SVR4 systems supposedly use these non-ANSI preprocessor directives.
3649
 */
3650
#ifdef SVR4
3651
fix = {
3652
    hackname  = svr4_preproc_lint_on;
3653
    select    = '#lint\(on\)';
3654
    c_fix     = format;
3655
    c_fix_arg = 'defined(lint)';
3656
    test_text = "#if #lint(on)";
3657
};
3658
fix = {
3659
    hackname  = svr4_preproc_lint_off;
3660
    select    = '#lint\(off\)';
3661
    c_fix     = format;
3662
    c_fix_arg = '!defined(lint)';
3663
    test_text = "#if #lint(off)";
3664
};
3665
fix = {
3666
    hackname  = svr4_preproc_machine;
3667
    select    = '#(machine|system|cpu)\(([^)]*)\)';
3668
    c_fix     = format;
3669
    c_fix_arg = 'defined(__%1__)';
3670
    test_text = "#if #machine(i386) || #system(vax) || #cpu(sparc)";
3671
};
3672
#endif
3673
 
3674
 
3675
/*
3676
 *   Fix broken decl of profil present on some svr4 systems.
3677
 */
3678
fix = {
3679
    hackname = svr4_profil;
3680
    files    = stdlib.h;
3681
    files    = unistd.h;
3682
 
3683
    select    =
3684
    'profil\(unsigned short \*, unsigned int, unsigned int, unsigned int\)';
3685
    /* The fix is wrong on IRIX 5/6 and creates a conflict with another
3686
       prototype in .  */
3687
    bypass    = 'Silicon Graphics';
3688
    c_fix     = format;
3689
    c_fix_arg = 'profil(unsigned short *, size_t, int, unsigned int)';
3690
 
3691
    test_text =
3692
    'profil(unsigned short *, unsigned int, unsigned int, unsigned int);';
3693
};
3694
 
3695
 
3696
/*
3697
 *  Convert functions to prototype form, and fix arg names in .
3698
 */
3699
#ifdef SVR4
3700
fix = {
3701
    hackname = svr4_proto_form;
3702
    files    = sys/stat.h;
3703
    select   = 'const extern';
3704
 
3705
    sed      = "/^stat([ \t]*[^c]/ {\nN\nN\n"
3706
                   "s/(.*)\\n/( /\n"
3707
                   "s/;\\n/, /\n"
3708
                   "s/;$/)/\n"  "}";
3709
 
3710
    sed      = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
3711
                   "s/(.*)\\n/( /\n"
3712
                   "s/;\\n/, /\n"
3713
                   "s/;$/)/\n"  "}";
3714
 
3715
    sed      = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
3716
                   "s/(.*)\\n/( /\n"
3717
                   "s/;\\n/, /\n"
3718
                   "s/;$/)/\n"  "}";
3719
 
3720
    sed      = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
3721
                   "s/(.*)\\n/( /\n"
3722
                   "s/;\\n/, /g\n"
3723
                   "s/;$/)/\n"  "}";
3724
 
3725
    sed      = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
3726
    sed      = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
3727
    sed      = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
3728
    sed      = "1,$s/ret\\([^u]\\)/__ret\\1/g";
3729
    sed      = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
3730
    sed      = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
3731
};
3732
#endif
3733
 
3734
/*
3735
 *  Add a prototyped declaration of mmap to .
3736
 */
3737
#ifdef SVR4
3738
fix = {
3739
    hackname = svr4_proto_mmap;
3740
    files    = sys/mman.h;
3741
    select   = '^extern caddr_t mmap();$';
3742
    sed = '/^extern caddr_t mmap();$/c' "\\\n"
3743
          "#ifdef __STDC__\\\n"
3744
          "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
3745
          "#else /* !defined(__STDC__) */\\\n"
3746
          "extern caddr_t mmap ();\\\n"
3747
          "#endif /* !defined(__STDC__) */\\\n";
3748
};
3749
#endif
3750
 
3751
/*
3752
 *  Add a #define of _SIGACTION_ into .
3753
 */
3754
#ifdef SVR4
3755
fix = {
3756
    hackname = svr4_sigaction;
3757
    files    = sys/signal.h;
3758
    sed      = "/^struct sigaction {/i\\\n"
3759
               "#define _SIGACTION_";
3760
    sed      = 's/(void *(\*)())/(void (*)(int))/';
3761
};
3762
#endif
3763
 
3764
 
3765
/*
3766
 * Correct types for signal handler constants like SIG_DFL; they might be
3767
 * void (*) (), and should be void (*) (int).  C++ doesn't like the
3768
 * old style.
3769
 */
3770
fix = {
3771
    hackname = svr4_sighandler_type;
3772
    files = sys/signal.h;
3773
    select = 'void *\(\*\)\(\)';
3774
    c_fix = format;
3775
    c_fix_arg = "void (*)(int)";
3776
    test_text = "#define SIG_DFL (void(*)())0\n"
3777
                "#define SIG_IGN (void (*)())0\n";
3778
};
3779
 
3780
/*
3781
 *  Put storage class at start of decl, to avoid warning.
3782
 */
3783
#ifdef SVR4
3784
fix = {
3785
    hackname = svr4_storage_class;
3786
    files    = rpc/types.h;
3787
    select   = 'const extern';
3788
    sed      = 's/const extern/extern const/g';
3789
};
3790
#endif
3791
 
3792
 
3793
/*
3794
 *  Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local
3795
 *  function 'getrnge' in  before they declare it.  For these
3796
 *  systems add a 'static int' declaration of 'getrnge' into 
3797
 *  early on.
3798
 *
3799
 *  'getrnge' traditionally manipulates a file-scope global called 'size',
3800
 *  so put the declaration right after the declaration of 'size'.
3801
 *
3802
 *  Don't do this if there is already a `static void getrnge' declaration
3803
 *  present, since this would cause a redeclaration error.  Solaris 2.x has
3804
 *  such a declaration.
3805
 */
3806
fix = {
3807
    hackname  = svr4_undeclared_getrnge;
3808
    files     = regexp.h;
3809
    select    = "getrnge";
3810
    bypass    = "static void getrnge";
3811
    c_fix     = format;
3812
    c_fix_arg = "%0\n"
3813
                "static int getrnge ();";
3814
    c_fix_arg = "^static int[ \t]+size;";
3815
    test_text = "static int size;\n"
3816
                "/* stuff which calls getrnge() */\n"
3817
                "static getrnge()\n"
3818
                "{}";
3819
};
3820
 
3821
 
3822
/*
3823
 *  Like svr4_mach_defines, but with newfangled syntax.
3824
 *  Source lines are of #define __i386 #machine(i386).   Delete them.
3825
 */
3826
#ifdef SVR5
3827
fix = {
3828
    hackname = svr5_mach_defines;
3829
    files    = ieeefp.h;
3830
    select   = "#define[ \t]*__i386.*\(i386\)";
3831
    sed      = "/#define[ \t]*__i386.*/d";
3832
};
3833
#endif /*  SVR5 */
3834
 
3835
 
3836
/*
3837
 *  Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
3838
 *  in string.h on sysV68
3839
 *  Correct the return type for strlen in string.h on Lynx.
3840
 *  Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
3841
 *  Add missing const for strdup on OSF/1 V3.0.
3842
 *  On sysV88 layout is slightly different.
3843
 */
3844
fix = {
3845
    hackname = sysv68_string;
3846
    files    = testing.h;
3847
    files    = string.h;
3848
    bypass   = "_CLASSIC_ANSI_TYPES";
3849
 
3850
    sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
3851
    sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
3852
    sed = "s/strdup(char \\*s1);/strdup(const char *s1);/";
3853
 
3854
    sed = "/^extern char$/N";
3855
    sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/";
3856
 
3857
    sed = "/^extern int$/N";
3858
    sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/";
3859
 
3860
    sed = "/^\tstrncmp(),$/N";
3861
    sed = 's/^\(' "\t" 'strncmp()\),\n\(' "\t" 'strlen(),\)$/'
3862
            '\1;' "\\\nextern unsigned int\\\n\\2/";
3863
 
3864
    test_text =
3865
    "extern int strlen();\n"
3866
 
3867
    "extern int ffs(long);\n"
3868
 
3869
    "extern char\n"
3870
    "\t*memccpy(),\n"
3871
    "\tmemcpy();\n"
3872
 
3873
    "extern int\n"
3874
    "\tstrcmp(),\n"
3875
    "\tstrncmp(),\n"
3876
    "\tstrlen(),\n"
3877
    "\tstrspn();\n"
3878
 
3879
    "extern int\n"
3880
    "\tstrlen(), strspn();";
3881
};
3882
 
3883
 
3884
/*
3885
 *  Fix return type of calloc, malloc, realloc, bsearch and exit
3886
 */
3887
fix = {
3888
    hackname = sysz_stdlib_for_sun;
3889
    files    = stdlib.h;
3890
    bypass   = "_CLASSIC_ANSI_TYPES";
3891
 
3892
    select    = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
3893
    c_fix     = format;
3894
    c_fix_arg = "void *\t%1(";
3895
 
3896
    test_text =
3897
    "extern char*\tcalloc(size_t);\n"
3898
    "extern char*\tmalloc(size_t);\n"
3899
    "extern char*\trealloc(void*,size_t);\n"
3900
    "extern char*\tbsearch(void*,size_t,size_t);\n";
3901
};
3902
 
3903
 
3904
/*
3905
 * __thread is now a keyword.
3906
 */
3907
fix = {
3908
    hackname  = thread_keyword;
3909
    files     = "pthread.h";
3910
    files     = "bits/sigthread.h";
3911
    select    = "([* ])__thread([,)])";
3912
    c_fix     = format;
3913
    c_fix_arg = "%1__thr%2";
3914
 
3915
    test_text =
3916
        "extern int pthread_create (pthread_t *__restrict __thread,\n"
3917
        "extern int pthread_kill (pthread_t __thread, int __signo);\n"
3918
        "extern int pthread_cancel (pthread_t __thread);";
3919
};
3920
 
3921
/*
3922
 *  if the #if says _cplusplus, not the double underscore __cplusplus
3923
 *  that it should be
3924
 */
3925
fix = {
3926
    hackname = tinfo_cplusplus;
3927
    files    = tinfo.h;
3928
    select   = "[ \t]_cplusplus";
3929
 
3930
    c_fix     = format;
3931
    c_fix_arg = " __cplusplus";
3932
    test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
3933
};
3934
 
3935
 
3936
/*
3937
 *  function parameter to atexit is missing "void" on VAX Ultrix 4.3.
3938
 */
3939
fix = {
3940
    hackname = ultrix_atexit_param;
3941
    files    = stdlib.h;
3942
    select   = 'atexit\(.*\(\)';
3943
 
3944
    c_fix     = format;
3945
    c_fix_arg = "atexit( void (*__func)( void )";
3946
 
3947
    test_text = "int atexit( void (*__func)() );\n";
3948
};
3949
 
3950
 
3951
/*
3952
 *  parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
3953
 */
3954
fix = {
3955
    hackname = ultrix_atof_param;
3956
    files    = math.h;
3957
    select   = "atof\\([ \t]*char";
3958
 
3959
    c_fix     = format;
3960
    c_fix_arg = "atof(const char";
3961
 
3962
    test_text = "extern double atof( char *__nptr);\n";
3963
};
3964
 
3965
 
3966
/*
3967
 *  parameters not const on DECstation Ultrix V4.0 and OSF/1.
3968
 */
3969
fix = {
3970
    hackname  = ultrix_const;
3971
    files     = stdio.h;
3972
    select    = 'perror\( char \*';
3973
 
3974
    c_fix     = format;
3975
    c_fix_arg = "%1 const %3 *__";
3976
    c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
3977
                "[ \t]+(char|void) \\*__";
3978
 
3979
    test_text =
3980
    "extern void perror( char *__s );\n"
3981
    "extern int fputs( char *__s, FILE *);\n"
3982
    "extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
3983
    "extern int fscanf( FILE *__stream, char *__format, ...);\n"
3984
    "extern int scanf( char *__format, ...);\n";
3985
};
3986
 
3987
 
3988
/*
3989
 *  parameters not const on DECstation Ultrix V4.0 and OSF/1.
3990
 */
3991
fix = {
3992
    hackname  = ultrix_const2;
3993
    files     = stdio.h;
3994
 
3995
    select    = '\*fopen\( char \*';
3996
    c_fix     = format;
3997
    c_fix_arg = "%1( const char *%3, const char *";
3998
    c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
3999
               "[ \t]*char[ \t]*\\*([^,]*),"
4000
               "[ \t]*char[ \t]*\\*[ \t]*";
4001
 
4002
    test_text =
4003
    "extern FILE *fopen( char *__filename, char *__type );\n"
4004
    "extern int sscanf( char *__s, char *__format, ...);\n"
4005
    "extern FILE *popen(char *, char *);\n"
4006
    "extern char *tempnam(char*,char*);\n";
4007
};
4008
 
4009
 
4010
/*
4011
 *  parameters not const on Ultrix V4.3.
4012
 */
4013
fix = {
4014
    hackname  = ultrix_const3;
4015
    files     = stdio.h;
4016
    select    = 'fdopen\( .*, char \*';
4017
 
4018
    c_fix     = format;
4019
    c_fix_arg = "%1 const %3 *__";
4020
    c_fix_arg = "([ \t*](fdopen)\\(.*)"
4021
                "[ \t]+(char|void) \\*__";
4022
 
4023
    test_text =
4024
    "extern FILE *      fdopen( int __filedes, char *__type );\n";
4025
};
4026
 
4027
 
4028
/*
4029
 * Ultrix V4.[35] puts the declaration of uname before the definition
4030
 * of struct utsname, so the prototype (added by fixproto) causes havoc.
4031
 */
4032
fix = {
4033
    hackname = ultrix_fix_fixproto;
4034
    files    = sys/utsname.h;
4035
    select   = ULTRIX;
4036
 
4037
    c_fix     = format;
4038
    c_fix_arg = "struct utsname;\n%0";
4039
    c_fix_arg = "^[ \t]*extern[ \t]*int[ \t]*uname\\(\\);";
4040
 
4041
    test_text =
4042
    "/* ULTRIX's uname */\nextern\tint\tuname();";
4043
};
4044
 
4045
 
4046
/*
4047
 *  Check for bad #ifdef line (in Ultrix 4.1)
4048
 */
4049
fix = {
4050
    hackname = ultrix_ifdef;
4051
    select   = "^#ifdef KERNEL[ \t]+&&";
4052
    files    = sys/file.h;
4053
 
4054
    c_fix     = format;
4055
    c_fix_arg = "#if defined(KERNEL) &&";
4056
 
4057
    test_text =
4058
    "#ifdef KERNEL\t&& defined( mumbojumbo )\nint oops;\n#endif";
4059
};
4060
 
4061
 
4062
/*
4063
 *  Add once-only latch to Ultrix V4.3 locale.h.
4064
 */
4065
fix = {
4066
    hackname = ultrix_locale;
4067
    files  = locale.h;
4068
    select = "@\\(#\\)locale\\.h.*6\\.1.*\\(ULTRIX\\)";
4069
    c_fix  = wrap;
4070
    test_text =
4071
    "@(#)locale.h   6.1     (ULTRIX)\n";
4072
};
4073
 
4074
 
4075
/*
4076
 * Strip "|| CC$gfloat" from Ultrix math headers.
4077
 */
4078
fix = {
4079
    hackname  = ultrix_math_ifdef;
4080
    files     = sys/limits.h;
4081
    files     = float.h;
4082
    files     = math.h;
4083
    select    = "^(#if.*)\\|\\|[ \t]+CC\\$[a-z]+";
4084
    c_fix     = format;
4085
    c_fix_arg = "%1";
4086
 
4087
    test_text = '#if     defined(__GFLOAT) || CC\$gfloat';
4088
};
4089
 
4090
 
4091
/*
4092
 *  Avoid nested comments on Ultrix 4.3.
4093
 */
4094
fix = {
4095
    hackname = ultrix_nested_ioctl;
4096
    files    = sys/ioctl.h;
4097
    select   = "^/\\* #define SIOCSCREEN";
4098
    sed      = "/^\\/\\* #define SIOCSCREEN/s@/\\* screend@*//* screend@";
4099
    test_text =
4100
    "/* #define SIOCSCREENON _IOWR('i', 49, int)"
4101
    "/* screend, net/gw_screen.h */\n";
4102
};
4103
 
4104
 
4105
fix = {
4106
    hackname = ultrix_nested_svc;
4107
    files    = rpc/svc.h;
4108
    select   = "^ \\*[ \t]*int protocol;  */\\*";
4109
    sed      = "s@^\\( \\*\tint protocol;  \\)/\\*@\\1*/ /*@";
4110
    test_text =
4111
    " *\tint protocol;  /* like TCP or UDP\n";
4112
};
4113
 
4114
 
4115
/*
4116
 *  Add missing prototype for lstat and define for S_ISLNK
4117
 *  in Ultrix V4.3 sys/stat.h.
4118
 */
4119
fix = {
4120
    hackname = ultrix_stat;
4121
    files  = sys/stat.h;
4122
    select = "@\\(#\\)stat\\.h.*6\\.1.*\\(ULTRIX\\)";
4123
    sed    = "/^#define[ \t]S_IFPORT[ \t]*S_IFIFO$/a\\\n"
4124
                "\\\n"
4125
                "/* macro to test for symbolic link */\\\n"
4126
                "#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)\\\n"
4127
                "\n";
4128
    sed    = "/^[ \t]*fstat(),$/a\\\n"
4129
                "\tlstat(),\n";
4130
    test_text =
4131
    "@(#)stat.h      6.1     (ULTRIX)\n"
4132
    "#define S_IFPORT S_IFIFO\n"
4133
    "\tfstat(),\n/* THE INSERTION LINE FAILS ON BSD SYSTEMS */";
4134
};
4135
 
4136
 
4137
/*
4138
 *  Check for superfluous `static' (in Ultrix 4.2)
4139
 *  On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
4140
 */
4141
fix = {
4142
    hackname = ultrix_static;
4143
    files  = machine/cpu.h;
4144
    select = '#include "r[34]_cpu';
4145
    sed    = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
4146
    sed    = 's/^#include "r3_cpu\.h"$/#include /';
4147
    sed    = 's/^#include "r4_cpu\.h"$/#include /';
4148
    test_text =
4149
    "static struct tlb_pid_state {\n"
4150
    "#include \"r3_cpu.h\"\n";
4151
};
4152
 
4153
 
4154
/*
4155
 *  Add missing declarations to Ultrix V4.3 stdlib.h.
4156
 */
4157
fix = {
4158
    hackname = ultrix_stdlib;
4159
    files  = stdlib.h;
4160
    select = "@\\(#\\)stdlib\\.h.*6\\.1.*\\(ULTRIX\\)";
4161
 
4162
    sed    = "/^char.*getenv( const char .* );.*$/a\\\n"
4163
    "int\t\tsetenv( const char *__name, const char *__val, int __ovrwrt );\\\n"
4164
    "void\t\tunsetenv( const char *__name );\\\n"
4165
    "int\t\tputenv( char *__s );\n";
4166
 
4167
    sed    = "/^char.*getenv();.*$/a\\\n"
4168
    "int\tsetenv();\\\n"
4169
    "void\tunsetenv();\\\n"
4170
    "int\tputenv();\n";
4171
 
4172
    test_text =
4173
    "@(#)stdlib.h      6.1     (ULTRIX)\n"
4174
    "char *             getenv( const char *__name );\n"
4175
    "char       *getenv();\n";
4176
};
4177
 
4178
 
4179
/*
4180
 *  Add once-only latch to Ultrix V4.3 strings.h.
4181
 */
4182
fix = {
4183
    hackname = ultrix_strings;
4184
    files  = strings.h;
4185
    select = "@\\(#\\)strings\\.h.*6\\.1.*\\(ULTRIX\\)";
4186
    c_fix  = wrap;
4187
    test_text =
4188
    "@(#)strings.h   6.1     (ULTRIX)\n";
4189
};
4190
 
4191
 
4192
/*
4193
 *  Add missing declarations to Ultrix V4.3 strings.h.
4194
 */
4195
fix = {
4196
    hackname = ultrix_strings2;
4197
    files  = strings.h;
4198
    select = "@\\(#\\)strings\\.h.*6\\.1.*\\(ULTRIX\\)";
4199
 
4200
    sed    = "/^.*strncmp( const .* );.*/a\\\n"
4201
    "\\\n"
4202
    "extern int\\\n"
4203
    "\tstrcasecmp( const char *__s1, const char *__s2),\\\n"
4204
    "\tstrncasecmp( const char *__s1, const char *__s2, size_t __n );\n";
4205
 
4206
    sed    = "/^.*strncmp();.*/a\\\n"
4207
    "extern int\\\n"
4208
    "\tstrcasecmp(),\\\n"
4209
    "\tstrncasecmp();\n";
4210
 
4211
    test_text =
4212
    "@(#)strings.h      6.1     (ULTRIX)\n"
4213
    "\tstrncmp( const char *__s1, const char *__s2, size_t __n );\n"
4214
    "\tstrncmp();\n";
4215
};
4216
 
4217
 
4218
/*
4219
 *  Add missing declarations to Ultrix V4.3 sys/time.h.
4220
 */
4221
fix = {
4222
    hackname = ultrix_sys_time;
4223
    files  = sys/time.h;
4224
    select = "@\\(#\\)time\\.h.*6\\.1.*\\(ULTRIX\\)";
4225
 
4226
    sed    = "/^extern.*time_t.*time( time_t .* );.*$/a\\\n"
4227
    "\\\n"
4228
    "extern int adjtime(struct timeval *, struct timeval *);\\\n"
4229
    "extern int getitimer(int, struct itimerval *);\\\n"
4230
    "extern int setitimer(int, struct itimerval *, struct itimerval *);\\\n"
4231
    "extern int gettimeofday(struct timeval *, struct timezone *);\\\n"
4232
    "extern int settimeofday(struct timeval *, struct timezone *);\\\n"
4233
    "extern void profil(const void *, size_t, size_t, unsigned int);\\\n"
4234
    "extern int stime(const time_t *);\\\n"
4235
    "extern int utimes(const char *, const struct timeval[2]);\\\n"
4236
    "extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);\n";
4237
 
4238
    sed    = "/^extern.*double.*difftime();.*$/a\\\n"
4239
    "extern\tint adjtime();\\\n"
4240
    "extern\tint getitimer();\\\n"
4241
    "extern\tint setitimer();\\\n"
4242
    "extern\tint gettimeofday();\\\n"
4243
    "extern\tint settimeofday();\\\n"
4244
    "extern\tvoid profil();\\\n"
4245
    "extern\tint stime();\\\n"
4246
    "extern\tint utimes();\\\n"
4247
    "extern\tint select();\n";
4248
 
4249
    test_text =
4250
    "@(#)time.h      6.1     (ULTRIX)\n"
4251
    "extern time_t              time( time_t *__tloc );\n"
4252
    "extern double difftime();\n";
4253
};
4254
 
4255
 
4256
/*
4257
 *  Add missing declarations to Ultrix V4.3 unistd.h.
4258
 */
4259
fix = {
4260
    hackname = ultrix_unistd;
4261
    files  = unistd.h;
4262
    select = "@\\(#\\)unistd\\.h.*6\\.1.*\\(ULTRIX\\)";
4263
 
4264
    sed    = "/^[ \t]*getgroups(),.*$/a\\\n"
4265
    "\tgetpagesize(),\n";
4266
 
4267
    sed    = "/^[ \t]*fork(),.*$/a\\\n"
4268
    "\tvfork(),\n";
4269
 
4270
    test_text =
4271
    "@(#)unistd.h      6.1     (ULTRIX)\n"
4272
    "\tgetgroups(),\n"
4273
    "\tfork(),\n";
4274
};
4275
 
4276
 
4277
/*
4278
 * On Cray Unicos/Mk some standard headers use the C99 keyword "restrict"
4279
 * which must be replaced by __restrict__ for GCC.
4280
 */
4281
fix = {
4282
    hackname = unicosmk_restrict;
4283
    files    = stdio.h;
4284
    files    = stdlib.h;
4285
    files    = wchar.h;
4286
    mach     = "*-*-unicosmk*";
4287
    select   = "(\\*[ \t]*)restrict([ \t]+)";
4288
 
4289
    c_fix     = format;
4290
    c_fix_arg = "%1__restrict__%2";
4291
 
4292
    test_text = "void f (char * restrict x);";
4293
};
4294
 
4295
/*
4296
 * If arpa/inet.h prototypes are incompatible with the ones we just
4297
 * installed in , just remove the protos.
4298
 * Because of this close association, this patch must be applied only
4299
 * on those systems where the replacement byteorder header is installed.
4300
 */
4301
fix = {
4302
    hackname = uw7_byteorder_fix;
4303
    files    = arpa/inet.h;
4304
    select   = "in_port_t";
4305
    test     = "-f sys/byteorder.h";
4306
#ifndef SVR5
4307
        mach = "*-*-sysv4*";
4308
        mach = "i?86-*-sysv5*";
4309
        mach = "i?86-*-udk*";
4310
        mach = "i?86-*-solaris2.[0-4]";
4311
        mach = "powerpcle-*-solaris2.[0-4]";
4312
        mach = "sparc-*-solaris2.[0-4]";
4313
#endif /* SVR5 */
4314
 
4315
    c_fix     = format;
4316
    c_fix_arg = "";
4317
    c_fix_arg = "^extern.*[ \t](htons|ntohs).*\\(in_port_t\\).*;";
4318
 
4319
    test_text = "extern in_port_t\thtons __P((in_port_t));\n"
4320
                "extern in_port_t\tntohs __P((in_port_t));"
4321
                "`[ ! -d $DESTDIR/sys ] && mkdir $DESTDIR/sys\n"
4322
                "echo '/* DUMMY */' >> sys/byteorder.h`";
4323
};
4324
 
4325
 
4326
/*
4327
 *  Fix definitions of macros used by va-i960.h in VxWorks header file.
4328
 */
4329
fix = {
4330
    hackname  = va_i960_macro;
4331
    files     = arch/i960/archI960.h;
4332
    select    = "__(vsiz|vali|vpad|alignof__)";
4333
 
4334
    c_fix     = format;
4335
    c_fix_arg = "__vx%1";
4336
 
4337
    test_text =
4338
    "extern int __vsiz vsiz;\n"
4339
    "extern int __vali vali;\n"
4340
    "extern int __vpad vpad;\n"
4341
    "#define __alignof__(x) ...";
4342
};
4343
 
4344
 
4345
/*
4346
 *  AIX and Interix headers define NULL to be cast to a void pointer,
4347
 *  which is illegal in ANSI C++.
4348
 */
4349
fix = {
4350
    hackname  = void_null;
4351
    files     = curses.h;
4352
    files     = dbm.h;
4353
    files     = locale.h;
4354
    files     = stdio.h;
4355
    files     = stdlib.h;
4356
    files     = string.h;
4357
    files     = time.h;
4358
    files     = unistd.h;
4359
    files     = sys/dir.h;
4360
    files     = sys/param.h;
4361
    files     = sys/types.h;
4362
    /* avoid changing C++ friendly NULL */
4363
    bypass    = __cplusplus;
4364
    select    = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
4365
    c_fix     = format;
4366
    c_fix_arg = "#define NULL 0";
4367
    test_text = "# define\tNULL \t((void *)0)  /* typed NULL */";
4368
};
4369
 
4370
 
4371
/*
4372
 *  Make VxWorks header which is almost gcc ready fully gcc ready.
4373
 */
4374
fix = {
4375
    hackname = vxworks_gcc_problem;
4376
    files    = types/vxTypesBase.h;
4377
    select   = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__";
4378
 
4379
    sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/"
4380
          "#if 1/";
4381
 
4382
    sed = "/[ \t]size_t/i\\\n"
4383
        "#ifndef _GCC_SIZE_T\\\n"
4384
        "#define _GCC_SIZE_T\n";
4385
 
4386
    sed = "/[ \t]size_t/a\\\n"
4387
        "#endif\n";
4388
 
4389
    sed = "/[ \t]ptrdiff_t/i\\\n"
4390
        "#ifndef _GCC_PTRDIFF_T\\\n"
4391
        "#define _GCC_PTRDIFF_T\n";
4392
 
4393
    sed = "/[ \t]ptrdiff_t/a\\\n"
4394
        "#endif\n";
4395
 
4396
    sed = "/[ \t]wchar_t/i\\\n"
4397
        "#ifndef _GCC_WCHAR_T\\\n"
4398
        "#define _GCC_WCHAR_T\n";
4399
 
4400
    sed = "/[ \t]wchar_t/a\\\n"
4401
        "#endif\n";
4402
 
4403
    test_text =
4404
    "#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
4405
    "typedef unsigned int size_t;\n"
4406
    "typedef long ptrdiff_t;\n"
4407
    "typedef unsigned short wchar_t;\n"
4408
    "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
4409
};
4410
 
4411
 
4412
/*
4413
 *  Fix VxWorks  to not require including .
4414
 */
4415
fix = {
4416
    hackname  = vxworks_needs_vxtypes;
4417
    files     = time.h;
4418
    select    = "uint_t([ \t]+_clocks_per_sec)";
4419
    c_fix     = format;
4420
    c_fix_arg = "unsigned int%1";
4421
    test_text = "uint_t\t_clocks_per_sec;";
4422
};
4423
 
4424
 
4425
/*
4426
 *  Fix VxWorks  to not require including .
4427
 */
4428
fix = {
4429
    hackname = vxworks_needs_vxworks;
4430
    files    = sys/stat.h;
4431
    test     = " -r types/vxTypesOld.h";
4432
    test     = " -n \"`egrep '#include' $file`\"";
4433
    test     = " -n \"`egrep ULONG $file`\"";
4434
    select   = "#[ \t]define[ \t]+__INCstath";
4435
 
4436
    sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
4437
          "#include \n";
4438
 
4439
    test_text = "`touch types/vxTypesOld.h`"
4440
    "#include  /* ULONG */\n"
4441
    "# define\t__INCstath ";
4442
};
4443
 
4444
 
4445
/*
4446
 *  Another bad dependency in VxWorks 5.2 .
4447
 */
4448
fix = {
4449
    hackname = vxworks_time;
4450
    files    = time.h;
4451
    test     = " -r vxWorks.h";
4452
 
4453
    select    = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
4454
    c_fix     = format;
4455
 
4456
    c_fix_arg =
4457
    "#ifndef __gcc_VOIDFUNCPTR_defined\n"
4458
    "#ifdef __cplusplus\n"
4459
    "typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
4460
    "#else\n"
4461
    "typedef void (*__gcc_VOIDFUNCPTR) ();\n"
4462
    "#endif\n"
4463
    "#define __gcc_VOIDFUNCPTR_defined\n"
4464
    "#endif\n"
4465
    "#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
4466
 
4467
    test_text = "`touch vxWorks.h`"
4468
                "#define VOIDFUNCPTR (void(*)())";
4469
};
4470
 
4471
 
4472
/*
4473
 * WindISS math.h headers include bogus extern declarations of
4474
 * numerous math functions that conflict with libstdc++-v3.
4475
 */
4476
fix = {
4477
    hackname  = windiss_math1;
4478
    files     = math.h;
4479
    mach      = "*-*-windiss";
4480
    sed       = "s|inline long double cosl.*|#ifndef __GNUC__|";
4481
 
4482
    test_text = "inline long double cosl(long double);";
4483
};
4484
 
4485
fix = {
4486
    hackname  = windiss_math2;
4487
    files     = math.h;
4488
    mach      = "*-*-windiss";
4489
    sed       = "s|/\\* long double declarations \\*/|"
4490
                  "#endif /* __GNUC__ */|";
4491
 
4492
    test_text = "/* long double declarations */";
4493
};
4494
 
4495
/*
4496
 * WindISS headers include "diab/va_list.h" instead of "stdarg.h"
4497
 */
4498
fix = {
4499
    select    = '(#include.*)diab/va_list.h';
4500
    hackname  = windiss_valist;
4501
    sed       = "s|diab/va_list.h|stdarg.h|";
4502
    mach      = "*-*-windiss";
4503
 
4504
    test_text = "#include ";
4505
};
4506
 
4507
/*
4508
 *  There are several name conflicts with C++ reserved words in X11 header
4509
 *  files.  These are fixed in some versions, so don't do the fixes if
4510
 *  we find __cplusplus in the file.  These were found on the RS/6000.
4511
 */
4512
fix = {
4513
    hackname  = x11_class;
4514
    files     = X11/ShellP.h;
4515
    bypass    = __cplusplus;
4516
    select    = "^([ \t]*char \\*)class;(.*)";
4517
    c_fix     = format;
4518
    c_fix_arg = "#ifdef __cplusplus\n%1c_class;%2\n"
4519
                "#else\n%1class;%2\n#endif";
4520
    test_text =
4521
    "struct {\n"
4522
    "   char *class;\n"
4523
    "} mumble;\n";
4524
};
4525
 
4526
 
4527
/*
4528
 *  class in Xm/BaseClassI.h
4529
 */
4530
fix = {
4531
    hackname = x11_class_usage;
4532
    files    = Xm/BaseClassI.h;
4533
    bypass   = "__cplusplus";
4534
 
4535
    select    = " class\\)";
4536
    c_fix     = format;
4537
    c_fix_arg = " c_class)";
4538
 
4539
    test_text = "extern mumble (int  class);\n";
4540
};
4541
 
4542
 
4543
/*
4544
 *  new in Xm/Traversal.h
4545
 */
4546
fix = {
4547
    hackname = x11_new;
4548
    files    = Xm/Traversal.h;
4549
    bypass   = __cplusplus;
4550
 
4551
    sed      = "/Widget\told, new;/i\\\n"
4552
                   "#ifdef __cplusplus\\\n"
4553
                   "\tWidget\told, c_new;\\\n"
4554
                   "#else\n";
4555
 
4556
    sed      = "/Widget\told, new;/a\\\n"
4557
                   "#endif\n";
4558
 
4559
    sed      = "s/Widget new,/Widget c_new,/g";
4560
    test_text =
4561
    "struct wedge {\n"
4562
    "   Widget\told, new; /* fixinc check FAILS ON BSD */\n"
4563
    "};\nextern Wedged( Widget new, Widget old );";
4564
};
4565
 
4566
 
4567
/*
4568
 *  Incorrect sprintf declaration in X11/Xmu.h
4569
 */
4570
fix = {
4571
    hackname = x11_sprintf;
4572
    files    = X11/Xmu.h;
4573
    files    = X11/Xmu/Xmu.h;
4574
    select   = "^extern char \\*\tsprintf\\(\\);$";
4575
 
4576
    c_fix     = format;
4577
    c_fix_arg = "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
4578
 
4579
    test_text = "extern char *\tsprintf();";
4580
};
4581
 
4582
/*EOF*/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.