| 1 |
/* -*- 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[ \t]*=[ \t]*(.*);' |
| 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 |
/* On AIX when _LARGE_FILES is defined stdio.h defines fopen to |
| 24 |
* fopen64 etc. and this causes problems when building with g++ |
| 25 |
* because cstdio udefs everything from stdio.h, leaving us with |
| 26 |
* ::fopen has not been declared errors. This fixes stdio.h to |
| 27 |
* undef those defines and use __asm__ to alias the symbols if |
| 28 |
* building with g++ and -D_LARGE_FILES |
| 29 |
*/ |
| 30 |
fix = { |
| 31 |
hackname = AAB_aix_stdio; |
| 32 |
files = stdio.h; |
| 33 |
select = "define fopen fopen64"; |
| 34 |
mach = "*-*-aix*"; |
| 35 |
test-text = ''; /* no way to test */ |
| 36 |
|
| 37 |
c_fix = wrap; |
| 38 |
|
| 39 |
c_fix_arg = ""; |
| 40 |
|
| 41 |
c_fix_arg = <<- _EOArg_ |
| 42 |
|
| 43 |
#if defined __GNUG__ && defined _LARGE_FILES && defined __cplusplus |
| 44 |
#define __need__aix_stdio_h_fix |
| 45 |
#ifdef __need__aix_stdio_h_fix |
| 46 |
#undef fseeko |
| 47 |
#undef ftello |
| 48 |
#undef fgetpos |
| 49 |
#undef fsetpos |
| 50 |
#undef fopen |
| 51 |
#undef freopen |
| 52 |
/* Alias the symbols using asm */ |
| 53 |
extern "C" { |
| 54 |
extern int fgetpos(FILE *, fpos64_t *) __asm__("fgetpos64"); |
| 55 |
extern FILE *fopen(const char *, const char *) __asm__("fopen64"); |
| 56 |
extern FILE *freopen(const char *, const char *, FILE *) __asm__("freopen64"); |
| 57 |
extern int fseeko(FILE *, off64_t, int) __asm__("fseeko64"); |
| 58 |
extern int fsetpos(FILE *, const fpos64_t *) __asm__("fsetpos64"); |
| 59 |
extern off64_t ftello(FILE *) __asm__("ftello64"); |
| 60 |
} |
| 61 |
#endif |
| 62 |
#endif |
| 63 |
|
| 64 |
_EOArg_; |
| 65 |
}; |
| 66 |
|
| 67 |
/* On AIX when _LARGE_FILES is defined fcntl.h defines open to |
| 68 |
* open64 and creat to creat64. This fixes fcntl.h to |
| 69 |
* undef those defines and use __asm__ to alias the symbols if |
| 70 |
* building with g++ and -D_LARGE_FILES |
| 71 |
*/ |
| 72 |
fix = { |
| 73 |
hackname = AAB_aix_fcntl; |
| 74 |
files = fcntl.h; |
| 75 |
select = "define open[ \t]open64"; |
| 76 |
mach = "*-*-aix*"; |
| 77 |
test-text = ''; /* no way to test */ |
| 78 |
|
| 79 |
c_fix = wrap; |
| 80 |
|
| 81 |
c_fix_arg = ""; |
| 82 |
|
| 83 |
c_fix_arg = <<- _EOArg_ |
| 84 |
|
| 85 |
#if defined __GNUG__ && defined _LARGE_FILES && defined __cplusplus |
| 86 |
#define __need__aix_fcntl_h_fix |
| 87 |
#ifdef __need__aix_fcntl_h_fix |
| 88 |
#undef open |
| 89 |
#undef creat |
| 90 |
#undef openat |
| 91 |
/* Alias the symbols using asm */ |
| 92 |
extern "C" { |
| 93 |
extern int open(const char *, int, ...) __asm__("open64"); |
| 94 |
extern int creat(const char *, mode_t) __asm__("creat64"); |
| 95 |
#if (_XOPEN_SOURCE >= 700) |
| 96 |
extern int openat(int, const char *, int, ...) __asm__("open64at"); |
| 97 |
#endif |
| 98 |
} |
| 99 |
#endif |
| 100 |
#endif |
| 101 |
|
| 102 |
_EOArg_; |
| 103 |
}; |
| 104 |
|
| 105 |
/* |
| 106 |
* On Mac OS 10.3.9, the 'long double' functions are available in |
| 107 |
* libSystem, but are not prototyped in math.h. |
| 108 |
*/ |
| 109 |
fix = { |
| 110 |
hackname = AAB_darwin7_9_long_double_funcs; |
| 111 |
mach = "*-*-darwin7.9*"; |
| 112 |
files = architecture/ppc/math.h; |
| 113 |
bypass = "powl"; |
| 114 |
replace = <<- _EndOfHeader_ |
| 115 |
/* This file prototypes the long double functions available on Mac OS |
| 116 |
10.3.9. */ |
| 117 |
#ifndef __MATH__ |
| 118 |
# undef __APPLE_CC__ |
| 119 |
# define __APPLE_CC__ 1345 |
| 120 |
# include_next <architecture/ppc/math.h> |
| 121 |
# undef __APPLE_CC__ |
| 122 |
# define __APPLE_CC__ 1 |
| 123 |
# ifndef __LIBMLDBL_COMPAT |
| 124 |
# ifdef __LONG_DOUBLE_128__ |
| 125 |
# define __LIBMLDBL_COMPAT(sym) __asm("_" #sym "$LDBL128") |
| 126 |
# else |
| 127 |
# define __LIBMLDBL_COMPAT(sym) |
| 128 |
# endif /* __LONG_DOUBLE_128__ */ |
| 129 |
# endif /* __LIBMLDBL_COMPAT */ |
| 130 |
# ifdef __cplusplus |
| 131 |
extern "C" { |
| 132 |
# endif |
| 133 |
extern long double acosl( long double ) __LIBMLDBL_COMPAT(acosl); |
| 134 |
extern long double asinl( long double ) __LIBMLDBL_COMPAT(asinl); |
| 135 |
extern long double atanl( long double ) __LIBMLDBL_COMPAT(atanl); |
| 136 |
extern long double atan2l( long double, long double ) __LIBMLDBL_COMPAT(atan2l); |
| 137 |
extern long double cosl( long double ) __LIBMLDBL_COMPAT(cosl); |
| 138 |
extern long double sinl( long double ) __LIBMLDBL_COMPAT(sinl); |
| 139 |
extern long double tanl( long double ) __LIBMLDBL_COMPAT(tanl); |
| 140 |
extern long double acoshl( long double ) __LIBMLDBL_COMPAT(acoshl); |
| 141 |
extern long double asinhl( long double ) __LIBMLDBL_COMPAT(asinhl); |
| 142 |
extern long double atanhl( long double ) __LIBMLDBL_COMPAT(atanhl); |
| 143 |
extern long double coshl( long double ) __LIBMLDBL_COMPAT(coshl); |
| 144 |
extern long double sinhl( long double ) __LIBMLDBL_COMPAT(sinhl); |
| 145 |
extern long double tanhl( long double ) __LIBMLDBL_COMPAT(tanhl); |
| 146 |
extern long double expl( long double ) __LIBMLDBL_COMPAT(expl); |
| 147 |
extern long double exp2l( long double ) __LIBMLDBL_COMPAT(exp2l); |
| 148 |
extern long double expm1l( long double ) __LIBMLDBL_COMPAT(expm1l); |
| 149 |
extern long double logl( long double ) __LIBMLDBL_COMPAT(logl); |
| 150 |
extern long double log10l( long double ) __LIBMLDBL_COMPAT(log10l); |
| 151 |
extern long double log2l( long double ) __LIBMLDBL_COMPAT(log2l); |
| 152 |
extern long double log1pl( long double ) __LIBMLDBL_COMPAT(log1pl); |
| 153 |
extern long double logbl( long double ) __LIBMLDBL_COMPAT(logbl); |
| 154 |
extern long double modfl( long double, long double * ) __LIBMLDBL_COMPAT(modfl); |
| 155 |
extern long double ldexpl( long double, int ) __LIBMLDBL_COMPAT(ldexpl); |
| 156 |
extern long double frexpl( long double, int * ) __LIBMLDBL_COMPAT(frexpl); |
| 157 |
extern int ilogbl( long double ) __LIBMLDBL_COMPAT(ilogbl); |
| 158 |
extern long double scalbnl( long double, int ) __LIBMLDBL_COMPAT(scalbnl); |
| 159 |
extern long double scalblnl( long double, long int ) __LIBMLDBL_COMPAT(scalblnl); |
| 160 |
extern long double fabsl( long double ) __LIBMLDBL_COMPAT(fabsl); |
| 161 |
extern long double cbrtl( long double ) __LIBMLDBL_COMPAT(cbrtl); |
| 162 |
extern long double hypotl( long double, long double ) __LIBMLDBL_COMPAT(hypotl); |
| 163 |
extern long double powl( long double, long double ) __LIBMLDBL_COMPAT(powl); |
| 164 |
extern long double sqrtl( long double ) __LIBMLDBL_COMPAT(sqrtl); |
| 165 |
extern long double erfl( long double ) __LIBMLDBL_COMPAT(erfl); |
| 166 |
extern long double erfcl( long double ) __LIBMLDBL_COMPAT(erfcl); |
| 167 |
extern long double lgammal( long double ) __LIBMLDBL_COMPAT(lgammal); |
| 168 |
extern long double tgammal( long double ) __LIBMLDBL_COMPAT(tgammal); |
| 169 |
extern long double ceill( long double ) __LIBMLDBL_COMPAT(ceill); |
| 170 |
extern long double floorl( long double ) __LIBMLDBL_COMPAT(floorl); |
| 171 |
extern long double nearbyintl( long double ) __LIBMLDBL_COMPAT(nearbyintl); |
| 172 |
extern long double rintl( long double ) __LIBMLDBL_COMPAT(rintl); |
| 173 |
extern long int lrintl( long double ) __LIBMLDBL_COMPAT(lrintl); |
| 174 |
extern long long int llrintl( long double ) __LIBMLDBL_COMPAT(llrintl); |
| 175 |
extern long double roundl( long double ) __LIBMLDBL_COMPAT(roundl); |
| 176 |
extern long int lroundl( long double ) __LIBMLDBL_COMPAT(lroundl); |
| 177 |
extern long long int llroundl( long double ) __LIBMLDBL_COMPAT(llroundl); |
| 178 |
extern long double truncl( long double ) __LIBMLDBL_COMPAT(truncl); |
| 179 |
extern long double fmodl( long double, long double) __LIBMLDBL_COMPAT(fmodl); |
| 180 |
extern long double remainderl( long double, long double ) __LIBMLDBL_COMPAT(remainderl); |
| 181 |
extern long double remquol( long double, long double, int * ) __LIBMLDBL_COMPAT(remquol); |
| 182 |
extern long double copysignl( long double, long double ) __LIBMLDBL_COMPAT(copysignl); |
| 183 |
extern long double nanl( const char * ) __LIBMLDBL_COMPAT(nanl); |
| 184 |
extern long double nextafterl( long double, long double ) __LIBMLDBL_COMPAT(nextafterl); |
| 185 |
extern long double nexttowardl( long double, long double ) __LIBMLDBL_COMPAT(nexttowardl); |
| 186 |
extern long double fdiml( long double, long double ) __LIBMLDBL_COMPAT(fdiml); |
| 187 |
extern long double fmaxl( long double, long double ) __LIBMLDBL_COMPAT(fmaxl); |
| 188 |
extern long double fminl( long double, long double ) __LIBMLDBL_COMPAT(fminl); |
| 189 |
extern long double fmal( long double, long double, long double ) __LIBMLDBL_COMPAT(fmal); |
| 190 |
# ifdef __cplusplus |
| 191 |
} |
| 192 |
# endif |
| 193 |
#endif /* __MATH__ */ |
| 194 |
_EndOfHeader_; |
| 195 |
}; |
| 196 |
|
| 197 |
/* |
| 198 |
* SDKs for 10.13 and 10.14 omit the definitions for API_AVAILABLE where |
| 199 |
* __attribute__((availability)) is not supported. |
| 200 |
*/ |
| 201 |
fix = { |
| 202 |
hackname = darwin_api_availability; |
| 203 |
mach = "*-*-darwin*"; |
| 204 |
files = os/availability.h; |
| 205 |
bypass = "__IPHONE_OS_VERSION_MIN_REQUIRED"; |
| 206 |
select = |
| 207 |
" *#define __API_AVAILABLE.*\n" |
| 208 |
" *#define __API_DEPRECATED.*\n" |
| 209 |
" *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n" |
| 210 |
" *#define __API_UNAVAILABLE.*\n"; |
| 211 |
c_fix = format; |
| 212 |
c_fix_arg = |
| 213 |
" #define API_AVAILABLE(...)\n" |
| 214 |
" #define API_DEPRECATED(...)\n" |
| 215 |
" #define API_DEPRECATED_WITH_REPLACEMENT(...)\n" |
| 216 |
" #define API_UNAVAILABLE(...)\n"; |
| 217 |
test_text = |
| 218 |
"#define __API_AVAILABLE(...)\n" |
| 219 |
"#define __API_DEPRECATED(...)\n" |
| 220 |
"#define __API_DEPRECATED_WITH_REPLACEMENT(...)\n" |
| 221 |
"#define __API_UNAVAILABLE(...)\n"; |
| 222 |
}; |
| 223 |
|
| 224 |
/* |
| 225 |
* This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n) |
| 226 |
*/ |
| 227 |
fix = { |
| 228 |
hackname = AAB_fd_zero_asm_posix_types_h; |
| 229 |
files = asm/posix_types.h; |
| 230 |
mach = 'i[34567]86-*-linux*'; |
| 231 |
bypass = '} while'; |
| 232 |
bypass = 'x86_64'; |
| 233 |
bypass = 'posix_types_64'; |
| 234 |
|
| 235 |
/* |
| 236 |
* Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not |
| 237 |
* the start, so that if #include_next gets another instance of |
| 238 |
* the wrapper, this will follow the #include_next chain until |
| 239 |
* we arrive at the real <asm/posix_types.h>. |
| 240 |
*/ |
| 241 |
replace = <<- _EndOfHeader_ |
| 242 |
/* This file fixes a bug in the __FD_ZERO macro |
| 243 |
for older versions of the Linux kernel. */ |
| 244 |
#ifndef _POSIX_TYPES_H_WRAPPER |
| 245 |
#include <features.h> |
| 246 |
#include_next <asm/posix_types.h> |
| 247 |
|
| 248 |
#if defined(__FD_ZERO) && !defined(__GLIBC__) |
| 249 |
#undef __FD_ZERO |
| 250 |
#define __FD_ZERO(fdsetp) \ |
| 251 |
do { \ |
| 252 |
int __d0, __d1; \ |
| 253 |
__asm__ __volatile__("cld ; rep ; stosl" \ |
| 254 |
: "=&c" (__d0), "=&D" (__d1) \ |
| 255 |
: "a" (0), "0" (__FDSET_LONGS), \ |
| 256 |
"1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \ |
| 257 |
} while (0) |
| 258 |
#endif |
| 259 |
|
| 260 |
#define _POSIX_TYPES_H_WRAPPER |
| 261 |
#endif /* _POSIX_TYPES_H_WRAPPER */ |
| 262 |
_EndOfHeader_; |
| 263 |
}; |
| 264 |
|
| 265 |
/* |
| 266 |
* This fixes __FD_ZERO bug for glibc-1.x |
| 267 |
*/ |
| 268 |
fix = { |
| 269 |
hackname = AAB_fd_zero_gnu_types_h; |
| 270 |
files = gnu/types.h; |
| 271 |
mach = 'i[34567]86-*-linux*'; |
| 272 |
|
| 273 |
/* |
| 274 |
* Define _TYPES_H_WRAPPER at the end of the wrapper, not |
| 275 |
* the start, so that if #include_next gets another instance of |
| 276 |
* the wrapper, this will follow the #include_next chain until |
| 277 |
* we arrive at the real <gnu/types.h>. |
| 278 |
*/ |
| 279 |
replace = <<- _EndOfHeader_ |
| 280 |
/* This file fixes a bug in the __FD_ZERO macro present in glibc 1.x. */ |
| 281 |
#ifndef _TYPES_H_WRAPPER |
| 282 |
#include <features.h> |
| 283 |
#include_next <gnu/types.h> |
| 284 |
|
| 285 |
#if defined(__FD_ZERO) && !defined(__GLIBC__) |
| 286 |
#undef __FD_ZERO |
| 287 |
# define __FD_ZERO(fdsetp) \ |
| 288 |
do { \ |
| 289 |
int __d0, __d1; \ |
| 290 |
__asm__ __volatile__("cld ; rep ; stosl" \ |
| 291 |
: "=&c" (__d0), "=&D" (__d1) \ |
| 292 |
: "a" (0), "0" (__FDSET_LONGS), \ |
| 293 |
"1" ((__fd_set *) (fdsetp)) :"memory"); \ |
| 294 |
} while (0) |
| 295 |
#endif |
| 296 |
|
| 297 |
#define _TYPES_H_WRAPPER |
| 298 |
#endif /* _TYPES_H_WRAPPER */ |
| 299 |
_EndOfHeader_; |
| 300 |
}; |
| 301 |
|
| 302 |
/* |
| 303 |
* This fixes __FD_ZERO bug for glibc-2.0.x |
| 304 |
*/ |
| 305 |
fix = { |
| 306 |
hackname = AAB_fd_zero_selectbits_h; |
| 307 |
files = selectbits.h; |
| 308 |
mach = 'i[34567]86-*-linux*'; |
| 309 |
|
| 310 |
/* |
| 311 |
* Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not |
| 312 |
* the start, so that if #include_next gets another instance of |
| 313 |
* the wrapper, this will follow the #include_next chain until |
| 314 |
* we arrive at the real <selectbits.h>. |
| 315 |
*/ |
| 316 |
replace = <<- _EndOfHeader_ |
| 317 |
/* This file fixes a bug in the __FD_ZERO macro present in glibc 2.0.x. */ |
| 318 |
#ifndef _SELECTBITS_H_WRAPPER |
| 319 |
#include <features.h> |
| 320 |
#include_next <selectbits.h> |
| 321 |
|
| 322 |
#if defined(__FD_ZERO) && defined(__GLIBC__) \\ |
| 323 |
&& defined(__GLIBC_MINOR__) && __GLIBC__ == 2 \\ |
| 324 |
&& __GLIBC_MINOR__ == 0 |
| 325 |
#undef __FD_ZERO |
| 326 |
#define __FD_ZERO(fdsetp) \\ |
| 327 |
do { \\ |
| 328 |
int __d0, __d1; \\ |
| 329 |
__asm__ __volatile__ ("cld; rep; stosl" \\ |
| 330 |
: "=&c" (__d0), "=&D" (__d1) \\ |
| 331 |
: "a" (0), "0" (sizeof (__fd_set) \\ |
| 332 |
/ sizeof (__fd_mask)), \\ |
| 333 |
"1" ((__fd_mask *) (fdsetp)) \\ |
| 334 |
: "memory"); \\ |
| 335 |
} while (0) |
| 336 |
#endif |
| 337 |
|
| 338 |
#define _SELECTBITS_H_WRAPPER |
| 339 |
#endif /* _SELECTBITS_H_WRAPPER */ |
| 340 |
_EndOfHeader_; |
| 341 |
}; |
| 342 |
|
| 343 |
/* |
| 344 |
* Solaris <sys/varargs.h> is a DDK (aka kernel-land) header providing |
| 345 |
* the same interface as <stdarg.h>. No idea why they couldn't have just |
| 346 |
* used the standard header. |
| 347 |
*/ |
| 348 |
fix = { |
| 349 |
hackname = AAB_solaris_sys_varargs_h; |
| 350 |
files = "sys/varargs.h"; |
| 351 |
mach = '*-*-solaris*'; |
| 352 |
replace = <<- _EndOfHeader_ |
| 353 |
#ifdef __STDC__ |
| 354 |
#include <stdarg.h> |
| 355 |
#else |
| 356 |
#include <varargs.h> |
| 357 |
#endif |
| 358 |
_EndOfHeader_; |
| 359 |
}; |
| 360 |
|
| 361 |
/* |
| 362 |
* Fix non-ANSI memcpy declaration that conflicts with gcc's builtin |
| 363 |
* declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because |
| 364 |
* many other systems have similar text but correct versions of the file. |
| 365 |
* To ensure only Sun's is fixed, we grep for a likely unique string. |
| 366 |
* Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t ) |
| 367 |
*/ |
| 368 |
fix = { |
| 369 |
hackname = AAB_sun_memcpy; |
| 370 |
files = memory.h; |
| 371 |
select = "/\\*\t@\\(#\\)" |
| 372 |
"(head/memory.h\t50.1\t " |
| 373 |
"|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/"; |
| 374 |
|
| 375 |
replace = <<- _EndOfHeader_ |
| 376 |
/* This file was generated by fixincludes */ |
| 377 |
#ifndef __memory_h__ |
| 378 |
#define __memory_h__ |
| 379 |
|
| 380 |
#ifdef __STDC__ |
| 381 |
extern void *memccpy(); |
| 382 |
extern void *memchr(); |
| 383 |
extern void *memcpy(); |
| 384 |
extern void *memset(); |
| 385 |
#else |
| 386 |
extern char *memccpy(); |
| 387 |
extern char *memchr(); |
| 388 |
extern char *memcpy(); |
| 389 |
extern char *memset(); |
| 390 |
#endif /* __STDC__ */ |
| 391 |
|
| 392 |
extern int memcmp(); |
| 393 |
|
| 394 |
#endif /* __memory_h__ */ |
| 395 |
_EndOfHeader_; |
| 396 |
}; |
| 397 |
|
| 398 |
/* |
| 399 |
* Fix assert.h on VxWorks: |
| 400 |
*/ |
| 401 |
fix = { |
| 402 |
hackname = AAB_vxworks_assert; |
| 403 |
files = assert.h; |
| 404 |
mach = "*-*-vxworks*"; |
| 405 |
|
| 406 |
replace = <<- _EndOfHeader_ |
| 407 |
#ifdef _ASSERT_H |
| 408 |
#undef _ASSERT_H |
| 409 |
#undef assert |
| 410 |
#endif |
| 411 |
|
| 412 |
#define _ASSERT_H |
| 413 |
|
| 414 |
#ifdef __cplusplus |
| 415 |
extern "C" { |
| 416 |
#endif |
| 417 |
|
| 418 |
#if defined(__STDC__) || defined(__cplusplus) |
| 419 |
extern void __assert (const char*); |
| 420 |
#else |
| 421 |
extern void __assert (); |
| 422 |
#endif |
| 423 |
|
| 424 |
#ifdef NDEBUG |
| 425 |
#define assert(ign) ((void)0) |
| 426 |
#else |
| 427 |
|
| 428 |
#define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str) |
| 429 |
#define ASSERT_STRINGIFY_HELPER(str) #str |
| 430 |
|
| 431 |
#define assert(test) ((void) \ |
| 432 |
((test) ? ((void)0) : \ |
| 433 |
__assert("Assertion failed: " #test ", file " \ |
| 434 |
__FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n"))) |
| 435 |
|
| 436 |
#endif |
| 437 |
|
| 438 |
#ifdef __cplusplus |
| 439 |
} |
| 440 |
#endif |
| 441 |
_EndOfHeader_; |
| 442 |
}; |
| 443 |
|
| 444 |
/* |
| 445 |
* Add needed include to regs.h (NOT the gcc header) on VxWorks |
| 446 |
*/ |
| 447 |
|
| 448 |
fix = { |
| 449 |
hackname = AAB_vxworks_regs_vxtypes; |
| 450 |
files = regs.h; |
| 451 |
mach = "*-*-vxworks*"; |
| 452 |
|
| 453 |
replace = <<- _EndOfHeader_ |
| 454 |
#ifndef _REGS_H |
| 455 |
#define _REGS_H |
| 456 |
/* regs.h depends on CPU_FAMILY being properly defined, which |
| 457 |
is done by vxCpu.h. */ |
| 458 |
#include <types/vxCpu.h> |
| 459 |
/* regs.h includes a CPU_FAMILY-specific header that requires |
| 460 |
vxTypesOld.h to already have been included. Those headers |
| 461 |
contain proper _ASMLANGUAGE guards around their typedefs, |
| 462 |
but vxTypesOld.h itself does not. So we avoid including |
| 463 |
vxTypesOld.h from assembly. */ |
| 464 |
#ifndef _ASMLANGUAGE |
| 465 |
#include <types/vxTypesOld.h> |
| 466 |
#endif |
| 467 |
#include_next <arch/../regs.h> |
| 468 |
#endif |
| 469 |
_EndOfHeader_; |
| 470 |
}; |
| 471 |
|
| 472 |
/* |
| 473 |
* This hack makes makes unistd.h more POSIX-compliant on VxWorks |
| 474 |
*/ |
| 475 |
fix = { |
| 476 |
hackname = AAB_vxworks_unistd; |
| 477 |
files = unistd.h; |
| 478 |
mach = "*-*-vxworks*"; |
| 479 |
|
| 480 |
replace = <<- _EndOfHeader_ |
| 481 |
#ifndef _UNISTD_H |
| 482 |
#define _UNISTD_H |
| 483 |
#include_next <unistd.h> |
| 484 |
#include <ioLib.h> |
| 485 |
#ifndef STDIN_FILENO |
| 486 |
#define STDIN_FILENO 0 |
| 487 |
#endif |
| 488 |
#ifndef STDOUT_FILENO |
| 489 |
#define STDOUT_FILENO 1 |
| 490 |
#endif |
| 491 |
#ifndef STDERR_FILENO |
| 492 |
#define STDERR_FILENO 2 |
| 493 |
#endif |
| 494 |
#endif /* _UNISTD_H */ |
| 495 |
_EndOfHeader_; |
| 496 |
}; |
| 497 |
|
| 498 |
/* |
| 499 |
* assert.h on AIX 7 redefines static_assert as _Static_assert without |
| 500 |
* protecting C++. |
| 501 |
*/ |
| 502 |
fix = { |
| 503 |
hackname = aix_assert; |
| 504 |
mach = "*-*-aix*"; |
| 505 |
files = assert.h; |
| 506 |
select = "#define[ \t]static_assert[ \t]_Static_assert"; |
| 507 |
c_fix = format; |
| 508 |
c_fix_arg = "#ifndef __cplusplus\n%0\n#endif"; |
| 509 |
test_text = "#define static_assert _Static_assert"; |
| 510 |
}; |
| 511 |
|
| 512 |
/* |
| 513 |
* complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I, |
| 514 |
* which only is provided by AIX xlc C99. |
| 515 |
*/ |
| 516 |
fix = { |
| 517 |
hackname = aix_complex; |
| 518 |
mach = "*-*-aix*"; |
| 519 |
files = complex.h; |
| 520 |
select = "#define[ \t]_Complex_I[ \t]__I"; |
| 521 |
c_fix = format; |
| 522 |
c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)"; |
| 523 |
test_text = "#define _Complex_I __I\n"; |
| 524 |
}; |
| 525 |
|
| 526 |
/* |
| 527 |
* On AIX some headers are not properly guarded by 'extern "C"'. |
| 528 |
*/ |
| 529 |
fix = { |
| 530 |
hackname = aix_externc; |
| 531 |
mach = "*-*-aix*"; |
| 532 |
files = ctype.h; |
| 533 |
files = fcntl.h; |
| 534 |
files = langinfo.h; |
| 535 |
files = ldfcn.h; |
| 536 |
files = sys/localedef.h; |
| 537 |
files = sys/times.h; |
| 538 |
bypass = "extern \"C\""; |
| 539 |
c_fix = wrap; |
| 540 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 541 |
"extern \"C\" {\n" |
| 542 |
"#endif\n"; |
| 543 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 544 |
"}\n" |
| 545 |
"#endif\n"; |
| 546 |
test_text = "extern int __n_pthreads;\n"; |
| 547 |
}; |
| 548 |
|
| 549 |
/* |
| 550 |
* On AIX sys/socket.h assumes C++. |
| 551 |
*/ |
| 552 |
fix = { |
| 553 |
hackname = aix_externcpp1; |
| 554 |
mach = "*-*-aix*"; |
| 555 |
files = "sys/socket.h"; |
| 556 |
select = "#ifndef _KERNEL\n" |
| 557 |
"#ifdef __cplusplus\n" |
| 558 |
"extern \"C\" int naccept\\(int, struct sockaddr \\*, socklen_t \\*\\);"; |
| 559 |
c_fix = format; |
| 560 |
c_fix_arg = "#ifndef _KERNEL\n" |
| 561 |
"#ifdef __cplusplus\n" |
| 562 |
"extern \"C++\" {\n" |
| 563 |
"extern \"C\" int naccept(int, struct sockaddr *, socklen_t *);"; |
| 564 |
test_text = "#ifndef _KERNEL\n" |
| 565 |
"#ifdef __cplusplus\n" |
| 566 |
"extern \"C\" int naccept(int, struct sockaddr *, socklen_t *);"; |
| 567 |
}; |
| 568 |
|
| 569 |
fix = { |
| 570 |
hackname = aix_externcpp2; |
| 571 |
mach = "*-*-aix*"; |
| 572 |
files = "sys/socket.h"; |
| 573 |
select = "#endif /\\* COMPAT_43 \\*/\n" |
| 574 |
"#else /\\* __cplusplus \\*/"; |
| 575 |
c_fix = format; |
| 576 |
c_fix_arg = "#endif /* COMPAT_43 */\n" |
| 577 |
"} /* extern \"C++\" */\n" |
| 578 |
"#else /* __cplusplus */"; |
| 579 |
test_text = "#endif /* COMPAT_43 */\n" |
| 580 |
"#else /* __cplusplus */"; |
| 581 |
}; |
| 582 |
|
| 583 |
/* |
| 584 |
* inttypes.h STDC_FORMAT_MACROS |
| 585 |
*/ |
| 586 |
fix = { |
| 587 |
hackname = aix_inttypes; |
| 588 |
mach = "*-*-aix*"; |
| 589 |
files = "sys/inttypes.h"; |
| 590 |
select = "#if !defined\\(__cplusplus\\) \\|\\| defined\\(__STDC_FORMAT_MACROS\\)"; |
| 591 |
c_fix = format; |
| 592 |
c_fix_arg = "#if 1"; |
| 593 |
test_text = "#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)"; |
| 594 |
}; |
| 595 |
|
| 596 |
/* |
| 597 |
* malloc.h on AIX6 uses XLC++ specific builtin syntax |
| 598 |
*/ |
| 599 |
fix = { |
| 600 |
hackname = aix_malloc; |
| 601 |
mach = "*-*-aix*"; |
| 602 |
files = "malloc.h"; |
| 603 |
select = "#ifdef __cplusplus\n" |
| 604 |
"extern \"C\" \\{\n" |
| 605 |
"[ \t]extern \"builtin\" char \\*__alloca \\(size_t\\);"; |
| 606 |
c_fix = format; |
| 607 |
c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))\n" |
| 608 |
"extern \"C\" {\n" |
| 609 |
"\textern \"builtin\" char *__alloca (size_t);"; |
| 610 |
test_text = "#ifdef __cplusplus\n" |
| 611 |
"extern \"C\" {\n" |
| 612 |
"\textern \"builtin\" char *__alloca (size_t);"; |
| 613 |
}; |
| 614 |
|
| 615 |
/* |
| 616 |
* net/if_arp.h defines a variable fc_softc instead of adding a |
| 617 |
* typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1 |
| 618 |
*/ |
| 619 |
fix = { |
| 620 |
hackname = aix_net_if_arp; |
| 621 |
mach = "*-*-aix*"; |
| 622 |
files = "net/if_arp.h"; |
| 623 |
select = "^struct fc_softc \\{"; |
| 624 |
c_fix = format; |
| 625 |
c_fix_arg = "typedef struct _fc_softc {"; |
| 626 |
test_text = "struct fc_softc {\n int a;\n};"; |
| 627 |
}; |
| 628 |
|
| 629 |
/* |
| 630 |
* Fix AIX definition of NULL for G++. |
| 631 |
*/ |
| 632 |
fix = { |
| 633 |
hackname = aix_null; |
| 634 |
mach = "*-*-aix*"; |
| 635 |
files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h, |
| 636 |
time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h; |
| 637 |
bypass = __null; |
| 638 |
select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*"; |
| 639 |
c_fix = format; |
| 640 |
c_fix_arg = <<- _EOFix_ |
| 641 |
#ifndef NULL |
| 642 |
#ifdef __cplusplus |
| 643 |
#ifdef __GNUG__ |
| 644 |
#define NULL __null |
| 645 |
#else /* ! __GNUG__ */ |
| 646 |
#define NULL 0L |
| 647 |
#endif /* __GNUG__ */ |
| 648 |
#else /* ! __cplusplus */ |
| 649 |
#define NULL ((void *)0) |
| 650 |
#endif /* __cplusplus */ |
| 651 |
#endif /* !NULL */ |
| 652 |
_EOFix_; |
| 653 |
test_text = "# define\tNULL \t(0L) /* typed NULL */"; |
| 654 |
}; |
| 655 |
|
| 656 |
/* |
| 657 |
* pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER, |
| 658 |
* PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough |
| 659 |
* braces. |
| 660 |
*/ |
| 661 |
fix = { |
| 662 |
hackname = aix_once_init_1; |
| 663 |
mach = "*-*-aix*"; |
| 664 |
files = "pthread.h"; |
| 665 |
select = "#define[ \t]PTHREAD_ONCE_INIT \\\\\n" |
| 666 |
"\\{ \\\\\n"; |
| 667 |
c_fix = format; |
| 668 |
c_fix_arg = "#define PTHREAD_ONCE_INIT \\\n" |
| 669 |
"{{ \\\n"; |
| 670 |
test_text = "#define PTHREAD_ONCE_INIT \\\\\n" |
| 671 |
"{ \\\\\n"; |
| 672 |
}; |
| 673 |
|
| 674 |
fix = { |
| 675 |
hackname = aix_once_init_2; |
| 676 |
mach = "*-*-aix*"; |
| 677 |
files = "pthread.h"; |
| 678 |
select = "[ \t]0 \\\\\n" |
| 679 |
"\\}\n"; |
| 680 |
c_fix = format; |
| 681 |
c_fix_arg = " 0 \\\n" |
| 682 |
"}}\n"; |
| 683 |
test_text = " 0 \\\\\n" |
| 684 |
"}\n"; |
| 685 |
}; |
| 686 |
|
| 687 |
fix = { |
| 688 |
hackname = aix_mutex_initializer_1; |
| 689 |
mach = "*-*-aix*"; |
| 690 |
files = "pthread.h"; |
| 691 |
select = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n" |
| 692 |
"\\{ \\\\\n"; |
| 693 |
c_fix = format; |
| 694 |
c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n" |
| 695 |
"{{ \\\n"; |
| 696 |
test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n" |
| 697 |
"{ \\\\\n"; |
| 698 |
}; |
| 699 |
|
| 700 |
fix = { |
| 701 |
hackname = aix_cond_initializer_1; |
| 702 |
mach = "*-*-aix*"; |
| 703 |
files = "pthread.h"; |
| 704 |
select = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n" |
| 705 |
"\\{ \\\\\n"; |
| 706 |
c_fix = format; |
| 707 |
c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n" |
| 708 |
"{{ \\\n"; |
| 709 |
test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n" |
| 710 |
"{ \\\\\n"; |
| 711 |
}; |
| 712 |
|
| 713 |
fix = { |
| 714 |
hackname = aix_rwlock_initializer_1; |
| 715 |
mach = "*-*-aix*"; |
| 716 |
files = "pthread.h"; |
| 717 |
select = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n" |
| 718 |
"\\{ \\\\\n"; |
| 719 |
c_fix = format; |
| 720 |
c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n" |
| 721 |
"{{ \\\n"; |
| 722 |
test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n" |
| 723 |
"{ \\\\\n"; |
| 724 |
}; |
| 725 |
|
| 726 |
|
| 727 |
/* On AIX 'typedef struct {<stuff>} * physadr_t;' needs to give the struct a |
| 728 |
name for linkage purposes. Fortunately it is on exactly one |
| 729 |
line. */ |
| 730 |
fix = { |
| 731 |
hackname = aix_physadr_t; |
| 732 |
mach = "*-*-aix*"; |
| 733 |
files = sys/types.h; |
| 734 |
select = "typedef[ \t]*struct[ \t]*([{][^}]*[}][ \t]*\\*[ \t]*physadr_t;)"; |
| 735 |
c_fix = format; |
| 736 |
c_fix_arg = "typedef struct __physadr_s %1"; |
| 737 |
test_text = "typedef struct { random stuff } * physadr_t;"; |
| 738 |
}; |
| 739 |
|
| 740 |
/* |
| 741 |
* pthread.h on AIX 4.3.3 tries to define a macro without whitspace |
| 742 |
* which violates a requirement of ISO C. |
| 743 |
*/ |
| 744 |
fix = { |
| 745 |
hackname = aix_pthread; |
| 746 |
files = "pthread.h"; |
| 747 |
select = "(#define[\t ][A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])"; |
| 748 |
c_fix = format; |
| 749 |
c_fix_arg = "%1 %2"; |
| 750 |
test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n" |
| 751 |
"{...init stuff...}"; |
| 752 |
}; |
| 753 |
|
| 754 |
/* |
| 755 |
* AIX stdint.h fixes. |
| 756 |
*/ |
| 757 |
fix = { |
| 758 |
hackname = aix_stdint_1; |
| 759 |
mach = "*-*-aix*"; |
| 760 |
files = stdint-aix.h, stdint.h; |
| 761 |
select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n" |
| 762 |
"#define[ \t]UINT16_MAX[ \t]\\(65535U\\)"; |
| 763 |
c_fix = format; |
| 764 |
c_fix_arg = "#define UINT8_MAX (255)\n" |
| 765 |
"#define UINT16_MAX (65535)"; |
| 766 |
test_text = "#define UINT8_MAX (255U)\n" |
| 767 |
"#define UINT16_MAX (65535U)"; |
| 768 |
}; |
| 769 |
|
| 770 |
/* |
| 771 |
* aix_stdint_2 |
| 772 |
*/ |
| 773 |
fix = { |
| 774 |
hackname = aix_stdint_2; |
| 775 |
mach = "*-*-aix*"; |
| 776 |
files = stdint-aix.h, stdint.h; |
| 777 |
select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n" |
| 778 |
"#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n" |
| 779 |
"#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n" |
| 780 |
"#else\n" |
| 781 |
"#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n" |
| 782 |
"#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n" |
| 783 |
"#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX"; |
| 784 |
c_fix = format; |
| 785 |
c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n" |
| 786 |
"#define INTPTR_MAX 9223372036854775807L\n" |
| 787 |
"#define UINTPTR_MAX 18446744073709551615UL\n" |
| 788 |
"#else\n" |
| 789 |
"#define INTPTR_MIN (-INTPTR_MAX-1)\n" |
| 790 |
"#define INTPTR_MAX 2147483647L\n" |
| 791 |
"#define UINTPTR_MAX 4294967295UL"; |
| 792 |
test_text = "#define INTPTR_MIN INT64_MIN\n" |
| 793 |
"#define INTPTR_MAX INT64_MAX\n" |
| 794 |
"#define UINTPTR_MAX UINT64_MAX\n" |
| 795 |
"#else\n" |
| 796 |
"#define INTPTR_MIN INT32_MIN\n" |
| 797 |
"#define INTPTR_MAX INT32_MAX\n" |
| 798 |
"#define UINTPTR_MAX UINT32_MAX"; |
| 799 |
}; |
| 800 |
|
| 801 |
/* |
| 802 |
* aix_stdint_3 |
| 803 |
*/ |
| 804 |
fix = { |
| 805 |
hackname = aix_stdint_3; |
| 806 |
mach = "*-*-aix*"; |
| 807 |
files = stdint-aix.h, stdint.h; |
| 808 |
select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n" |
| 809 |
"#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n" |
| 810 |
"#else\n" |
| 811 |
"#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n" |
| 812 |
"#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX"; |
| 813 |
c_fix = format; |
| 814 |
c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n" |
| 815 |
"#define PTRDIFF_MAX 9223372036854775807L\n" |
| 816 |
"#else\n" |
| 817 |
"#define PTRDIFF_MIN (-2147483647L - 1)\n" |
| 818 |
"#define PTRDIFF_MAX 2147483647L"; |
| 819 |
test_text = "#define PTRDIFF_MIN INT64_MIN\n" |
| 820 |
"#define PTRDIFF_MAX INT64_MAX\n" |
| 821 |
"#else\n" |
| 822 |
"#define PTRDIFF_MIN INT32_MIN\n" |
| 823 |
"#define PTRDIFF_MAX INT32_MAX"; |
| 824 |
}; |
| 825 |
|
| 826 |
/* |
| 827 |
* aix_stdint_4 |
| 828 |
*/ |
| 829 |
fix = { |
| 830 |
hackname = aix_stdint_4; |
| 831 |
mach = "*-*-aix*"; |
| 832 |
files = stdint-aix.h, stdint.h; |
| 833 |
select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n" |
| 834 |
"#else\n" |
| 835 |
"#define[ \t]SIZE_MAX[ \t]*UINT32_MAX"; |
| 836 |
c_fix = format; |
| 837 |
c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n" |
| 838 |
"#else\n" |
| 839 |
"#define SIZE_MAX 4294967295UL"; |
| 840 |
test_text = "#define SIZE_MAX UINT64_MAX\n" |
| 841 |
"#else\n" |
| 842 |
"#define SIZE_MAX UINT32_MAX"; |
| 843 |
}; |
| 844 |
|
| 845 |
/* |
| 846 |
* aix_stdint_5 |
| 847 |
*/ |
| 848 |
fix = { |
| 849 |
hackname = aix_stdint_5; |
| 850 |
mach = "*-*-aix*"; |
| 851 |
files = stdint-aix.h, stdint.h; |
| 852 |
select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n" |
| 853 |
"#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)"; |
| 854 |
c_fix = format; |
| 855 |
c_fix_arg = "#define UINT8_C(c) c\n" |
| 856 |
"#define UINT16_C(c) c"; |
| 857 |
test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n" |
| 858 |
"#define UINT16_C(c) __CONCAT__(c,U)"; |
| 859 |
}; |
| 860 |
|
| 861 |
/* |
| 862 |
* stdio.h on AIX defines ferror, clearerr and feof as C++ inline, which |
| 863 |
produces wrong code with G++. |
| 864 |
*/ |
| 865 |
fix = { |
| 866 |
hackname = aix_stdio_inline; |
| 867 |
mach = "*-*-aix*"; |
| 868 |
files = stdio.h; |
| 869 |
select = "#ifdef __cplusplus\\\n" |
| 870 |
"}\\\n\\\n" |
| 871 |
"#ifdef ferror\\\n"; |
| 872 |
c_fix = format; |
| 873 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 874 |
"}\n" |
| 875 |
"#endif\n\n" |
| 876 |
"#if (defined(__cplusplus) && defined(__IBMCPP__))\n" |
| 877 |
"#ifdef ferror\n"; |
| 878 |
test_text = "#ifdef __cplusplus\n}\n\n#ifdef ferror"; |
| 879 |
}; |
| 880 |
|
| 881 |
/* |
| 882 |
* stdlib.h on AIX uses #define on malloc and friends. |
| 883 |
*/ |
| 884 |
fix = { |
| 885 |
hackname = aix_stdlib_malloc; |
| 886 |
mach = "*-*-aix*"; |
| 887 |
files = stdlib.h; |
| 888 |
select = "#define[ \t]+malloc[ \t]+__linux_malloc"; |
| 889 |
c_fix = format; |
| 890 |
c_fix_arg = "extern void *malloc(size_t) __asm__(\"__linux_malloc\");"; |
| 891 |
test_text = "#define malloc __linux_malloc"; |
| 892 |
}; |
| 893 |
|
| 894 |
fix = { |
| 895 |
hackname = aix_stdlib_realloc; |
| 896 |
mach = "*-*-aix*"; |
| 897 |
files = stdlib.h; |
| 898 |
select = "#define[ \t]+realloc[ \t]+__linux_realloc"; |
| 899 |
c_fix = format; |
| 900 |
c_fix_arg = "extern void *realloc(void *, size_t) __asm__(\"__linux_realloc\");"; |
| 901 |
test_text = "#define realloc __linux_realloc"; |
| 902 |
}; |
| 903 |
|
| 904 |
fix = { |
| 905 |
hackname = aix_stdlib_calloc; |
| 906 |
mach = "*-*-aix*"; |
| 907 |
files = stdlib.h; |
| 908 |
select = "#define[ \t]+calloc[ \t]+__linux_calloc"; |
| 909 |
c_fix = format; |
| 910 |
c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"__linux_calloc\");"; |
| 911 |
test_text = "#define calloc __linux_calloc"; |
| 912 |
}; |
| 913 |
|
| 914 |
fix = { |
| 915 |
hackname = aix_stdlib_valloc; |
| 916 |
mach = "*-*-aix*"; |
| 917 |
files = stdlib.h; |
| 918 |
select = "#define[ \t]+valloc[ \t]+__linux_valloc"; |
| 919 |
c_fix = format; |
| 920 |
c_fix_arg = "extern void *valloc(size_t) __asm__(\"__linux_valloc\");"; |
| 921 |
test_text = "#define valloc __linux_valloc"; |
| 922 |
}; |
| 923 |
|
| 924 |
fix = { |
| 925 |
hackname = aix_stdlib_vec_malloc; |
| 926 |
mach = "*-*-aix*"; |
| 927 |
files = stdlib.h; |
| 928 |
select = "#define[ \t]+malloc[ \t]+vec_malloc"; |
| 929 |
c_fix = format; |
| 930 |
c_fix_arg = "extern void *malloc(size_t) __asm__(\"vec_malloc\");"; |
| 931 |
test_text = "#define malloc vec_malloc"; |
| 932 |
}; |
| 933 |
|
| 934 |
fix = { |
| 935 |
hackname = aix_stdlib_vec_calloc; |
| 936 |
mach = "*-*-aix*"; |
| 937 |
files = stdlib.h; |
| 938 |
select = "#define[ \t]+calloc[ \t]+vec_calloc"; |
| 939 |
c_fix = format; |
| 940 |
c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"vec_calloc\");"; |
| 941 |
test_text = "#define calloc vec_calloc"; |
| 942 |
}; |
| 943 |
|
| 944 |
/* |
| 945 |
* stdlib.h on AIX 4.3 declares strtof() with a non-const first argument. |
| 946 |
*/ |
| 947 |
fix = { |
| 948 |
hackname = aix_strtof_const; |
| 949 |
mach = "*-*-aix*"; |
| 950 |
files = stdlib.h; |
| 951 |
select = "((extern[ \t]+)?float[ \t]+strtof)\\(char \\*, char \\*\\*\\);"; |
| 952 |
c_fix = format; |
| 953 |
c_fix_arg = "%1(const char *, char **);"; |
| 954 |
test_text = "extern float strtof(char *, char **);"; |
| 955 |
}; |
| 956 |
|
| 957 |
/* |
| 958 |
* sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline |
| 959 |
* in an otherwise harmless (and #ifed out) macro definition |
| 960 |
*/ |
| 961 |
fix = { |
| 962 |
hackname = aix_sysmachine; |
| 963 |
mach = "*-*-aix*"; |
| 964 |
files = sys/machine.h; |
| 965 |
select = "\\\\ +\n"; |
| 966 |
c_fix = format; |
| 967 |
c_fix_arg = "\\\n"; |
| 968 |
test_text = "#define FOO \\\n" |
| 969 |
" bar \\ \n baz \\ \n bat"; |
| 970 |
}; |
| 971 |
|
| 972 |
/* |
| 973 |
* sys/wait.h on AIX 5.2 defines macros that have both signed and |
| 974 |
* unsigned types in conditional expressions. |
| 975 |
*/ |
| 976 |
fix = { |
| 977 |
hackname = aix_syswait_2; |
| 978 |
mach = "*-*-aix*"; |
| 979 |
files = sys/wait.h; |
| 980 |
select = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)'; |
| 981 |
c_fix = format; |
| 982 |
c_fix_arg = "? (int)%1"; |
| 983 |
test_text = "#define WSTOPSIG(__x) " |
| 984 |
"(int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)"; |
| 985 |
}; |
| 986 |
|
| 987 |
/* |
| 988 |
* sys/signal.h on some versions of AIX uses volatile in the typedef of |
| 989 |
* sig_atomic_t, which causes gcc to generate a warning about duplicate |
| 990 |
* volatile when a sig_atomic_t variable is declared volatile, as |
| 991 |
* required by ANSI C. |
| 992 |
*/ |
| 993 |
fix = { |
| 994 |
hackname = aix_volatile; |
| 995 |
mach = "*-*-aix*"; |
| 996 |
files = sys/signal.h; |
| 997 |
select = "typedef volatile int sig_atomic_t"; |
| 998 |
c_fix = format; |
| 999 |
c_fix_arg = "typedef int sig_atomic_t"; |
| 1000 |
test_text = "typedef volatile int sig_atomic_t;"; |
| 1001 |
}; |
| 1002 |
|
| 1003 |
/* |
| 1004 |
* AIX unistd.h defines a static function with an empty parameter list. |
| 1005 |
*/ |
| 1006 |
fix = { |
| 1007 |
hackname = aix_unistd; |
| 1008 |
mach = "*-*-aix*"; |
| 1009 |
files = unistd.h; |
| 1010 |
|
| 1011 |
select = "[ \t]+static[ \t]+int[ \t]+getdtablesize\\(\\)"; |
| 1012 |
c_fix = format; |
| 1013 |
c_fix_arg = "\tstatic int\t\tgetdtablesize(void)"; |
| 1014 |
test_text = " static int getdtablesize()"; |
| 1015 |
}; |
| 1016 |
|
| 1017 |
/* |
| 1018 |
* Fix __assert declaration in assert.h on Alpha OSF/1. |
| 1019 |
*/ |
| 1020 |
fix = { |
| 1021 |
hackname = alpha___assert; |
| 1022 |
files = "assert.h"; |
| 1023 |
select = '__assert\(char \*, char \*, int\)'; |
| 1024 |
c_fix = format; |
| 1025 |
c_fix_arg = "__assert(const char *, const char *, int)"; |
| 1026 |
test_text = 'extern void __assert(char *, char *, int);'; |
| 1027 |
}; |
| 1028 |
|
| 1029 |
/* |
| 1030 |
* Fix assert macro in assert.h on Alpha OSF/1. |
| 1031 |
* The superfluous int cast breaks C++. |
| 1032 |
*/ |
| 1033 |
fix = { |
| 1034 |
hackname = alpha_assert; |
| 1035 |
files = "assert.h"; |
| 1036 |
select = "(#[ \t]*" 'define assert\(EX\).*)\(\(int\) \(EX\)\)'; |
| 1037 |
c_fix = format; |
| 1038 |
c_fix_arg = "%1(EX)"; |
| 1039 |
test_text = '#define assert(EX) (((int) (EX)) ? (void)0 ' |
| 1040 |
': __assert(#EX, __FILE__, __LINE__))'; |
| 1041 |
}; |
| 1042 |
|
| 1043 |
/* |
| 1044 |
* Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX. |
| 1045 |
*/ |
| 1046 |
fix = { |
| 1047 |
hackname = alpha_getopt; |
| 1048 |
files = "stdio.h"; |
| 1049 |
files = "stdlib.h"; |
| 1050 |
select = 'getopt\(int, char \*\[\], *char \*\)'; |
| 1051 |
c_fix = format; |
| 1052 |
c_fix_arg = "getopt(int, char *const[], const char *)"; |
| 1053 |
test_text = 'extern int getopt(int, char *[], char *);'; |
| 1054 |
}; |
| 1055 |
|
| 1056 |
/* |
| 1057 |
* Fix missing semicolon on Alpha OSF/4 in <net/if.h> |
| 1058 |
*/ |
| 1059 |
fix = { |
| 1060 |
hackname = alpha_if_semicolon; |
| 1061 |
files = net/if.h; |
| 1062 |
select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*"; |
| 1063 |
c_fix = format; |
| 1064 |
c_fix_arg = "struct sockaddr vmif_paddr;\t/*"; |
| 1065 |
test_text = ' struct sockaddr vmif_paddr /* protocol address */'; |
| 1066 |
}; |
| 1067 |
|
| 1068 |
/* |
| 1069 |
* Remove erroneous parentheses in sym.h on Alpha OSF/1. |
| 1070 |
*/ |
| 1071 |
fix = { |
| 1072 |
hackname = alpha_parens; |
| 1073 |
files = sym.h; |
| 1074 |
select = '#ifndef\(__mips64\)'; |
| 1075 |
c_fix = format; |
| 1076 |
c_fix_arg = "#ifndef __mips64"; |
| 1077 |
test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif"; |
| 1078 |
}; |
| 1079 |
|
| 1080 |
/* |
| 1081 |
* Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0 |
| 1082 |
* And OpenBSD. |
| 1083 |
*/ |
| 1084 |
fix = { |
| 1085 |
hackname = alpha_sbrk; |
| 1086 |
files = unistd.h; |
| 1087 |
select = "char[ \t]*\\*[\t ]*sbrk[ \t]*\\("; |
| 1088 |
c_fix = format; |
| 1089 |
c_fix_arg = "void *sbrk("; |
| 1090 |
test_text = "extern char* sbrk(ptrdiff_t increment);"; |
| 1091 |
}; |
| 1092 |
|
| 1093 |
/* |
| 1094 |
* For C++, avoid any typedef or macro definition of bool, |
| 1095 |
* and use the built in type instead. |
| 1096 |
* HP/UX 10.20 also has it in curses_colr/curses.h. |
| 1097 |
*/ |
| 1098 |
fix = { |
| 1099 |
hackname = avoid_bool_define; |
| 1100 |
files = curses.h; |
| 1101 |
files = curses_colr/curses.h; |
| 1102 |
files = term.h; |
| 1103 |
files = tinfo.h; |
| 1104 |
|
| 1105 |
select = "#[ \t]*define[ \t]+bool[ \t]"; |
| 1106 |
bypass = "__cplusplus"; |
| 1107 |
|
| 1108 |
c_fix = format; |
| 1109 |
c_fix_arg = "#ifndef __cplusplus\n%0\n#endif"; |
| 1110 |
c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+bool[ \t].*"; |
| 1111 |
|
| 1112 |
test_text = "# define bool\t char \n"; |
| 1113 |
}; |
| 1114 |
|
| 1115 |
/* |
| 1116 |
* avoid_bool_type |
| 1117 |
*/ |
| 1118 |
fix = { |
| 1119 |
hackname = avoid_bool_type; |
| 1120 |
files = curses.h; |
| 1121 |
files = curses_colr/curses.h; |
| 1122 |
files = term.h; |
| 1123 |
files = tinfo.h; |
| 1124 |
|
| 1125 |
select = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;"; |
| 1126 |
bypass = "__cplusplus"; |
| 1127 |
|
| 1128 |
c_fix = format; |
| 1129 |
c_fix_arg = "#ifndef __cplusplus\n%0\n#endif"; |
| 1130 |
|
| 1131 |
test_text = "typedef unsigned int\tbool \t; /* bool\n type */"; |
| 1132 |
}; |
| 1133 |
|
| 1134 |
/* |
| 1135 |
* For C++, avoid any typedef definition of wchar_t, |
| 1136 |
* and use the built in type instead. |
| 1137 |
* Don't do this for headers that are smart enough to do the right |
| 1138 |
* thing (recent [n]curses.h and Xlib.h). |
| 1139 |
* Don't do it for <linux/nls.h> which is never used from C++ anyway, |
| 1140 |
* and will be broken by the edit. |
| 1141 |
*/ |
| 1142 |
|
| 1143 |
fix = { |
| 1144 |
hackname = avoid_wchar_t_type; |
| 1145 |
|
| 1146 |
select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;"; |
| 1147 |
bypass = "__cplusplus"; |
| 1148 |
bypass = "_LINUX_NLS_H"; |
| 1149 |
bypass = "XFree86: xc/lib/X11/Xlib\\.h"; |
| 1150 |
|
| 1151 |
c_fix = format; |
| 1152 |
c_fix_arg = "#ifndef __cplusplus\n%0\n#endif"; |
| 1153 |
|
| 1154 |
test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */"; |
| 1155 |
}; |
| 1156 |
|
| 1157 |
/* |
| 1158 |
* Fix `typedef struct term;' on hppa1.1-hp-hpux9. |
| 1159 |
*/ |
| 1160 |
fix = { |
| 1161 |
hackname = bad_struct_term; |
| 1162 |
files = curses.h; |
| 1163 |
select = "^[ \t]*typedef[ \t]+struct[ \t]+term[ \t]*;"; |
| 1164 |
c_fix = format; |
| 1165 |
c_fix_arg = "struct term;"; |
| 1166 |
|
| 1167 |
test_text = 'typedef struct term;'; |
| 1168 |
}; |
| 1169 |
|
| 1170 |
/* |
| 1171 |
* Fix one other error in this file: |
| 1172 |
* a mismatched quote not inside a C comment. |
| 1173 |
*/ |
| 1174 |
fix = { |
| 1175 |
hackname = badquote; |
| 1176 |
files = sundev/vuid_event.h; |
| 1177 |
select = "doesn't"; |
| 1178 |
c_fix = format; |
| 1179 |
c_fix_arg = "does not"; |
| 1180 |
|
| 1181 |
test_text = "/* doesn't have matched single quotes */"; |
| 1182 |
}; |
| 1183 |
|
| 1184 |
/* |
| 1185 |
* check for broken assert.h that needs stdio.h |
| 1186 |
*/ |
| 1187 |
fix = { |
| 1188 |
hackname = broken_assert_stdio; |
| 1189 |
files = assert.h; |
| 1190 |
select = stderr; |
| 1191 |
bypass = "include.*stdio\\.h"; |
| 1192 |
c_fix = wrap; |
| 1193 |
c_fix_arg = "#include <stdio.h>\n"; |
| 1194 |
test_text = "extern FILE* stderr;"; |
| 1195 |
}; |
| 1196 |
|
| 1197 |
/* |
| 1198 |
* check for broken assert.h that needs stdlib.h |
| 1199 |
*/ |
| 1200 |
fix = { |
| 1201 |
hackname = broken_assert_stdlib; |
| 1202 |
files = assert.h; |
| 1203 |
select = 'exit *\(|abort *\('; |
| 1204 |
bypass = "include.*stdlib\\.h"; |
| 1205 |
c_fix = wrap; |
| 1206 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 1207 |
"#include <stdlib.h>\n" |
| 1208 |
"#endif\n"; |
| 1209 |
test_text = "extern void exit ( int );"; |
| 1210 |
}; |
| 1211 |
|
| 1212 |
/* |
| 1213 |
* Remove `extern double cabs' declarations from math.h. |
| 1214 |
* This conflicts with C99. Discovered on AIX. |
| 1215 |
* Darwin hides its broken cabs in architecture-specific subdirs. |
| 1216 |
*/ |
| 1217 |
fix = { |
| 1218 |
hackname = broken_cabs; |
| 1219 |
files = math.h, "architecture/*/math.h"; |
| 1220 |
select = "^extern[ \t]+double[ \t]+cabs"; |
| 1221 |
|
| 1222 |
sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//"; |
| 1223 |
sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//"; |
| 1224 |
|
| 1225 |
test_text = "#ifdef __STDC__\n" |
| 1226 |
"extern double cabs(struct dbl_hypot);\n" |
| 1227 |
"#else\n" |
| 1228 |
"extern double cabs();\n" |
| 1229 |
"#endif\n" |
| 1230 |
"extern double cabs ( _Complex z );"; |
| 1231 |
}; |
| 1232 |
|
| 1233 |
/* |
| 1234 |
* Fixup Darwin's broken check for __builtin_nanf. |
| 1235 |
*/ |
| 1236 |
fix = { |
| 1237 |
hackname = broken_nan; |
| 1238 |
/* |
| 1239 |
* It is tempting to omit the first "files" entry. Do not. |
| 1240 |
* The testing machinery will take the first "files" entry as the name |
| 1241 |
* of a test file to play with. It would be a nuisance to have a directory |
| 1242 |
* with the name "*". |
| 1243 |
*/ |
| 1244 |
files = "architecture/ppc/math.h"; |
| 1245 |
files = "architecture/*/math.h"; |
| 1246 |
select = '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)'; |
| 1247 |
bypass = "powl"; |
| 1248 |
c_fix = format; |
| 1249 |
c_fix_arg = "#if 1"; |
| 1250 |
test_text = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)"; |
| 1251 |
}; |
| 1252 |
|
| 1253 |
/* |
| 1254 |
* Various systems derived from BSD4.4 contain a macro definition |
| 1255 |
* for vfscanf that interacts badly with requirements of builtin-attrs.def. |
| 1256 |
* Known to be fixed in FreeBSD 5 system headers. |
| 1257 |
*/ |
| 1258 |
fix = { |
| 1259 |
hackname = bsd_stdio_attrs_conflict; |
| 1260 |
mach = "*-*-*bsd*"; |
| 1261 |
mach = "*-*-*darwin*"; |
| 1262 |
files = stdio.h; |
| 1263 |
select = "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$"; |
| 1264 |
c_fix = format; |
| 1265 |
c_fix_arg = '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n" |
| 1266 |
'#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n" |
| 1267 |
'int vfscanf(FILE *, const char *, __builtin_va_list) ' |
| 1268 |
'__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");'; |
| 1269 |
test_text = '#define vfscanf __svfscanf'; |
| 1270 |
}; |
| 1271 |
|
| 1272 |
fix = { |
| 1273 |
hackname = apple_local_stdio_fn_deprecation; |
| 1274 |
mach = "*-*-*darwin2*"; |
| 1275 |
files = stdio.h; |
| 1276 |
files = _stdio.h; |
| 1277 |
select = "__deprecated_msg([^\n]*)$"; |
| 1278 |
c_fix = format; |
| 1279 |
c_fix_arg = "#if defined(__APPLE_LOCAL_DEPRECATIONS)\n" |
| 1280 |
"%0\n" |
| 1281 |
"#endif"; |
| 1282 |
test_text = '__deprecated_msg("This function is provided for compat...")'; |
| 1283 |
}; |
| 1284 |
|
| 1285 |
/* |
| 1286 |
* Fix various macros used to define ioctl numbers. |
| 1287 |
* The traditional syntax was: |
| 1288 |
* |
| 1289 |
* #define _CTRL(n, x) (('n'<<8)+x) |
| 1290 |
* #define TCTRLCFOO _CTRL(T, 1) |
| 1291 |
* |
| 1292 |
* but this does not work with the C standard, which disallows macro |
| 1293 |
* expansion inside strings. We have to rewrite it thus: |
| 1294 |
* |
| 1295 |
* #define _CTRL(n, x) ((n<<8)+x) |
| 1296 |
* #define TCTRLCFOO _CTRL('T', 1) |
| 1297 |
* |
| 1298 |
* The select expressions match too much, but the c_fix code is cautious. |
| 1299 |
* |
| 1300 |
* CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ... |
| 1301 |
*/ |
| 1302 |
fix = { |
| 1303 |
hackname = ctrl_quotes_def; |
| 1304 |
select = "define[ \t]+[A-Z0-9_]+CTRL\\([a-zA-Z][,)]"; |
| 1305 |
c_fix = char_macro_def; |
| 1306 |
c_fix_arg = "CTRL"; |
| 1307 |
|
| 1308 |
/* |
| 1309 |
* This is two tests in order to ensure that the "CTRL(c)" can |
| 1310 |
* be selected in isolation from the multi-arg format |
| 1311 |
*/ |
| 1312 |
test_text = "#define BSD43_CTRL(n, x) (('n'<<8)+x)\n"; |
| 1313 |
test_text = "#define _CTRL(c) ('c'&037)"; |
| 1314 |
}; |
| 1315 |
|
| 1316 |
/* |
| 1317 |
* Fix various macros used to define ioctl numbers. |
| 1318 |
*/ |
| 1319 |
fix = { |
| 1320 |
hackname = ctrl_quotes_use; |
| 1321 |
select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']"; |
| 1322 |
c_fix = char_macro_use; |
| 1323 |
c_fix_arg = "CTRL"; |
| 1324 |
test_text = "#define TCTRLFOO BSD43_CTRL(T, 1)"; |
| 1325 |
}; |
| 1326 |
|
| 1327 |
/* |
| 1328 |
* sys/mman.h on HP/UX is not C++ ready, |
| 1329 |
* even though NO_IMPLICIT_EXTERN_C is defined on HP/UX. |
| 1330 |
* |
| 1331 |
* rpc/types.h on OSF1/2.0 is not C++ ready, |
| 1332 |
* even though NO_IMPLICIT_EXTERN_C is defined for the alpha. |
| 1333 |
* |
| 1334 |
* The problem is the declaration of malloc. |
| 1335 |
*/ |
| 1336 |
fix = { |
| 1337 |
hackname = cxx_unready; |
| 1338 |
files = sys/mman.h; |
| 1339 |
files = rpc/types.h; |
| 1340 |
select = '[^#]+malloc.*;'; /* Catch any form of declaration |
| 1341 |
not within a macro. */ |
| 1342 |
bypass = '"C"|__BEGIN_DECLS'; |
| 1343 |
|
| 1344 |
c_fix = wrap; |
| 1345 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 1346 |
"extern \"C\" {\n" |
| 1347 |
"#endif\n"; |
| 1348 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 1349 |
"}\n" |
| 1350 |
"#endif\n"; |
| 1351 |
test_text = "extern void* malloc( size_t );"; |
| 1352 |
}; |
| 1353 |
|
| 1354 |
/* |
| 1355 |
* macOS 10.12 <AvailabilityInternal.h> uses __attribute__((availability)) |
| 1356 |
* unconditionally. |
| 1357 |
*/ |
| 1358 |
fix = { |
| 1359 |
hackname = darwin_availabilityinternal; |
| 1360 |
mach = "*-*-darwin*"; |
| 1361 |
files = AvailabilityInternal.h; |
| 1362 |
select = "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*"; |
| 1363 |
c_fix = format; |
| 1364 |
c_fix_arg = <<- _EOFix_ |
| 1365 |
#if defined(__has_attribute) |
| 1366 |
#if __has_attribute(availability) |
| 1367 |
%0 |
| 1368 |
#else |
| 1369 |
#define %1 |
| 1370 |
#endif |
| 1371 |
#else |
| 1372 |
#define %1 |
| 1373 |
#endif |
| 1374 |
_EOFix_; |
| 1375 |
|
| 1376 |
test_text = "#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))\n" |
| 1377 |
"#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))"; |
| 1378 |
}; |
| 1379 |
|
| 1380 |
/* |
| 1381 |
* For the AAB_darwin7_9_long_double_funcs fix (and later fixes for long long) |
| 1382 |
* to be useful, the main math.h must use <> and not "" includes. |
| 1383 |
*/ |
| 1384 |
fix = { |
| 1385 |
hackname = darwin_9_long_double_funcs_2; |
| 1386 |
mach = "*-*-darwin*"; |
| 1387 |
files = math.h; |
| 1388 |
select = '#include[ \t]+\"'; |
| 1389 |
c_fix = format; |
| 1390 |
c_fix_arg = "%1<%2.h>"; |
| 1391 |
|
| 1392 |
c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"'; |
| 1393 |
|
| 1394 |
test_text = '#include <architecture/ppc/math.h>'; |
| 1395 |
}; |
| 1396 |
|
| 1397 |
/* |
| 1398 |
* On darwin8 and earlier, mach-o/swap.h isn't properly guarded |
| 1399 |
* by 'extern "C"'. On darwin7 some mach/ headers aren't properly guarded. |
| 1400 |
*/ |
| 1401 |
fix = { |
| 1402 |
hackname = darwin_externc; |
| 1403 |
mach = "*-*-darwin*"; |
| 1404 |
files = mach-o/swap.h; |
| 1405 |
files = mach/mach_time.h; |
| 1406 |
files = mach/mach_traps.h; |
| 1407 |
files = mach/message.h; |
| 1408 |
files = mach/mig.h; |
| 1409 |
files = mach/semaphore.h; |
| 1410 |
bypass = "extern \"C\""; |
| 1411 |
bypass = "__BEGIN_DECLS"; |
| 1412 |
c_fix = wrap; |
| 1413 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 1414 |
"extern \"C\" {\n" |
| 1415 |
"#endif\n"; |
| 1416 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 1417 |
"}\n" |
| 1418 |
"#endif\n"; |
| 1419 |
test_text = "extern void swap_fat_header();\n"; |
| 1420 |
}; |
| 1421 |
|
| 1422 |
/* |
| 1423 |
* AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of |
| 1424 |
* bad __GNUC__ tests. |
| 1425 |
*/ |
| 1426 |
fix = { |
| 1427 |
hackname = darwin_gcc4_breakage; |
| 1428 |
mach = "*-*-darwin*"; |
| 1429 |
files = AvailabilityMacros.h; |
| 1430 |
select = "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)"; |
| 1431 |
c_fix = format; |
| 1432 |
c_fix_arg = "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))"; |
| 1433 |
test_text = "#if defined(__GNUC__) && (__GNUC__ >= 3) && " |
| 1434 |
"(__GNUC_MINOR__ >= 1)\n"; |
| 1435 |
}; |
| 1436 |
|
| 1437 |
/* |
| 1438 |
* math.h hides the long long functions that are available on the system for |
| 1439 |
* 10.5 and 10.6 SDKs, we expect to use them in G++ without specifying a value |
| 1440 |
* for __STDC_VERSION__, or switching __STRICT_ANSI__ off. |
| 1441 |
*/ |
| 1442 |
fix = { |
| 1443 |
hackname = darwin_ll_funcs_avail; |
| 1444 |
mach = "*-*-darwin*"; |
| 1445 |
files = architecture/ppc/math.h, architecture/i386/math.h; |
| 1446 |
select = "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*" |
| 1447 |
"__STRICT_ANSI__[^_]*__GNUC__[^\)]*"; |
| 1448 |
sed = "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*" |
| 1449 |
"__STRICT_ANSI__[^_]*__GNUC__[^\\)]*\)/#if\ !\(__DARWIN_NO_LONG_LONG\)/"; |
| 1450 |
test_text = "#if\ !(__DARWIN_NO_LONG_LONG)"; |
| 1451 |
}; |
| 1452 |
|
| 1453 |
/* |
| 1454 |
* Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn. |
| 1455 |
*/ |
| 1456 |
fix = { |
| 1457 |
hackname = darwin_longjmp_noreturn; |
| 1458 |
mach = "*-*-darwin*"; |
| 1459 |
files = "i386/setjmp.h"; |
| 1460 |
bypass = "__dead2"; |
| 1461 |
select = "(.*longjmp\\(.*jmp_buf.*[^)]+\\));"; |
| 1462 |
c_fix = format; |
| 1463 |
c_fix_arg = "%1 __attribute__ ((__noreturn__));"; |
| 1464 |
|
| 1465 |
test_text = "void siglongjmp(sigjmp_buf, int);"; |
| 1466 |
}; |
| 1467 |
|
| 1468 |
/* |
| 1469 |
* Mac OS X 10.11 <os/trace.h> uses attribute on function definition. |
| 1470 |
*/ |
| 1471 |
fix = { |
| 1472 |
hackname = darwin_os_trace_1; |
| 1473 |
mach = "*-*-darwin*"; |
| 1474 |
files = os/trace.h; |
| 1475 |
select = "^(_os_trace_verify_printf.*) (__attribute__.*)"; |
| 1476 |
c_fix = format; |
| 1477 |
c_fix_arg = "%1"; |
| 1478 |
test_text = "_os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2)))"; |
| 1479 |
}; |
| 1480 |
|
| 1481 |
/* |
| 1482 |
* Mac OS X 10.1[012] <os/trace.h> os_trace_payload_t typedef uses Blocks |
| 1483 |
* extension without guard. |
| 1484 |
*/ |
| 1485 |
fix = { |
| 1486 |
hackname = darwin_os_trace_2; |
| 1487 |
mach = "*-*-darwin*"; |
| 1488 |
files = os/trace.h; |
| 1489 |
select = "typedef.*\\^os_trace_payload_t.*"; |
| 1490 |
bypass = "#ifdef __BLOCKS__"; |
| 1491 |
c_fix = format; |
| 1492 |
c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; |
| 1493 |
test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);"; |
| 1494 |
}; |
| 1495 |
|
| 1496 |
/* |
| 1497 |
* macOSX 13.0 SDK objc/runtime.h uses Apple Blocks extension without a guard. |
| 1498 |
*/ |
| 1499 |
|
| 1500 |
fix = { |
| 1501 |
hackname = darwin_objc_runtime_1; |
| 1502 |
mach = "*-*-darwin2*"; |
| 1503 |
files = objc/runtime.h; |
| 1504 |
select = <<- _EOSelect_ |
| 1505 |
OBJC_EXPORT void.* |
| 1506 |
objc_enumerateClasses.* |
| 1507 |
.* |
| 1508 |
.* |
| 1509 |
.* |
| 1510 |
.*void \(\^ _Nonnull block.* |
| 1511 |
.* |
| 1512 |
.* |
| 1513 |
.*OBJC_REFINED_FOR_SWIFT.* |
| 1514 |
_EOSelect_; |
| 1515 |
bypass = "#ifdef __BLOCKS__"; |
| 1516 |
c_fix = format; |
| 1517 |
c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; |
| 1518 |
test_text = <<- _OBJC_RUNTIME_1 |
| 1519 |
OBJC_EXPORT void |
| 1520 |
objc_enumerateClasses(const void * _Nullable image, |
| 1521 |
const char * _Nullable namePrefix, |
| 1522 |
Protocol * _Nullable conformingTo, |
| 1523 |
Class _Nullable subclassing, |
| 1524 |
void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop) |
| 1525 |
OBJC_NOESCAPE) |
| 1526 |
OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0) |
| 1527 |
OBJC_REFINED_FOR_SWIFT; |
| 1528 |
_OBJC_RUNTIME_1; |
| 1529 |
}; |
| 1530 |
|
| 1531 |
|
| 1532 |
/* |
| 1533 |
* In Mac OS X 10.1[012] <os/trace.h>, need to guard users of |
| 1534 |
* os_trace_payload_t typedef, too. |
| 1535 |
*/ |
| 1536 |
fix = { |
| 1537 |
hackname = darwin_os_trace_3; |
| 1538 |
mach = "*-*-darwin*"; |
| 1539 |
files = os/trace.h; |
| 1540 |
select = <<- _EOSelect_ |
| 1541 |
__(API|OSX)_.* |
| 1542 |
OS_EXPORT.* |
| 1543 |
.* |
| 1544 |
_os_trace.*os_trace_payload_t payload); |
| 1545 |
_EOSelect_; |
| 1546 |
c_fix = format; |
| 1547 |
c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; |
| 1548 |
test_text = <<- _EOText_ |
| 1549 |
__API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0)) |
| 1550 |
OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED |
| 1551 |
void |
| 1552 |
_os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); |
| 1553 |
|
| 1554 |
__OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0) |
| 1555 |
OS_EXPORT OS_NOTHROW |
| 1556 |
void |
| 1557 |
_os_trace_internal(void *dso, uint8_t type, const char *format, const uint8_t *buf, size_t buf_size, os_trace_payload_t payload); |
| 1558 |
_EOText_; |
| 1559 |
}; |
| 1560 |
|
| 1561 |
/* |
| 1562 |
* In macOS 10.10 <os/base.h>, doesn't have __has_extension guarded. |
| 1563 |
*/ |
| 1564 |
fix = { |
| 1565 |
hackname = darwin_os_base_1; |
| 1566 |
mach = "*-*-darwin*"; |
| 1567 |
files = os/base.h; |
| 1568 |
select = <<- OS_BASE_1_SEL |
| 1569 |
#define __has_attribute.* |
| 1570 |
#endif |
| 1571 |
OS_BASE_1_SEL; |
| 1572 |
bypass = "#define __has_extension"; |
| 1573 |
c_fix = format; |
| 1574 |
c_fix_arg = <<- OS_BASE_1_FIX |
| 1575 |
%0 |
| 1576 |
#ifndef __has_extension |
| 1577 |
#define __has_extension(x) 0 |
| 1578 |
#endif |
| 1579 |
OS_BASE_1_FIX; |
| 1580 |
test_text = <<- OS_BASE_1_TEST |
| 1581 |
#define __has_attribute(x) 0 |
| 1582 |
#endif |
| 1583 |
|
| 1584 |
#if __GNUC__ |
| 1585 |
OS_BASE_1_TEST; |
| 1586 |
}; |
| 1587 |
|
| 1588 |
/* |
| 1589 |
* In macOS 10.10 <dispatch/object.h>, has unguarded block syntax. |
| 1590 |
*/ |
| 1591 |
fix = { |
| 1592 |
hackname = darwin_dispatch_object_1; |
| 1593 |
mach = "*-*-darwin*"; |
| 1594 |
files = dispatch/object.h; |
| 1595 |
select = "typedef void.*\\^dispatch_block_t.*"; |
| 1596 |
bypass = "#ifdef __BLOCKS__"; |
| 1597 |
c_fix = format; |
| 1598 |
c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; |
| 1599 |
test_text = <<- DISPATCH_OBJECT_1_TEST |
| 1600 |
typedef void (^dispatch_block_t)(void); |
| 1601 |
|
| 1602 |
__BEGIN_DECLS |
| 1603 |
DISPATCH_OBJECT_1_TEST; |
| 1604 |
}; |
| 1605 |
|
| 1606 |
/* |
| 1607 |
* __private_extern__ doesn't exist in FSF GCC. Even if it did, |
| 1608 |
* why would you ever put it in a system header file? |
| 1609 |
*/ |
| 1610 |
fix = { |
| 1611 |
hackname = darwin_private_extern; |
| 1612 |
mach = "*-*-darwin*"; |
| 1613 |
files = mach-o/dyld.h; |
| 1614 |
select = "__private_extern__ [a-z_]+ _dyld_"; |
| 1615 |
c_fix = format; |
| 1616 |
c_fix_arg = "extern"; |
| 1617 |
c_fix_arg = "__private_extern__"; |
| 1618 |
test_text = "__private_extern__ int _dyld_func_lookup(\n" |
| 1619 |
"const char *dyld_func_name,\n" |
| 1620 |
"unsigned long *address);\n"; |
| 1621 |
}; |
| 1622 |
|
| 1623 |
/* |
| 1624 |
* Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to |
| 1625 |
* unsigned constants. |
| 1626 |
*/ |
| 1627 |
fix = { |
| 1628 |
hackname = darwin_stdint_1; |
| 1629 |
mach = "*-*-darwin*"; |
| 1630 |
files = stdint-darwin.h, stdint.h; |
| 1631 |
c_fix = format; |
| 1632 |
c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv"; |
| 1633 |
select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n" |
| 1634 |
"#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)"; |
| 1635 |
test_text = "#define UINT8_C(v) (v ## U)\n" |
| 1636 |
"#define UINT16_C(v) (v ## U)"; |
| 1637 |
}; |
| 1638 |
|
| 1639 |
/* |
| 1640 |
* Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX |
| 1641 |
* with wrong types. |
| 1642 |
*/ |
| 1643 |
fix = { |
| 1644 |
hackname = darwin_stdint_2; |
| 1645 |
mach = "*-*-darwin*"; |
| 1646 |
files = stdint-darwin.h, stdint.h; |
| 1647 |
c_fix = format; |
| 1648 |
c_fix_arg = "#if __WORDSIZE == 64\n" |
| 1649 |
"#define INTPTR_MAX 9223372036854775807L\n" |
| 1650 |
"#define INTPTR_MIN (-INTPTR_MAX-1)\n" |
| 1651 |
"#else\n" |
| 1652 |
"#define INTPTR_MAX 2147483647L\n" |
| 1653 |
"#define INTPTR_MIN (-INTPTR_MAX-1)\n" |
| 1654 |
"#endif"; |
| 1655 |
select = "#if __WORDSIZE == 64\n" |
| 1656 |
"#define INTPTR_MIN[ \t]+INT64_MIN\n" |
| 1657 |
"#define INTPTR_MAX[ \t]+INT64_MAX\n" |
| 1658 |
"#else\n" |
| 1659 |
"#define INTPTR_MIN[ \t]+INT32_MIN\n" |
| 1660 |
"#define INTPTR_MAX[ \t]+INT32_MAX\n" |
| 1661 |
"#endif"; |
| 1662 |
test_text = "#if __WORDSIZE == 64\n" |
| 1663 |
"#define INTPTR_MIN INT64_MIN\n" |
| 1664 |
"#define INTPTR_MAX INT64_MAX\n" |
| 1665 |
"#else\n" |
| 1666 |
"#define INTPTR_MIN INT32_MIN\n" |
| 1667 |
"#define INTPTR_MAX INT32_MAX\n" |
| 1668 |
"#endif"; |
| 1669 |
}; |
| 1670 |
|
| 1671 |
/* |
| 1672 |
* Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type. |
| 1673 |
*/ |
| 1674 |
fix = { |
| 1675 |
hackname = darwin_stdint_3; |
| 1676 |
mach = "*-*-darwin*"; |
| 1677 |
files = stdint-darwin.h, stdint.h; |
| 1678 |
c_fix = format; |
| 1679 |
c_fix_arg = "#if __WORDSIZE == 64\n" |
| 1680 |
"#define UINTPTR_MAX 18446744073709551615UL\n" |
| 1681 |
"#else\n" |
| 1682 |
"#define UINTPTR_MAX 4294967295UL\n" |
| 1683 |
"#endif"; |
| 1684 |
select = "#if __WORDSIZE == 64\n" |
| 1685 |
"#define UINTPTR_MAX[ \t]+UINT64_MAX\n" |
| 1686 |
"#else\n" |
| 1687 |
"#define UINTPTR_MAX[ \t]+UINT32_MAX\n" |
| 1688 |
"#endif"; |
| 1689 |
test_text = "#if __WORDSIZE == 64\n" |
| 1690 |
"#define UINTPTR_MAX UINT64_MAX\n" |
| 1691 |
"#else\n" |
| 1692 |
"#define UINTPTR_MAX UINT32_MAX\n" |
| 1693 |
"#endif"; |
| 1694 |
}; |
| 1695 |
|
| 1696 |
/* |
| 1697 |
* Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type. |
| 1698 |
*/ |
| 1699 |
fix = { |
| 1700 |
hackname = darwin_stdint_4; |
| 1701 |
mach = "*-*-darwin*"; |
| 1702 |
files = stdint-darwin.h, stdint.h; |
| 1703 |
c_fix = format; |
| 1704 |
c_fix_arg = "#if __WORDSIZE == 64\n" |
| 1705 |
"#define SIZE_MAX 18446744073709551615UL\n" |
| 1706 |
"#else\n" |
| 1707 |
"#define SIZE_MAX 4294967295UL\n" |
| 1708 |
"#endif"; |
| 1709 |
select = "#if __WORDSIZE == 64\n" |
| 1710 |
"#define SIZE_MAX[ \t]+UINT64_MAX\n" |
| 1711 |
"#else\n" |
| 1712 |
"#define SIZE_MAX[ \t]+UINT32_MAX\n" |
| 1713 |
"#endif"; |
| 1714 |
test_text = "#if __WORDSIZE == 64\n" |
| 1715 |
"#define SIZE_MAX UINT64_MAX\n" |
| 1716 |
"#else\n" |
| 1717 |
"#define SIZE_MAX UINT32_MAX\n" |
| 1718 |
"#endif"; |
| 1719 |
}; |
| 1720 |
|
| 1721 |
/* |
| 1722 |
* Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX} |
| 1723 |
* with a wrong type. |
| 1724 |
*/ |
| 1725 |
fix = { |
| 1726 |
hackname = darwin_stdint_5; |
| 1727 |
mach = "*-*-darwin*"; |
| 1728 |
files = stdint-darwin.h, stdint.h; |
| 1729 |
c_fix = format; |
| 1730 |
c_fix_arg = "#if __WORDSIZE == 64\n" |
| 1731 |
"#define INTMAX_MIN (-9223372036854775807L - 1)\n" |
| 1732 |
"#define INTMAX_MAX 9223372036854775807L\n" |
| 1733 |
"#define UINTMAX_MAX 18446744073709551615UL\n" |
| 1734 |
"#else\n" |
| 1735 |
"#define INTMAX_MIN (-9223372036854775807LL - 1)\n" |
| 1736 |
"#define INTMAX_MAX 9223372036854775807LL\n" |
| 1737 |
"#define UINTMAX_MAX 18446744073709551615ULL\n" |
| 1738 |
"#endif"; |
| 1739 |
select = "#define INTMAX_MIN[ \t]+INT64_MIN\n" |
| 1740 |
"#define INTMAX_MAX[ \t]+INT64_MAX\n" |
| 1741 |
"\n" |
| 1742 |
"#define UINTMAX_MAX[ \t]+UINT64_MAX"; |
| 1743 |
test_text = "#define INTMAX_MIN INT64_MIN\n" |
| 1744 |
"#define INTMAX_MAX INT64_MAX\n" |
| 1745 |
"\n" |
| 1746 |
"#define UINTMAX_MAX UINT64_MAX"; |
| 1747 |
}; |
| 1748 |
|
| 1749 |
/* |
| 1750 |
* Darwin headers have a stdint.h that defines {U,}INTMAX_C |
| 1751 |
* with a wrong type. |
| 1752 |
*/ |
| 1753 |
fix = { |
| 1754 |
hackname = darwin_stdint_6; |
| 1755 |
mach = "*-*-darwin*"; |
| 1756 |
files = stdint-darwin.h, stdint.h; |
| 1757 |
c_fix = format; |
| 1758 |
c_fix_arg = "#if __WORDSIZE == 64\n" |
| 1759 |
"#define PTRDIFF_MIN (-9223372036854775807L - 1)\n" |
| 1760 |
"#define PTRDIFF_MAX 9223372036854775807L\n" |
| 1761 |
"#else\n" |
| 1762 |
"#define PTRDIFF_MIN (-2147483647 - 1)\n" |
| 1763 |
"#define PTRDIFF_MAX 2147483647\n" |
| 1764 |
"#endif"; |
| 1765 |
select = "#if __WORDSIZE == 64\n" |
| 1766 |
"#define PTRDIFF_MIN[ \t]+INT64_MIN\n" |
| 1767 |
"#define PTRDIFF_MAX[ \t]+INT64_MAX\n" |
| 1768 |
"#else\n" |
| 1769 |
"#define PTRDIFF_MIN[ \t]+INT32_MIN\n" |
| 1770 |
"#define PTRDIFF_MAX[ \t]+INT32_MAX\n" |
| 1771 |
"#endif"; |
| 1772 |
test_text = "#if __WORDSIZE == 64\n" |
| 1773 |
"#define PTRDIFF_MIN INT64_MIN\n" |
| 1774 |
"#define PTRDIFF_MAX INT64_MAX\n" |
| 1775 |
"#else\n" |
| 1776 |
"#define PTRDIFF_MIN INT32_MIN\n" |
| 1777 |
"#define PTRDIFF_MAX INT32_MAX\n" |
| 1778 |
"#endif"; |
| 1779 |
}; |
| 1780 |
|
| 1781 |
/* |
| 1782 |
* Darwin headers have a stdint.h that defines {U,}INTMAX_C |
| 1783 |
* with a wrong type. |
| 1784 |
*/ |
| 1785 |
fix = { |
| 1786 |
hackname = darwin_stdint_7; |
| 1787 |
mach = "*-*-darwin*"; |
| 1788 |
files = stdint-darwin.h, stdint.h; |
| 1789 |
c_fix = format; |
| 1790 |
c_fix_arg = "#if __WORDSIZE == 64\n" |
| 1791 |
"#define INTMAX_C(v) (v ## L)\n" |
| 1792 |
"#define UINTMAX_C(v) (v ## UL)\n" |
| 1793 |
"#else\n" |
| 1794 |
"#define INTMAX_C(v) (v ## LL)\n" |
| 1795 |
"#define UINTMAX_C(v) (v ## ULL)\n" |
| 1796 |
"#endif"; |
| 1797 |
select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n" |
| 1798 |
"#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)"; |
| 1799 |
bypass = '#ifdef __LP64__'; |
| 1800 |
test_text = "#define INTMAX_C(v) (v ## LL)\n" |
| 1801 |
"#define UINTMAX_C(v) (v ## ULL)"; |
| 1802 |
}; |
| 1803 |
|
| 1804 |
/* The SDK included with XCode 10.2 has the file <sys/ucred.h> that uses the |
| 1805 |
C11 _Atomic keyword (exposing it to C++ code). The work-around here follows |
| 1806 |
the header in declaring the entity volatile when _Atomic is not available. |
| 1807 |
*/ |
| 1808 |
fix = { |
| 1809 |
hackname = darwin_ucred__Atomic; |
| 1810 |
mach = "*-*-darwin*"; |
| 1811 |
files = sys/ucred.h; |
| 1812 |
select = "_Atomic"; |
| 1813 |
c_fix = wrap; |
| 1814 |
c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n" |
| 1815 |
"# define _Atomic volatile\n" |
| 1816 |
"#endif\n"; |
| 1817 |
c_fix_arg = "#if (__STDC_VERSION__ < 201112L) || defined(__cplusplus)\n" |
| 1818 |
"# undef _Atomic\n" |
| 1819 |
"#endif\n"; |
| 1820 |
test_text = ""; /* Don't provide this for wrap fixes. */ |
| 1821 |
}; |
| 1822 |
|
| 1823 |
/* The darwin headers don't accept __FLT_EVAL_METHOD__ == 16. */ |
| 1824 |
fix = { |
| 1825 |
hackname = darwin_flt_eval_method; |
| 1826 |
mach = "*-*-darwin*"; |
| 1827 |
files = math.h; |
| 1828 |
select = "^#if __FLT_EVAL_METHOD__ == 0( \\|\\| __FLT_EVAL_METHOD__ == -1)?$"; |
| 1829 |
c_fix = format; |
| 1830 |
c_fix_arg = "%0 || __FLT_EVAL_METHOD__ == 16"; |
| 1831 |
test_text = "#if __FLT_EVAL_METHOD__ == 0\n" |
| 1832 |
"#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1"; |
| 1833 |
}; |
| 1834 |
|
| 1835 |
/* |
| 1836 |
* Fix <c_asm.h> on Digital UNIX V4.0: |
| 1837 |
* It contains a prototype for a DEC C internal asm() function, |
| 1838 |
* clashing with gcc's asm keyword. So protect this with __DECC. |
| 1839 |
*/ |
| 1840 |
fix = { |
| 1841 |
hackname = dec_intern_asm; |
| 1842 |
files = c_asm.h; |
| 1843 |
sed = "/^[ \t]*float[ \t]*fasm/i\\\n#ifdef __DECC\n"; |
| 1844 |
sed = "/^[ \t]*#[ \t]*pragma[ \t]*intrinsic([ \t]*dasm/a\\\n" |
| 1845 |
"#endif\n"; |
| 1846 |
test_text = |
| 1847 |
"float fasm {\n" |
| 1848 |
" ... asm stuff ...\n" |
| 1849 |
"};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/"; |
| 1850 |
}; |
| 1851 |
|
| 1852 |
/* |
| 1853 |
* Fix typo in <wchar.h> on DJGPP 2.03. |
| 1854 |
*/ |
| 1855 |
fix = { |
| 1856 |
hackname = djgpp_wchar_h; |
| 1857 |
file = wchar.h; |
| 1858 |
select = "__DJ_wint_t"; |
| 1859 |
bypass = "sys/djtypes.h"; |
| 1860 |
c_fix = format; |
| 1861 |
c_fix_arg = "%0\n#include <sys/djtypes.h>"; |
| 1862 |
c_fix_arg = "#include <stddef.h>"; |
| 1863 |
test_text = "#include <stddef.h>\n" |
| 1864 |
"extern __DJ_wint_t x;\n"; |
| 1865 |
}; |
| 1866 |
|
| 1867 |
/* |
| 1868 |
* Fix these Sun OS files to avoid an invalid identifier in an #ifdef. |
| 1869 |
*/ |
| 1870 |
fix = { |
| 1871 |
hackname = ecd_cursor; |
| 1872 |
files = "sunwindow/win_lock.h"; |
| 1873 |
files = "sunwindow/win_cursor.h"; |
| 1874 |
select = 'ecd\.cursor'; |
| 1875 |
c_fix = format; |
| 1876 |
c_fix_arg = 'ecd_cursor'; |
| 1877 |
|
| 1878 |
test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */"; |
| 1879 |
}; |
| 1880 |
|
| 1881 |
/* |
| 1882 |
* Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64 |
| 1883 |
* that fails when compiling for SSE-less 32-bit x86. |
| 1884 |
*/ |
| 1885 |
fix = { |
| 1886 |
hackname = feraiseexcept_nosse_divbyzero; |
| 1887 |
mach = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*'; |
| 1888 |
files = bits/fenv.h, '*/bits/fenv.h'; |
| 1889 |
select = "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : " |
| 1890 |
": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$"; |
| 1891 |
bypass = "\"fdivp .*; fwait\""; |
| 1892 |
|
| 1893 |
c_fix = format; |
| 1894 |
c_fix_arg = <<- _EOText_ |
| 1895 |
# ifdef __SSE_MATH__ |
| 1896 |
%0 |
| 1897 |
# else |
| 1898 |
%1__asm__ __volatile__ ("fdivp %%%%st, %%%%st(1); fwait" |
| 1899 |
%1 : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)"); |
| 1900 |
# endif |
| 1901 |
_EOText_; |
| 1902 |
|
| 1903 |
test_text = <<- _EOText_ |
| 1904 |
__asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g)); |
| 1905 |
_EOText_; |
| 1906 |
}; |
| 1907 |
|
| 1908 |
/* |
| 1909 |
* Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64 |
| 1910 |
* that fails when compiling for SSE-less 32-bit x86. |
| 1911 |
*/ |
| 1912 |
fix = { |
| 1913 |
hackname = feraiseexcept_nosse_invalid; |
| 1914 |
mach = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*'; |
| 1915 |
files = bits/fenv.h, '*/bits/fenv.h'; |
| 1916 |
select = "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : " |
| 1917 |
": \"x\" \\(__f\\)\\);$"; |
| 1918 |
bypass = "\"fdiv .*; fwait\""; |
| 1919 |
|
| 1920 |
c_fix = format; |
| 1921 |
c_fix_arg = <<- _EOText_ |
| 1922 |
# ifdef __SSE_MATH__ |
| 1923 |
%0 |
| 1924 |
# else |
| 1925 |
%1__asm__ __volatile__ ("fdiv %%%%st, %%%%st(0); fwait" |
| 1926 |
%1 : "=t" (__f) : "0" (__f)); |
| 1927 |
# endif |
| 1928 |
_EOText_; |
| 1929 |
|
| 1930 |
test_text = <<- _EOText_ |
| 1931 |
__asm__ __volatile__ ("divss %0, %0" : : "x" (__f)); |
| 1932 |
_EOText_; |
| 1933 |
}; |
| 1934 |
|
| 1935 |
/* |
| 1936 |
* Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume |
| 1937 |
* neither the existence of GCC 3 nor its exact feature set yet break |
| 1938 |
* (by design?) when __GNUC__ is set beyond 2. |
| 1939 |
*/ |
| 1940 |
fix = { |
| 1941 |
hackname = freebsd_gcc3_breakage; |
| 1942 |
mach = "*-*-freebsd*"; |
| 1943 |
files = sys/cdefs.h; |
| 1944 |
select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$'; |
| 1945 |
bypass = '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)'; |
| 1946 |
c_fix = format; |
| 1947 |
c_fix_arg = '%0 || __GNUC__ >= 3'; |
| 1948 |
test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7'; |
| 1949 |
}; |
| 1950 |
|
| 1951 |
/* |
| 1952 |
* Some releases of FreeBSD 4 and FreeBSD 5.0 and 5.1 system headers presume |
| 1953 |
* neither the existence of GCC 4 nor its exact feature set yet break |
| 1954 |
* (by design?) when __GNUC__ is set beyond 3. |
| 1955 |
*/ |
| 1956 |
fix = { |
| 1957 |
hackname = freebsd_gcc4_breakage; |
| 1958 |
mach = "*-*-freebsd*"; |
| 1959 |
files = sys/cdefs.h; |
| 1960 |
select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$'; |
| 1961 |
c_fix = format; |
| 1962 |
c_fix_arg = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3'; |
| 1963 |
test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3'; |
| 1964 |
}; |
| 1965 |
|
| 1966 |
/* |
| 1967 |
* Some versions of glibc don't expect the C99 inline semantics. |
| 1968 |
*/ |
| 1969 |
fix = { |
| 1970 |
hackname = glibc_c99_inline_1; |
| 1971 |
files = features.h, '*/features.h'; |
| 1972 |
select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$"; |
| 1973 |
c_fix = format; |
| 1974 |
c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)"; |
| 1975 |
test_text = <<-EOT |
| 1976 |
#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ |
| 1977 |
&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ |
| 1978 |
# define __USE_EXTERN_INLINES 1 |
| 1979 |
#endif |
| 1980 |
EOT; |
| 1981 |
}; |
| 1982 |
|
| 1983 |
/* |
| 1984 |
* Similar, but a version that didn't have __NO_INLINE__ |
| 1985 |
*/ |
| 1986 |
fix = { |
| 1987 |
hackname = glibc_c99_inline_1a; |
| 1988 |
files = features.h, '*/features.h'; |
| 1989 |
select = "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n" |
| 1990 |
"(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)"; |
| 1991 |
c_fix = format; |
| 1992 |
c_fix_arg = "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2"; |
| 1993 |
test_text = <<-EOT |
| 1994 |
#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ |
| 1995 |
# define __USE_EXTERN_INLINES 1 |
| 1996 |
#endif |
| 1997 |
EOT; |
| 1998 |
}; |
| 1999 |
|
| 2000 |
/* |
| 2001 |
* The glibc_c99_inline_1 fix should have fixed everything. Unfortunately |
| 2002 |
* there are many glibc headers which do not respect __USE_EXTERN_INLINES. |
| 2003 |
* The remaining glibc_c99_inline_* fixes deal with some of those headers. |
| 2004 |
*/ |
| 2005 |
fix = { |
| 2006 |
hackname = glibc_c99_inline_2; |
| 2007 |
files = sys/stat.h, '*/sys/stat.h'; |
| 2008 |
select = "extern __inline__ int"; |
| 2009 |
sed = "s/extern int \\(stat\\)/" |
| 2010 |
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" |
| 2011 |
"__inline__ int \\1/"; |
| 2012 |
sed = "s/extern int \\([lf]stat\\)/" |
| 2013 |
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" |
| 2014 |
"__inline__ int \\1/"; |
| 2015 |
sed = "s/extern int \\(mknod\\)/" |
| 2016 |
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" |
| 2017 |
"__inline__ int \\1/"; |
| 2018 |
sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/" |
| 2019 |
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" |
| 2020 |
"__inline__ int __REDIRECT\\1 (\\2/"; |
| 2021 |
sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/" |
| 2022 |
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" |
| 2023 |
"__inline__ int __REDIRECT\\1 (\\2/"; |
| 2024 |
sed = "s/^extern __inline__ int/" |
| 2025 |
"#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" |
| 2026 |
"__inline__ int/"; |
| 2027 |
test_text = <<-EOT |
| 2028 |
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); |
| 2029 |
extern __inline__ int |
| 2030 |
__NTH (fstat64 (int __fd, struct stat64 *__statbuf)) |
| 2031 |
{} |
| 2032 |
EOT; |
| 2033 |
}; |
| 2034 |
|
| 2035 |
/* |
| 2036 |
* glibc_c99_inline_3 |
| 2037 |
*/ |
| 2038 |
fix = { |
| 2039 |
hackname = glibc_c99_inline_3; |
| 2040 |
files = bits/string2.h, '*/bits/string2.h'; |
| 2041 |
select = "extern __inline"; |
| 2042 |
bypass = "__extern_inline|__GNU_STDC_INLINE__"; |
| 2043 |
c_fix = format; |
| 2044 |
c_fix_arg = "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)"; |
| 2045 |
c_fix_arg = "^# ifdef __cplusplus$"; |
| 2046 |
test_text = <<-EOT |
| 2047 |
# ifdef __cplusplus |
| 2048 |
# define __STRING_INLINE inline |
| 2049 |
# else |
| 2050 |
# define __STRING_INLINE extern __inline |
| 2051 |
# endif |
| 2052 |
EOT; |
| 2053 |
}; |
| 2054 |
|
| 2055 |
/* |
| 2056 |
* glibc_c99_inline_4 |
| 2057 |
*/ |
| 2058 |
fix = { |
| 2059 |
hackname = glibc_c99_inline_4; |
| 2060 |
files = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h', |
| 2061 |
pthread.h, '*/pthread.h'; |
| 2062 |
bypass = "__extern_inline|__gnu_inline__"; |
| 2063 |
select = "(^| )extern __inline"; |
| 2064 |
c_fix = format; |
| 2065 |
c_fix_arg = "%0 __attribute__ ((__gnu_inline__))"; |
| 2066 |
test_text = <<-EOT |
| 2067 |
__extension__ extern __inline unsigned int |
| 2068 |
extern __inline unsigned int |
| 2069 |
EOT; |
| 2070 |
}; |
| 2071 |
|
| 2072 |
/* glibc-2.27 to 2.36 assume GCC 7 or later supports some or all |
| 2073 |
* of _Float{16,32,64,128} and _Float{32,64,128}x keywords for C, |
| 2074 |
* but doesn't for C++. |
| 2075 |
*/ |
| 2076 |
fix = { |
| 2077 |
hackname = glibc_cxx_floatn_1; |
| 2078 |
files = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h"; |
| 2079 |
select = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n" |
| 2080 |
"(([ \t]*/\\*[^\n]*\\*/\n)?" |
| 2081 |
"([ \t]*#[ \t]*if[^\n]*\n)?" |
| 2082 |
"[ \t]*#[ \t]*define __f(16|32|64|128)x?\\()"; |
| 2083 |
c_fix = format; |
| 2084 |
c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2"; |
| 2085 |
test_text = <<-EOT |
| 2086 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2087 |
/* The literal suffix f128 exists only since GCC 7.0. */ |
| 2088 |
# define __f128(x) x##l |
| 2089 |
# else |
| 2090 |
# define __f128(x) x##f128 |
| 2091 |
# endif |
| 2092 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2093 |
/* The literal suffix (f128) exist for powerpc only since GCC 7.0. */ |
| 2094 |
# if __LDBL_MANT_DIG__ == 113 |
| 2095 |
# define __f128(x) x##l |
| 2096 |
# else |
| 2097 |
# define __f128(x) x##q |
| 2098 |
# endif |
| 2099 |
# else |
| 2100 |
# define __f128(x) x##f128 |
| 2101 |
# endif |
| 2102 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2103 |
# ifdef __NO_LONG_DOUBLE_MATH |
| 2104 |
# define __f64(x) x##l |
| 2105 |
# else |
| 2106 |
# define __f64(x) x |
| 2107 |
# endif |
| 2108 |
# else |
| 2109 |
# define __f64(x) x##f64 |
| 2110 |
# endif |
| 2111 |
EOT; |
| 2112 |
}; |
| 2113 |
|
| 2114 |
fix = { |
| 2115 |
hackname = glibc_cxx_floatn_2; |
| 2116 |
files = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h"; |
| 2117 |
select = "^([ \t]*#[ \t]*(el)?if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n" |
| 2118 |
"(([ \t]*/\\*[^\n]*\\*/\n)?" |
| 2119 |
"[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)"; |
| 2120 |
c_fix = format; |
| 2121 |
c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%3"; |
| 2122 |
test_text = <<-EOT |
| 2123 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2124 |
typedef float _Float16 __attribute__ ((__mode__ (__HF__))); |
| 2125 |
# endif |
| 2126 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2127 |
typedef __float128 _Float128; |
| 2128 |
# endif |
| 2129 |
# if 0 |
| 2130 |
# elif !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2131 |
typedef __float128 _Float128; |
| 2132 |
# endif |
| 2133 |
EOT; |
| 2134 |
}; |
| 2135 |
|
| 2136 |
fix = { |
| 2137 |
hackname = glibc_cxx_floatn_3; |
| 2138 |
files = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h"; |
| 2139 |
select = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n" |
| 2140 |
"(([ \t]*/\\*[^\n]*\n?[^\n]*\\*/\n)?" |
| 2141 |
"([ \t]*#[ \t]*if[^\n]*\n)?" |
| 2142 |
"([ \t]*typedef[ \t]+[^\n]*;\n)?" |
| 2143 |
"[ \t]*#[ \t]*define __CFLOAT(16|32|64|128)X?[ \t]+)"; |
| 2144 |
c_fix = format; |
| 2145 |
c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2"; |
| 2146 |
test_text = <<-EOT |
| 2147 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2148 |
# define __CFLOAT128 _Complex long double |
| 2149 |
# else |
| 2150 |
# define __CFLOAT128 _Complex _Float128 |
| 2151 |
# endif |
| 2152 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2153 |
/* Add a typedef for older GCC compilers which don't natively support |
| 2154 |
_Complex _Float128. */ |
| 2155 |
typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); |
| 2156 |
# define __CFLOAT128 __cfloat128 |
| 2157 |
# else |
| 2158 |
# define __CFLOAT128 _Complex _Float128 |
| 2159 |
# endif |
| 2160 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2161 |
# ifdef __NO_LONG_DOUBLE_MATH |
| 2162 |
# define __CFLOAT64 _Complex long double |
| 2163 |
# else |
| 2164 |
# define __CFLOAT64 _Complex double |
| 2165 |
# endif |
| 2166 |
# else |
| 2167 |
# define __CFLOAT64 _Complex _Float64 |
| 2168 |
# endif |
| 2169 |
EOT; |
| 2170 |
}; |
| 2171 |
|
| 2172 |
fix = { |
| 2173 |
hackname = glibc_cxx_floatn_4; |
| 2174 |
files = bits/floatn.h, "*/bits/floatn.h"; |
| 2175 |
select = "^([ \t]*#[ \t]*if __LDBL_MANT_DIG__ == 113 && )defined __cplusplus\n" |
| 2176 |
"(([ \t]*/\\*[^\n]*\\*/\n)?" |
| 2177 |
"[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float128;)"; |
| 2178 |
c_fix = format; |
| 2179 |
c_fix_arg = "%1defined __cplusplus && !__GNUC_PREREQ (13, 0)\n%2"; |
| 2180 |
test_text = <<-EOT |
| 2181 |
# if __LDBL_MANT_DIG__ == 113 && defined __cplusplus |
| 2182 |
typedef long double _Float128; |
| 2183 |
# define __CFLOAT128 _Complex long double |
| 2184 |
# endif |
| 2185 |
EOT; |
| 2186 |
}; |
| 2187 |
|
| 2188 |
fix = { |
| 2189 |
hackname = glibc_cxx_floatn_5; |
| 2190 |
files = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h"; |
| 2191 |
select = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n" |
| 2192 |
"([ \t]*#[ \t]+error \"_Float128[xX] supported but no )"; |
| 2193 |
c_fix = format; |
| 2194 |
c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2"; |
| 2195 |
test_text = <<-EOT |
| 2196 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2197 |
# error "_Float128X supported but no constant suffix" |
| 2198 |
# endif |
| 2199 |
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus |
| 2200 |
# error "_Float128x supported but no type" |
| 2201 |
# endif |
| 2202 |
EOT; |
| 2203 |
}; |
| 2204 |
|
| 2205 |
/* glibc-2.3.5 defines pthread mutex initializers incorrectly, |
| 2206 |
* so we replace them with versions that correspond to the |
| 2207 |
* definition. |
| 2208 |
*/ |
| 2209 |
fix = { |
| 2210 |
hackname = glibc_mutex_init; |
| 2211 |
files = pthread.h; |
| 2212 |
select = '\{ *\{ *0, *\} *\}'; |
| 2213 |
sed = "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n" |
| 2214 |
"N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}"; |
| 2215 |
sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_" |
| 2216 |
"\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/"; |
| 2217 |
sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_" |
| 2218 |
"\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/"; |
| 2219 |
sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_" |
| 2220 |
"\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/"; |
| 2221 |
sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_" |
| 2222 |
"\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/"; |
| 2223 |
sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_" |
| 2224 |
"\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/"; |
| 2225 |
sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_" |
| 2226 |
"\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/"; |
| 2227 |
sed = "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/" |
| 2228 |
"N;s/^[ \t]*#[ \t]*" |
| 2229 |
"\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n" |
| 2230 |
"[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n" |
| 2231 |
"# \\1\\\n" |
| 2232 |
" { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n" |
| 2233 |
"# else\\\n" |
| 2234 |
"# \\1\\\n" |
| 2235 |
" { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n" |
| 2236 |
"# endif/"; |
| 2237 |
sed = "s/{ \\(0, 0, 0, 0, 0, 0, " |
| 2238 |
"PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/"; |
| 2239 |
sed = "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/" |
| 2240 |
"s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/"; |
| 2241 |
|
| 2242 |
test_text = <<- _EOText_ |
| 2243 |
#define PTHREAD_MUTEX_INITIALIZER \\ |
| 2244 |
{ { 0, } } |
| 2245 |
#ifdef __USE_GNU |
| 2246 |
# if __WORDSIZE == 64 |
| 2247 |
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \\ |
| 2248 |
{ { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } } |
| 2249 |
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \\ |
| 2250 |
{ { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } } |
| 2251 |
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \\ |
| 2252 |
{ { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } } |
| 2253 |
# else |
| 2254 |
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \\ |
| 2255 |
{ { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } } |
| 2256 |
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \\ |
| 2257 |
{ { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } } |
| 2258 |
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \\ |
| 2259 |
{ { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } } |
| 2260 |
# endif |
| 2261 |
#endif |
| 2262 |
# define PTHREAD_RWLOCK_INITIALIZER \\ |
| 2263 |
{ { 0, } } |
| 2264 |
# ifdef __USE_GNU |
| 2265 |
# if __WORDSIZE == 64 |
| 2266 |
# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \\ |
| 2267 |
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\ |
| 2268 |
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } } |
| 2269 |
# else |
| 2270 |
# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \\ |
| 2271 |
{ { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } } |
| 2272 |
# endif |
| 2273 |
# endif |
| 2274 |
#define PTHREAD_COND_INITIALIZER { { 0, } } |
| 2275 |
_EOText_; |
| 2276 |
}; |
| 2277 |
|
| 2278 |
/* glibc versions before 2.5 have a version of stdint.h that defines |
| 2279 |
UINT8_C and UINT16_C to produce unsigned constants, as do uClibc |
| 2280 |
versions with stdint.h based on those glibc versions. */ |
| 2281 |
fix = { |
| 2282 |
hackname = glibc_stdint; |
| 2283 |
files = stdint.h; |
| 2284 |
select = "GNU C Library"; |
| 2285 |
c_fix = format; |
| 2286 |
c_fix_arg = "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc"; |
| 2287 |
c_fix_arg = "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U"; |
| 2288 |
test_text = "/* This file is part of the GNU C Library. */\n" |
| 2289 |
"# define UINT8_C(c)\tc ## U\n" |
| 2290 |
"# define UINT16_C(c)\tc ## U"; |
| 2291 |
}; |
| 2292 |
|
| 2293 |
/* Some versions of glibc have a version of bits/string2.h that |
| 2294 |
produces "value computed is not used" warnings from strncpy; fix |
| 2295 |
this definition by using __builtin_strncpy instead as in newer |
| 2296 |
versions. */ |
| 2297 |
fix = { |
| 2298 |
hackname = glibc_strncpy; |
| 2299 |
files = bits/string2.h, '*/bits/string2.h'; |
| 2300 |
bypass = "__builtin_strncpy"; |
| 2301 |
c_fix = format; |
| 2302 |
c_fix_arg = "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)"; |
| 2303 |
c_fix_arg = "# define strncpy([^\n]*\\\\\n)*[^\n]*"; |
| 2304 |
test_text = <<-EOT |
| 2305 |
# define strncpy(dest, src, n) \ |
| 2306 |
(__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \\ |
| 2307 |
? (strlen (src) + 1 >= ((size_t) (n)) \\ |
| 2308 |
? (char *) memcpy (dest, src, n) \\ |
| 2309 |
: strncpy (dest, src, n)) \\ |
| 2310 |
: strncpy (dest, src, n))) |
| 2311 |
EOT; |
| 2312 |
|
| 2313 |
}; |
| 2314 |
|
| 2315 |
/* glibc's tgmath.h relies on an expression that is not an integer |
| 2316 |
constant expression being treated as it was by GCC 4.4 and |
| 2317 |
earlier. */ |
| 2318 |
fix = { |
| 2319 |
hackname = glibc_tgmath; |
| 2320 |
files = tgmath.h; |
| 2321 |
select = '\(\(\(type\) 0.25\) && \(\(type\) 0.25 - 1\)\)'; |
| 2322 |
bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type"; |
| 2323 |
c_fix = format; |
| 2324 |
c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || " |
| 2325 |
"(__builtin_classify_type ((type) 0) == 9 && " |
| 2326 |
"__builtin_classify_type (__real__ ((type) 0)) == 8))"; |
| 2327 |
test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))"; |
| 2328 |
}; |
| 2329 |
|
| 2330 |
/* |
| 2331 |
* Fix these files to use the types we think they should for |
| 2332 |
* ptrdiff_t, size_t, and wchar_t. |
| 2333 |
* |
| 2334 |
* This defines the types in terms of macros predefined by our 'cpp'. |
| 2335 |
* This is supposedly necessary for glibc's handling of these types. |
| 2336 |
* It's probably not necessary for anyone else, but it doesn't hurt. |
| 2337 |
*/ |
| 2338 |
fix = { |
| 2339 |
hackname = gnu_types; |
| 2340 |
files = "sys/types.h"; |
| 2341 |
files = "stdlib.h"; |
| 2342 |
files = "sys/stdtypes.h"; |
| 2343 |
files = "stddef.h"; |
| 2344 |
files = "memory.h"; |
| 2345 |
files = "unistd.h"; |
| 2346 |
bypass = '_GCC_(PTRDIFF|SIZE|WCHAR)_T'; |
| 2347 |
select = "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;"; |
| 2348 |
c_fix = gnu_type; |
| 2349 |
/* The Solaris 10 headers already define these types correctly. */ |
| 2350 |
mach = '*-*-solaris2.1[0-9]*'; |
| 2351 |
not_machine = true; |
| 2352 |
|
| 2353 |
test_text = "typedef long int ptrdiff_t; /* long int */\n" |
| 2354 |
"typedef uint_t size_t; /* uint_t */\n" |
| 2355 |
"typedef ushort_t wchar_t; /* ushort_t */"; |
| 2356 |
}; |
| 2357 |
|
| 2358 |
/* |
| 2359 |
* Fix HP & Sony's use of "../machine/xxx.h" |
| 2360 |
* to refer to: <machine/xxx.h> |
| 2361 |
*/ |
| 2362 |
fix = { |
| 2363 |
hackname = hp_inline; |
| 2364 |
files = sys/spinlock.h; |
| 2365 |
files = machine/machparam.h; |
| 2366 |
select = "[ \t]*#[ \t]*include[ \t]+" '"\.\./machine/'; |
| 2367 |
|
| 2368 |
c_fix = format; |
| 2369 |
c_fix_arg = "%1<machine/%2.h>"; |
| 2370 |
|
| 2371 |
c_fix_arg = "([ \t]*#[ \t]*include[ \t]+)" '"\.\./machine/' |
| 2372 |
'([a-z]+)\.h"'; |
| 2373 |
|
| 2374 |
test_text = ' # include "../machine/mumble.h"'; |
| 2375 |
}; |
| 2376 |
|
| 2377 |
/* |
| 2378 |
* Check for (...) in C++ code in HP/UX sys/file.h. |
| 2379 |
*/ |
| 2380 |
fix = { |
| 2381 |
hackname = hp_sysfile; |
| 2382 |
files = sys/file.h; |
| 2383 |
select = "HPUX_SOURCE"; |
| 2384 |
|
| 2385 |
c_fix = format; |
| 2386 |
c_fix_arg = "(struct file *, ...)"; |
| 2387 |
c_fix_arg = '\(\.\.\.\)'; |
| 2388 |
|
| 2389 |
test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */"; |
| 2390 |
}; |
| 2391 |
|
| 2392 |
/* |
| 2393 |
* Un-Hide a series of five FP defines from post-1999 compliance GCC: |
| 2394 |
* FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN |
| 2395 |
*/ |
| 2396 |
fix = { |
| 2397 |
hackname = hppa_hpux_fp_macros; |
| 2398 |
mach = "hppa*-hp-hpux11*"; |
| 2399 |
files = math.h; |
| 2400 |
select = "#[ \t]*define[ \t]*FP_NORMAL.*\n" |
| 2401 |
"#[ \t]*define[ \t]*FP_ZERO.*\n" |
| 2402 |
"#[ \t]*define[ \t]*FP_INFINITE.*\n" |
| 2403 |
"#[ \t]*define[ \t]*FP_SUBNORMAL.*\n" |
| 2404 |
"#[ \t]*define[ \t]*FP_NAN.*\n"; |
| 2405 |
c_fix = format; |
| 2406 |
c_fix_arg = <<- _EOFix_ |
| 2407 |
#endif /* _INCLUDE_HPUX_SOURCE */ |
| 2408 |
|
| 2409 |
#if defined(_INCLUDE_HPUX_SOURCE) || \ |
| 2410 |
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) |
| 2411 |
%0#endif |
| 2412 |
|
| 2413 |
#ifdef _INCLUDE_HPUX_SOURCE |
| 2414 |
|
| 2415 |
_EOFix_; |
| 2416 |
|
| 2417 |
test_text = |
| 2418 |
"# define FP_NORMAL 0\n" |
| 2419 |
"# define FP_ZERO 1\n" |
| 2420 |
"# define FP_INFINITE 2\n" |
| 2421 |
"# define FP_SUBNORMAL 3\n" |
| 2422 |
"# define FP_NAN 4\n"; |
| 2423 |
}; |
| 2424 |
|
| 2425 |
/* |
| 2426 |
* Delete C++ double pow (double, int) inline function from HP-UX 10 & 11 |
| 2427 |
* math.h to prevent clash with define in c_std/bits/std_cmath.h. |
| 2428 |
*/ |
| 2429 |
fix = { |
| 2430 |
hackname = hpux10_cpp_pow_inline; |
| 2431 |
files = fixinc-test-limits.h, math.h; |
| 2432 |
select = <<- END_POW_INLINE |
| 2433 |
^# +ifdef +__cplusplus |
| 2434 |
+\} |
| 2435 |
+inline +double +pow\(double +__d,int +__expon\) +\{ |
| 2436 |
[ ]+return +pow\(__d,\(double\)__expon\); |
| 2437 |
+\} |
| 2438 |
+extern +"C" +\{ |
| 2439 |
#else |
| 2440 |
# +endif |
| 2441 |
END_POW_INLINE; |
| 2442 |
|
| 2443 |
c_fix = format; |
| 2444 |
c_fix_arg = ""; |
| 2445 |
|
| 2446 |
test_text = |
| 2447 |
"# ifdef __cplusplus\n" |
| 2448 |
" }\n" |
| 2449 |
" inline double pow(double __d,int __expon) {\n" |
| 2450 |
"\t return pow(__d,(double)__expon);\n" |
| 2451 |
" }\n" |
| 2452 |
' extern "C"' " {\n" |
| 2453 |
"#else\n" |
| 2454 |
"# endif"; |
| 2455 |
}; |
| 2456 |
|
| 2457 |
fix = { |
| 2458 |
hackname = hpux11_cpp_pow_inline; |
| 2459 |
files = math.h; |
| 2460 |
select = " +inline double pow\\(double d,int expon\\) \\{\n" |
| 2461 |
" +return pow\\(d, \\(double\\)expon\\);\n" |
| 2462 |
" +\\}\n"; |
| 2463 |
c_fix = format; |
| 2464 |
c_fix_arg = ""; |
| 2465 |
|
| 2466 |
test_text = |
| 2467 |
" inline double pow(double d,int expon) {\n" |
| 2468 |
" return pow(d, (double)expon);\n" |
| 2469 |
" }\n"; |
| 2470 |
}; |
| 2471 |
|
| 2472 |
/* |
| 2473 |
* This hack fixes the declarations of _DINFINITY, _SINFINITY and _SQNAN. |
| 2474 |
*/ |
| 2475 |
fix = { |
| 2476 |
hackname = hpux_math_constexpr; |
| 2477 |
mach = "*-hp-hpux11*"; |
| 2478 |
files = math.h; |
| 2479 |
sed = "s@^[ \t]*extern[ \t]*const[ \t]*double[ \t]*_DINFINITY;" |
| 2480 |
"[ \t]*$@# define _DINFINITY (__builtin_inf ())@"; |
| 2481 |
sed = "s@^[ \t]*extern[ \t]*const[ \t]*float[ \t]*_SINFINITY;" |
| 2482 |
"[ \t]*$@# define _SINFINITY (__builtin_inff ())@"; |
| 2483 |
sed = "s@^[ \t]*extern[ \t]*const[ \t]*float[ \t]*_SQNAN;" |
| 2484 |
"[ \t]*$@# define _SQNAN (__builtin_nanf (\\\"\\\"))@"; |
| 2485 |
test_text = " extern const double _DINFINITY;\n" |
| 2486 |
" extern const float _SINFINITY;\n" |
| 2487 |
" extern const float _SQNAN;"; |
| 2488 |
}; |
| 2489 |
|
| 2490 |
/* |
| 2491 |
* Fix hpux 10.X missing ctype declarations 1 |
| 2492 |
*/ |
| 2493 |
fix = { |
| 2494 |
hackname = hpux10_ctype_declarations1; |
| 2495 |
files = ctype.h; |
| 2496 |
select = "^#[ \t]*define _toupper\\(__c\\)[ \t]*__toupper\\(__c\\)"; |
| 2497 |
bypass = "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\("; |
| 2498 |
c_fix = format; |
| 2499 |
c_fix_arg = "#ifdef _PROTOTYPES\n" |
| 2500 |
"extern int __tolower(int);\n" |
| 2501 |
"extern int __toupper(int);\n" |
| 2502 |
"#else /* NOT _PROTOTYPES */\n" |
| 2503 |
"extern int __tolower();\n" |
| 2504 |
"extern int __toupper();\n" |
| 2505 |
"#endif /* _PROTOTYPES */\n\n" |
| 2506 |
"%0\n"; |
| 2507 |
|
| 2508 |
test_text = "# define _toupper(__c) __toupper(__c)\n"; |
| 2509 |
}; |
| 2510 |
|
| 2511 |
/* |
| 2512 |
* Fix hpux 10.X missing ctype declarations 2 |
| 2513 |
*/ |
| 2514 |
fix = { |
| 2515 |
hackname = hpux10_ctype_declarations2; |
| 2516 |
files = ctype.h; |
| 2517 |
select = "^# if defined\\(_SB_CTYPE_MACROS\\) && \\!defined\\(__lint\\)"; |
| 2518 |
bypass = "^[ \t]*extern[ \t]*int[ \t]*_isalnum[ \t]*\\("; |
| 2519 |
c_fix = format; |
| 2520 |
c_fix_arg = "%0\n\n" |
| 2521 |
"#ifdef _PROTOTYPES\n" |
| 2522 |
" extern int _isalnum(int);\n" |
| 2523 |
" extern int _isalpha(int);\n" |
| 2524 |
" extern int _iscntrl(int);\n" |
| 2525 |
" extern int _isdigit(int);\n" |
| 2526 |
" extern int _isgraph(int);\n" |
| 2527 |
" extern int _islower(int);\n" |
| 2528 |
" extern int _isprint(int);\n" |
| 2529 |
" extern int _ispunct(int);\n" |
| 2530 |
" extern int _isspace(int);\n" |
| 2531 |
" extern int _isupper(int);\n" |
| 2532 |
" extern int _isxdigit(int);\n" |
| 2533 |
"# else /* not _PROTOTYPES */\n" |
| 2534 |
" extern int _isalnum();\n" |
| 2535 |
" extern int _isalpha();\n" |
| 2536 |
" extern int _iscntrl();\n" |
| 2537 |
" extern int _isdigit();\n" |
| 2538 |
" extern int _isgraph();\n" |
| 2539 |
" extern int _islower();\n" |
| 2540 |
" extern int _isprint();\n" |
| 2541 |
" extern int _ispunct();\n" |
| 2542 |
" extern int _isspace();\n" |
| 2543 |
" extern int _isupper();\n" |
| 2544 |
" extern int _isxdigit();\n" |
| 2545 |
"#endif /* _PROTOTYPES */\n"; |
| 2546 |
|
| 2547 |
test_text = "# if defined(_SB_CTYPE_MACROS) && !defined(__lint)\n" |
| 2548 |
" extern unsigned int *__SB_masks;\n"; |
| 2549 |
}; |
| 2550 |
|
| 2551 |
/* |
| 2552 |
* Fix hpux 10.X missing stdio declarations |
| 2553 |
*/ |
| 2554 |
fix = { |
| 2555 |
hackname = hpux10_stdio_declarations; |
| 2556 |
files = stdio.h; |
| 2557 |
select = "^#[ \t]*define _iob[ \t]*__iob"; |
| 2558 |
bypass = "^[ \t]*extern[ \t]*int[ \t]*vsnprintf[ \t]*\\("; |
| 2559 |
c_fix = format; |
| 2560 |
c_fix_arg = "%0\n\n" |
| 2561 |
"# if defined(__STDC__) || defined(__cplusplus)\n" |
| 2562 |
" extern int snprintf(char *, size_t, const char *, ...);\n" |
| 2563 |
" extern int vsnprintf(char *, size_t, const char *, __va_list);\n" |
| 2564 |
"# else /* not __STDC__) || __cplusplus */\n" |
| 2565 |
" extern int snprintf();\n" |
| 2566 |
" extern int vsnprintf();\n" |
| 2567 |
"# endif /* __STDC__) || __cplusplus */\n"; |
| 2568 |
|
| 2569 |
test_text = "# define _iob __iob\n"; |
| 2570 |
}; |
| 2571 |
|
| 2572 |
/* |
| 2573 |
* The HP-UX stddef.h is replaced by gcc's. It doesn't include sys/stdsyms.h. |
| 2574 |
* As a result, we need to include sys/stdsyms.h in alloca.h. |
| 2575 |
*/ |
| 2576 |
fix = { |
| 2577 |
hackname = hppa_hpux11_alloca; |
| 2578 |
mach = "hppa*-*-hpux11*"; |
| 2579 |
files = alloca.h; |
| 2580 |
select = "#ifndef _STDDEF_INCLUDED"; |
| 2581 |
c_fix = format; |
| 2582 |
c_fix_arg = "#ifndef _SYS_STDSYMS_INCLUDED\n" |
| 2583 |
"# include <sys/stdsyms.h>\n" |
| 2584 |
"#endif /* _SYS_STDSYMS_INCLUDED */\n\n" |
| 2585 |
"%0"; |
| 2586 |
|
| 2587 |
test_text = "#ifndef _STDDEF_INCLUDED"; |
| 2588 |
}; |
| 2589 |
|
| 2590 |
/* |
| 2591 |
* Make sure hpux defines abs in header. |
| 2592 |
*/ |
| 2593 |
fix = { |
| 2594 |
hackname = hpux11_abs; |
| 2595 |
mach = "*-hp-hpux11*"; |
| 2596 |
files = stdlib.h; |
| 2597 |
select = "ifndef _MATH_INCLUDED"; |
| 2598 |
c_fix = format; |
| 2599 |
c_fix_arg = "if !defined(_MATH_INCLUDED) || defined(__GNUG__)"; |
| 2600 |
test_text = "#ifndef _MATH_INCLUDED"; |
| 2601 |
}; |
| 2602 |
|
| 2603 |
/* |
| 2604 |
* Fix hpux11 __LWP_RWLOCK_VALID define |
| 2605 |
*/ |
| 2606 |
fix = { |
| 2607 |
hackname = hpux11_lwp_rwlock_valid; |
| 2608 |
mach = "*-hp-hpux11*"; |
| 2609 |
files = sys/pthread.h; |
| 2610 |
select = "#define __LWP_RWLOCK_VALID[ \t]*0x8c91"; |
| 2611 |
c_fix = format; |
| 2612 |
c_fix_arg = "#define __LWP_RWLOCK_VALID -29551"; |
| 2613 |
test_text = "#define __LWP_RWLOCK_VALID 0x8c91"; |
| 2614 |
}; |
| 2615 |
|
| 2616 |
/* |
| 2617 |
* hpux sendfile() |
| 2618 |
*/ |
| 2619 |
fix = { |
| 2620 |
hackname = hpux11_extern_sendfile; |
| 2621 |
mach = "*-hp-hpux11.[12]*"; |
| 2622 |
files = sys/socket.h; |
| 2623 |
select = "^[ \t]*extern sbsize_t sendfile.*\n.*, int\\)\\);\n"; |
| 2624 |
c_fix = format; |
| 2625 |
c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n"; |
| 2626 |
test_text = " extern sbsize_t sendfile __((int, int, off_t, bsize_t,\n" |
| 2627 |
" const struct iovec *, int));\n"; |
| 2628 |
}; |
| 2629 |
|
| 2630 |
/* |
| 2631 |
* hpux sendpath() |
| 2632 |
*/ |
| 2633 |
fix = { |
| 2634 |
hackname = hpux11_extern_sendpath; |
| 2635 |
mach = "*-hp-hpux11.[12]*"; |
| 2636 |
files = sys/socket.h; |
| 2637 |
select = "^[ \t]*extern sbsize_t sendpath.*\n.*, int\\)\\);\n"; |
| 2638 |
c_fix = format; |
| 2639 |
c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n"; |
| 2640 |
test_text = " extern sbsize_t sendpath __((int, int, off_t, bsize_t,\n" |
| 2641 |
" const struct iovec *, int));\n"; |
| 2642 |
}; |
| 2643 |
|
| 2644 |
/* |
| 2645 |
* Keep HP-UX 11 from stomping on C++ math namespace |
| 2646 |
* with defines for fabsf. |
| 2647 |
*/ |
| 2648 |
fix = { |
| 2649 |
hackname = hpux11_fabsf; |
| 2650 |
mach = "*-hp-hpux11*"; |
| 2651 |
files = math.h; |
| 2652 |
select = "^[ \t]*#[ \t]*define[ \t]+fabsf\\(.*"; |
| 2653 |
|
| 2654 |
c_fix = format; |
| 2655 |
c_fix_arg = "#ifndef __cplusplus\n%0\n#endif"; |
| 2656 |
|
| 2657 |
test_text = |
| 2658 |
"#ifdef _PA_RISC\n" |
| 2659 |
"# define fabsf(x) ((float)fabs((double)(float)(x)))\n" |
| 2660 |
"#endif"; |
| 2661 |
}; |
| 2662 |
|
| 2663 |
/* |
| 2664 |
* The definitions for PTHREAD_MUTEX_INITIALIZER and similar initializers |
| 2665 |
* in pthread.h need to be constant expressions to be standard complient. |
| 2666 |
* As a result, we need to remove the void * casts in the initializers |
| 2667 |
* (see hpux11_pthread_const) and to change the __(M|C|RW)POINTER defines |
| 2668 |
* to use the long type. |
| 2669 |
*/ |
| 2670 |
fix = { |
| 2671 |
hackname = hpux11_pthread_pointer; |
| 2672 |
mach = "*-hp-hpux11.[0-3]*"; |
| 2673 |
files = sys/pthread.h; |
| 2674 |
select = "(void[ \t]*\\*)(m|c|rw)(_ptr)"; |
| 2675 |
|
| 2676 |
c_fix = format; |
| 2677 |
c_fix_arg = "long\t%2%3"; |
| 2678 |
test_text = "#define __MPOINTER\t\tvoid\t *m_ptr"; |
| 2679 |
}; |
| 2680 |
|
| 2681 |
/* |
| 2682 |
* Remove void pointer cast and fix C99 constant in __POINTER_SET defines. |
| 2683 |
*/ |
| 2684 |
fix = { |
| 2685 |
hackname = hpux11_pthread_const; |
| 2686 |
mach = "*-hp-hpux11.[0-3]*"; |
| 2687 |
files = sys/pthread.h; |
| 2688 |
select = "^(#define[ \t]+__POINTER_SET[ \t0,]*)(.*\\))"; |
| 2689 |
|
| 2690 |
c_fix = format; |
| 2691 |
c_fix_arg = "%11"; |
| 2692 |
test_text = "#define __POINTER_SET\t\t((void *) 1LL)"; |
| 2693 |
}; |
| 2694 |
|
| 2695 |
/* |
| 2696 |
* Prevent HP-UX 11 from defining __size_t and preventing size_t from |
| 2697 |
* being defined by having it define _hpux_size_t instead. |
| 2698 |
*/ |
| 2699 |
fix = { |
| 2700 |
hackname = hpux11_size_t; |
| 2701 |
mach = "*-hp-hpux11*"; |
| 2702 |
select = "__size_t"; |
| 2703 |
|
| 2704 |
c_fix = format; |
| 2705 |
c_fix_arg = "_hpux_size_t"; |
| 2706 |
|
| 2707 |
test_text = |
| 2708 |
"#define __size_t size_t\n" |
| 2709 |
" extern int getpwuid_r( char *, __size_t, struct passwd **);\n"; |
| 2710 |
}; |
| 2711 |
|
| 2712 |
/* |
| 2713 |
* Fix hpux 11.00 broken snprintf declaration |
| 2714 |
* (third argument is char *, needs to be const char * to prevent |
| 2715 |
* spurious warnings with -Wwrite-strings or in C++). |
| 2716 |
*/ |
| 2717 |
fix = { |
| 2718 |
hackname = hpux11_snprintf; |
| 2719 |
files = stdio.h; |
| 2720 |
select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)' |
| 2721 |
' *(char *\*, *\.\.\.\);)'; |
| 2722 |
c_fix = format; |
| 2723 |
c_fix_arg = '%1 const %3'; |
| 2724 |
|
| 2725 |
test_text = "extern int snprintf(char *, size_t, char *, ...);\n" |
| 2726 |
"extern int snprintf(char *, __size_t, char *, ...);\n" |
| 2727 |
"extern int snprintf(char *, _hpux_size_t, char *, ...);"; |
| 2728 |
}; |
| 2729 |
|
| 2730 |
/* |
| 2731 |
* Fix hpux 11.00 broken vsnprintf declaration |
| 2732 |
*/ |
| 2733 |
fix = { |
| 2734 |
hackname = hpux11_vsnprintf; |
| 2735 |
files = stdio.h; |
| 2736 |
select = '(extern int vsnprintf\(char \*, _[hpux]*_size_t, ' |
| 2737 |
'const char \*,) __va__list\);'; |
| 2738 |
c_fix = format; |
| 2739 |
c_fix_arg = "%1 __va_list);"; |
| 2740 |
|
| 2741 |
test_text = 'extern int vsnprintf(char *, _hpux_size_t, const char *,' |
| 2742 |
' __va__list);'; |
| 2743 |
}; |
| 2744 |
|
| 2745 |
/* |
| 2746 |
* Fix missing const in hpux vsscanf declaration |
| 2747 |
*/ |
| 2748 |
fix = { |
| 2749 |
hackname = hpux_vsscanf; |
| 2750 |
mach = "*-*-hpux*"; |
| 2751 |
files = stdio.h; |
| 2752 |
select = '(extern int vsscanf\()char'; |
| 2753 |
c_fix = format; |
| 2754 |
c_fix_arg = "%1const char"; |
| 2755 |
|
| 2756 |
test_text = 'extern int vsscanf(char *, const char *, __va_list);'; |
| 2757 |
}; |
| 2758 |
|
| 2759 |
/* |
| 2760 |
* get rid of bogus inline definitions in HP-UX 8.0 |
| 2761 |
*/ |
| 2762 |
fix = { |
| 2763 |
hackname = hpux8_bogus_inlines; |
| 2764 |
files = math.h; |
| 2765 |
select = inline; |
| 2766 |
bypass = "__GNUG__"; |
| 2767 |
sed = "s@inline int abs(int [a-z][a-z]*) {.*}" |
| 2768 |
"@extern \"C\" int abs(int);@"; |
| 2769 |
sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@"; |
| 2770 |
sed = "s@inline int sqr(int [a-z][a-z]*) {.*}@@"; |
| 2771 |
sed = "s@inline double sqr(double [a-z][a-z]*) {.*}@@"; |
| 2772 |
test_text = "inline int abs(int v) { return (v>=0)?v:-v; }\n" |
| 2773 |
"inline double sqr(double v) { return v**0.5; }"; |
| 2774 |
}; |
| 2775 |
|
| 2776 |
/* |
| 2777 |
* hpux intptr |
| 2778 |
*/ |
| 2779 |
fix = { |
| 2780 |
hackname = hpux_c99_intptr; |
| 2781 |
mach = "*-hp-hpux11.3*"; |
| 2782 |
files = stdint-hpux11.h, stdint.h; |
| 2783 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*" |
| 2784 |
"INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@"; |
| 2785 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*" |
| 2786 |
"INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@"; |
| 2787 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*" |
| 2788 |
"INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@"; |
| 2789 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*" |
| 2790 |
"INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@"; |
| 2791 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*" |
| 2792 |
"UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@"; |
| 2793 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*" |
| 2794 |
"UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@"; |
| 2795 |
test_text = "#define PTRDIFF_MAX INT32_MAX\n" |
| 2796 |
"#define PTRDIFF_MIN INT32_MIN\n" |
| 2797 |
"#define INTPTR_MAX INT32_MAX\n" |
| 2798 |
"#define INTPTR_MIN INT32_MIN\n" |
| 2799 |
"#define UINTPTR_MAX UINT32_MAX\n" |
| 2800 |
"#define SIZE_MAX UINT32_MAX\n"; |
| 2801 |
}; |
| 2802 |
|
| 2803 |
/* |
| 2804 |
* These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31. |
| 2805 |
*/ |
| 2806 |
fix = { |
| 2807 |
hackname = hpux_c99_inttypes; |
| 2808 |
mach = "*-hp-hpux11.[23]*"; |
| 2809 |
files = inttypes.h; |
| 2810 |
files = stdint-hpux11.h, stdint.h; |
| 2811 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*" |
| 2812 |
"__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@"; |
| 2813 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*" |
| 2814 |
"__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@"; |
| 2815 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*" |
| 2816 |
"__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@"; |
| 2817 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@" |
| 2818 |
"#define UINT32_C(__c) __CONCAT__(__c,u)@"; |
| 2819 |
test_text = "#define UINT8_C(__c) __CONCAT_U__(__c)\n" |
| 2820 |
"#define UINT16_C(__c) __CONCAT_U__(__c)\n" |
| 2821 |
"#define INT32_C(__c) __CONCAT__(__c,l)\n" |
| 2822 |
"#define UINT32_C(__c) __CONCAT__(__c,ul)\n"; |
| 2823 |
}; |
| 2824 |
|
| 2825 |
/* |
| 2826 |
* These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31. |
| 2827 |
*/ |
| 2828 |
fix = { |
| 2829 |
hackname = hpux_c99_inttypes2; |
| 2830 |
mach = "*-hp-hpux11.2*"; |
| 2831 |
files = stdint-hpux11.h, stdint.h; |
| 2832 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*" |
| 2833 |
"((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@"; |
| 2834 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*" |
| 2835 |
"((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@"; |
| 2836 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*" |
| 2837 |
"((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@"; |
| 2838 |
sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*" |
| 2839 |
"((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@"; |
| 2840 |
test_text = "# define INT8_C(__c) ((signed char)(__c))\n" |
| 2841 |
"# define UINT8_C(__c) ((unsigned char)(__c))\n" |
| 2842 |
"# define INT16_C(__c) ((short)(__c))\n" |
| 2843 |
"# define UINT16_C(__c) ((unsigned short)(__c))\n"; |
| 2844 |
}; |
| 2845 |
|
| 2846 |
/* |
| 2847 |
* Fix broken and missing defines in inttypes.h |
| 2848 |
*/ |
| 2849 |
fix = { |
| 2850 |
hackname = hpux_c99_inttypes3; |
| 2851 |
mach = "hppa*-hp-hpux11*"; |
| 2852 |
files = inttypes.h; |
| 2853 |
select = "#define[ \t]INTPTR_MAX[ \t]*\n" |
| 2854 |
"#define[ \t]UINTPTR_MAX[ \t]*\n"; |
| 2855 |
c_fix = format; |
| 2856 |
c_fix_arg = "#undef SIZE_MAX\n" |
| 2857 |
"#define SIZE_MAX __SIZE_MAX__\n" |
| 2858 |
"#ifdef __INTPTR_MAX__\n" |
| 2859 |
"# undef INTPTR_MAX\n" |
| 2860 |
"# define INTPTR_MAX __INTPTR_MAX__\n" |
| 2861 |
"# undef INTPTR_MIN\n" |
| 2862 |
"# define INTPTR_MIN (-INTPTR_MAX - 1)\n" |
| 2863 |
"#endif\n" |
| 2864 |
"#ifdef __UINTPTR_MAX__\n" |
| 2865 |
"# undef UINTPTR_MAX\n" |
| 2866 |
"# define UINTPTR_MAX __UINTPTR_MAX__\n" |
| 2867 |
"#endif\n"; |
| 2868 |
test_text = "#define INTPTR_MAX\n" |
| 2869 |
"#define UINTPTR_MAX\n"; |
| 2870 |
}; |
| 2871 |
|
| 2872 |
/* |
| 2873 |
* Fix missing SCNuMAX defines in inttypes.h |
| 2874 |
*/ |
| 2875 |
fix = { |
| 2876 |
hackname = hpux_c99_inttypes4; |
| 2877 |
mach = "hppa*-hp-hpux11.[01]*"; |
| 2878 |
files = inttypes.h; |
| 2879 |
sed = "/^[ \t]*#[ \t]*define[ \t]*SCNxMAX[ \t]*SCNx64/a\\\n" |
| 2880 |
"#define SCNuMAX \t SCNu64\n"; |
| 2881 |
sed = "/^[ \t]*#[ \t]*define[ \t]*SCNxMAX[ \t]*SCNx32/a\\\n" |
| 2882 |
"#define SCNuMAX \t SCNu32\n"; |
| 2883 |
test_text = "#define SCNxMAX SCNx64\n" |
| 2884 |
"#define SCNxMAX SCNx32\n"; |
| 2885 |
}; |
| 2886 |
|
| 2887 |
/* |
| 2888 |
* Fix missing PRIdPTR defines in inttypes.h |
| 2889 |
*/ |
| 2890 |
fix = { |
| 2891 |
hackname = hpux_c99_inttypes5; |
| 2892 |
mach = "hppa*-hp-hpux11.[01]*"; |
| 2893 |
files = inttypes.h; |
| 2894 |
select = "#ifndef[ \t]_KERNEL[ \t]*\n"; |
| 2895 |
c_fix = format; |
| 2896 |
c_fix_arg = "#ifndef __LP64__\n" |
| 2897 |
"#define PRIdPTR\t\tPRId32\n" |
| 2898 |
"#define PRIiPTR\t\tPRIi32\n" |
| 2899 |
"#define PRIoPTR\t\tPRIo32\n" |
| 2900 |
"#define PRIuPTR\t\tPRIu32\n" |
| 2901 |
"#define PRIxPTR\t\tPRIx32\n" |
| 2902 |
"#define PRIXPTR\t\tPRIX32\n" |
| 2903 |
"#else\n" |
| 2904 |
"#define PRIdPTR\t\tPRId64\n" |
| 2905 |
"#define PRIiPTR\t\tPRIi64\n" |
| 2906 |
"#define PRIoPTR\t\tPRIo64\n" |
| 2907 |
"#define PRIuPTR\t\tPRIu64\n" |
| 2908 |
"#define PRIxPTR\t\tPRIx64\n" |
| 2909 |
"#define PRIXPTR\t\tPRIX64\n" |
| 2910 |
"#endif\n\n" |
| 2911 |
"#ifndef _KERNEL\n"; |
| 2912 |
test_text = "#ifndef _KERNEL\n"; |
| 2913 |
}; |
| 2914 |
|
| 2915 |
/* |
| 2916 |
* Fix hpux broken ctype macros |
| 2917 |
*/ |
| 2918 |
fix = { |
| 2919 |
hackname = hpux_ctype_macros; |
| 2920 |
files = ctype.h; |
| 2921 |
select = '((: |\()__SB_masks \? )' |
| 2922 |
'(__SB_masks\[__(alnum|c)\] & _IS)'; |
| 2923 |
c_fix = format; |
| 2924 |
c_fix_arg = "%1(int)%3"; |
| 2925 |
|
| 2926 |
test_text = ": __SB_masks ? __SB_masks[__alnum] & _ISCNTRL\n" |
| 2927 |
"# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n"; |
| 2928 |
}; |
| 2929 |
|
| 2930 |
/* |
| 2931 |
* hpux errno() |
| 2932 |
*/ |
| 2933 |
fix = { |
| 2934 |
hackname = hpux_extern_errno; |
| 2935 |
mach = "*-hp-hpux10.*"; |
| 2936 |
mach = "*-hp-hpux11.[0-2]*"; |
| 2937 |
files = errno.h; |
| 2938 |
select = "^[ \t]*extern int errno;$"; |
| 2939 |
c_fix = format; |
| 2940 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 2941 |
"extern \"C\" {\n" |
| 2942 |
"#endif\n" |
| 2943 |
"%0\n" |
| 2944 |
"#ifdef __cplusplus\n" |
| 2945 |
"}\n" |
| 2946 |
"#endif"; |
| 2947 |
test_text = " extern int errno;\n"; |
| 2948 |
}; |
| 2949 |
|
| 2950 |
/* |
| 2951 |
* Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc. |
| 2952 |
*/ |
| 2953 |
fix = { |
| 2954 |
hackname = hpux_htonl; |
| 2955 |
files = netinet/in.h; |
| 2956 |
select = "#ifndef _XOPEN_SOURCE_EXTENDED[ \t]*\n" |
| 2957 |
"(/\\*\n" |
| 2958 |
" \\* Macros for number representation conversion\\.\n" |
| 2959 |
" \\*/\n" |
| 2960 |
"#ifndef ntohl)"; |
| 2961 |
c_fix = format; |
| 2962 |
c_fix_arg = "#if 1\n%1"; |
| 2963 |
|
| 2964 |
test_text = "#ifndef _XOPEN_SOURCE_EXTENDED\n" |
| 2965 |
"/*\n" |
| 2966 |
" * Macros for number representation conversion.\n" |
| 2967 |
" */\n" |
| 2968 |
"#ifndef ntohl\n" |
| 2969 |
"#define ntohl(x) (x)\n" |
| 2970 |
"#define ntohs(x) (x)\n" |
| 2971 |
"#define htonl(x) (x)\n" |
| 2972 |
"#define htons(x) (x)\n" |
| 2973 |
"#endif\n" |
| 2974 |
"#endif /* ! _XOPEN_SOURCE_EXTENDED */"; |
| 2975 |
}; |
| 2976 |
|
| 2977 |
/* |
| 2978 |
* These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31. |
| 2979 |
*/ |
| 2980 |
fix = { |
| 2981 |
hackname = hpux_imaginary_i; |
| 2982 |
mach = "ia64-hp-hpux11.*"; |
| 2983 |
files = complex.h; |
| 2984 |
select = "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*"; |
| 2985 |
c_fix = format; |
| 2986 |
c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)"; |
| 2987 |
test_text = "#define _Complex_I (0.f+_Imaginary_I)\n"; |
| 2988 |
}; |
| 2989 |
|
| 2990 |
/* |
| 2991 |
* These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31. |
| 2992 |
*/ |
| 2993 |
fix = { |
| 2994 |
hackname = hpux_inttype_int8_t; |
| 2995 |
mach = "*-hp-hpux1[01].*"; |
| 2996 |
files = sys/_inttypes.h; |
| 2997 |
select = "^[ \t]*typedef[ \t]*char[ \t]*int(_least){0,1}8_t.*"; |
| 2998 |
c_fix = format; |
| 2999 |
c_fix_arg = "typedef signed char int%18_t;"; |
| 3000 |
test_text = "typedef char int_least8_t;\n" |
| 3001 |
"typedef char int8_t;\n"; |
| 3002 |
}; |
| 3003 |
|
| 3004 |
/* |
| 3005 |
* HP-UX long_double |
| 3006 |
*/ |
| 3007 |
fix = { |
| 3008 |
hackname = hpux_long_double; |
| 3009 |
mach = "*-*-hpux10*"; |
| 3010 |
mach = "*-*-hpux11.[012]*"; |
| 3011 |
files = stdlib.h; |
| 3012 |
select = "extern[ \t]long_double[ \t]strtold"; |
| 3013 |
bypass = "long_double_t"; |
| 3014 |
sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D"; |
| 3015 |
sed = "s/long_double/long double/g"; |
| 3016 |
|
| 3017 |
test_text = "# ifndef _LONG_DOUBLE\n" |
| 3018 |
"# define _LONG_DOUBLE\n" |
| 3019 |
" typedef struct {\n" |
| 3020 |
" unsigned int word1, word2, word3, word4;\n" |
| 3021 |
" } long_double;\n" |
| 3022 |
"# endif /* _LONG_DOUBLE */\n" |
| 3023 |
"extern long_double strtold(const char *, char **);\n"; |
| 3024 |
}; |
| 3025 |
|
| 3026 |
/* |
| 3027 |
* We cannot use the above rule on 11.31 because it removes the strtold |
| 3028 |
* definition. ia64 is OK with no hack, PA needs some help. |
| 3029 |
*/ |
| 3030 |
fix = { |
| 3031 |
hackname = hpux_long_double_2; |
| 3032 |
mach = "hppa*-*-hpux11.3*"; |
| 3033 |
files = stdlib.h; |
| 3034 |
select = "#[ \t]*if[ \t]*!defined\\(__ia64\\) \\|\\| " |
| 3035 |
"defined\\(_PROTOTYPES\\) \\|\\| " |
| 3036 |
"defined\\(_LONG_DOUBLE_STRUCT\\)"; |
| 3037 |
c_fix = format; |
| 3038 |
c_fix_arg = "# if !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)"; |
| 3039 |
|
| 3040 |
test_text = "# if !defined(__ia64) || " |
| 3041 |
"!defined(_PROTOTYPES) || " |
| 3042 |
"defined(_LONG_DOUBLE_STRUCT)\n"; |
| 3043 |
}; |
| 3044 |
|
| 3045 |
/* |
| 3046 |
* Add missing braces to pthread initializer defines. |
| 3047 |
*/ |
| 3048 |
fix = { |
| 3049 |
hackname = hpux_pthread_initializers; |
| 3050 |
mach = "*-hp-hpux11.[0-3]*"; |
| 3051 |
files = sys/pthread.h; |
| 3052 |
sed = "s@^[ \t]*1, 1, 1, 1,[ \t]*\\\\" |
| 3053 |
"@\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@"; |
| 3054 |
sed = "s@^[ \t]*1,[ \t]*\\\\" |
| 3055 |
"@\t{ 1, 0 }@"; |
| 3056 |
sed = "/^[ \t]*0$/d"; |
| 3057 |
sed = "s@__PTHREAD_MUTEX_VALID, 0" |
| 3058 |
"@{ __PTHREAD_MUTEX_VALID, 0 }@"; |
| 3059 |
sed = "s@^[ \t]*0, 0, -1, 0,[ \t]*\\\\" |
| 3060 |
"@\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@"; |
| 3061 |
sed = "s@0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,[ \t]*\\\\" |
| 3062 |
"@{ 0, __LWP_MTX_VALID }, { 0, 1, 1, 1, 1 },\t\t\t\\\\@"; |
| 3063 |
sed = "s@^[ \t]*__LWP_MTX_VALID, 0, 1, 1, 1, 1,[ \t]*\\\\" |
| 3064 |
"@\t{ 0, __LWP_MTX_VALID }, { 0, 1, 1, 1, 1 },\t\t\t\\\\@"; |
| 3065 |
sed = "s@^[ \t]*0, 0[ \t]*\\\\" |
| 3066 |
"@\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@"; |
| 3067 |
sed = "s@__PTHREAD_COND_VALID, 0" |
| 3068 |
"@{ __PTHREAD_COND_VALID, 0 }@"; |
| 3069 |
sed = "s@__LWP_COND_VALID, 0,[ \t]*\\\\" |
| 3070 |
"@{ __LWP_COND_VALID, 0 },\t\t\t\t\t\\\\@"; |
| 3071 |
sed = "s@__PTHREAD_RWLOCK_VALID, 0" |
| 3072 |
"@{ __PTHREAD_RWLOCK_VALID, 0 }@"; |
| 3073 |
sed = "s@__LWP_RWLOCK_VALID, 0,[ \t]*\\\\" |
| 3074 |
"@{ __LWP_RWLOCK_VALID, 0 },\t\t\t\t\t\\\\@"; |
| 3075 |
sed = "s@^[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\" |
| 3076 |
"@\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@"; |
| 3077 |
test_text = "#define PTHREAD_MUTEX_INITIALIZER {\t\t\t\t\t\\\\\n" |
| 3078 |
"\t__PTHREAD_MUTEX_VALID, 0,\t\t\t\t\t\\\\\n" |
| 3079 |
"\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE),\t\t\\\\\n" |
| 3080 |
"\t__SPNLCK_INITIALIZER,\t\t\t\t\t\t\\\\\n" |
| 3081 |
"\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n" |
| 3082 |
"\t0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n" |
| 3083 |
"\t0, 0\t\t\t\t\t\t\t\t\\\\\n" |
| 3084 |
"}\n"; |
| 3085 |
}; |
| 3086 |
|
| 3087 |
/* |
| 3088 |
* Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown |
| 3089 |
* type and mpinfou is only defined when _KERNEL is set. |
| 3090 |
*/ |
| 3091 |
fix = { |
| 3092 |
hackname = hpux_spu_info; |
| 3093 |
mach = "*-hp-hpux*"; |
| 3094 |
/* |
| 3095 |
* It is tempting to omit the first "files" entry. Do not. |
| 3096 |
* The testing machinery will take the first "files" entry as the name |
| 3097 |
* of a test file to play with. It would be a nuisance to have a directory |
| 3098 |
* with the name "*". |
| 3099 |
*/ |
| 3100 |
files = "ia64/sys/getppdp.h"; |
| 3101 |
files = "*/sys/getppdp.h"; |
| 3102 |
select = "^.*extern.*spu_info.*"; |
| 3103 |
|
| 3104 |
c_fix = format; |
| 3105 |
c_fix_arg = "#ifdef _KERNEL\n%0\n#endif"; |
| 3106 |
|
| 3107 |
test_text = "extern union mpinfou spu_info[];"; |
| 3108 |
}; |
| 3109 |
|
| 3110 |
/* |
| 3111 |
* These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31. |
| 3112 |
*/ |
| 3113 |
fix = { |
| 3114 |
hackname = hpux_stdint_least_fast; |
| 3115 |
mach = "*-hp-hpux11.2*"; |
| 3116 |
files = stdint-hpux11.h, stdint.h; |
| 3117 |
select = |
| 3118 |
"^[ \t]*#[ \t]*define[ \t]+UINT_(LEAST|FAST)64_MAX[ \t]+ULLONG_MAX"; |
| 3119 |
c_fix = format; |
| 3120 |
c-fix-arg = "# define UINT_%164_MAX __UINT64_MAX__"; |
| 3121 |
test-text = "# define UINT_FAST64_MAX ULLONG_MAX\n" |
| 3122 |
"# define UINT_LEAST64_MAX ULLONG_MAX\n"; |
| 3123 |
}; |
| 3124 |
|
| 3125 |
/* |
| 3126 |
* Add noreturn attribute to longjmp declarations in hpux <setjmp.h> |
| 3127 |
*/ |
| 3128 |
fix = { |
| 3129 |
hackname = hpux_longjmp; |
| 3130 |
mach = "*-hp-hpux*"; |
| 3131 |
files = setjmp.h; |
| 3132 |
select = "^[ \t]*extern[ \t]+void[ \t]+.*longjmp[ \t]*\(__\\(\\(.*int\\)\\)|\\(.*int\\)|\\(\\)\)"; |
| 3133 |
|
| 3134 |
c_fix = format; |
| 3135 |
c_fix_arg = "%0 __attribute__ ((__noreturn__))"; |
| 3136 |
|
| 3137 |
test_text = 'extern void longjmp __((jmp_buf, int));'; |
| 3138 |
}; |
| 3139 |
|
| 3140 |
/* |
| 3141 |
* Fix hpux10.20 <sys/time.h> to avoid invalid forward decl |
| 3142 |
*/ |
| 3143 |
fix = { |
| 3144 |
hackname = hpux_systime; |
| 3145 |
files = sys/time.h; |
| 3146 |
select = "^extern struct sigevent;"; |
| 3147 |
|
| 3148 |
c_fix = format; |
| 3149 |
c_fix_arg = "struct sigevent;"; |
| 3150 |
|
| 3151 |
test_text = 'extern struct sigevent;'; |
| 3152 |
}; |
| 3153 |
|
| 3154 |
/* |
| 3155 |
* Fix glibc definition of HUGE_VAL in terms of hex floating point constant |
| 3156 |
*/ |
| 3157 |
fix = { |
| 3158 |
hackname = huge_val_hex; |
| 3159 |
files = bits/huge_val.h, '*/bits/huge_val.h'; |
| 3160 |
select = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*"; |
| 3161 |
bypass = "__builtin_huge_val"; |
| 3162 |
|
| 3163 |
c_fix = format; |
| 3164 |
c_fix_arg = "#define HUGE_VAL (__builtin_huge_val())\n"; |
| 3165 |
|
| 3166 |
test_text = "# define HUGE_VAL\t(__extension__ 0x1.0p2047)"; |
| 3167 |
}; |
| 3168 |
|
| 3169 |
/* |
| 3170 |
* Fix glibc definition of HUGE_VALF in terms of hex floating point constant |
| 3171 |
*/ |
| 3172 |
fix = { |
| 3173 |
hackname = huge_valf_hex; |
| 3174 |
files = bits/huge_val.h, '*/bits/huge_val.h'; |
| 3175 |
select = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*"; |
| 3176 |
bypass = "__builtin_huge_valf"; |
| 3177 |
|
| 3178 |
c_fix = format; |
| 3179 |
c_fix_arg = "#define HUGE_VALF (__builtin_huge_valf())\n"; |
| 3180 |
|
| 3181 |
test_text = "# define HUGE_VALF (__extension__ 0x1.0p255f)"; |
| 3182 |
}; |
| 3183 |
|
| 3184 |
/* |
| 3185 |
* Fix glibc definition of HUGE_VALL in terms of hex floating point constant |
| 3186 |
*/ |
| 3187 |
fix = { |
| 3188 |
hackname = huge_vall_hex; |
| 3189 |
files = bits/huge_val.h, '*/bits/huge_val.h'; |
| 3190 |
select = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*"; |
| 3191 |
bypass = "__builtin_huge_vall"; |
| 3192 |
|
| 3193 |
c_fix = format; |
| 3194 |
c_fix_arg = "#define HUGE_VALL (__builtin_huge_vall())\n"; |
| 3195 |
|
| 3196 |
test_text = "# define HUGE_VALL (__extension__ 0x1.0p32767L)"; |
| 3197 |
}; |
| 3198 |
|
| 3199 |
/* |
| 3200 |
* Fix return type of abort and free |
| 3201 |
*/ |
| 3202 |
fix = { |
| 3203 |
hackname = int_abort_free_and_exit; |
| 3204 |
files = stdlib.h; |
| 3205 |
select = "int[ \t]+(abort|free|exit)[ \t]*\\("; |
| 3206 |
bypass = "_CLASSIC_ANSI_TYPES"; |
| 3207 |
|
| 3208 |
c_fix = format; |
| 3209 |
c_fix_arg = "void\t%1("; |
| 3210 |
|
| 3211 |
test_text = "extern int abort(int);\n" |
| 3212 |
"extern int free(void*);\n" |
| 3213 |
"extern int exit(void*);"; |
| 3214 |
}; |
| 3215 |
|
| 3216 |
/* |
| 3217 |
* Fix various macros used to define ioctl numbers. |
| 3218 |
* The traditional syntax was: |
| 3219 |
* |
| 3220 |
* #define _IO(n, x) (('n'<<8)+x) |
| 3221 |
* #define TIOCFOO _IO(T, 1) |
| 3222 |
* |
| 3223 |
* but this does not work with the C standard, which disallows macro |
| 3224 |
* expansion inside strings. We have to rewrite it thus: |
| 3225 |
* |
| 3226 |
* #define _IO(n, x) ((n<<8)+x) |
| 3227 |
* #define TIOCFOO _IO('T', 1) |
| 3228 |
* |
| 3229 |
* The select expressions match too much, but the c_fix code is cautious. |
| 3230 |
* |
| 3231 |
* _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes. |
| 3232 |
*/ |
| 3233 |
fix = { |
| 3234 |
hackname = io_quotes_def; |
| 3235 |
select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\([a-zA-Z][,)]"; |
| 3236 |
c_fix = char_macro_def; |
| 3237 |
c_fix_arg = "IO"; |
| 3238 |
test_text = |
| 3239 |
"#define BSD43__IOWR(n, x) (('n'<<8)+x)\n" |
| 3240 |
"#define _IOWN(x,y,t) (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)\n" |
| 3241 |
"#define _IO(x,y) ('x'<<8|y)"; |
| 3242 |
test_text = |
| 3243 |
"#define XX_IO(x) ('x'<<8|256)"; |
| 3244 |
}; |
| 3245 |
|
| 3246 |
/* |
| 3247 |
* Fix the usage of the ioctl macro numbers. |
| 3248 |
*/ |
| 3249 |
fix = { |
| 3250 |
hackname = io_quotes_use; |
| 3251 |
select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*" |
| 3252 |
"\\( *[^,']"; |
| 3253 |
c_fix = char_macro_use; |
| 3254 |
c_fix_arg = "IO"; |
| 3255 |
test_text = "#define TIOCFOO BSD43__IOWR(T, 1)\n" |
| 3256 |
"#define TIOCFOO \\\\\n" |
| 3257 |
"BSD43__IOWR(T, 1) /* Some are multi-line */"; |
| 3258 |
}; |
| 3259 |
|
| 3260 |
/* |
| 3261 |
* Check for missing ';' in struct |
| 3262 |
*/ |
| 3263 |
fix = { |
| 3264 |
hackname = ip_missing_semi; |
| 3265 |
files = netinet/ip.h; |
| 3266 |
select = "}$"; |
| 3267 |
sed = "/^struct/,/^};/s/}$/};/"; |
| 3268 |
test_text= |
| 3269 |
"struct mumble {\n" |
| 3270 |
" union {\n" |
| 3271 |
" int x;\n" |
| 3272 |
" }\n" |
| 3273 |
"}; /* mumbled struct */\n"; |
| 3274 |
}; |
| 3275 |
|
| 3276 |
/* |
| 3277 |
* Non-traditional "const" declaration in Irix's limits.h. |
| 3278 |
*/ |
| 3279 |
fix = { |
| 3280 |
hackname = irix_limits_const; |
| 3281 |
files = fixinc-test-limits.h, limits.h; |
| 3282 |
select = "^extern const "; |
| 3283 |
c_fix = format; |
| 3284 |
c_fix_arg = "extern __const "; |
| 3285 |
test_text = "extern const char limit; /* test limits */"; |
| 3286 |
}; |
| 3287 |
|
| 3288 |
/* |
| 3289 |
* IRIX 5.x's stdio.h declares some functions that take a va_list as |
| 3290 |
* taking char *. However, GCC uses void * for va_list, so |
| 3291 |
* calling vfprintf with a va_list fails in C++. */ |
| 3292 |
fix = { |
| 3293 |
hackname = irix_stdio_va_list; |
| 3294 |
files = stdio.h; |
| 3295 |
|
| 3296 |
select = '/\* va_list \*/ char \*'; |
| 3297 |
c_fix = format; |
| 3298 |
c_fix_arg = "__gnuc_va_list"; |
| 3299 |
test_text = |
| 3300 |
"extern int printf( const char *, /* va_list */ char * );"; |
| 3301 |
}; |
| 3302 |
|
| 3303 |
/* |
| 3304 |
* These files in Sun OS 4.x and ARM/RISCiX and BSD4.3 |
| 3305 |
* use / * * / to concatenate tokens. |
| 3306 |
*/ |
| 3307 |
fix = { |
| 3308 |
hackname = kandr_concat; |
| 3309 |
files = "sparc/asm_linkage.h"; |
| 3310 |
files = "sun*/asm_linkage.h"; |
| 3311 |
files = "arm/as_support.h"; |
| 3312 |
files = "arm/mc_type.h"; |
| 3313 |
files = "arm/xcb.h"; |
| 3314 |
files = "dev/chardefmac.h"; |
| 3315 |
files = "dev/ps_irq.h"; |
| 3316 |
files = "dev/screen.h"; |
| 3317 |
files = "dev/scsi.h"; |
| 3318 |
files = "sys/tty.h"; |
| 3319 |
files = "Xm.acorn/XmP.h"; |
| 3320 |
files = bsd43/bsd43_.h; |
| 3321 |
select = '/\*\*/'; |
| 3322 |
c_fix = format; |
| 3323 |
c_fix_arg = '##'; |
| 3324 |
test_text = "#define __CONCAT__(a,b) a/**/b"; |
| 3325 |
}; |
| 3326 |
|
| 3327 |
/* |
| 3328 |
* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines |
| 3329 |
* an _SC_GR0_OFFSET macro using an idiom that isn't a compile time |
| 3330 |
* constant on recent versions of g++. |
| 3331 |
*/ |
| 3332 |
fix = { |
| 3333 |
hackname = linux_ia64_ucontext; |
| 3334 |
files = "sys/ucontext.h"; |
| 3335 |
mach = "ia64-*-linux*"; |
| 3336 |
select = '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)' |
| 3337 |
'->sc_gr\[0\]\) - \(char \*\) 0\)'; |
| 3338 |
c_fix = format; |
| 3339 |
c_fix_arg = "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)"; |
| 3340 |
test_text = "# define _SC_GR0_OFFSET\t\\\\\n" |
| 3341 |
"\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n"; |
| 3342 |
}; |
| 3343 |
|
| 3344 |
/* |
| 3345 |
* Remove header file warning from sys/time.h. Autoconf's |
| 3346 |
* AC_HEADER_TIME recommends to include both sys/time.h and time.h |
| 3347 |
* which causes warning on LynxOS. Remove the warning. |
| 3348 |
*/ |
| 3349 |
fix = { |
| 3350 |
hackname = lynxos_no_warning_in_sys_time_h; |
| 3351 |
files = sys/time.h; |
| 3352 |
select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>"; |
| 3353 |
c_fix = format; |
| 3354 |
c_fix_arg = ""; |
| 3355 |
test_text = "#warning Using <time.h> instead of <sys/time.h>"; |
| 3356 |
}; |
| 3357 |
|
| 3358 |
/* |
| 3359 |
* Add missing declaration for putenv. |
| 3360 |
*/ |
| 3361 |
fix = { |
| 3362 |
hackname = lynxos_missing_putenv; |
| 3363 |
mach = '*-*-lynxos*'; |
| 3364 |
files = stdlib.h; |
| 3365 |
bypass = 'putenv[ \t]*\\('; |
| 3366 |
select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);"; |
| 3367 |
c_fix = format; |
| 3368 |
c_fix_arg = "%0\n" |
| 3369 |
"extern int putenv _AP((char *));"; |
| 3370 |
c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);"; |
| 3371 |
test_text = "extern char *getenv _AP((const char *));"; |
| 3372 |
}; |
| 3373 |
|
| 3374 |
/* |
| 3375 |
* Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_. |
| 3376 |
* |
| 3377 |
* On NetBSD, machine is a symbolic link to an architecture specific |
| 3378 |
* directory name, so we can't match a specific file name here. |
| 3379 |
*/ |
| 3380 |
fix = { |
| 3381 |
hackname = machine_ansi_h_va_list; |
| 3382 |
select = "define[ \t]+_BSD_VA_LIST_[ \t]"; |
| 3383 |
bypass = '__builtin_va_list'; |
| 3384 |
|
| 3385 |
c_fix = format; |
| 3386 |
c_fix_arg = "%1__builtin_va_list"; |
| 3387 |
c_fix_arg = "(define[ \t]+_BSD_VA_LIST_[ \t]+).*"; |
| 3388 |
|
| 3389 |
test_text = " # define _BSD_VA_LIST_\tchar**"; |
| 3390 |
}; |
| 3391 |
|
| 3392 |
/* |
| 3393 |
* Fix non-ansi machine name defines |
| 3394 |
*/ |
| 3395 |
fix = { |
| 3396 |
hackname = machine_name; |
| 3397 |
c_test = machine_name; |
| 3398 |
c_fix = machine_name; |
| 3399 |
|
| 3400 |
test_text = "/* MACH_DIFF: */\n" |
| 3401 |
"#if defined( i386 ) || defined( sparc ) || defined( vax ) || " |
| 3402 |
"defined( linux ) || __has_include ( <linux.h> )" |
| 3403 |
"\n/* no uniform test, so be careful :-) */"; |
| 3404 |
}; |
| 3405 |
|
| 3406 |
/* |
| 3407 |
* Some math.h files define struct exception (it's in the System V |
| 3408 |
* Interface Definition), which conflicts with the class exception defined |
| 3409 |
* in the C++ file std/stdexcept.h. We redefine it to __math_exception. |
| 3410 |
* This is not a great fix, but I haven't been able to think of anything |
| 3411 |
* better. |
| 3412 |
*/ |
| 3413 |
fix = { |
| 3414 |
hackname = math_exception; |
| 3415 |
files = math.h; |
| 3416 |
select = "struct exception"; |
| 3417 |
bypass = '__cplusplus'; |
| 3418 |
c_fix = wrap; |
| 3419 |
|
| 3420 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 3421 |
"#define exception __math_exception\n" |
| 3422 |
"#endif\n"; |
| 3423 |
|
| 3424 |
c_fix_arg = "#ifdef __cplusplus\n" |
| 3425 |
"#undef exception\n" |
| 3426 |
"#endif\n"; |
| 3427 |
|
| 3428 |
test_text = "typedef struct exception t_math_exception;"; |
| 3429 |
}; |
| 3430 |
|
| 3431 |
/* |
| 3432 |
* This looks pretty broken to me. ``dbl_max_def'' will contain |
| 3433 |
* "define DBL_MAX " at the start, when what we really want is just |
| 3434 |
* the value portion. Can't figure out how to write a test case |
| 3435 |
* for this either :-( |
| 3436 |
*/ |
| 3437 |
fix = { |
| 3438 |
hackname = math_huge_val_from_dbl_max; |
| 3439 |
files = math.h; |
| 3440 |
|
| 3441 |
/* |
| 3442 |
* IF HUGE_VAL is defined to be DBL_MAX *and* DBL_MAX is _not_ defined |
| 3443 |
* in math.h, this fix applies. |
| 3444 |
*/ |
| 3445 |
select = "define[ \t]+HUGE_VAL[ \t]+DBL_MAX"; |
| 3446 |
bypass = "define[ \t]+DBL_MAX"; |
| 3447 |
|
| 3448 |
shell = |
| 3449 |
/* |
| 3450 |
* See if we have a definition for DBL_MAX in float.h. |
| 3451 |
* If we do, we will replace the one in math.h with that one. |
| 3452 |
*/ |
| 3453 |
|
| 3454 |
"\tdbl_max_def=`egrep 'define[ \t]+DBL_MAX[ \t]+.*' float.h " |
| 3455 |
"| sed 's/.*DBL_MAX[ \t]*//' 2>/dev/null`\n\n" |
| 3456 |
|
| 3457 |
"\tif ( test -n \"${dbl_max_def}\" ) > /dev/null 2>&1\n" |
| 3458 |
"\tthen sed -e '/define[ \t]*HUGE_VAL[ \t]*DBL_MAX/" |
| 3459 |
"s@DBL_MAX@'\"$dbl_max_def@\"\n" |
| 3460 |
"\telse cat\n" |
| 3461 |
"\tfi"; |
| 3462 |
|
| 3463 |
test_text = |
| 3464 |
"`echo '#define DBL_MAX\t3.1415e+9 /* really big */' >> float.h`\n" |
| 3465 |
"#define HUGE_VAL DBL_MAX"; |
| 3466 |
}; |
| 3467 |
|
| 3468 |
/* |
| 3469 |
* nested comment |
| 3470 |
*/ |
| 3471 |
fix = { |
| 3472 |
hackname = nested_auth_des; |
| 3473 |
files = rpc/rpc.h; |
| 3474 |
select = '(/\*.*rpc/auth_des\.h>.*)/\*'; |
| 3475 |
c_fix = format; |
| 3476 |
c_fix_arg = "%1*/ /*"; |
| 3477 |
test_text = "/*#include <rpc/auth_des.h> /* skip this */"; |
| 3478 |
}; |
| 3479 |
|
| 3480 |
/* |
| 3481 |
* Some versions of NetBSD don't expect the C99 inline semantics. |
| 3482 |
*/ |
| 3483 |
fix = { |
| 3484 |
hackname = netbsd_c99_inline_1; |
| 3485 |
mach = "*-*-netbsd*"; |
| 3486 |
files = signal.h; |
| 3487 |
select = "extern __inline int"; |
| 3488 |
|
| 3489 |
c_fix = format; |
| 3490 |
c_fix_arg = "extern\n" |
| 3491 |
"#ifdef __GNUC_STDC_INLINE__\n" |
| 3492 |
"__attribute__((__gnu_inline__))\n" |
| 3493 |
"#endif\n" |
| 3494 |
"__inline int"; |
| 3495 |
|
| 3496 |
test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}"; |
| 3497 |
}; |
| 3498 |
|
| 3499 |
/* |
| 3500 |
* netbsd_c99_inline_2 |
| 3501 |
*/ |
| 3502 |
fix = { |
| 3503 |
hackname = netbsd_c99_inline_2; |
| 3504 |
mach = "*-*-netbsd*"; |
| 3505 |
files = signal.h; |
| 3506 |
select = "#define _SIGINLINE extern __inline"; |
| 3507 |
|
| 3508 |
c_fix = format; |
| 3509 |
c_fix_arg = <<- _EOArg_ |
| 3510 |
#ifdef __GNUC_STDC_INLINE__ |
| 3511 |
#define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline |
| 3512 |
#else |
| 3513 |
%0 |
| 3514 |
#endif |
| 3515 |
_EOArg_; |
| 3516 |
|
| 3517 |
test_text = "#define _SIGINLINE extern __inline"; |
| 3518 |
}; |
| 3519 |
|
| 3520 |
/* |
| 3521 |
* NetBSD has a semicolon after the ending '}' for some extern "C". |
| 3522 |
*/ |
| 3523 |
fix = { |
| 3524 |
hackname = netbsd_extra_semicolon; |
| 3525 |
mach = "*-*-netbsd*"; |
| 3526 |
files = sys/cdefs.h; |
| 3527 |
select = "#define[ \t]*__END_DECLS[ \t]*};"; |
| 3528 |
|
| 3529 |
c_fix = format; |
| 3530 |
c_fix_arg = "#define __END_DECLS }"; |
| 3531 |
|
| 3532 |
test_text = "#define __END_DECLS };"; |
| 3533 |
}; |
| 3534 |
|
| 3535 |
/* |
| 3536 |
* newlib's stdint.h has several failures to conform to C99. The fix |
| 3537 |
* for these removed a comment that can be matched to identify unfixed |
| 3538 |
* versions. |
| 3539 |
*/ |
| 3540 |
fix = { |
| 3541 |
hackname = newlib_stdint_1; |
| 3542 |
files = stdint-newlib.h, stdint.h; |
| 3543 |
select = "@todo - Add support for wint_t types"; |
| 3544 |
sed = "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@"; |
| 3545 |
sed = "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@"; |
| 3546 |
sed = "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@"; |
| 3547 |
sed = "s@#define INT_LEAST32_MIN.*@" |
| 3548 |
"#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@"; |
| 3549 |
sed = "s@#define INT_LEAST32_MAX.*@" |
| 3550 |
"#define INT_LEAST32_MAX __INT_LEAST32_MAX__@"; |
| 3551 |
sed = "s@#define UINT_LEAST32_MAX.*@" |
| 3552 |
"#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@"; |
| 3553 |
sed = 's@#define INT_FAST\([0-9]*\)_MIN.*@' |
| 3554 |
'#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@'; |
| 3555 |
sed = 's@#define INT_FAST\([0-9]*\)_MAX.*@' |
| 3556 |
'#define INT_FAST\1_MAX __INT_FAST\1_MAX__@'; |
| 3557 |
sed = 's@#define UINT_FAST\([0-9]*\)_MAX.*@' |
| 3558 |
'#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@'; |
| 3559 |
sed = "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@"; |
| 3560 |
sed = "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@"; |
| 3561 |
sed = "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@"; |
| 3562 |
sed = "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@"; |
| 3563 |
sed = "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@"; |
| 3564 |
test_text = "/* @todo - Add support for wint_t types. */\n" |
| 3565 |
"#define INT32_MIN (-2147483647-1)\n" |
| 3566 |
"#define INT32_MAX 2147483647\n" |
| 3567 |
"#define UINT32_MAX 4294967295U\n" |
| 3568 |
"#define INT_LEAST32_MIN (-2147483647-1)\n" |
| 3569 |
"#define INT_LEAST32_MAX 2147483647\n" |
| 3570 |
"#define UINT_LEAST32_MAX 4294967295U\n" |
| 3571 |
"#define INT_FAST8_MIN INT8_MIN\n" |
| 3572 |
"#define INT_FAST8_MAX INT8_MAX\n" |
| 3573 |
"#define UINT_FAST8_MAX UINT8_MAX\n" |
| 3574 |
"#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n" |
| 3575 |
"#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n" |
| 3576 |
"#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n" |
| 3577 |
"#define UINT8_C(x) x##U\n" |
| 3578 |
"#define UINT16_C(x) x##U"; |
| 3579 |
}; |
| 3580 |
|
| 3581 |
/* |
| 3582 |
* newlib_stdint_2 |
| 3583 |
*/ |
| 3584 |
fix = { |
| 3585 |
hackname = newlib_stdint_2; |
| 3586 |
files = stdint-newlib.h, stdint.h; |
| 3587 |
select = "@todo - Add support for wint_t types"; |
| 3588 |
c_fix = format; |
| 3589 |
c_fix_arg = "#define INTMAX_MAX __INTMAX_MAX__\n" |
| 3590 |
"#define INTMAX_MIN (-INTMAX_MAX - 1)\n" |
| 3591 |
"#define UINTMAX_MAX __UINTMAX_MAX__\n" |
| 3592 |
"#define WCHAR_MAX __WCHAR_MAX__\n" |
| 3593 |
"#define WCHAR_MIN __WCHAR_MIN__\n" |
| 3594 |
"#define WINT_MAX __WINT_MAX__\n" |
| 3595 |
"#define WINT_MIN __WINT_MIN__\n\n" |
| 3596 |
"%0"; |
| 3597 |
c_fix_arg = '/\*\* Macros for minimum-width integer constant expressions \*/'; |
| 3598 |
test_text = "/* @todo - Add support for wint_t types. */\n" |
| 3599 |
"/** Macros for minimum-width integer constant expressions */"; |
| 3600 |
}; |
| 3601 |
|
| 3602 |
/* |
| 3603 |
* NeXT 3.2 adds const prefix to some math functions. |
| 3604 |
* These conflict with the built-in functions. |
| 3605 |
*/ |
| 3606 |
fix = { |
| 3607 |
hackname = next_math_prefix; |
| 3608 |
files = ansi/math.h; |
| 3609 |
select = "^extern[ \t]+double[ \t]+__const__[ \t]"; |
| 3610 |
|
| 3611 |
c_fix = format; |
| 3612 |
c_fix_arg = "extern double %1("; |
| 3613 |
c_fix_arg = "^extern[ \t]+double[ \t]+__const__[ \t]+([a-z]+)\\("; |
| 3614 |
|
| 3615 |
test_text = "extern\tdouble\t__const__\tmumble();"; |
| 3616 |
}; |
| 3617 |
|
| 3618 |
/* |
| 3619 |
* NeXT 3.2 uses the word "template" as a parameter for some |
| 3620 |
* functions. GCC reports an invalid use of a reserved key word |
| 3621 |
* with the built-in functions. |
| 3622 |
*/ |
| 3623 |
fix = { |
| 3624 |
hackname = next_template; |
| 3625 |
files = bsd/libc.h; |
| 3626 |
select = "[ \t]template\\)"; |
| 3627 |
|
| 3628 |
c_fix = format; |
| 3629 |
c_fix_arg = "(%1)"; |
| 3630 |
c_fix_arg = "\\(([^)]*)[ \t]template\\)"; |
| 3631 |
test_text = "extern mumble( char * template); /* fix */"; |
| 3632 |
}; |
| 3633 |
|
| 3634 |
/* |
| 3635 |
* NeXT 3.2 includes the keyword volatile in the abort() and exit() |
| 3636 |
* function prototypes. That conflicts with the built-in functions. |
| 3637 |
*/ |
| 3638 |
fix = { |
| 3639 |
hackname = next_volitile; |
| 3640 |
files = ansi/stdlib.h; |
| 3641 |
select = "^extern[ \t]+volatile[ \t]+void[ \t]"; |
| 3642 |
|
| 3643 |
c_fix = format; |
| 3644 |
c_fix_arg = "extern void %1("; |
| 3645 |
c_fix_arg = "^extern[ \t]+volatile[ \t]+void[ \t]+(exit|abort)\\("; |
| 3646 |
|
| 3647 |
test_text = "extern\tvolatile\tvoid\tabort();"; |
| 3648 |
}; |
| 3649 |
|
| 3650 |
/* |
| 3651 |
* NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1. |
| 3652 |
* Note that version 3 of the NeXT system has wait.h in a different directory, |
| 3653 |
* so that this code won't do anything. But wait.h in version 3 has a |
| 3654 |
* conditional, so it doesn't need this fix. So everything is okay. |
| 3655 |
*/ |
| 3656 |
fix = { |
| 3657 |
hackname = next_wait_union; |
| 3658 |
files = sys/wait.h; |
| 3659 |
|
| 3660 |
select = 'wait\(union wait'; |
| 3661 |
c_fix = format; |
| 3662 |
c_fix_arg = "wait(void"; |
| 3663 |
test_text = "extern pid_d wait(union wait*);"; |
| 3664 |
}; |
| 3665 |
|
| 3666 |
/* |
| 3667 |
* a missing semi-colon at the end of the nodeent structure definition. |
| 3668 |
*/ |
| 3669 |
fix = { |
| 3670 |
hackname = nodeent_syntax; |
| 3671 |
files = netdnet/dnetdb.h; |
| 3672 |
select = "char[ \t]*\\*na_addr[ \t]*$"; |
| 3673 |
c_fix = format; |
| 3674 |
c_fix_arg = "%0;"; |
| 3675 |
test_text = "char *na_addr\t"; |
| 3676 |
}; |
| 3677 |
|
| 3678 |
/* |
| 3679 |
* Fix OpenBSD's NULL definition. |
| 3680 |
*/ |
| 3681 |
fix = { |
| 3682 |
hackname = openbsd_null_definition; |
| 3683 |
mach = "*-*-openbsd*"; |
| 3684 |
files = locale.h, stddef.h, stdio.h, string.h, |
| 3685 |
time.h, unistd.h, wchar.h, sys/param.h; |
| 3686 |
select = "__GNUG__"; |
| 3687 |
c_fix = format; |
| 3688 |
c_fix_arg = "#ifndef NULL\n" |
| 3689 |
"#ifdef __cplusplus\n" |
| 3690 |
"#ifdef __GNUG__\n" |
| 3691 |
"#define NULL\t__null\n" |
| 3692 |
"#else\t /* ! __GNUG__ */\n" |
| 3693 |
"#define NULL\t0L\n" |
| 3694 |
"#endif\t /* __GNUG__ */\n" |
| 3695 |
"#else\t /* ! __cplusplus */\n" |
| 3696 |
"#define NULL\t((void *)0)\n" |
| 3697 |
"#endif\t /* __cplusplus */\n" |
| 3698 |
"#endif\t /* !NULL */"; |
| 3699 |
|
| 3700 |
c_fix_arg = "^#ifndef[ \t]*NULL\n" |
| 3701 |
"^#ifdef[ \t]*__GNUG__\n" |
| 3702 |
"^#define[ \t]*NULL[ \t]*__null\n" |
| 3703 |
"^#else\n" |
| 3704 |
"^#define[ \t]*NULL[ \t]*0L\n" |
| 3705 |
"^#endif\n" |
| 3706 |
"^#endif"; |
| 3707 |
test_text = |
| 3708 |
"#ifndef NULL\n" |
| 3709 |
"#ifdef __GNUG__\n" |
| 3710 |
"#define NULL __null\n" |
| 3711 |
"#else\n" |
| 3712 |
"#define NULL 0L\n" |
| 3713 |
"#endif\n" |
| 3714 |
"#endif\n"; |
| 3715 |
}; |
| 3716 |
|
| 3717 |
/* |
| 3718 |
* obstack.h used casts as lvalues. |
| 3719 |
* |
| 3720 |
* We need to change postincrements of casted pointers (which are |
| 3721 |
* then dereferenced and assigned into) of the form |
| 3722 |
* |
| 3723 |
* *((TYPE*)PTRVAR)++ = (VALUE) |
| 3724 |
* |
| 3725 |
* into expressions like |
| 3726 |
* |
| 3727 |
* ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE))) |
| 3728 |
* |
| 3729 |
* which is correct for the cases used in obstack.h since PTRVAR is |
| 3730 |
* of type char * and the value of the expression is not used. |
| 3731 |
*/ |
| 3732 |
fix = { |
| 3733 |
hackname = obstack_lvalue_cast; |
| 3734 |
files = obstack.h; |
| 3735 |
select = '\*\(\(([^()]*)\*\)(.*)\)\+\+ = \(([^()]*)\)'; |
| 3736 |
c_fix = format; |
| 3737 |
c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))"; |
| 3738 |
test_text = "*((void **) (h)->next_free)++ = (aptr)"; |
| 3739 |
}; |
| 3740 |
|
| 3741 |
/* |
| 3742 |
* Fix OpenBSD's va_start define. |
| 3743 |
*/ |
| 3744 |
fix = { |
| 3745 |
hackname = openbsd_va_start; |
| 3746 |
mach = "*-*-openbsd*"; |
| 3747 |
files = stdarg.h; |
| 3748 |
select = '__builtin_stdarg_start'; |
| 3749 |
c_fix = format; |
| 3750 |
c_fix_arg = __builtin_va_start; |
| 3751 |
|
| 3752 |
test_text = "#define va_start(v,l) __builtin_stdarg_start((v),l)"; |
| 3753 |
}; |
| 3754 |
|
| 3755 |
/* |
| 3756 |
* sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by |
| 3757 |
* defining regex.h related types. This causes libg++ build and usage |
| 3758 |
* failures. Fixing this correctly requires checking and modifying 3 files. |
| 3759 |
*/ |
| 3760 |
fix = { |
| 3761 |
hackname = osf_namespace_a; |
| 3762 |
files = reg_types.h; |
| 3763 |
files = sys/lc_core.h; |
| 3764 |
test = " -r reg_types.h"; |
| 3765 |
test = " -r sys/lc_core.h"; |
| 3766 |
test = " -n \"`grep '} regex_t;' reg_types.h`\""; |
| 3767 |
test = " -z \"`grep __regex_t regex.h`\""; |
| 3768 |
|
| 3769 |
c_fix = format; |
| 3770 |
c_fix_arg = "__%0"; |
| 3771 |
c_fix_arg = "reg(ex|off|match)_t"; |
| 3772 |
|
| 3773 |
test_text = "`touch sys/lc_core.h`" |
| 3774 |
"typedef struct {\n int stuff, mo_suff;\n} regex_t;\n" |
| 3775 |
"extern regex_t re;\n" |
| 3776 |
"extern regoff_t ro;\n" |
| 3777 |
"extern regmatch_t rm;\n"; |
| 3778 |
}; |
| 3779 |
|
| 3780 |
fix = { |
| 3781 |
hackname = osf_namespace_c; |
| 3782 |
files = regex.h; |
| 3783 |
test = " -r reg_types.h"; |
| 3784 |
test = " -r sys/lc_core.h"; |
| 3785 |
test = " -n \"`grep '} regex_t;' reg_types.h`\""; |
| 3786 |
test = " -z \"`grep __regex_t regex.h`\""; |
| 3787 |
|
| 3788 |
select = "#include <reg_types\.h>.*"; |
| 3789 |
c_fix = format; |
| 3790 |
c_fix_arg = "%0\n" |
| 3791 |
"typedef __regex_t\tregex_t;\n" |
| 3792 |
"typedef __regoff_t\tregoff_t;\n" |
| 3793 |
"typedef __regmatch_t\tregmatch_t;"; |
| 3794 |
|
| 3795 |
test_text = "#include <reg_types.h>"; |
| 3796 |
}; |
| 3797 |
|
| 3798 |
/* |
| 3799 |
* On broken glibc-2.3.3 systems an array of incomplete structures is |
| 3800 |
* passed to __sigsetjmp. Fix that to take a pointer instead. |
| 3801 |
*/ |
| 3802 |
fix = { |
| 3803 |
hackname = pthread_incomplete_struct_argument; |
| 3804 |
files = pthread.h; |
| 3805 |
select = "struct __jmp_buf_tag"; |
| 3806 |
bypass = "bits/types/struct___jmp_buf_tag.h"; |
| 3807 |
c_fix = format; |
| 3808 |
c_fix_arg = "%1 *%2%3"; |
| 3809 |
c_fix_arg = "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) " |
| 3810 |
"(__env)\\[1\\](.*)$"; |
| 3811 |
test_text = "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], " |
| 3812 |
"int __savemask);"; |
| 3813 |
}; |
| 3814 |
|
| 3815 |
/* |
| 3816 |
* Fix return type of fread and fwrite on sysV68 |
| 3817 |
*/ |
| 3818 |
fix = { |
| 3819 |
hackname = read_ret_type; |
| 3820 |
files = stdio.h; |
| 3821 |
select = "extern int\t.*, fread\\(\\), fwrite\\(\\)"; |
| 3822 |
c_fix = format; |
| 3823 |
c_fix_arg = "extern unsigned int fread(), fwrite();\n%1%2"; |
| 3824 |
c_fix_arg = "(extern int\t.*), fread\\(\\), fwrite\\(\\)(.*)"; |
| 3825 |
|
| 3826 |
test_text = "extern int\tfclose(), fflush(), fread(), fwrite(), foo();"; |
| 3827 |
}; |
| 3828 |
|
| 3829 |
/* |
| 3830 |
* Fix casts as lvalues in glibc's <rpc/xdr.h>. |
| 3831 |
*/ |
| 3832 |
fix = { |
| 3833 |
hackname = rpc_xdr_lvalue_cast_a; |
| 3834 |
files = rpc/xdr.h; |
| 3835 |
select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*"; |
| 3836 |
c_fix = format; |
| 3837 |
c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))"; |
| 3838 |
test_text = "#define IXDR_GET_LONG(buf) \\\\\n" |
| 3839 |
"\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))"; |
| 3840 |
}; |
| 3841 |
|
| 3842 |
/* |
| 3843 |
* rpc_xdr_lvalue_cast_b |
| 3844 |
*/ |
| 3845 |
fix = { |
| 3846 |
hackname = rpc_xdr_lvalue_cast_b; |
| 3847 |
files = rpc/xdr.h; |
| 3848 |
select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*"; |
| 3849 |
c_fix = format; |
| 3850 |
c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))"; |
| 3851 |
test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n" |
| 3852 |
"\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))"; |
| 3853 |
}; |
| 3854 |
|
| 3855 |
/* |
| 3856 |
* function class(double x) conflicts with C++ keyword on rs/6000 |
| 3857 |
*/ |
| 3858 |
fix = { |
| 3859 |
hackname = rs6000_double; |
| 3860 |
files = math.h; |
| 3861 |
select = '[^a-zA-Z_]class\('; |
| 3862 |
|
| 3863 |
c_fix = format; |
| 3864 |
c_fix_arg = "#ifndef __cplusplus\n%0\n#endif"; |
| 3865 |
c_fix_arg = '^.*[^a-zA-Z_]class\(.*'; |
| 3866 |
|
| 3867 |
test_text = "extern int class();"; |
| 3868 |
}; |
| 3869 |
|
| 3870 |
/* |
| 3871 |
* Wrong fchmod prototype on RS/6000. |
| 3872 |
*/ |
| 3873 |
fix = { |
| 3874 |
hackname = rs6000_fchmod; |
| 3875 |
files = sys/stat.h; |
| 3876 |
select = 'fchmod\(char \*'; |
| 3877 |
c_fix = format; |
| 3878 |
c_fix_arg = "fchmod(int"; |
| 3879 |
test_text = "extern int fchmod(char *, mode_t);"; |
| 3880 |
}; |
| 3881 |
|
| 3882 |
/* |
| 3883 |
* parameters conflict with C++ new on rs/6000 |
| 3884 |
*/ |
| 3885 |
fix = { |
| 3886 |
hackname = rs6000_param; |
| 3887 |
files = "stdio.h"; |
| 3888 |
files = "unistd.h"; |
| 3889 |
|
| 3890 |
select = 'rename\(const char \*old, const char \*new\)'; |
| 3891 |
c_fix = format; |
| 3892 |
c_fix_arg = 'rename(const char *_old, const char *_new)'; |
| 3893 |
|
| 3894 |
test_text = 'extern int rename(const char *old, const char *new);'; |
| 3895 |
}; |
| 3896 |
|
| 3897 |
/* |
| 3898 |
* Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict |
| 3899 |
* for C99. This is wrong for C++, which needs many C99 features, but |
| 3900 |
* only supports __restrict. |
| 3901 |
*/ |
| 3902 |
fix = { |
| 3903 |
hackname = solaris___restrict; |
| 3904 |
files = sys/feature_tests.h; |
| 3905 |
select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict"; |
| 3906 |
mach = "*-*-solaris2*"; |
| 3907 |
c_fix = format; |
| 3908 |
c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n" |
| 3909 |
"#else\n%0\n#endif"; |
| 3910 |
test_text = "#define _RESTRICT_KYWD restrict"; |
| 3911 |
}; |
| 3912 |
|
| 3913 |
/* |
| 3914 |
* Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of |
| 3915 |
* themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I |
| 3916 |
* and imaginary definitions which are not supported by GCC. |
| 3917 |
*/ |
| 3918 |
fix = { |
| 3919 |
hackname = solaris_complex; |
| 3920 |
mach = "*-*-solaris2.*"; |
| 3921 |
files = complex.h; |
| 3922 |
select = "#define[ \t]_Complex_I[ \t]_Complex_I"; |
| 3923 |
sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/" |
| 3924 |
"#define\t_Complex_I\t(__extension__ 1.0iF)/"; |
| 3925 |
sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d"; |
| 3926 |
sed = "/#define[ \t]imaginary[ \t]_Imaginary/d"; |
| 3927 |
sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/"; |
| 3928 |
test_text = "#define _Complex_I _Complex_I\n" |
| 3929 |
"#define complex _Complex\n" |
| 3930 |
"#define _Imaginary_I _Imaginary_I\n" |
| 3931 |
"#define imaginary _Imaginary\n" |
| 3932 |
"#undef I\n" |
| 3933 |
"#define I _Imaginary_I"; |
| 3934 |
}; |
| 3935 |
|
| 3936 |
/* |
| 3937 |
* Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in |
| 3938 |
* extern "C" instead so libstdc++ can use it. |
| 3939 |
*/ |
| 3940 |
fix = { |
| 3941 |
hackname = solaris_complex_cxx; |
| 3942 |
mach = "*-*-solaris2.*"; |
| 3943 |
files = complex.h; |
| 3944 |
sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n" |
| 3945 |
"#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif"; |
| 3946 |
sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n" |
| 3947 |
"#ifdef\t__cplusplus\\\n}\\\n#endif"; |
| 3948 |
test_text = "#if !defined(__cplusplus)\n" |
| 3949 |
"#endif /* !defined(__cplusplus) */"; |
| 3950 |
}; |
| 3951 |
|
| 3952 |
/* |
| 3953 |
* g++ rejects functions declared with both C and C++ linkage. |
| 3954 |
*/ |
| 3955 |
fix = { |
| 3956 |
hackname = solaris_cxx_linkage; |
| 3957 |
mach = '*-*-solaris2*'; |
| 3958 |
files = "iso/stdlib_iso.h"; |
| 3959 |
select = "(#if __cplusplus >= 199711L)\n" |
| 3960 |
"(extern \"C\\+\\+\" \\{\n)" |
| 3961 |
"(.*(bsearch|qsort).*)"; |
| 3962 |
c_fix = format; |
| 3963 |
c_fix_arg = "%1 && !__GNUG__\n%2%3"; |
| 3964 |
|
| 3965 |
test_text = |
| 3966 |
"#if __cplusplus >= 199711L\n" |
| 3967 |
"extern \"C++\" {\n" |
| 3968 |
" void *bsearch(const void *, const void *, size_t, size_t,"; |
| 3969 |
}; |
| 3970 |
|
| 3971 |
/* |
| 3972 |
* Solaris <iso/stdio_iso.h> doesn't declare getc for C++ with |
| 3973 |
* _STRICT_STDC, but uses it. |
| 3974 |
*/ |
| 3975 |
fix = { |
| 3976 |
hackname = solaris_getc_strict_stdc; |
| 3977 |
mach = "*-*-solaris2*"; |
| 3978 |
files = "iso/stdio_iso.h"; |
| 3979 |
select = "(.*&& )!defined\\(_STRICT_STDC\\)(.*)"; |
| 3980 |
c_fix = format; |
| 3981 |
c_fix_arg = "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2"; |
| 3982 |
|
| 3983 |
test_text = |
| 3984 |
"#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)"; |
| 3985 |
}; |
| 3986 |
|
| 3987 |
/* |
| 3988 |
* Solaris <iso/stdio_iso.h> should deprecate gets before C11. |
| 3989 |
*/ |
| 3990 |
fix = { |
| 3991 |
hackname = solaris_gets_c11; |
| 3992 |
mach = "*-*-solaris2*"; |
| 3993 |
files = "iso/stdio_iso.h"; |
| 3994 |
select = "(extern char[ \t]*\\*gets\\(char \\*\\));"; |
| 3995 |
|
| 3996 |
c_fix = format; |
| 3997 |
c_fix_arg = "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n" |
| 3998 |
"%1 __attribute__((__deprecated__));\n" |
| 3999 |
"#endif"; |
| 4000 |
|
| 4001 |
test_text = "extern char *gets(char *);"; |
| 4002 |
}; |
| 4003 |
|
| 4004 |
/* |
| 4005 |
* Solaris <iso/stdio_iso.h> shouldn't declare gets for C++14. |
| 4006 |
*/ |
| 4007 |
fix = { |
| 4008 |
hackname = solaris_gets_cxx14; |
| 4009 |
mach = "*-*-solaris2*"; |
| 4010 |
files = "iso/stdio_iso.h"; |
| 4011 |
select = <<- _EOSelect_ |
| 4012 |
(#if __STDC_VERSION__ < 201112L) |
| 4013 |
(extern char \*gets\(char \*\) __ATTR_DEPRECATED;) |
| 4014 |
_EOSelect_; |
| 4015 |
c_fix = format; |
| 4016 |
c_fix_arg = "%1 && __cplusplus < 201402L\n%2"; |
| 4017 |
|
| 4018 |
test_text = <<- _EOText_ |
| 4019 |
#if __STDC_VERSION__ < 201112L |
| 4020 |
extern char *gets(char *) __ATTR_DEPRECATED; |
| 4021 |
_EOText_; |
| 4022 |
}; |
| 4023 |
|
| 4024 |
/* |
| 4025 |
* Sun Solaris 2 has a version of sys/int_const.h that defines |
| 4026 |
* UINT8_C and UINT16_C to unsigned constants. |
| 4027 |
*/ |
| 4028 |
fix = { |
| 4029 |
hackname = solaris_int_const; |
| 4030 |
files = sys/int_const.h; |
| 4031 |
mach = '*-*-solaris2*'; |
| 4032 |
c_fix = format; |
| 4033 |
c_fix_arg = "#define\tUINT8_C(c)\t(c)\n" |
| 4034 |
"%1\n" |
| 4035 |
"#define\tUINT16_C(c)\t(c)"; |
| 4036 |
select = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n" |
| 4037 |
"(/\*.*\*/)\n" |
| 4038 |
"#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*"; |
| 4039 |
test_text = |
| 4040 |
"#define UINT8_C(c) __CONCAT__(c,u)\n" |
| 4041 |
"/* CSTYLED */\n" |
| 4042 |
"#define UINT16_C(c) __CONCAT__(c,u)"; |
| 4043 |
}; |
| 4044 |
|
| 4045 |
/* |
| 4046 |
* Sun Solaris 2 has a version of sys/int_limits.h that defines |
| 4047 |
* UINT8_MAX and UINT16_MAX to unsigned constants. |
| 4048 |
*/ |
| 4049 |
fix = { |
| 4050 |
hackname = solaris_int_limits_1; |
| 4051 |
files = sys/int_limits.h; |
| 4052 |
mach = '*-*-solaris2*'; |
| 4053 |
c_fix = format; |
| 4054 |
c_fix_arg = "#define\tUINT8_MAX\t(255)\n" |
| 4055 |
"#define\tUINT16_MAX\t(65535)"; |
| 4056 |
select = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n" |
| 4057 |
"#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)"; |
| 4058 |
test_text = |
| 4059 |
"#define UINT8_MAX (255U)\n" |
| 4060 |
"#define UINT16_MAX (65535U)"; |
| 4061 |
}; |
| 4062 |
|
| 4063 |
/* |
| 4064 |
* Sun Solaris 2 has a version of sys/int_limits.h that defines |
| 4065 |
* INT_FAST16 limits to wrong values for sys/int_types.h. |
| 4066 |
*/ |
| 4067 |
fix = { |
| 4068 |
hackname = solaris_int_limits_2; |
| 4069 |
files = sys/int_limits.h; |
| 4070 |
mach = '*-*-solaris2*'; |
| 4071 |
c_fix = format; |
| 4072 |
c_fix_arg = "#define\t%1_FAST16_%2 %132_%2"; |
| 4073 |
select = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*"; |
| 4074 |
test_text = |
| 4075 |
"#define INT_FAST16_MAX INT16_MAX\n" |
| 4076 |
"#define UINT_FAST16_MAX UINT16_MAX\n" |
| 4077 |
"#define INT_FAST16_MIN INT16_MIN"; |
| 4078 |
}; |
| 4079 |
|
| 4080 |
/* |
| 4081 |
* Sun Solaris 2 has a version of sys/int_limits.h that defines |
| 4082 |
* SIZE_MAX as unsigned long. |
| 4083 |
*/ |
| 4084 |
fix = { |
| 4085 |
hackname = solaris_int_limits_3; |
| 4086 |
files = sys/int_limits.h; |
| 4087 |
mach = '*-*-solaris2*'; |
| 4088 |
c_fix = format; |
| 4089 |
c_fix_arg = "#define\tSIZE_MAX\t4294967295U"; |
| 4090 |
select = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL"; |
| 4091 |
test_text = |
| 4092 |
"#define SIZE_MAX 4294967295UL"; |
| 4093 |
}; |
| 4094 |
|
| 4095 |
/* |
| 4096 |
* Sun Solaris 10 defines several C99 math macros in terms of |
| 4097 |
* builtins specific to the Studio compiler, in particular not |
| 4098 |
* compatible with the GNU compiler. |
| 4099 |
*/ |
| 4100 |
fix = { |
| 4101 |
hackname = solaris_math_1; |
| 4102 |
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4103 |
bypass = "__GNUC__"; |
| 4104 |
files = iso/math_c99.h; |
| 4105 |
c_fix = format; |
| 4106 |
c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())"; |
| 4107 |
c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)"; |
| 4108 |
test_text = |
| 4109 |
'#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" |
| 4110 |
"#undef HUGE_VAL\n" |
| 4111 |
"#define HUGE_VAL __builtin_huge_val\n" |
| 4112 |
"#undef HUGE_VALF\n" |
| 4113 |
"#define HUGE_VALF __builtin_huge_valf\n" |
| 4114 |
"#undef HUGE_VALL\n" |
| 4115 |
"#define HUGE_VALL __builtin_huge_vall"; |
| 4116 |
}; |
| 4117 |
|
| 4118 |
/* |
| 4119 |
* On Solaris 11, if you do isinf(NaN) you'll get a floating point |
| 4120 |
* exception. Provide an alternative using GCC's builtin. |
| 4121 |
*/ |
| 4122 |
fix = { |
| 4123 |
hackname = solaris_math_10; |
| 4124 |
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4125 |
files = iso/math_c99.h; |
| 4126 |
c_fix = format; |
| 4127 |
c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)"; |
| 4128 |
c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n" |
| 4129 |
"[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);" |
| 4130 |
"[ \t]*\\\\\n" |
| 4131 |
"[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*" |
| 4132 |
"INFINITY[ \t]*\\|\\|[ \t]*\\\\\n" |
| 4133 |
"[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*" |
| 4134 |
"\\(-INFINITY\\);[ \t]*\\}\\)"; |
| 4135 |
test_text = |
| 4136 |
'#pragma ident "@(#)math_c99.h 1.12 07/01/21 SMI"'"\n" |
| 4137 |
"#undef isinf\n" |
| 4138 |
"#define isinf(x) __extension__( \\\\\n" |
| 4139 |
" { __typeof(x) __x_i = (x); \\\\\n" |
| 4140 |
" __x_i == (__typeof(__x_i)) INFINITY || \\\\\n" |
| 4141 |
" __x_i == (__typeof(__x_i)) (-INFINITY); })"; |
| 4142 |
}; |
| 4143 |
|
| 4144 |
/* |
| 4145 |
* Solaris math INFINITY |
| 4146 |
*/ |
| 4147 |
fix = { |
| 4148 |
hackname = solaris_math_2; |
| 4149 |
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4150 |
bypass = "__GNUC__"; |
| 4151 |
files = iso/math_c99.h; |
| 4152 |
c_fix = format; |
| 4153 |
c_fix_arg = "#define\tINFINITY\t(__builtin_inff())"; |
| 4154 |
c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity"; |
| 4155 |
test_text = |
| 4156 |
'#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" |
| 4157 |
"#undef INFINITY\n" |
| 4158 |
"#define INFINITY __builtin_infinity"; |
| 4159 |
}; |
| 4160 |
|
| 4161 |
/* |
| 4162 |
* Solaris math NAN |
| 4163 |
*/ |
| 4164 |
fix = { |
| 4165 |
hackname = solaris_math_3; |
| 4166 |
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4167 |
bypass = "__GNUC__"; |
| 4168 |
files = iso/math_c99.h; |
| 4169 |
c_fix = format; |
| 4170 |
c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))"; |
| 4171 |
c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan"; |
| 4172 |
test_text = |
| 4173 |
'#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" |
| 4174 |
"#undef NAN\n" |
| 4175 |
"#define NAN __builtin_nan"; |
| 4176 |
}; |
| 4177 |
|
| 4178 |
/* |
| 4179 |
* Solaris math fpclassify |
| 4180 |
*/ |
| 4181 |
fix = { |
| 4182 |
hackname = solaris_math_4; |
| 4183 |
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4184 |
bypass = "__GNUC__"; |
| 4185 |
files = iso/math_c99.h; |
| 4186 |
c_fix = format; |
| 4187 |
c_fix_arg = "#define\tfpclassify(x) \\\n" |
| 4188 |
" __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, " |
| 4189 |
"FP_SUBNORMAL, FP_ZERO, (x))"; |
| 4190 |
c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)"; |
| 4191 |
test_text = |
| 4192 |
'#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" |
| 4193 |
"#undef fpclassify\n" |
| 4194 |
"#define fpclassify(x) __builtin_fpclassify(x)"; |
| 4195 |
}; |
| 4196 |
|
| 4197 |
/* |
| 4198 |
* Solaris math signbit |
| 4199 |
*/ |
| 4200 |
fix = { |
| 4201 |
hackname = solaris_math_8; |
| 4202 |
select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4203 |
bypass = "__GNUC__"; |
| 4204 |
files = iso/math_c99.h; |
| 4205 |
c_fix = format; |
| 4206 |
c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n" |
| 4207 |
"\t\t\t ? __builtin_signbitf(x) \\\n" |
| 4208 |
"\t\t\t : sizeof(x) == sizeof(long double) \\\n" |
| 4209 |
"\t\t\t ? __builtin_signbitl(x) \\\n" |
| 4210 |
"\t\t\t : __builtin_signbit(x))"; |
| 4211 |
c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)"; |
| 4212 |
test_text = <<- _EOText_ |
| 4213 |
#ident "@(#)math_c99.h 1.9 04/11/01 SMI" |
| 4214 |
#undef signbit |
| 4215 |
#define signbit(x) __builtin_signbit(x) |
| 4216 |
_EOText_; |
| 4217 |
}; |
| 4218 |
|
| 4219 |
/* |
| 4220 |
* Solaris math comparison macros |
| 4221 |
*/ |
| 4222 |
fix = { |
| 4223 |
hackname = solaris_math_9; |
| 4224 |
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4225 |
bypass = "__GNUC__"; |
| 4226 |
files = iso/math_c99.h; |
| 4227 |
c_fix = format; |
| 4228 |
c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)"; |
| 4229 |
c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) " |
| 4230 |
"__builtin_[a-z]+\\(y\\)\\)"; |
| 4231 |
test_text = |
| 4232 |
'#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n" |
| 4233 |
"#undef isgreater\n" |
| 4234 |
"#define isgreater(x, y) ((x) __builtin_isgreater(y))\n" |
| 4235 |
"#undef isgreaterequal\n" |
| 4236 |
"#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n" |
| 4237 |
"#undef isless\n" |
| 4238 |
"#define isless(x, y) ((x) __builtin_isless(y))\n" |
| 4239 |
"#undef islessequal\n" |
| 4240 |
"#define islessequal(x, y) ((x) __builtin_islessequal(y))\n" |
| 4241 |
"#undef islessgreater\n" |
| 4242 |
"#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n" |
| 4243 |
"#undef isunordered\n" |
| 4244 |
"#define isunordered(x, y) ((x) __builtin_isunordered(y))"; |
| 4245 |
}; |
| 4246 |
|
| 4247 |
/* |
| 4248 |
* Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing |
| 4249 |
* warnings. |
| 4250 |
*/ |
| 4251 |
fix = { |
| 4252 |
hackname = solaris_math_11; |
| 4253 |
select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ "; |
| 4254 |
files = iso/math_c99.h; |
| 4255 |
c_fix = format; |
| 4256 |
c_fix_arg = << _EOArg_ |
| 4257 |
#undef signbit |
| 4258 |
#define signbit(x) (sizeof(x) == sizeof(float) \ |
| 4259 |
? __builtin_signbitf(x) \ |
| 4260 |
: sizeof(x) == sizeof(long double) \ |
| 4261 |
? __builtin_signbitl(x) \ |
| 4262 |
: __builtin_signbit(x)) |
| 4263 |
_EOArg_; |
| 4264 |
c_fix_arg = << _EOArg_ |
| 4265 |
^#undef[ ]+signbit |
| 4266 |
#if defined\(__sparc\) |
| 4267 |
#define[ ]+signbit\(x\)[ ]+__extension__\( \\ |
| 4268 |
[ ]+\{[ ]*__typeof\(x\)[ ]*__x_s[ ]*=[ ]*\(x\);[ ]*\\ |
| 4269 |
[ ]+\(int\)[ ]*\(\*\(unsigned[ ]*\*\)[ ]*\&__x_s[ ]*>>[ ]*31\);[ ]*\}\) |
| 4270 |
#elif defined\(__i386\) \|\| defined\(__amd64\) |
| 4271 |
#define[ ]+signbit\(x\)[ ]+__extension__\( \\ |
| 4272 |
[ ]+\{ __typeof\(x\) __x_s = \(x\); \\ |
| 4273 |
[ ]+\(sizeof \(__x_s\) == sizeof \(float\) \? \\ |
| 4274 |
[ ]+\(int\) \(\*\(unsigned \*\) \&__x_s >> 31\) : \\ |
| 4275 |
[ ]+sizeof \(__x_s\) == sizeof \(double\) \? \\ |
| 4276 |
[ ]+\(int\) \(\(\(unsigned \*\) \&__x_s\)\[1\] >> 31\) : \\ |
| 4277 |
[ ]+\(int\) \(\(\(unsigned short \*\) \&__x_s\)\[4\] >> 15\)\); \}\) |
| 4278 |
#endif |
| 4279 |
_EOArg_; |
| 4280 |
test_text = << _EOText_ |
| 4281 |
/* @(#)math_c99.h 1.14 13/03/27 */ |
| 4282 |
#undef signbit |
| 4283 |
#if defined(__sparc) |
| 4284 |
#define signbit(x) __extension__( \\ |
| 4285 |
{ __typeof(x) __x_s = (x); \\ |
| 4286 |
(int) (*(unsigned *) &__x_s >> 31); }) |
| 4287 |
#elif defined(__i386) || defined(__amd64) |
| 4288 |
#define signbit(x) __extension__( \\ |
| 4289 |
{ __typeof(x) __x_s = (x); \\ |
| 4290 |
(sizeof (__x_s) == sizeof (float) ? \\ |
| 4291 |
(int) (*(unsigned *) &__x_s >> 31) : \\ |
| 4292 |
sizeof (__x_s) == sizeof (double) ? \\ |
| 4293 |
(int) (((unsigned *) &__x_s)[1] >> 31) : \\ |
| 4294 |
(int) (((unsigned short *) &__x_s)[4] >> 15)); }) |
| 4295 |
#endif |
| 4296 |
_EOText_; |
| 4297 |
}; |
| 4298 |
|
| 4299 |
/* |
| 4300 |
* Some versions of Solaris 10+ <math.h> #undef libstdc++-internal macros. |
| 4301 |
*/ |
| 4302 |
fix = { |
| 4303 |
hackname = solaris_math_12; |
| 4304 |
files = math.h; |
| 4305 |
mach = '*-*-solaris2*'; |
| 4306 |
select = '#undef.*_GLIBCXX_USE_C99_MATH'; |
| 4307 |
bypass = '__MATH_PREEMPTS_GLIBCXX_C99_MATH'; |
| 4308 |
sed = "/#undef[ \t]*_GLIBCXX_USE_C99_MATH/d"; |
| 4309 |
test_text = << _EOText_ |
| 4310 |
#if __cplusplus >= 201103L |
| 4311 |
#undef _GLIBCXX_USE_C99_MATH |
| 4312 |
#undef _GLIBCXX_USE_C99_MATH_TR1 |
| 4313 |
#endif |
| 4314 |
_EOText_; |
| 4315 |
}; |
| 4316 |
|
| 4317 |
/* |
| 4318 |
* Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a |
| 4319 |
* structure. As such, it need two levels of brackets, but only |
| 4320 |
* contains one. Wrap the macro definition in an extra layer. |
| 4321 |
*/ |
| 4322 |
fix = { |
| 4323 |
hackname = solaris_once_init_1; |
| 4324 |
select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4325 |
files = pthread.h; |
| 4326 |
mach = '*-*-solaris*'; |
| 4327 |
c_fix = format; |
| 4328 |
c_fix_arg = "%1{%2}%3"; |
| 4329 |
c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$"; |
| 4330 |
test_text = |
| 4331 |
'#pragma ident "@(#)pthread.h 1.37 04/09/28 SMI"'"\n" |
| 4332 |
"#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}"; |
| 4333 |
}; |
| 4334 |
|
| 4335 |
/* |
| 4336 |
* Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the |
| 4337 |
* posix_spawn declarations, which doesn't work with C++. |
| 4338 |
*/ |
| 4339 |
fix = { |
| 4340 |
hackname = solaris_posix_spawn_restrict; |
| 4341 |
files = spawn.h; |
| 4342 |
mach = '*-*-solaris2*'; |
| 4343 |
c_fix = format; |
| 4344 |
c_fix_arg = "%1*_RESTRICT_KYWD %2%3"; |
| 4345 |
select = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)"; |
| 4346 |
test_text = |
| 4347 |
"char *const argv[_RESTRICT_KYWD],\n" |
| 4348 |
"char *const envp[_RESTRICT_KYWD]);"; |
| 4349 |
}; |
| 4350 |
|
| 4351 |
/* |
| 4352 |
* The pow overloads with int were removed in C++ 2011 DR 550. |
| 4353 |
*/ |
| 4354 |
fix = { |
| 4355 |
hackname = solaris_pow_int_overload; |
| 4356 |
mach = '*-*-solaris2*'; |
| 4357 |
files = "iso/math_iso.h"; |
| 4358 |
select = "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)" |
| 4359 |
" *\\{[^{}]*\n[^{}]*\\}"; |
| 4360 |
c_fix = format; |
| 4361 |
c_fix_arg = "#if __cplusplus < 201103L\n%0\n#endif"; |
| 4362 |
|
| 4363 |
test_text = |
| 4364 |
" inline long double pow(long double __X, int __Y) { return\n" |
| 4365 |
" __powl(__X, (long double) (__Y)); }"; |
| 4366 |
}; |
| 4367 |
|
| 4368 |
/* |
| 4369 |
* Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some |
| 4370 |
* fields of the pthread_rwlock_t structure, which are of type |
| 4371 |
* upad64_t, which itself is typedef'd to int64_t, but with __STDC__ |
| 4372 |
* defined (e.g. by -ansi) it is a union. So change the initializer |
| 4373 |
* to "{0}" instead. |
| 4374 |
*/ |
| 4375 |
fix = { |
| 4376 |
hackname = solaris_rwlock_init_1; |
| 4377 |
select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; |
| 4378 |
files = pthread.h; |
| 4379 |
mach = '*-*-solaris*'; |
| 4380 |
c_fix = format; |
| 4381 |
c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n" |
| 4382 |
"%0\n" |
| 4383 |
"#else\n" |
| 4384 |
"%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n" |
| 4385 |
"#endif"; |
| 4386 |
c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)" |
| 4387 |
"\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$"; |
| 4388 |
|
| 4389 |
test_text = |
| 4390 |
'#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n" |
| 4391 |
"#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}"; |
| 4392 |
}; |
| 4393 |
|
| 4394 |
/* |
| 4395 |
* Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and |
| 4396 |
* std::__flsbuf, but <iso/stdio_iso.h> uses them. |
| 4397 |
*/ |
| 4398 |
fix = { |
| 4399 |
hackname = solaris_std___filbuf; |
| 4400 |
files = stdio.h; |
| 4401 |
mach = '*-*-solaris2*'; |
| 4402 |
bypass = "using std::__filbuf"; |
| 4403 |
select = "(using std::perror;\n)(#endif)"; |
| 4404 |
c_fix = format; |
| 4405 |
c_fix_arg = "%1#ifndef _LP64\n" |
| 4406 |
"using std::__filbuf;\n" |
| 4407 |
"using std::__flsbuf;\n" |
| 4408 |
"#endif\n%2"; |
| 4409 |
|
| 4410 |
test_text = "using std::perror;\n" |
| 4411 |
"#endif"; |
| 4412 |
}; |
| 4413 |
|
| 4414 |
/* |
| 4415 |
* Solaris <stdio.h> shouldn't use std::gets for C++14. |
| 4416 |
*/ |
| 4417 |
fix = { |
| 4418 |
hackname = solaris_std_gets_cxx14; |
| 4419 |
mach = "*-*-solaris2*"; |
| 4420 |
files = "stdio.h"; |
| 4421 |
select = "using std::gets;"; |
| 4422 |
|
| 4423 |
c_fix = format; |
| 4424 |
c_fix_arg = "#if __cplusplus < 201402L\n%0\n#endif"; |
| 4425 |
|
| 4426 |
test_text = "using std::gets;"; |
| 4427 |
}; |
| 4428 |
|
| 4429 |
/* |
| 4430 |
* Sun Solaris 8 has what appears to be some gross workaround for |
| 4431 |
* some old version of their c++ compiler. G++ doesn't want it |
| 4432 |
* either, but doesn't want to be tied to SunPRO version numbers. |
| 4433 |
*/ |
| 4434 |
fix = { |
| 4435 |
hackname = solaris_stdio_tag; |
| 4436 |
files = stdio_tag.h; |
| 4437 |
|
| 4438 |
select = '__cplusplus < 54321L'; |
| 4439 |
/* In Solaris 10, the code in stdio_tag.h is conditionalized on |
| 4440 |
"!defined(__GNUC__)" so we no longer need to fix it. */ |
| 4441 |
bypass = '__GNUC__'; |
| 4442 |
sed = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/'; |
| 4443 |
|
| 4444 |
test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)"; |
| 4445 |
}; |
| 4446 |
|
| 4447 |
/* |
| 4448 |
* Solaris <stdlib.h> shouldn't use _Noreturn, breaks with C++. |
| 4449 |
*/ |
| 4450 |
fix = { |
| 4451 |
hackname = solaris_stdlib_noreturn; |
| 4452 |
mach = "*-*-solaris2*"; |
| 4453 |
files = "iso/stdlib_c99.h"; |
| 4454 |
select = "(extern) _Noreturn (void quick_exit\\(int\\));"; |
| 4455 |
|
| 4456 |
c_fix = format; |
| 4457 |
c_fix_arg = "%1 %2 __attribute__((__noreturn__));"; |
| 4458 |
|
| 4459 |
test_text = "extern _Noreturn void quick_exit(int);"; |
| 4460 |
}; |
| 4461 |
|
| 4462 |
/* |
| 4463 |
* a missing semi-colon at the end of the statsswtch structure definition. |
| 4464 |
*/ |
| 4465 |
fix = { |
| 4466 |
hackname = statsswtch; |
| 4467 |
files = rpcsvc/rstat.h; |
| 4468 |
select = "boottime$"; |
| 4469 |
c_fix = format; |
| 4470 |
c_fix_arg = "boottime;"; |
| 4471 |
test_text = "struct statswtch {\n int boottime\n};"; |
| 4472 |
}; |
| 4473 |
|
| 4474 |
/* |
| 4475 |
* Arrange for stdio.h to use stdarg.h to define __gnuc_va_list. |
| 4476 |
* On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's |
| 4477 |
* OK too. |
| 4478 |
*/ |
| 4479 |
fix = { |
| 4480 |
hackname = stdio_stdarg_h; |
| 4481 |
files = stdio.h; |
| 4482 |
bypass = "include.*(stdarg\.h|machine/ansi\.h)"; |
| 4483 |
/* |
| 4484 |
* On Solaris 10, this fix is unncessary; <stdio.h> includes |
| 4485 |
* <iso/stdio_iso.h>, which includes <sys/va_list.h>. |
| 4486 |
*/ |
| 4487 |
mach = '*-*-solaris2.1[0-9]*'; |
| 4488 |
not_machine = true; |
| 4489 |
|
| 4490 |
c_fix = wrap; |
| 4491 |
|
| 4492 |
c_fix_arg = "#define __need___va_list\n#include <stdarg.h>\n"; |
| 4493 |
|
| 4494 |
test_text = ""; |
| 4495 |
}; |
| 4496 |
|
| 4497 |
/* |
| 4498 |
* Don't use or define the name va_list in stdio.h. This is for |
| 4499 |
* ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence |
| 4500 |
* of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to |
| 4501 |
* indicate that the header knows what it's doing -- under SUSv2, |
| 4502 |
* stdio.h is required to define va_list, and we shouldn't break |
| 4503 |
* that. |
| 4504 |
*/ |
| 4505 |
fix = { |
| 4506 |
hackname = stdio_va_list; |
| 4507 |
files = stdio.h; |
| 4508 |
bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list'; |
| 4509 |
/* |
| 4510 |
* On Solaris 10, the definition in |
| 4511 |
* <stdio.h> is guarded appropriately by the _XPG4 feature macro; |
| 4512 |
* there is therefore no need for this fix there. |
| 4513 |
*/ |
| 4514 |
mach = '*-*-solaris2.1[0-9]*'; |
| 4515 |
not_machine = true; |
| 4516 |
|
| 4517 |
/* |
| 4518 |
* Use __gnuc_va_list in arg types in place of va_list. |
| 4519 |
* On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A |
| 4520 |
* use __gnuc_va_list instead of __VA_LIST__. We're hoping the |
| 4521 |
* trailing parentheses and semicolon save all other systems from this. |
| 4522 |
* Define __not_va_list__ (something harmless and unused) |
| 4523 |
* instead of va_list. |
| 4524 |
* Don't claim to have defined va_list. |
| 4525 |
*/ |
| 4526 |
sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n" |
| 4527 |
"s@(va_list)&@(__gnuc_va_list)\\&@\n" |
| 4528 |
"s@ _VA_LIST_));@ __gnuc_va_list));@\n" |
| 4529 |
"s@ __VA_LIST__));@ __gnuc_va_list));@\n" |
| 4530 |
"s@ va_list@ __not_va_list__@\n" |
| 4531 |
"s@\\*va_list@*__not_va_list__@\n" |
| 4532 |
"s@ __va_list)@ __gnuc_va_list)@\n" |
| 4533 |
"s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;" |
| 4534 |
"@typedef \\1 __not_va_list__;@\n" |
| 4535 |
"s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n" |
| 4536 |
"s@GNUC_VA_LIST@GNUC_Va_LIST@\n" |
| 4537 |
"s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n" |
| 4538 |
"s@_NEED___VA_LIST@_NEED___Va_LIST@\n" |
| 4539 |
"s@VA_LIST@DUMMY_VA_LIST@\n" |
| 4540 |
"s@_Va_LIST@_VA_LIST@"; |
| 4541 |
test_text = "extern void mumble( va_list);"; |
| 4542 |
}; |
| 4543 |
|
| 4544 |
/* |
| 4545 |
* Fix headers that use va_list from stdio.h to use the updated |
| 4546 |
* va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is |
| 4547 |
* dealt with elsewhere. The presence of __gnuc_va_list, |
| 4548 |
* __DJ_va_list, or _G_va_list is taken to indicate that the header |
| 4549 |
* knows what it's doing. |
| 4550 |
*/ |
| 4551 |
fix = { |
| 4552 |
hackname = stdio_va_list_clients; |
| 4553 |
files = com_err.h; |
| 4554 |
files = cps.h; |
| 4555 |
files = curses.h; |
| 4556 |
files = krb5.h; |
| 4557 |
files = lc_core.h; |
| 4558 |
files = pfmt.h; |
| 4559 |
files = wchar.h; |
| 4560 |
files = curses_colr/curses.h; |
| 4561 |
bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list'; |
| 4562 |
/* Don't fix, if we use va_list from stdarg.h, or if the use is |
| 4563 |
otherwise protected. */ |
| 4564 |
bypass = 'include <stdarg\.h>|#ifdef va_start'; |
| 4565 |
|
| 4566 |
/* |
| 4567 |
* Use __gnuc_va_list in arg types in place of va_list. |
| 4568 |
* On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A |
| 4569 |
* use __gnuc_va_list instead of __VA_LIST__. We're hoping the |
| 4570 |
* trailing parentheses and semicolon save all other systems from this. |
| 4571 |
* Define __not_va_list__ (something harmless and unused) |
| 4572 |
* instead of va_list. |
| 4573 |
* Don't claim to have defined va_list. |
| 4574 |
*/ |
| 4575 |
sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n" |
| 4576 |
"s@(va_list)&@(__gnuc_va_list)\\&@\n" |
| 4577 |
"s@ _VA_LIST_));@ __gnuc_va_list));@\n" |
| 4578 |
"s@ __VA_LIST__));@ __gnuc_va_list));@\n" |
| 4579 |
"s@ va_list@ __not_va_list__@\n" |
| 4580 |
"s@\\*va_list@*__not_va_list__@\n" |
| 4581 |
"s@ __va_list)@ __gnuc_va_list)@\n" |
| 4582 |
"s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;" |
| 4583 |
"@typedef \\1 __not_va_list__;@\n" |
| 4584 |
"s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n" |
| 4585 |
"s@GNUC_VA_LIST@GNUC_Va_LIST@\n" |
| 4586 |
"s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n" |
| 4587 |
"s@_NEED___VA_LIST@_NEED___Va_LIST@\n" |
| 4588 |
"s@VA_LIST@DUMMY_VA_LIST@\n" |
| 4589 |
"s@_Va_LIST@_VA_LIST@"; |
| 4590 |
test_text = "extern void mumble( va_list);"; |
| 4591 |
}; |
| 4592 |
|
| 4593 |
/* |
| 4594 |
* "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0" |
| 4595 |
* is "!defined( __STRICT_ANSI__ )" |
| 4596 |
*/ |
| 4597 |
fix = { |
| 4598 |
hackname = strict_ansi_not; |
| 4599 |
select = "^([ \t]*#[ \t]*if.*)" |
| 4600 |
"(!__STDC__" |
| 4601 |
"|__STDC__[ \t]*==[ \t]*0" |
| 4602 |
"|__STDC__[ \t]*!=[ \t]*1" |
| 4603 |
"|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)"; |
| 4604 |
/* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */ |
| 4605 |
bypass = 'GNU and MIPS C compilers define __STDC__ differently'; |
| 4606 |
/* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which |
| 4607 |
is not defined by GCC, so it is safe. */ |
| 4608 |
bypass = '__SCO_VERSION__.*__STDC__ != 1'; |
| 4609 |
c_test = stdc_0_in_system_headers; |
| 4610 |
|
| 4611 |
c_fix = format; |
| 4612 |
c_fix_arg = "%1 !defined(__STRICT_ANSI__)"; |
| 4613 |
|
| 4614 |
test_text = "#if !__STDC__ \n" |
| 4615 |
"#if __STDC__ == 0\n" |
| 4616 |
"#if __STDC__ != 1\n" |
| 4617 |
"#if __STDC__ - 0 == 0" |
| 4618 |
"/* not std C */\nint foo;\n" |
| 4619 |
"\n#end-end-end-end-if :-)"; |
| 4620 |
}; |
| 4621 |
|
| 4622 |
/* |
| 4623 |
* "__STDC__-0==0" |
| 4624 |
* is "!defined( __STRICT_ANSI__ )" on continued #if-s |
| 4625 |
*/ |
| 4626 |
fix = { |
| 4627 |
hackname = strict_ansi_not_ctd; |
| 4628 |
files = math.h, limits.h, stdio.h, signal.h, |
| 4629 |
stdlib.h, sys/signal.h, time.h; |
| 4630 |
/* |
| 4631 |
* Starting at the beginning of a line, skip white space and |
| 4632 |
* a leading "(" or "&&" or "||". One of those must be found. |
| 4633 |
* Then, zero, one or more copies of a "defined(_FOO_BAR_) &&" |
| 4634 |
* expression. If these are nested, then they must accumulate |
| 4635 |
* because we won't match any closing parentheses. Finally, |
| 4636 |
* after skipping over all that, we must then match our suspect |
| 4637 |
* phrase: "__STDC__-0==0" with or without white space. |
| 4638 |
*/ |
| 4639 |
select = "^([ \t]*" '(\(|&&|\|\|)' |
| 4640 |
"([ \t(]*!*[ \t]*defined\\([a-zA-Z_0-9]+\\)[ \t]*[|&][|&])*" |
| 4641 |
"[ \t(]*)" |
| 4642 |
"(__STDC__[ \t]*(|-[ \t]*0[ \t]*)==[ \t]*0)"; |
| 4643 |
c_test = stdc_0_in_system_headers; |
| 4644 |
|
| 4645 |
c_fix = format; |
| 4646 |
c_fix_arg = "%1 !defined(__STRICT_ANSI__)"; |
| 4647 |
|
| 4648 |
test_text = "#if 1 && \\\\\n" |
| 4649 |
"&& defined(mumbling) |& (__STDC__ - 0 == 0) \\\\\n" |
| 4650 |
"( __STDC__ == 0 && !defined(_XOPEN_SOURCE) \\\\\n" |
| 4651 |
"|| __STDC__ - 0 == 0 ) /* not std C */\n" |
| 4652 |
"int foo;\n#endif"; |
| 4653 |
}; |
| 4654 |
|
| 4655 |
/* |
| 4656 |
* "__STDC__!=0" or "__STDC__==1" or "__STDC__-0==1" |
| 4657 |
* is "defined( __STRICT_ANSI__ )" |
| 4658 |
*/ |
| 4659 |
fix = { |
| 4660 |
hackname = strict_ansi_only; |
| 4661 |
select = "^([ \t]*#[ \t]*if.*)" |
| 4662 |
"(__STDC__[ \t]*!=[ \t]*0" |
| 4663 |
"|__STDC__[ \t]*==[ \t]*1" |
| 4664 |
"|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1" |
| 4665 |
"|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0)"; |
| 4666 |
c_test = stdc_0_in_system_headers; |
| 4667 |
|
| 4668 |
c_fix = format; |
| 4669 |
c_fix_arg = "%1 defined(__STRICT_ANSI__)"; |
| 4670 |
|
| 4671 |
test_text = "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif"; |
| 4672 |
}; |
| 4673 |
|
| 4674 |
/* |
| 4675 |
* IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s |
| 4676 |
* in prototype without previous definition. |
| 4677 |
*/ |
| 4678 |
fix = { |
| 4679 |
hackname = struct_file; |
| 4680 |
files = rpc/xdr.h; |
| 4681 |
select = '^.*xdrstdio_create.*struct __file_s'; |
| 4682 |
c_fix = format; |
| 4683 |
c_fix_arg = "struct __file_s;\n%0"; |
| 4684 |
test_text = "extern void xdrstdio_create( struct __file_s* );"; |
| 4685 |
}; |
| 4686 |
|
| 4687 |
/* |
| 4688 |
* IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr |
| 4689 |
* in prototype without previous definition. |
| 4690 |
* |
| 4691 |
* Don't fix OpenBSD, which uses struct sockaddr_in prototyping the same |
| 4692 |
* function, and does define it. |
| 4693 |
*/ |
| 4694 |
fix = { |
| 4695 |
hackname = struct_sockaddr; |
| 4696 |
files = rpc/auth.h; |
| 4697 |
select = "^.*authdes_create.*struct sockaddr[^_]"; |
| 4698 |
bypass = "<sys/socket\.h>"; |
| 4699 |
bypass = "struct sockaddr;\n"; |
| 4700 |
c_fix = format; |
| 4701 |
c_fix_arg = "struct sockaddr;\n%0"; |
| 4702 |
test_text = "extern AUTH* authdes_create( struct sockaddr* );"; |
| 4703 |
}; |
| 4704 |
|
| 4705 |
/* |
| 4706 |
* Apply fix this to all OSs since this problem seems to effect |
| 4707 |
* more than just SunOS. |
| 4708 |
*/ |
| 4709 |
fix = { |
| 4710 |
hackname = sun_auth_proto; |
| 4711 |
files = rpc/auth.h; |
| 4712 |
files = rpc/clnt.h; |
| 4713 |
files = rpc/svc.h; |
| 4714 |
files = rpc/xdr.h; |
| 4715 |
bypass = "__cplusplus"; |
| 4716 |
/* |
| 4717 |
* Select those files containing '(*name)()'. |
| 4718 |
*/ |
| 4719 |
select = '\(\*[a-z][a-z_]*\)\(\)'; |
| 4720 |
|
| 4721 |
c_fix = format; |
| 4722 |
c_fix_arg = "#ifdef __cplusplus\n%1(...);%2\n" |
| 4723 |
"#else\n%1();%2\n#endif"; |
| 4724 |
c_fix_arg = '(.*\(\*[a-z][a-z_]*\))\(\);(.*)'; |
| 4725 |
|
| 4726 |
test_text = |
| 4727 |
"struct auth_t {\n" |
| 4728 |
" int (*name)(); /* C++ bad */\n" |
| 4729 |
"};"; |
| 4730 |
}; |
| 4731 |
|
| 4732 |
/* |
| 4733 |
* Fix bogus #ifdef on SunOS 4.1. |
| 4734 |
*/ |
| 4735 |
fix = { |
| 4736 |
hackname = sun_bogus_ifdef; |
| 4737 |
files = "hsfs/hsfs_spec.h"; |
| 4738 |
files = "hsfs/iso_spec.h"; |
| 4739 |
select = '#ifdef(.*\|\|.*)'; |
| 4740 |
c_fix = format; |
| 4741 |
c_fix_arg = "#if%1"; |
| 4742 |
|
| 4743 |
test_text = "#ifdef __i386__ || __vax__ || __sun4c__"; |
| 4744 |
}; |
| 4745 |
|
| 4746 |
/* |
| 4747 |
* Fix the CAT macro in SunOS memvar.h. |
| 4748 |
*/ |
| 4749 |
fix = { |
| 4750 |
hackname = sun_catmacro; |
| 4751 |
files = pixrect/memvar.h; |
| 4752 |
select = "^#define[ \t]+CAT\\(a,b\\).*"; |
| 4753 |
c_fix = format; |
| 4754 |
|
| 4755 |
c_fix_arg = |
| 4756 |
"#ifdef __STDC__\n" |
| 4757 |
"# define CAT(a,b) a##b\n" |
| 4758 |
"#else\n%0\n#endif"; |
| 4759 |
|
| 4760 |
test_text = |
| 4761 |
"#define CAT(a,b)\ta/**/b"; |
| 4762 |
}; |
| 4763 |
|
| 4764 |
/* |
| 4765 |
* Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1. |
| 4766 |
* Also fix return type of {m,re}alloc in <malloc.h> on sysV68 |
| 4767 |
*/ |
| 4768 |
fix = { |
| 4769 |
hackname = sun_malloc; |
| 4770 |
files = malloc.h; |
| 4771 |
bypass = "_CLASSIC_ANSI_TYPES"; |
| 4772 |
|
| 4773 |
sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g"; |
| 4774 |
sed = "s/int[ \t][ \t]*free/void\tfree/g"; |
| 4775 |
sed = "s/char\\([ \t]*\\*[ \t]*malloc\\)/void\\1/g"; |
| 4776 |
sed = "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g"; |
| 4777 |
sed = "s/char\\([ \t]*\\*[ \t]*calloc\\)/void\\1/g"; |
| 4778 |
|
| 4779 |
test_text = |
| 4780 |
"typedef char *\tmalloc_t;\n" |
| 4781 |
"int \tfree();\n" |
| 4782 |
"char*\tmalloc();\n" |
| 4783 |
"char*\tcalloc();\n" |
| 4784 |
"char*\trealloc();"; |
| 4785 |
}; |
| 4786 |
|
| 4787 |
/* |
| 4788 |
* Check for yet more missing ';' in struct (in SunOS 4.0.x) |
| 4789 |
*/ |
| 4790 |
fix = { |
| 4791 |
hackname = sun_rusers_semi; |
| 4792 |
files = rpcsvc/rusers.h; |
| 4793 |
select = "_cnt$"; |
| 4794 |
sed = "/^struct/,/^};/s/_cnt$/_cnt;/"; |
| 4795 |
test_text = "struct mumble\n int _cnt\n};"; |
| 4796 |
}; |
| 4797 |
|
| 4798 |
/* |
| 4799 |
* signal.h on SunOS defines signal using (), |
| 4800 |
* which causes trouble when compiling with g++ -pedantic. |
| 4801 |
*/ |
| 4802 |
fix = { |
| 4803 |
hackname = sun_signal; |
| 4804 |
files = sys/signal.h; |
| 4805 |
files = signal.h; |
| 4806 |
select = "^void\t" '\(\*signal\(\)\)\(\);.*'; |
| 4807 |
|
| 4808 |
c_fix = format; |
| 4809 |
c_fix_arg = |
| 4810 |
"#ifdef __cplusplus\n" |
| 4811 |
"void\t(*signal(...))(...);\n" |
| 4812 |
"#else\n%0\n#endif"; |
| 4813 |
|
| 4814 |
test_text = "void\t(*signal())();"; |
| 4815 |
}; |
| 4816 |
|
| 4817 |
/* |
| 4818 |
* Correct the return type for strlen in strings.h in SunOS 4. |
| 4819 |
*/ |
| 4820 |
fix = { |
| 4821 |
hackname = sunos_strlen; |
| 4822 |
files = strings.h; |
| 4823 |
select = "int[ \t]*strlen\\(\\);(.*)"; |
| 4824 |
c_fix = format; |
| 4825 |
c_fix_arg = "__SIZE_TYPE__ strlen();%1"; |
| 4826 |
test_text = " int\tstrlen(); /* string length */"; |
| 4827 |
}; |
| 4828 |
|
| 4829 |
/* |
| 4830 |
* Linux kernel's vt.h breaks C++ |
| 4831 |
*/ |
| 4832 |
fix = { |
| 4833 |
hackname = suse_linux_vt_cxx; |
| 4834 |
files = linux/vt.h; |
| 4835 |
|
| 4836 |
select = "^[ \t]*unsigned int new;"; |
| 4837 |
c_fix = format; |
| 4838 |
c_fix_arg = "unsigned int newev;"; |
| 4839 |
|
| 4840 |
test_text = " unsigned int new; /* New console (if changing) */"; |
| 4841 |
}; |
| 4842 |
|
| 4843 |
/* |
| 4844 |
* Disable apparent native compiler optimization cruft in SVR4.2 <string.h> |
| 4845 |
* that is visible to any ANSI compiler using this include. Simply |
| 4846 |
* delete the lines that #define some string functions to internal forms. |
| 4847 |
*/ |
| 4848 |
fix = { |
| 4849 |
hackname = svr4_disable_opt; |
| 4850 |
files = string.h; |
| 4851 |
select = '#define.*__std_hdr_'; |
| 4852 |
sed = '/#define.*__std_hdr_/d'; |
| 4853 |
test_text = "#define strlen __std_hdr_strlen\n"; |
| 4854 |
}; |
| 4855 |
|
| 4856 |
/* |
| 4857 |
* Fix broken decl of getcwd present on some svr4 systems. |
| 4858 |
*/ |
| 4859 |
fix = { |
| 4860 |
hackname = svr4_getcwd; |
| 4861 |
files = stdlib.h; |
| 4862 |
files = unistd.h; |
| 4863 |
files = prototypes.h; |
| 4864 |
select = 'getcwd\(char \*, int\)'; |
| 4865 |
|
| 4866 |
c_fix = format; |
| 4867 |
c_fix_arg = "getcwd(char *, size_t)"; |
| 4868 |
|
| 4869 |
test_text = "extern char* getcwd(char *, int);"; |
| 4870 |
}; |
| 4871 |
|
| 4872 |
/* |
| 4873 |
* Fix broken decl of profil present on some svr4 systems. |
| 4874 |
*/ |
| 4875 |
fix = { |
| 4876 |
hackname = svr4_profil; |
| 4877 |
files = stdlib.h; |
| 4878 |
files = unistd.h; |
| 4879 |
|
| 4880 |
select = |
| 4881 |
'profil\(unsigned short \*, unsigned int, unsigned int, unsigned int\)'; |
| 4882 |
c_fix = format; |
| 4883 |
c_fix_arg = 'profil(unsigned short *, size_t, int, unsigned int)'; |
| 4884 |
|
| 4885 |
test_text = |
| 4886 |
'profil(unsigned short *, unsigned int, unsigned int, unsigned int);'; |
| 4887 |
}; |
| 4888 |
|
| 4889 |
/* |
| 4890 |
* Correct types for signal handler constants like SIG_DFL; they might be |
| 4891 |
* void (*) (), and should be void (*) (int). C++ doesn't like the |
| 4892 |
* old style. |
| 4893 |
*/ |
| 4894 |
fix = { |
| 4895 |
hackname = svr4_sighandler_type; |
| 4896 |
files = sys/signal.h; |
| 4897 |
select = 'void *\(\*\)\(\)'; |
| 4898 |
c_fix = format; |
| 4899 |
c_fix_arg = "void (*)(int)"; |
| 4900 |
test_text = "#define SIG_DFL (void(*)())0\n" |
| 4901 |
"#define SIG_IGN (void (*)())0\n"; |
| 4902 |
}; |
| 4903 |
|
| 4904 |
/* |
| 4905 |
* Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local |
| 4906 |
* function 'getrnge' in <regexp.h> before they declare it. For these |
| 4907 |
* systems add a 'static int' declaration of 'getrnge' into <regexp.h> |
| 4908 |
* early on. |
| 4909 |
* |
| 4910 |
* 'getrnge' traditionally manipulates a file-scope global called 'size', |
| 4911 |
* so put the declaration right after the declaration of 'size'. |
| 4912 |
* |
| 4913 |
* Don't do this if there is already a `static void getrnge' declaration |
| 4914 |
* present, since this would cause a redeclaration error. Solaris 2.x has |
| 4915 |
* such a declaration. |
| 4916 |
*/ |
| 4917 |
fix = { |
| 4918 |
hackname = svr4_undeclared_getrnge; |
| 4919 |
files = regexp.h; |
| 4920 |
select = "getrnge"; |
| 4921 |
bypass = "static void getrnge"; |
| 4922 |
c_fix = format; |
| 4923 |
c_fix_arg = "%0\n" |
| 4924 |
"static int getrnge ();"; |
| 4925 |
c_fix_arg = "^static int[ \t]+size;"; |
| 4926 |
test_text = "static int size;\n" |
| 4927 |
"/* stuff which calls getrnge() */\n" |
| 4928 |
"static getrnge()\n" |
| 4929 |
"{}"; |
| 4930 |
}; |
| 4931 |
|
| 4932 |
/* |
| 4933 |
* Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn} |
| 4934 |
* in string.h on sysV68 |
| 4935 |
* Correct the return type for strlen in string.h on Lynx. |
| 4936 |
* Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0. |
| 4937 |
* Add missing const for strdup on OSF/1 V3.0. |
| 4938 |
* On sysV88 layout is slightly different. |
| 4939 |
*/ |
| 4940 |
fix = { |
| 4941 |
hackname = sysv68_string; |
| 4942 |
files = testing.h; |
| 4943 |
files = string.h; |
| 4944 |
bypass = "_CLASSIC_ANSI_TYPES"; |
| 4945 |
|
| 4946 |
sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/"; |
| 4947 |
sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/"; |
| 4948 |
sed = "s/strdup(char \\*s1);/strdup(const char *s1);/"; |
| 4949 |
|
| 4950 |
sed = "/^extern char$/N"; |
| 4951 |
sed = "s/^extern char\\(\\n\t\\*memccpy(),\\)$/extern void\\1/"; |
| 4952 |
|
| 4953 |
sed = "/^extern int$/N"; |
| 4954 |
sed = "s/^extern int\\(\\n\tstrlen(),\\)/extern size_t\\1/"; |
| 4955 |
|
| 4956 |
sed = "/^\tstrncmp(),$/N"; |
| 4957 |
sed = 's/^\(' "\t" 'strncmp()\),\n\(' "\t" 'strlen(),\)$/' |
| 4958 |
'\1;' "\\\nextern unsigned int\\\n\\2/"; |
| 4959 |
|
| 4960 |
test_text = |
| 4961 |
"extern int strlen();\n" |
| 4962 |
|
| 4963 |
"extern int ffs(long);\n" |
| 4964 |
|
| 4965 |
"extern char\n" |
| 4966 |
"\t*memccpy(),\n" |
| 4967 |
"\tmemcpy();\n" |
| 4968 |
|
| 4969 |
"extern int\n" |
| 4970 |
"\tstrcmp(),\n" |
| 4971 |
"\tstrncmp(),\n" |
| 4972 |
"\tstrlen(),\n" |
| 4973 |
"\tstrspn();\n" |
| 4974 |
|
| 4975 |
"extern int\n" |
| 4976 |
"\tstrlen(), strspn();"; |
| 4977 |
}; |
| 4978 |
|
| 4979 |
/* |
| 4980 |
* Fix return type of calloc, malloc, realloc, bsearch and exit |
| 4981 |
*/ |
| 4982 |
fix = { |
| 4983 |
hackname = sysz_stdlib_for_sun; |
| 4984 |
files = stdlib.h; |
| 4985 |
bypass = "_CLASSIC_ANSI_TYPES"; |
| 4986 |
|
| 4987 |
select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\("; |
| 4988 |
c_fix = format; |
| 4989 |
c_fix_arg = "void *\t%1("; |
| 4990 |
|
| 4991 |
test_text = |
| 4992 |
"extern char*\tcalloc(size_t);\n" |
| 4993 |
"extern char*\tmalloc(size_t);\n" |
| 4994 |
"extern char*\trealloc(void*,size_t);\n" |
| 4995 |
"extern char*\tbsearch(void*,size_t,size_t);\n"; |
| 4996 |
}; |
| 4997 |
|
| 4998 |
/* |
| 4999 |
* __thread is now a keyword. |
| 5000 |
*/ |
| 5001 |
fix = { |
| 5002 |
hackname = thread_keyword; |
| 5003 |
files = "pthread.h"; |
| 5004 |
files = bits/sigthread.h, '*/bits/sigthread.h'; |
| 5005 |
select = "([* ])__thread([,)])"; |
| 5006 |
c_fix = format; |
| 5007 |
c_fix_arg = "%1__thr%2"; |
| 5008 |
|
| 5009 |
test_text = |
| 5010 |
"extern int pthread_create (pthread_t *__restrict __thread,\n" |
| 5011 |
"extern int pthread_kill (pthread_t __thread, int __signo);\n" |
| 5012 |
"extern int pthread_cancel (pthread_t __thread);"; |
| 5013 |
}; |
| 5014 |
|
| 5015 |
/* |
| 5016 |
* if the #if says _cplusplus, not the double underscore __cplusplus |
| 5017 |
* that it should be |
| 5018 |
*/ |
| 5019 |
fix = { |
| 5020 |
hackname = tinfo_cplusplus; |
| 5021 |
files = tinfo.h; |
| 5022 |
select = "[ \t]_cplusplus"; |
| 5023 |
|
| 5024 |
c_fix = format; |
| 5025 |
c_fix_arg = " __cplusplus"; |
| 5026 |
test_text = "#ifdef _cplusplus\nint bogus;\n#endif"; |
| 5027 |
}; |
| 5028 |
|
| 5029 |
/* |
| 5030 |
* parameters not const on DECstation Ultrix V4.0 and OSF/1. |
| 5031 |
*/ |
| 5032 |
fix = { |
| 5033 |
hackname = ultrix_const; |
| 5034 |
files = stdio.h; |
| 5035 |
select = 'perror\( char \*'; |
| 5036 |
|
| 5037 |
c_fix = format; |
| 5038 |
c_fix_arg = "%1 const %3 *__"; |
| 5039 |
c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)" |
| 5040 |
"[ \t]+(char|void) \\*__"; |
| 5041 |
|
| 5042 |
test_text = |
| 5043 |
"extern void perror( char *__s );\n" |
| 5044 |
"extern int fputs( char *__s, FILE *);\n" |
| 5045 |
"extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n" |
| 5046 |
"extern int fscanf( FILE *__stream, char *__format, ...);\n" |
| 5047 |
"extern int scanf( char *__format, ...);\n"; |
| 5048 |
}; |
| 5049 |
|
| 5050 |
/* |
| 5051 |
* parameters not const on DECstation Ultrix V4.0 and OSF/1. |
| 5052 |
*/ |
| 5053 |
fix = { |
| 5054 |
hackname = ultrix_const2; |
| 5055 |
files = stdio.h; |
| 5056 |
|
| 5057 |
select = '\*fopen\( char \*'; |
| 5058 |
c_fix = format; |
| 5059 |
c_fix_arg = "%1( const char *%3, const char *"; |
| 5060 |
c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\(" |
| 5061 |
"[ \t]*char[ \t]*\\*([^,]*)," |
| 5062 |
"[ \t]*char[ \t]*\\*[ \t]*"; |
| 5063 |
|
| 5064 |
test_text = |
| 5065 |
"extern FILE *fopen( char *__filename, char *__type );\n" |
| 5066 |
"extern int sscanf( char *__s, char *__format, ...);\n" |
| 5067 |
"extern FILE *popen(char *, char *);\n" |
| 5068 |
"extern char *tempnam(char*,char*);\n"; |
| 5069 |
}; |
| 5070 |
|
| 5071 |
/* |
| 5072 |
* Fix definitions of macros used by va-i960.h in VxWorks header file. |
| 5073 |
*/ |
| 5074 |
fix = { |
| 5075 |
hackname = va_i960_macro; |
| 5076 |
files = arch/i960/archI960.h; |
| 5077 |
select = "__(vsiz|vali|vpad|alignof__)"; |
| 5078 |
|
| 5079 |
c_fix = format; |
| 5080 |
c_fix_arg = "__vx%1"; |
| 5081 |
|
| 5082 |
test_text = |
| 5083 |
"extern int __vsiz vsiz;\n" |
| 5084 |
"extern int __vali vali;\n" |
| 5085 |
"extern int __vpad vpad;\n" |
| 5086 |
"#define __alignof__(x) ..."; |
| 5087 |
}; |
| 5088 |
|
| 5089 |
/* |
| 5090 |
* On VMS, add missing braces around sigset_t constants. |
| 5091 |
*/ |
| 5092 |
fix = { |
| 5093 |
hackname = vms_add_missing_braces; |
| 5094 |
select = "(_SIG_[A-Z]+_SET[ \t]+= \\{)(0x[0F]+, 0x[0F]+)"; |
| 5095 |
mach = "*-*-*vms*"; |
| 5096 |
files = "rtldef/signal.h"; |
| 5097 |
c_fix = format; |
| 5098 |
|
| 5099 |
c_fix_arg = '%1 {%2} '; |
| 5100 |
|
| 5101 |
test_text = "static const __sigset_t _SIG_EMPTY_SET = " |
| 5102 |
"{0x00000000, 0x00000000},\n" |
| 5103 |
" _SIG_FULL_SET = {0xFFFFFFFF, 0xFFFFFFFF};\n"; |
| 5104 |
}; |
| 5105 |
|
| 5106 |
/* |
| 5107 |
* On VMS, some DEC-C builtins are directly used. |
| 5108 |
*/ |
| 5109 |
fix = { |
| 5110 |
hackname = vms_decc_builtin; |
| 5111 |
select = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY)"; |
| 5112 |
mach = "*-*-*vms*"; |
| 5113 |
files = rtldef/string.h, rtldef/time.h, rtldef/strings.h, |
| 5114 |
rtldef/socket.h; |
| 5115 |
sed = "s@__MEMSET@memset@"; |
| 5116 |
sed = "s@__MEMMOVE@memmove@"; |
| 5117 |
sed = "s@__MEMCPY@memcpy@"; |
| 5118 |
sed = "s@__STRLEN@strlen@"; |
| 5119 |
sed = "s@__STRCPY@strcpy@"; |
| 5120 |
|
| 5121 |
test_text = "define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p)))\n"; |
| 5122 |
}; |
| 5123 |
|
| 5124 |
/* |
| 5125 |
* Define __CAN_USE_EXTERN_PREFIX on vms. |
| 5126 |
*/ |
| 5127 |
fix = { |
| 5128 |
hackname = vms_define_can_use_extern_prefix; |
| 5129 |
files = "rtldef/decc$types.h"; |
| 5130 |
select = "#[ \t]*else\n" |
| 5131 |
"#[ \t]*if defined\\(__DECCXX\\)\n" |
| 5132 |
"#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n"; |
| 5133 |
mach = "*-*-*vms*"; |
| 5134 |
c_fix = format; |
| 5135 |
|
| 5136 |
c_fix_arg = "%0" |
| 5137 |
"# elif defined (__GNUC__)\n" |
| 5138 |
"#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"; |
| 5139 |
|
| 5140 |
test_text = "# else\n" |
| 5141 |
"# if defined(__DECCXX)\n" |
| 5142 |
"#\tdefine __CAN_USE_EXTERN_PREFIX 1\n" |
| 5143 |
"# endif\n" |
| 5144 |
"# endif\n"; |
| 5145 |
}; |
| 5146 |
|
| 5147 |
/* |
| 5148 |
* On VMS, disable the use of dec-c string builtins |
| 5149 |
*/ |
| 5150 |
fix = { |
| 5151 |
hackname = vms_disable_decc_string_builtins; |
| 5152 |
select = "#if !defined\\(__VAX\\)\n"; |
| 5153 |
mach = "*-*-*vms*"; |
| 5154 |
files = "rtldef/string.h"; |
| 5155 |
c_fix = format; |
| 5156 |
|
| 5157 |
c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n"; |
| 5158 |
|
| 5159 |
test_text = "#if !defined(__VAX)\n"; |
| 5160 |
}; |
| 5161 |
|
| 5162 |
/* |
| 5163 |
* On VMS, fix incompatible redeclaration of hostalias. |
| 5164 |
*/ |
| 5165 |
fix = { |
| 5166 |
hackname = vms_do_not_redeclare_hostalias; |
| 5167 |
select = "(void[ \t]+fp_nquery \\(const u_char \\*, int, FILE \\*\\);)\n" |
| 5168 |
"(__char_ptr32[ \t]+hostalias \\(const char \\*\\);)"; |
| 5169 |
mach = "*-*-*vms*"; |
| 5170 |
files = "rtldef/resolv.h"; |
| 5171 |
c_fix = format; |
| 5172 |
|
| 5173 |
c_fix_arg = "%1\n" |
| 5174 |
"/* %2 */"; |
| 5175 |
|
| 5176 |
test_text = "void fp_nquery (const u_char *, int, FILE *);\n" |
| 5177 |
"__char_ptr32 hostalias (const char *);\n"; |
| 5178 |
}; |
| 5179 |
|
| 5180 |
/* |
| 5181 |
* On VMS, forward declare structure before referencing them in prototypes. |
| 5182 |
*/ |
| 5183 |
fix = { |
| 5184 |
hackname = vms_forward_declare_struct; |
| 5185 |
select = "(/\\* forward decls for C\\+\\+ \\*/\n)" |
| 5186 |
"#ifdef __cplusplus\n"; |
| 5187 |
mach = "*-*-*vms*"; |
| 5188 |
files = rtldef/if.h; |
| 5189 |
c_fix = format; |
| 5190 |
|
| 5191 |
c_fix_arg = "%1" |
| 5192 |
"#if defined (__cplusplus) || defined (__GNUC__)\n"; |
| 5193 |
|
| 5194 |
test_text = "/* forward decls for C++ */\n" |
| 5195 |
"#ifdef __cplusplus\n" |
| 5196 |
"struct foo;\n" |
| 5197 |
"#endif\n"; |
| 5198 |
}; |
| 5199 |
|
| 5200 |
/* |
| 5201 |
* On VMS, do not declare getopt and al if pointers are 64 bit. |
| 5202 |
*/ |
| 5203 |
fix = { |
| 5204 |
hackname = vms_no_64bit_getopt; |
| 5205 |
select = "^[ \t]*(extern[ \t]*)?(int[ \t]*(getopt|optind|opterr|optopt)" |
| 5206 |
"|(char \\*optarg))([ \t]*\\(.*\\))?;\n"; |
| 5207 |
mach = "*-*-*vms*"; |
| 5208 |
files = rtldef/stdio.h, rtldef/unistd.h; |
| 5209 |
c_fix = format; |
| 5210 |
|
| 5211 |
c_fix_arg = <<- _EOArg_ |
| 5212 |
#if __INITIAL_POINTER_SIZE != 64 /* getopt is short ptr only. */ |
| 5213 |
%0#endif |
| 5214 |
|
| 5215 |
_EOArg_; |
| 5216 |
|
| 5217 |
test_text = "int getopt (int, char * const [], const char *);"; |
| 5218 |
}; |
| 5219 |
|
| 5220 |
/* |
| 5221 |
* On VMS, force the use of fast setjmp, as the normal setjmp uses conditions |
| 5222 |
* which is not yet fully supported by gcc. |
| 5223 |
*/ |
| 5224 |
fix = { |
| 5225 |
hackname = vms_use_fast_setjmp; |
| 5226 |
select = "(#[ \t]*if[ \t]*defined\\(__FAST_SETJMP\\)[ \t]*\\|\\|)"; |
| 5227 |
mach = "*-*-*vms*"; |
| 5228 |
files = rtldef/setjmp.h; |
| 5229 |
c_fix = format; |
| 5230 |
|
| 5231 |
c_fix_arg = "%0 defined (__GNUC__) ||"; |
| 5232 |
|
| 5233 |
test_text = "# if defined(__FAST_SETJMP) || defined(__UNIX_SETJMP)"; |
| 5234 |
}; |
| 5235 |
|
| 5236 |
/* |
| 5237 |
* On VMS, use pragma extern_model instead of VAX-C keywords. |
| 5238 |
*/ |
| 5239 |
fix = { |
| 5240 |
hackname = vms_use_pragma_extern_model; |
| 5241 |
select = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n" |
| 5242 |
"# pragma extern_model __save\n"; |
| 5243 |
mach = "*-*-*vms*"; |
| 5244 |
c_fix = format; |
| 5245 |
|
| 5246 |
c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n" |
| 5247 |
"# pragma extern_model __save\n"; |
| 5248 |
|
| 5249 |
test_text = "#if defined(__DECC) || defined(__DECCXX)\n" |
| 5250 |
"# pragma extern_model __save\n" |
| 5251 |
"# pragma extern_model strict_refdef\n" |
| 5252 |
" extern struct x zz$yy;\n" |
| 5253 |
"# pragma extern_model __restore\n" |
| 5254 |
"#endif\n"; |
| 5255 |
}; |
| 5256 |
|
| 5257 |
/* |
| 5258 |
* On VMS, change <resource.h> to <sys/resource.h> to avoid a |
| 5259 |
* conflict while building gcc. Likewise for <builtins.h> |
| 5260 |
*/ |
| 5261 |
fix = { |
| 5262 |
hackname = vms_use_quoted_include; |
| 5263 |
select = "(#[ \t]*include[ \t]+)<(resource|builtins)\\.h>"; |
| 5264 |
mach = "*-*-*vms*"; |
| 5265 |
files = rtldef/wait.h, starlet_c/pthread.h; |
| 5266 |
c_fix = format; |
| 5267 |
|
| 5268 |
c_fix_arg = '%1<sys/%2.h>'; |
| 5269 |
|
| 5270 |
test_text = "# include <resource.h>"; |
| 5271 |
}; |
| 5272 |
|
| 5273 |
/* |
| 5274 |
* AIX and Interix headers define NULL to be cast to a void pointer, |
| 5275 |
* which is illegal in ANSI C++. |
| 5276 |
*/ |
| 5277 |
fix = { |
| 5278 |
hackname = void_null; |
| 5279 |
files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h, |
| 5280 |
time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h; |
| 5281 |
/* avoid changing C++ friendly NULL */ |
| 5282 |
bypass = __cplusplus; |
| 5283 |
bypass = __null; |
| 5284 |
select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)"; |
| 5285 |
c_fix = format; |
| 5286 |
c_fix_arg = <<- _EOFix_ |
| 5287 |
#ifndef NULL |
| 5288 |
#ifdef __cplusplus |
| 5289 |
#ifdef __GNUG__ |
| 5290 |
#define NULL __null |
| 5291 |
#else /* ! __GNUG__ */ |
| 5292 |
#define NULL 0L |
| 5293 |
#endif /* __GNUG__ */ |
| 5294 |
#else /* ! __cplusplus */ |
| 5295 |
#define NULL ((void *)0) |
| 5296 |
#endif /* __cplusplus */ |
| 5297 |
#endif /* !NULL */ |
| 5298 |
_EOFix_; |
| 5299 |
test_text = "# define\tNULL \t((void *)0) /* typed NULL */"; |
| 5300 |
}; |
| 5301 |
|
| 5302 |
/* |
| 5303 |
* Make VxWorks header which is almost gcc ready fully gcc ready. |
| 5304 |
*/ |
| 5305 |
fix = { |
| 5306 |
hackname = vxworks_gcc_problem; |
| 5307 |
files = types/vxTypesBase.h; |
| 5308 |
select = "__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__"; |
| 5309 |
|
| 5310 |
sed = "s/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/" |
| 5311 |
"#if 1/"; |
| 5312 |
|
| 5313 |
sed = "/[ \t]size_t/i\\\n" |
| 5314 |
"#ifndef _GCC_SIZE_T\\\n" |
| 5315 |
"#define _GCC_SIZE_T\n"; |
| 5316 |
|
| 5317 |
sed = "/[ \t]size_t/a\\\n" |
| 5318 |
"#endif\n"; |
| 5319 |
|
| 5320 |
sed = "/[ \t]ptrdiff_t/i\\\n" |
| 5321 |
"#ifndef _GCC_PTRDIFF_T\\\n" |
| 5322 |
"#define _GCC_PTRDIFF_T\n"; |
| 5323 |
|
| 5324 |
sed = "/[ \t]ptrdiff_t/a\\\n" |
| 5325 |
"#endif\n"; |
| 5326 |
|
| 5327 |
sed = "/[ \t]wchar_t/i\\\n" |
| 5328 |
"#ifndef _GCC_WCHAR_T\\\n" |
| 5329 |
"#define _GCC_WCHAR_T\n"; |
| 5330 |
|
| 5331 |
sed = "/[ \t]wchar_t/a\\\n" |
| 5332 |
"#endif\n"; |
| 5333 |
|
| 5334 |
test_text = |
| 5335 |
"#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n" |
| 5336 |
"typedef unsigned int size_t;\n" |
| 5337 |
"typedef long ptrdiff_t;\n" |
| 5338 |
"typedef unsigned short wchar_t;\n" |
| 5339 |
"#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n"; |
| 5340 |
}; |
| 5341 |
|
| 5342 |
/* |
| 5343 |
* Wrap VxWorks ioctl to keep everything pretty |
| 5344 |
*/ |
| 5345 |
fix = { |
| 5346 |
hackname = vxworks_ioctl_macro; |
| 5347 |
files = ioLib.h; |
| 5348 |
mach = "*-*-vxworks*"; |
| 5349 |
|
| 5350 |
c_fix = format; |
| 5351 |
c_fix_arg = "%0\n" |
| 5352 |
"#define ioctl(fd, func, arg) ioctl(fd, func, (int)(arg))\n"; |
| 5353 |
c_fix_arg = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);"; |
| 5354 |
|
| 5355 |
test_text = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;"; |
| 5356 |
}; |
| 5357 |
|
| 5358 |
/* |
| 5359 |
* Provide C99 FP classification support in VxWorks math.h if |
| 5360 |
* not already there. Note the strict expectation on #define without |
| 5361 |
* whitespaces in the bypass expression, which "works" for |
| 5362 |
* the system headers we have met and doesn't match test texts for |
| 5363 |
* other hacks, found in the test baseline. |
| 5364 |
*/ |
| 5365 |
fix = { |
| 5366 |
hackname = vxworks_math_h_fp_c99; |
| 5367 |
mach = "*-*-vxworks*"; |
| 5368 |
files = math.h; |
| 5369 |
bypass = "#define[ \t]+FP_INFINITE"; |
| 5370 |
select = "#define HUGE_VAL[ \t]*_ARCH.*"; |
| 5371 |
c_fix = format; |
| 5372 |
c_fix_arg = << _EOArg_ |
| 5373 |
|
| 5374 |
%0 |
| 5375 |
|
| 5376 |
#if _C99 |
| 5377 |
|
| 5378 |
#define FP_INFINITE 1 |
| 5379 |
#define FP_NAN 2 |
| 5380 |
#define FP_NORMAL (-1) |
| 5381 |
#define FP_SUBNORMAL (-2) |
| 5382 |
#define FP_ZERO 0 |
| 5383 |
|
| 5384 |
#define fpclassify(x) \ |
| 5385 |
__builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, \ |
| 5386 |
FP_SUBNORMAL, FP_ZERO, (x)) |
| 5387 |
|
| 5388 |
#define signbit(x) __builtin_signbit(x) |
| 5389 |
#define isfinite(x) __builtin_isfinite(x) |
| 5390 |
#define isnormal(x) __builtin_isnormal(x) |
| 5391 |
#define isnan(x) __builtin_isnan(x) |
| 5392 |
#define isinf(x) __builtin_isinf(x) |
| 5393 |
|
| 5394 |
#define isgreater(x, y) __builtin_isgreater((x),(y)) |
| 5395 |
#define isgreaterequal(x, y) __builtin_isgreaterequal((x),(y)) |
| 5396 |
#define isless(x, y) __builtin_isless((x),(y)) |
| 5397 |
#define islessequal(x, y) __builtin_islessequal((x),(y)) |
| 5398 |
#define islessgreater(x, y) __builtin_islessgreater((x),(y)) |
| 5399 |
#define isunordered(x, y) __builtin_isunordered((x),(y)) |
| 5400 |
|
| 5401 |
#endif /* _C99 */ |
| 5402 |
|
| 5403 |
_EOArg_; |
| 5404 |
|
| 5405 |
test_text = "#define HUGE_VAL _ARCH_HUGH_VAL"; |
| 5406 |
}; |
| 5407 |
|
| 5408 |
/* |
| 5409 |
* mkdir's posix interface expects two arguments. While the RTP VxWorks |
| 5410 |
* API is fine, the kernel version handles only one. We used to expose |
| 5411 |
* a macro and this didn't play nice with uses such as posix:mkdir(x, y) |
| 5412 |
* in libstdc++, so we expose a vararg prototype instead. |
| 5413 |
*/ |
| 5414 |
fix = { |
| 5415 |
hackname = vxworks_posix_mkdir; |
| 5416 |
files = sys/stat.h; |
| 5417 |
mach = "*-*-vxworks*"; |
| 5418 |
|
| 5419 |
c_fix = format; |
| 5420 |
c_fix_arg = "extern STATUS mkdir(const char *dir, ...);"; |
| 5421 |
c_fix_arg = "extern[\t ]+STATUS[\t ]+mkdir[\t ]*" |
| 5422 |
"\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*" /* arg type */ |
| 5423 |
"(|[_[:alpha:]][_[:alnum:]]*)" /* arg name (optional) */ |
| 5424 |
"\\)[\t ]*;"; |
| 5425 |
|
| 5426 |
test_text = "extern STATUS mkdir (const char * _qwerty) ;"; |
| 5427 |
}; |
| 5428 |
|
| 5429 |
/* |
| 5430 |
* Fix VxWorks <time.h> to not require including <vxTypes.h>. |
| 5431 |
*/ |
| 5432 |
fix = { |
| 5433 |
hackname = vxworks_needs_vxtypes; |
| 5434 |
files = time.h; |
| 5435 |
select = "uint_t([ \t]+_clocks_per_sec)"; |
| 5436 |
c_fix = format; |
| 5437 |
c_fix_arg = "unsigned int%1"; |
| 5438 |
test_text = "uint_t\t_clocks_per_sec;"; |
| 5439 |
}; |
| 5440 |
|
| 5441 |
/* |
| 5442 |
* Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>. |
| 5443 |
*/ |
| 5444 |
fix = { |
| 5445 |
hackname = vxworks_needs_vxworks; |
| 5446 |
files = sys/stat.h; |
| 5447 |
test = " -r types/vxTypesOld.h"; |
| 5448 |
test = " -n \"`egrep '#include' $file`\""; |
| 5449 |
test = " -n \"`egrep ULONG $file`\""; |
| 5450 |
select = "#[ \t]define[ \t]+__INCstath"; |
| 5451 |
|
| 5452 |
sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n" |
| 5453 |
"#include <types/vxTypesOld.h>\n"; |
| 5454 |
|
| 5455 |
test_text = "`touch types/vxTypesOld.h`" |
| 5456 |
"#include </dev/null> /* ULONG */\n" |
| 5457 |
"# define\t__INCstath <sys/stat.h>"; |
| 5458 |
}; |
| 5459 |
|
| 5460 |
/* |
| 5461 |
* yvals.h on VxWorks-6 expects the toolchain to provide its own |
| 5462 |
* version of the header, which we don't do. Arrange to fallback |
| 5463 |
* on the system definition. |
| 5464 |
*/ |
| 5465 |
fix = { |
| 5466 |
hackname = vxworks_next_yvals; |
| 5467 |
mach = "*-*-vxworks*"; |
| 5468 |
files = yvals.h; |
| 5469 |
select = "#include_next <yvals.h>"; |
| 5470 |
c_fix = format; |
| 5471 |
c_fix_arg = "#if 0 /* GCC does not provide yvals.h. */\n%1"; |
| 5472 |
c_fix_arg = "#if .*\n" |
| 5473 |
"/\\* .*\n" |
| 5474 |
"(#include_next <yvals.h>\n)"; |
| 5475 |
|
| 5476 |
test_text = "#if (defined(__cplusplus) && defined(__GNUC__))\n" |
| 5477 |
"/* GCC C++ has it's own yvals.h */\n" |
| 5478 |
"#include_next <yvals.h>\n" |
| 5479 |
"#else\n"; |
| 5480 |
}; |
| 5481 |
|
| 5482 |
/* |
| 5483 |
* Make it so VxWorks does not include gcc/regs.h accidentally |
| 5484 |
*/ |
| 5485 |
fix = { |
| 5486 |
hackname = vxworks_regs; |
| 5487 |
mach = "*-*-vxworks*"; |
| 5488 |
|
| 5489 |
select = "#[\t ]*include[\t ]+[<\"]regs.h[>\"]"; |
| 5490 |
c_fix = format; |
| 5491 |
c_fix_arg = "#include <arch/../regs.h>"; |
| 5492 |
|
| 5493 |
test_text = "#include <regs.h>\n"; |
| 5494 |
}; |
| 5495 |
|
| 5496 |
/* |
| 5497 |
* Likewise, open's posix interface allows two or three arguments and |
| 5498 |
* some VxWorks headers expose only a strict 3 arguments version. Merely |
| 5499 |
* changing the prototype into a varargs one is risky as the implementation |
| 5500 |
* would receive garbage in the third arg for calls providing only two, |
| 5501 |
* which libstdc++ does. We simply provide an always inline overload for C++ |
| 5502 |
* instead. |
| 5503 |
* |
| 5504 |
* Both fcntl.h and ioLib.h might "feature" such a prototype for _WRS_KERNEL. |
| 5505 |
* The latter #includes the former though (since 1992 according to the embedded |
| 5506 |
* log), so just leave ioLib.h alone. |
| 5507 |
*/ |
| 5508 |
fix = { |
| 5509 |
hackname = vxworks_posix_open; |
| 5510 |
mach = "*-*-vxworks*"; |
| 5511 |
files = fcntl.h; |
| 5512 |
|
| 5513 |
select = "extern int.*open \\(const char \\*[ a-z]*, int[ a-z]*, int[ a-z]*\\);"; |
| 5514 |
c_fix = format; |
| 5515 |
c_fix_arg = << _EOArg_ |
| 5516 |
%0 |
| 5517 |
|
| 5518 |
#if defined(__cplusplus) |
| 5519 |
extern "C++" { |
| 5520 |
inline int open (const char *, int) __attribute__((__always_inline__)); |
| 5521 |
|
| 5522 |
inline int |
| 5523 |
open (const char *name, int flags) |
| 5524 |
{ |
| 5525 |
return open (name, flags, 0); |
| 5526 |
} |
| 5527 |
} |
| 5528 |
#endif |
| 5529 |
|
| 5530 |
_EOArg_; |
| 5531 |
|
| 5532 |
test_text = |
| 5533 |
"extern int open (const char *, int, int);\n" |
| 5534 |
"extern int open (const char *name, int flags, int mode );\n"; |
| 5535 |
}; |
| 5536 |
|
| 5537 |
/* |
| 5538 |
* Another bad dependency in VxWorks 5.2 <time.h>. |
| 5539 |
*/ |
| 5540 |
fix = { |
| 5541 |
hackname = vxworks_time; |
| 5542 |
files = time.h; |
| 5543 |
test = " -r vxWorks.h"; |
| 5544 |
|
| 5545 |
select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*"; |
| 5546 |
c_fix = format; |
| 5547 |
|
| 5548 |
c_fix_arg = |
| 5549 |
"#ifndef __gcc_VOIDFUNCPTR_defined\n" |
| 5550 |
"#ifdef __cplusplus\n" |
| 5551 |
"typedef void (*__gcc_VOIDFUNCPTR) (...);\n" |
| 5552 |
"#else\n" |
| 5553 |
"typedef void (*__gcc_VOIDFUNCPTR) ();\n" |
| 5554 |
"#endif\n" |
| 5555 |
"#define __gcc_VOIDFUNCPTR_defined\n" |
| 5556 |
"#endif\n" |
| 5557 |
"#define VOIDFUNCPTR __gcc_VOIDFUNCPTR"; |
| 5558 |
|
| 5559 |
test_text = "`touch vxWorks.h`" |
| 5560 |
"#define VOIDFUNCPTR (void(*)())"; |
| 5561 |
}; |
| 5562 |
|
| 5563 |
/* |
| 5564 |
* This hack makes write const-correct on VxWorks |
| 5565 |
*/ |
| 5566 |
fix = { |
| 5567 |
hackname = vxworks_write_const; |
| 5568 |
files = ioLib.h; |
| 5569 |
mach = "*-*-vxworks*"; |
| 5570 |
|
| 5571 |
c_fix = format; |
| 5572 |
c_fix_arg = "extern int write (int, const char*, size_t);"; |
| 5573 |
c_fix_arg = "extern[\t ]+int[\t ]+write[\t ]*\\(" |
| 5574 |
"[\t ]*int[\t ]*," |
| 5575 |
"[\t ]*char[\t ]*\\*[\t ]*," |
| 5576 |
"[\t ]*size_t[\t ]*\\)[\t ]*;"; |
| 5577 |
|
| 5578 |
test_text = "extern int write ( int , char * , size_t ) ;"; |
| 5579 |
}; |
| 5580 |
|
| 5581 |
/* |
| 5582 |
* This hack ensures the include_next in the fixed unistd.h actually |
| 5583 |
* finds the system's unistd.h and not the fixed unistd.h again. |
| 5584 |
*/ |
| 5585 |
fix = { |
| 5586 |
hackname = vxworks_iolib_include_unistd; |
| 5587 |
files = ioLib.h; |
| 5588 |
mach = "*-*-vxworks*"; |
| 5589 |
select = "#include \"unistd.h\""; |
| 5590 |
|
| 5591 |
c_fix = format; |
| 5592 |
c_fix_arg = "#include <unistd.h>"; |
| 5593 |
|
| 5594 |
test_text = "#include \"unistd.h\""; |
| 5595 |
}; |
| 5596 |
|
| 5597 |
/* |
| 5598 |
* Make sure there is a visible prototype of sysClkRateGet() when |
| 5599 |
* CLOCKS_PER_SEC is #defined to that in time.h for VxWorks. This would |
| 5600 |
* typically be provided by sysLib.h. |
| 5601 |
* |
| 5602 |
* The new #include has to come after the one for vxWorks.h in kernel headers |
| 5603 |
* and vxWorks.h is typically not #included in RTP headers. yvals.h is |
| 5604 |
* conditionally included in the latter, instead, and new #include are better |
| 5605 |
* inserted after that. |
| 5606 |
*/ |
| 5607 |
fix = { |
| 5608 |
hackname = vxworks_time_h_syslib; |
| 5609 |
files = time.h; |
| 5610 |
mach = "*-*-vxworks*"; |
| 5611 |
select = "[ \t]*#define[ \t]+CLOCKS_PER_SEC[ \t]+sysClkRateGet.*"; |
| 5612 |
|
| 5613 |
c_fix = format; |
| 5614 |
c_fix_arg = "%0\n#include <sysLib.h>"; |
| 5615 |
c_fix_arg = "#include <vxWorks.h>|#endif.* _YVALS.*"; |
| 5616 |
|
| 5617 |
test_text = |
| 5618 |
"/* kernel header pattern: */\n" |
| 5619 |
"#include <vxWorks.h>\n" |
| 5620 |
"\n" |
| 5621 |
"/* rtp header pattern: */\n" |
| 5622 |
"#ifndef _YVALS\n" |
| 5623 |
"#include <yvals.h>\n" |
| 5624 |
"#endif /* _YVALS */\n" |
| 5625 |
"\n" |
| 5626 |
"#define CLOCKS_PER_SEC sysClkRateGet()"; |
| 5627 |
}; |
| 5628 |
|
| 5629 |
/* |
| 5630 |
* There are several name conflicts with C++ reserved words in X11 header |
| 5631 |
* files. These are fixed in some versions, so don't do the fixes if |
| 5632 |
* we find __cplusplus in the file. These were found on the RS/6000. |
| 5633 |
*/ |
| 5634 |
fix = { |
| 5635 |
hackname = x11_class; |
| 5636 |
files = X11/ShellP.h; |
| 5637 |
bypass = __cplusplus; |
| 5638 |
select = "^([ \t]*char \\*)class;(.*)"; |
| 5639 |
c_fix = format; |
| 5640 |
c_fix_arg = "#ifdef __cplusplus\n%1c_class;%2\n" |
| 5641 |
"#else\n%1class;%2\n#endif"; |
| 5642 |
test_text = |
| 5643 |
"struct {\n" |
| 5644 |
" char *class;\n" |
| 5645 |
"} mumble;\n"; |
| 5646 |
}; |
| 5647 |
|
| 5648 |
/* |
| 5649 |
* class in Xm/BaseClassI.h |
| 5650 |
*/ |
| 5651 |
fix = { |
| 5652 |
hackname = x11_class_usage; |
| 5653 |
files = Xm/BaseClassI.h; |
| 5654 |
bypass = "__cplusplus"; |
| 5655 |
|
| 5656 |
select = " class\\)"; |
| 5657 |
c_fix = format; |
| 5658 |
c_fix_arg = " c_class)"; |
| 5659 |
|
| 5660 |
test_text = "extern mumble (int class);\n"; |
| 5661 |
}; |
| 5662 |
|
| 5663 |
/* |
| 5664 |
* new in Xm/Traversal.h |
| 5665 |
*/ |
| 5666 |
fix = { |
| 5667 |
hackname = x11_new; |
| 5668 |
files = Xm/Traversal.h; |
| 5669 |
bypass = __cplusplus; |
| 5670 |
|
| 5671 |
sed = "/Widget\told, new;/i\\\n" |
| 5672 |
"#ifdef __cplusplus\\\n" |
| 5673 |
"\\\tWidget\told, c_new;\\\n" |
| 5674 |
"#else\n"; |
| 5675 |
|
| 5676 |
sed = "/Widget\told, new;/a\\\n" |
| 5677 |
"#endif\n"; |
| 5678 |
|
| 5679 |
sed = "s/Widget new,/Widget c_new,/g"; |
| 5680 |
test_text = |
| 5681 |
"struct wedge {\n" |
| 5682 |
" Widget\told, new;\n" |
| 5683 |
"};\nextern Wedged( Widget new, Widget old );"; |
| 5684 |
}; |
| 5685 |
|
| 5686 |
/* |
| 5687 |
* Incorrect sprintf declaration in X11/Xmu.h |
| 5688 |
*/ |
| 5689 |
fix = { |
| 5690 |
hackname = x11_sprintf; |
| 5691 |
files = X11/Xmu.h; |
| 5692 |
files = X11/Xmu/Xmu.h; |
| 5693 |
select = "^extern char \\*\tsprintf\\(\\);$"; |
| 5694 |
|
| 5695 |
c_fix = format; |
| 5696 |
c_fix_arg = "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */"; |
| 5697 |
|
| 5698 |
test_text = "extern char *\tsprintf();"; |
| 5699 |
}; |
| 5700 |
/*EOF*/ |