comparison fixincludes/inclhack.def @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
354 _EndOfHeader_; 354 _EndOfHeader_;
355 }; 355 };
356 356
357 357
358 /* 358 /*
359 * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
360 * which only is provided by AIX xlc C99.
361 */
362 fix = {
363 hackname = aix_complex;
364 mach = "*-*-aix*";
365 files = complex.h;
366 select = "#define[ \t]_Complex_I[ \t]__I";
367 c_fix = format;
368 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
369 test_text = "#define _Complex_I __I\n";
370 };
371
372
373 /*
359 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace 374 * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
360 * which violates a requirement of ISO C. 375 * which violates a requirement of ISO C.
361 */ 376 */
362 fix = { 377 fix = {
363 hackname = aix_pthread; 378 hackname = aix_pthread;
369 "{...init stuff...}"; 384 "{...init stuff...}";
370 }; 385 };
371 386
372 387
373 /* 388 /*
389 * AIX stdint.h fixes.
390 */
391 fix = {
392 hackname = aix_stdint_1;
393 mach = "*-*-aix*";
394 files = stdint.h;
395 select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
396 "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
397 c_fix = format;
398 c_fix_arg = "#define UINT8_MAX (255)\n"
399 "#define UINT16_MAX (65535)";
400 test_text = "#define UINT8_MAX (255U)\n"
401 "#define UINT16_MAX (65535U)";
402 };
403
404
405 fix = {
406 hackname = aix_stdint_2;
407 mach = "*-*-aix*";
408 files = stdint.h;
409 select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
410 "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
411 "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
412 "#else\n"
413 "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
414 "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
415 "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
416 c_fix = format;
417 c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
418 "#define INTPTR_MAX 9223372036854775807L\n"
419 "#define UINTPTR_MAX 18446744073709551615UL\n"
420 "#else\n"
421 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
422 "#define INTPTR_MAX 2147483647L\n"
423 "#define UINTPTR_MAX 4294967295UL";
424 test_text = "#define INTPTR_MIN INT64_MIN\n"
425 "#define INTPTR_MAX INT64_MAX\n"
426 "#define UINTPTR_MAX UINT64_MAX\n"
427 "#else\n"
428 "#define INTPTR_MIN INT32_MIN\n"
429 "#define INTPTR_MAX INT32_MAX\n"
430 "#define UINTPTR_MAX UINT32_MAX";
431 };
432
433
434 fix = {
435 hackname = aix_stdint_3;
436 mach = "*-*-aix*";
437 files = stdint.h;
438 select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
439 "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
440 "#else\n"
441 "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
442 "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
443 c_fix = format;
444 c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
445 "#define PTRDIFF_MAX 9223372036854775807L\n"
446 "#else\n"
447 "#define PTRDIFF_MIN (-2147483647L - 1)\n"
448 "#define PTRDIFF_MAX 2147483647L";
449 test_text = "#define PTRDIFF_MIN INT64_MIN\n"
450 "#define PTRDIFF_MAX INT64_MAX\n"
451 "#else\n"
452 "#define PTRDIFF_MIN INT32_MIN\n"
453 "#define PTRDIFF_MAX INT32_MAX";
454 };
455
456
457 fix = {
458 hackname = aix_stdint_4;
459 mach = "*-*-aix*";
460 files = stdint.h;
461 select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
462 "#else\n"
463 "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
464 c_fix = format;
465 c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
466 "#else\n"
467 "#define SIZE_MAX 4294967295UL";
468 test_text = "#define SIZE_MAX UINT64_MAX\n"
469 "#else\n"
470 "#define SIZE_MAX UINT32_MAX";
471 };
472
473
474 fix = {
475 hackname = aix_stdint_5;
476 mach = "*-*-aix*";
477 files = stdint.h;
478 select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
479 "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
480 c_fix = format;
481 c_fix_arg = "#define UINT8_C(c) c\n"
482 "#define UINT16_C(c) c";
483 test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
484 "#define UINT16_C(c) __CONCAT__(c,U)";
485 };
486
487
488 /*
374 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline 489 * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
375 * in an otherwise harmless (and #ifed out) macro definition 490 * in an otherwise harmless (and #ifed out) macro definition
376 */ 491 */
377 fix = { 492 fix = {
378 hackname = aix_sysmachine; 493 hackname = aix_sysmachine;
380 select = "\\\\ +\n"; 495 select = "\\\\ +\n";
381 c_fix = format; 496 c_fix = format;
382 c_fix_arg = "\\\n"; 497 c_fix_arg = "\\\n";
383 test_text = "#define FOO \\\n" 498 test_text = "#define FOO \\\n"
384 " bar \\ \n baz \\ \n bat"; 499 " bar \\ \n baz \\ \n bat";
385 };
386
387
388 /*
389 * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the
390 * definition of struct rusage, so the prototype added by fixproto fails.
391 */
392 fix = {
393 hackname = aix_syswait;
394 files = sys/wait.h;
395 select = "^extern pid_t wait3\\(\\);\n";
396 select = "bos325,";
397 c_fix = format;
398 c_fix_arg = "struct rusage;\n%0";
399 test_text = "/* bos325, */\n"
400 "extern pid_t wait3();\n"
401 "\t/* pid_t wait3(int *, int, struct rusage *); */";
402 }; 500 };
403 501
404 502
405 /* 503 /*
406 * sys/wait.h on AIX 5.2 defines macros that have both signed and 504 * sys/wait.h on AIX 5.2 defines macros that have both signed and
1038 "unsigned long *address);\n"; 1136 "unsigned long *address);\n";
1039 }; 1137 };
1040 1138
1041 1139
1042 /* 1140 /*
1141 * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
1142 * unsigned constants.
1143 */
1144 fix = {
1145 hackname = darwin_stdint_1;
1146 mach = "*-*-darwin*";
1147 files = stdint.h;
1148 c_fix = format;
1149 c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
1150 select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
1151 "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
1152 test_text = "#define UINT8_C(v) (v ## U)\n"
1153 "#define UINT16_C(v) (v ## U)";
1154 };
1155
1156
1157 /*
1158 * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
1159 * with wrong types.
1160 */
1161 fix = {
1162 hackname = darwin_stdint_2;
1163 mach = "*-*-darwin*";
1164 files = stdint.h;
1165 c_fix = format;
1166 c_fix_arg = "#if __WORDSIZE == 64\n"
1167 "#define INTPTR_MAX 9223372036854775807L\n"
1168 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1169 "#else\n"
1170 "#define INTPTR_MAX 2147483647L\n"
1171 "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
1172 "#endif";
1173 select = "#if __WORDSIZE == 64\n"
1174 "#define INTPTR_MIN[ \t]+INT64_MIN\n"
1175 "#define INTPTR_MAX[ \t]+INT64_MAX\n"
1176 "#else\n"
1177 "#define INTPTR_MIN[ \t]+INT32_MIN\n"
1178 "#define INTPTR_MAX[ \t]+INT32_MAX\n"
1179 "#endif";
1180 test_text = "#if __WORDSIZE == 64\n"
1181 "#define INTPTR_MIN INT64_MIN\n"
1182 "#define INTPTR_MAX INT64_MAX\n"
1183 "#else\n"
1184 "#define INTPTR_MIN INT32_MIN\n"
1185 "#define INTPTR_MAX INT32_MAX\n"
1186 "#endif";
1187 };
1188
1189
1190 /*
1191 * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
1192 */
1193 fix = {
1194 hackname = darwin_stdint_3;
1195 mach = "*-*-darwin*";
1196 files = stdint.h;
1197 c_fix = format;
1198 c_fix_arg = "#if __WORDSIZE == 64\n"
1199 "#define UINTPTR_MAX 18446744073709551615UL\n"
1200 "#else\n"
1201 "#define UINTPTR_MAX 4294967295UL\n"
1202 "#endif";
1203 select = "#if __WORDSIZE == 64\n"
1204 "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
1205 "#else\n"
1206 "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
1207 "#endif";
1208 test_text = "#if __WORDSIZE == 64\n"
1209 "#define UINTPTR_MAX UINT64_MAX\n"
1210 "#else\n"
1211 "#define UINTPTR_MAX UINT32_MAX\n"
1212 "#endif";
1213 };
1214
1215
1216 /*
1217 * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
1218 */
1219 fix = {
1220 hackname = darwin_stdint_4;
1221 mach = "*-*-darwin*";
1222 files = stdint.h;
1223 c_fix = format;
1224 c_fix_arg = "#if __WORDSIZE == 64\n"
1225 "#define SIZE_MAX 18446744073709551615UL\n"
1226 "#else\n"
1227 "#define SIZE_MAX 4294967295UL\n"
1228 "#endif";
1229 select = "#if __WORDSIZE == 64\n"
1230 "#define SIZE_MAX[ \t]+UINT64_MAX\n"
1231 "#else\n"
1232 "#define SIZE_MAX[ \t]+UINT32_MAX\n"
1233 "#endif";
1234 test_text = "#if __WORDSIZE == 64\n"
1235 "#define SIZE_MAX UINT64_MAX\n"
1236 "#else\n"
1237 "#define SIZE_MAX UINT32_MAX\n"
1238 "#endif";
1239 };
1240
1241
1242 /*
1243 * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
1244 * with a wrong type.
1245 */
1246 fix = {
1247 hackname = darwin_stdint_5;
1248 mach = "*-*-darwin*";
1249 files = stdint.h;
1250 c_fix = format;
1251 c_fix_arg = "#if __WORDSIZE == 64\n"
1252 "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
1253 "#define INTMAX_MAX 9223372036854775807L\n"
1254 "#define UINTMAX_MAX 18446744073709551615UL\n"
1255 "#else\n"
1256 "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
1257 "#define INTMAX_MAX 9223372036854775807LL\n"
1258 "#define UINTMAX_MAX 18446744073709551615ULL\n"
1259 "#endif";
1260 select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
1261 "#define INTMAX_MAX[ \t]+INT64_MAX\n"
1262 "\n"
1263 "#define UINTMAX_MAX[ \t]+UINT64_MAX";
1264 test_text = "#define INTMAX_MIN INT64_MIN\n"
1265 "#define INTMAX_MAX INT64_MAX\n"
1266 "\n"
1267 "#define UINTMAX_MAX UINT64_MAX";
1268 };
1269
1270
1271 /*
1272 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1273 * with a wrong type.
1274 */
1275 fix = {
1276 hackname = darwin_stdint_6;
1277 mach = "*-*-darwin*";
1278 files = stdint.h;
1279 c_fix = format;
1280 c_fix_arg = "#if __WORDSIZE == 64\n"
1281 "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
1282 "#define PTRDIFF_MAX 9223372036854775807L\n"
1283 "#else\n"
1284 "#define PTRDIFF_MIN (-2147483647 - 1)\n"
1285 "#define PTRDIFF_MAX 2147483647\n"
1286 "#endif";
1287 select = "#if __WORDSIZE == 64\n"
1288 "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
1289 "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
1290 "#else\n"
1291 "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
1292 "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
1293 "#endif";
1294 test_text = "#if __WORDSIZE == 64\n"
1295 "#define PTRDIFF_MIN INT64_MIN\n"
1296 "#define PTRDIFF_MAX INT64_MAX\n"
1297 "#else\n"
1298 "#define PTRDIFF_MIN INT32_MIN\n"
1299 "#define PTRDIFF_MAX INT32_MAX\n"
1300 "#endif";
1301 };
1302
1303
1304 /*
1305 * Darwin headers have a stdint.h that defines {U,}INTMAX_C
1306 * with a wrong type.
1307 */
1308 fix = {
1309 hackname = darwin_stdint_7;
1310 mach = "*-*-darwin*";
1311 files = stdint.h;
1312 c_fix = format;
1313 c_fix_arg = "#if __WORDSIZE == 64\n"
1314 "#define INTMAX_C(v) (v ## L)\n"
1315 "#define UINTMAX_C(v) (v ## UL)\n"
1316 "#else\n"
1317 "#define INTMAX_C(v) (v ## LL)\n"
1318 "#define UINTMAX_C(v) (v ## ULL)\n"
1319 "#endif";
1320 select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
1321 "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
1322 test_text = "#define INTMAX_C(v) (v ## LL)\n"
1323 "#define UINTMAX_C(v) (v ## ULL)";
1324 };
1325
1326
1327 /*
1043 * Fix <c_asm.h> on Digital UNIX V4.0: 1328 * Fix <c_asm.h> on Digital UNIX V4.0:
1044 * It contains a prototype for a DEC C internal asm() function, 1329 * It contains a prototype for a DEC C internal asm() function,
1045 * clashing with gcc's asm keyword. So protect this with __DECC. 1330 * clashing with gcc's asm keyword. So protect this with __DECC.
1046 */ 1331 */
1047 fix = { 1332 fix = {
1087 test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */"; 1372 test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
1088 }; 1373 };
1089 1374
1090 1375
1091 /* 1376 /*
1092 * math.h on SunOS 4 puts the declaration of matherr before the definition
1093 * of struct exception, so the prototype (added by fixproto) causes havoc.
1094 * This must appear before the math_exception fix.
1095 */
1096 fix = {
1097 hackname = exception_structure;
1098 files = math.h;
1099
1100 /* If matherr has a prototype already, the header needs no fix. */
1101 bypass = 'matherr.*(struct exception|__MATH_EXCEPTION|[ \t]*__FP_EXCEPTION[ \t]*\*[ \t]*)';
1102 select = matherr;
1103
1104 c_fix = wrap;
1105 c_fix_arg = "struct exception;\n";
1106
1107 test_text = "extern int matherr();";
1108 };
1109
1110
1111 /*
1112 * Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume 1377 * Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume
1113 * neither the existence of GCC 3 nor its exact feature set yet break 1378 * neither the existence of GCC 3 nor its exact feature set yet break
1114 * (by design?) when __GNUC__ is set beyond 2. 1379 * (by design?) when __GNUC__ is set beyond 2.
1115 */ 1380 */
1116 fix = { 1381 fix = {
1184 */ 1449 */
1185 fix = { 1450 fix = {
1186 hackname = glibc_c99_inline_2; 1451 hackname = glibc_c99_inline_2;
1187 files = sys/stat.h, '*/sys/stat.h'; 1452 files = sys/stat.h, '*/sys/stat.h';
1188 select = "extern __inline__ int"; 1453 select = "extern __inline__ int";
1189 sed = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/" 1454 sed = "s/extern int \\(stat\\)/"
1190 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" 1455 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1191 "__inline__ int \\1/"; 1456 "__inline__ int \\1/";
1192 sed = "s/extern int __REDIRECT\\(_NTH\\|\\) (\\(stat\\|lstat\\|fstat\\)/" 1457 sed = "s/extern int \\([lf]stat\\)/"
1458 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1459 "__inline__ int \\1/";
1460 sed = "s/extern int \\(mknod\\)/"
1461 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1462 "__inline__ int \\1/";
1463 sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
1464 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1465 "__inline__ int __REDIRECT\\1 (\\2/";
1466 sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
1193 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" 1467 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1194 "__inline__ int __REDIRECT\\1 (\\2/"; 1468 "__inline__ int __REDIRECT\\1 (\\2/";
1195 sed = "s/^extern __inline__ int/" 1469 sed = "s/^extern __inline__ int/"
1196 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n" 1470 "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
1197 "__inline__ int/"; 1471 "__inline__ int/";
1242 */ 1516 */
1243 fix = { 1517 fix = {
1244 hackname = glibc_mutex_init; 1518 hackname = glibc_mutex_init;
1245 files = pthread.h; 1519 files = pthread.h;
1246 select = '\{ *\{ *0, *\} *\}'; 1520 select = '\{ *\{ *0, *\} *\}';
1247 sed = "/define[ \t]\\+PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n" 1521 sed = "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
1248 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}"; 1522 "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
1249 sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_" 1523 sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1250 "\\(RECURSIVE\\|ERRORCHECK\\|ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/"; 1524 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
1525 sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1526 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
1527 sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
1528 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
1251 sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_" 1529 sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1252 "\\(RECURSIVE\\|ERRORCHECK\\|ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/"; 1530 "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1253 sed = "/define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/" 1531 sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1532 "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
1533 sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
1534 "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
1535 sed = "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
1254 "N;s/^[ \t]*#[ \t]*" 1536 "N;s/^[ \t]*#[ \t]*"
1255 "\\(define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n" 1537 "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
1256 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\n" 1538 "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
1257 "# \\1\\n" 1539 "# \\1\\\n"
1258 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\n" 1540 " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1259 "# else\\n" 1541 "# else\\\n"
1260 "# \\1\\n" 1542 "# \\1\\\n"
1261 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\n" 1543 " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
1262 "# endif/"; 1544 "# endif/";
1263 sed = "s/{ \\(0, 0, 0, 0, 0, 0, " 1545 sed = "s/{ \\(0, 0, 0, 0, 0, 0, "
1264 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/"; 1546 "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
1265 sed = "/define[ \t]\\+PTHREAD_COND_INITIALIZER/" 1547 sed = "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
1266 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/"; 1548 "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
1267 1549
1268 test_text = <<- _EOText_ 1550 test_text = <<- _EOText_
1269 #define PTHREAD_MUTEX_INITIALIZER \\ 1551 #define PTHREAD_MUTEX_INITIALIZER \\
1270 { { 0, } } 1552 { { 0, } }
1300 #define PTHREAD_COND_INITIALIZER { { 0, } } 1582 #define PTHREAD_COND_INITIALIZER { { 0, } }
1301 _EOText_; 1583 _EOText_;
1302 }; 1584 };
1303 1585
1304 1586
1587 /* glibc versions before 2.5 have a version of stdint.h that defines
1588 UINT8_C and UINT16_C to produce unsigned constants, as do uClibc
1589 versions with stdint.h based on those glibc versions. */
1590 fix = {
1591 hackname = glibc_stdint;
1592 files = stdint.h;
1593 select = "GNU C Library";
1594 c_fix = format;
1595 c_fix_arg = "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
1596 c_fix_arg = "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
1597 test_text = "/* This file is part of the GNU C Library. */\n# define UINT8_C(c)\tc ## U\n# define UINT16_C(c)\tc ## U";
1598 };
1599
1600
1601 /* glibc's tgmath.h relies on an expression that is not an integer
1602 constant expression being treated as it was by GCC 4.4 and
1603 earlier. */
1604 fix = {
1605 hackname = glibc_tgmath;
1606 files = tgmath.h;
1607 select = '\(\(\(type\) 0.25\) && \(\(type\) 0.25 - 1\)\)';
1608 bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
1609 c_fix = format;
1610 c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || (__builtin_classify_type ((type) 0) == 9 && __builtin_classify_type (__real__ ((type) 0)) == 8))";
1611 test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
1612 };
1613
1305 /* 1614 /*
1306 * Fix these files to use the types we think they should for 1615 * Fix these files to use the types we think they should for
1307 * ptrdiff_t, size_t, and wchar_t. 1616 * ptrdiff_t, size_t, and wchar_t.
1308 * 1617 *
1309 * This defines the types in terms of macros predefined by our 'cpp'. 1618 * This defines the types in terms of macros predefined by our 'cpp'.
1617 test_text = "extern int snprintf(char *, size_t, char *, ...);\n" 1926 test_text = "extern int snprintf(char *, size_t, char *, ...);\n"
1618 "extern int snprintf(char *, __size_t, char *, ...);\n" 1927 "extern int snprintf(char *, __size_t, char *, ...);\n"
1619 "extern int snprintf(char *, _hpux_size_t, char *, ...);"; 1928 "extern int snprintf(char *, _hpux_size_t, char *, ...);";
1620 }; 1929 };
1621 1930
1622
1623 /*
1624 * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
1625 * of UINT32_C has undefined behavior according to ISO/ANSI:
1626 * the arguments to __CONCAT__ are not macro expanded before the
1627 * concatination happens so the trailing ')' in the first argument
1628 * is concatinated with the 'l' in the second argument creating an
1629 * invalid pp token. The behavior of invalid pp tokens is undefined.
1630 * GCC does not handle these invalid tokens the way the HP compiler does.
1631 * This problem will potentially occur anytime macros are used in the
1632 * arguments to __CONCAT__. A general solution to this problem would be to
1633 * insert another layer of macro between __CONCAT__ and its use
1634 * in UINT32_C. An example of this solution can be found in the C standard.
1635 * A more specific solution, the one used here, is to change the UINT32_C
1636 * macro to not used macros in the arguments to __CONCAT__.
1637 */
1638 fix = {
1639 hackname = hpux11_uint32_c;
1640 files = inttypes.h;
1641 select = "^#define UINT32_C\\(__c\\)[ \t]*"
1642 "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
1643 c_fix = format;
1644 c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
1645 test_text =
1646 "#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
1647 "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
1648 };
1649
1650
1651 /* 1931 /*
1652 * Fix hpux 11.00 broken vsnprintf declaration 1932 * Fix hpux 11.00 broken vsnprintf declaration
1653 */ 1933 */
1654 fix = { 1934 fix = {
1655 hackname = hpux11_vsnprintf; 1935 hackname = hpux11_vsnprintf;
1729 /* 2009 /*
1730 * HP-UX long_double 2010 * HP-UX long_double
1731 */ 2011 */
1732 fix = { 2012 fix = {
1733 hackname = hpux_long_double; 2013 hackname = hpux_long_double;
2014 mach = "*-*-hpux10*";
2015 mach = "*-*-hpux11.[012]*";
1734 files = stdlib.h; 2016 files = stdlib.h;
1735 select = "extern[ \t]long_double[ \t]strtold"; 2017 select = "extern[ \t]long_double[ \t]strtold";
1736 bypass = "long_double_t"; 2018 bypass = "long_double_t";
1737 sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D"; 2019 sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
1738 sed = "s/long_double/long double/g"; 2020 sed = "s/long_double/long double/g";
1744 " } long_double;\n" 2026 " } long_double;\n"
1745 "# endif /* _LONG_DOUBLE */\n" 2027 "# endif /* _LONG_DOUBLE */\n"
1746 "extern long_double strtold(const char *, char **);\n"; 2028 "extern long_double strtold(const char *, char **);\n";
1747 }; 2029 };
1748 2030
2031 /*
2032 * We cannot use the above rule on 11.31 because it removes the strtold
2033 * definition. ia64 is OK with no hack, PA needs some help.
2034 */
2035 fix = {
2036 hackname = hpux_long_double_2;
2037 mach = "hppa*-*-hpux11.3*";
2038 files = stdlib.h;
2039 select = "#[ \t]*if[ \t]*!defined\\(__ia64\\) \\|\\| defined\\(_PROTOTYPES\\) \\|\\| defined\\(_LONG_DOUBLE_STRUCT\\)";
2040 c_fix = format;
2041 c_fix_arg = "# if !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)";
2042
2043 test_text = "# if !defined(__ia64) || !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)\n";
2044 };
1749 2045
1750 /* 2046 /*
1751 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl 2047 * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
1752 */ 2048 */
1753 fix = { 2049 fix = {
1857 "\t0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n" 2153 "\t0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
1858 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n" 2154 "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
1859 "}\n"; 2155 "}\n";
1860 }; 2156 };
1861 2157
2158 fix = {
2159 hackname = hpux_c99_intptr;
2160 mach = "*-hp-hpux11.3*";
2161 files = stdint.h;
2162 sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
2163 sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
2164 sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
2165 sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
2166 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
2167 sed = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
2168 test_text = "#define PTRDIFF_MAX INT32_MAX\n"
2169 "#define PTRDIFF_MIN INT32_MIN\n"
2170 "#define INTPTR_MAX INT32_MAX\n"
2171 "#define INTPTR_MIN INT32_MIN\n"
2172 "#define UINTPTR_MAX UINT32_MAX\n"
2173 "#define SIZE_MAX UINT32_MAX\n";
2174 };
2175
2176 /*
2177 * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
2178 */
2179
2180 fix = {
2181 hackname = hpux_c99_inttypes;
2182 mach = "*-hp-hpux11.[23]*";
2183 files = inttypes.h;
2184 files = stdint.h;
2185 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@";
2186 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@";
2187 sed = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@";
2188 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@#define UINT32_C(__c) __CONCAT__(__c,u)@";
2189 test_text = "#define UINT8_C(__c) __CONCAT_U__(__c)\n"
2190 "#define UINT16_C(__c) __CONCAT_U__(__c)\n"
2191 "#define INT32_C(__c) __CONCAT__(__c,l)\n"
2192 "#define UINT32_C(__c) __CONCAT__(__c,ul)\n";
2193 };
2194
2195 fix = {
2196 hackname = hpux_c99_inttypes2;
2197 mach = "*-hp-hpux11.2*";
2198 files = stdint.h;
2199 sed = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@";
2200 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@";
2201 sed = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@";
2202 sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@";
2203 test_text = "# define INT8_C(__c) ((signed char)(__c))\n"
2204 "# define UINT8_C(__c) ((unsigned char)(__c))\n"
2205 "# define INT16_C(__c) ((short)(__c))\n"
2206 "# define UINT16_C(__c) ((unsigned short)(__c))\n";
2207 };
2208
2209 fix = {
2210 hackname = hpux_stdint_least_fast;
2211 mach = "*-hp-hpux11.2*";
2212 files = stdint.h;
2213 select =
2214 "^[ \t]*#[ \t]*define[ \t]+UINT_(LEAST|FAST)64_MAX[ \t]+ULLONG_MAX";
2215 c_fix = format;
2216 c-fix-arg = "# define UINT_%164_MAX __UINT64_MAX__";
2217 test-text = "# define UINT_FAST64_MAX ULLONG_MAX\n"
2218 "# define UINT_LEAST64_MAX ULLONG_MAX\n";
2219 _EOFix_;
2220 };
2221
2222 fix = {
2223 hackname = hpux_inttype_int8_t;
2224 mach = "*-hp-hpux1[01].*";
2225 files = sys/_inttypes.h;
2226 select = "^[ \t]*typedef[ \t]*char[ \t]*int(_least){0,1}8_t.*";
2227 c_fix = format;
2228 c_fix_arg = "typedef signed char int%18_t;";
2229 test_text = "typedef char int_least8_t;\n"
2230 "typedef char int8_t;\n";
2231 };
2232
2233 fix = {
2234 hackname = hpux_imaginary_i;
2235 mach = "ia64-hp-hpux11.*";
2236 files = complex.h;
2237 select = "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*";
2238 c_fix = format;
2239 c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
2240 test_text = "#define _Complex_I (0.f+_Imaginary_I)\n";
2241 };
2242
1862 /* 2243 /*
1863 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant 2244 * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
1864 */ 2245 */
1865 fix = { 2246 fix = {
1866 hackname = huge_val_hex; 2247 hackname = huge_val_hex;
2064 test_text = "\t# and we're on vacation"; 2445 test_text = "\t# and we're on vacation";
2065 }; 2446 };
2066 2447
2067 2448
2068 /* 2449 /*
2450 * IRIX 6.5 complex.h defines _Complex_I and _Imaginary_I in terms of __I__,
2451 * which is a MIPSpro compiler builtin. Remove _Imaginary_I and imaginary
2452 * definitions which are not supported by GCC.
2453 */
2454 fix = {
2455 hackname = irix_complex;
2456 mach = "mips-sgi-irix6.5";
2457 files = complex.h;
2458 select = "#define[ \t]_Complex_I[ \t]\\(\\(float[ \t]_Complex\\)[ \t]\\(__I__\\)\\)";
2459 sed = "s/#define[ \t]_Complex_I[ \t]((float[ \t]_Complex)[ \t](__I__))/"
2460 "#define _Complex_I (__extension__ 1.0iF)/";
2461 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
2462 sed = "/#define[ \t]_Imaginary_I/d";
2463 sed = "s/#define[ \t]I[ \t]_Imaginary_I/#define I _Complex_I/";
2464 test_text = "#define _Complex_I ((float _Complex) (__I__))\n"
2465 "#define imaginary _Imaginary\n"
2466 "// #define _Imaginary_I ((float _Imaginary) 1)\n"
2467 "#define _Imaginary_I __I__\n"
2468 "#define I _Imaginary_I";
2469 };
2470
2471
2472 /*
2069 * Non-traditional "const" declaration in Irix's limits.h. 2473 * Non-traditional "const" declaration in Irix's limits.h.
2070 */ 2474 */
2071 fix = { 2475 fix = {
2072 hackname = irix_limits_const; 2476 hackname = irix_limits_const;
2073 files = fixinc-test-limits.h, limits.h; 2477 files = fixinc-test-limits.h, limits.h;
2153 2557
2154 test_text = "#if _NO_XOPEN5\n" 2558 test_text = "#if _NO_XOPEN5\n"
2155 "extern size_t wcsftime(wchar_t *, " 2559 "extern size_t wcsftime(wchar_t *, "
2156 "__SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, " 2560 "__SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, "
2157 "const struct tm *);"; 2561 "const struct tm *);";
2158 };
2159
2160 /*
2161 * Fixing ISC fmod declaration
2162 */
2163 fix = {
2164 hackname = isc_fmod;
2165 files = math.h;
2166 select = 'fmod\(double\)';
2167 c_fix = format;
2168 c_fix_arg = "fmod(double, double)";
2169 test_text = "extern double fmod(double);";
2170 };
2171
2172
2173 /*
2174 * On Interactive Unix 2.2, certain traditional Unix definitions
2175 * (notably getc and putc in stdio.h) are omitted if __STDC__ is
2176 * defined, not just if _POSIX_SOURCE is defined. This makes it
2177 * impossible to compile any nontrivial program except with -posix.
2178 */
2179 fix = {
2180 hackname = isc_omits_with_stdc;
2181
2182 files = "stdio.h";
2183 files = "math.h";
2184 files = "ctype.h";
2185 files = "sys/limits.h";
2186 files = "sys/fcntl.h";
2187 files = "sys/dirent.h";
2188
2189 select = '!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)';
2190 c_fix = format;
2191 c_fix_arg = '!defined(_POSIX_SOURCE)';
2192 test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
2193 "\nint foo;\n#endif";
2194 }; 2562 };
2195 2563
2196 2564
2197 /* 2565 /*
2198 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3 2566 * These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
2304 /* 2672 /*
2305 * Some math.h files define struct exception (it's in the System V 2673 * Some math.h files define struct exception (it's in the System V
2306 * Interface Definition), which conflicts with the class exception defined 2674 * Interface Definition), which conflicts with the class exception defined
2307 * in the C++ file std/stdexcept.h. We redefine it to __math_exception. 2675 * in the C++ file std/stdexcept.h. We redefine it to __math_exception.
2308 * This is not a great fix, but I haven't been able to think of anything 2676 * This is not a great fix, but I haven't been able to think of anything
2309 * better. Note that we have to put the #ifdef/#endif blocks at beginning 2677 * better.
2310 * and end of file, because fixproto runs after us and may insert
2311 * additional references to struct exception.
2312 */ 2678 */
2313 fix = { 2679 fix = {
2314 hackname = math_exception; 2680 hackname = math_exception;
2315 files = math.h; 2681 files = math.h;
2316 select = "struct exception"; 2682 select = "struct exception";
2386 test_text = "/*#include <rpc/auth_des.h> /* skip this */"; 2752 test_text = "/*#include <rpc/auth_des.h> /* skip this */";
2387 }; 2753 };
2388 2754
2389 2755
2390 /* 2756 /*
2391 * Fixing nested comments in ISC <sys/limits.h>
2392 */
2393 fix = {
2394 hackname = nested_sys_limits;
2395 files = sys/limits.h;
2396 select = CHILD_MAX;
2397 sed = "/CHILD_MAX/s,/\\* Max, Max,";
2398 sed = "/OPEN_MAX/s,/\\* Max, Max,";
2399 test_text = "/*\n#define CHILD_MAX 20 /* Max, Max, ... */ /*\n"
2400 "#define OPEN_MAX 20 /* Max, Max, ... */\n";
2401 };
2402
2403
2404 /*
2405 * Some versions of NetBSD don't expect the C99 inline semantics. 2757 * Some versions of NetBSD don't expect the C99 inline semantics.
2406 */ 2758 */
2407 fix = { 2759 fix = {
2408 hackname = netbsd_c99_inline_1; 2760 hackname = netbsd_c99_inline_1;
2409 mach = "*-*-netbsd*"; 2761 mach = "*-*-netbsd*";
2451 2803
2452 c_fix = format; 2804 c_fix = format;
2453 c_fix_arg = "#define __END_DECLS }"; 2805 c_fix_arg = "#define __END_DECLS }";
2454 2806
2455 test_text = "#define __END_DECLS };"; 2807 test_text = "#define __END_DECLS };";
2808 };
2809
2810
2811 /* newlib's stdint.h has several failures to conform to C99. The fix
2812 for these removed a comment that can be matched to identify unfixed
2813 versions. */
2814 fix = {
2815 hackname = newlib_stdint_1;
2816 files = stdint.h;
2817 select = "@todo - Add support for wint_t types";
2818 sed = "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
2819 sed = "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
2820 sed = "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
2821 sed = "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
2822 sed = "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
2823 sed = "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
2824 sed = 's@#define INT_FAST\([0-9]*\)_MIN.*@#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
2825 sed = 's@#define INT_FAST\([0-9]*\)_MAX.*@#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
2826 sed = 's@#define UINT_FAST\([0-9]*\)_MAX.*@#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
2827 sed = "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
2828 sed = "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
2829 sed = "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
2830 sed = "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
2831 sed = "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
2832 test_text = "/* @todo - Add support for wint_t types. */\n"
2833 "#define INT32_MIN (-2147483647-1)\n"
2834 "#define INT32_MAX 2147483647\n"
2835 "#define UINT32_MAX 4294967295U\n"
2836 "#define INT_LEAST32_MIN (-2147483647-1)\n"
2837 "#define INT_LEAST32_MAX 2147483647\n"
2838 "#define UINT_LEAST32_MAX 4294967295U\n"
2839 "#define INT_FAST8_MIN INT8_MIN\n"
2840 "#define INT_FAST8_MAX INT8_MAX\n"
2841 "#define UINT_FAST8_MAX UINT8_MAX\n"
2842 "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
2843 "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
2844 "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
2845 "#define UINT8_C(x) x##U\n"
2846 "#define UINT16_C(x) x##U";
2847 };
2848
2849
2850 fix = {
2851 hackname = newlib_stdint_2;
2852 files = stdint.h;
2853 select = "@todo - Add support for wint_t types";
2854 c_fix = format;
2855 c_fix_arg = "#define INTMAX_MAX __INTMAX_MAX__\n"
2856 "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
2857 "#define UINTMAX_MAX __UINTMAX_MAX__\n"
2858 "#define WCHAR_MAX __WCHAR_MAX__\n"
2859 "#define WCHAR_MIN __WCHAR_MIN__\n"
2860 "#define WINT_MAX __WINT_MAX__\n"
2861 "#define WINT_MIN __WINT_MIN__\n\n"
2862 "%0";
2863 c_fix_arg = '/\*\* Macros for minimum-width integer constant expressions \*/';
2864 test_text = "/* @todo - Add support for wint_t types. */\n"
2865 "/** Macros for minimum-width integer constant expressions */";
2456 }; 2866 };
2457 2867
2458 2868
2459 /* 2869 /*
2460 * NeXT 3.2 adds const prefix to some math functions. 2870 * NeXT 3.2 adds const prefix to some math functions.
2656 test_text = "#include <reg_types.h>"; 3066 test_text = "#include <reg_types.h>";
2657 }; 3067 };
2658 3068
2659 3069
2660 /* 3070 /*
2661 * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
2662 * The original ones fail if uninitialized externs are not common.
2663 * This is the default for all ANSI standard C++ compilers.
2664 */
2665 fix = {
2666 hackname = pthread_page_size;
2667 files = pthread.h;
2668 select = "^int __page_size";
2669 c_fix = format;
2670 c_fix_arg = "extern %0";
2671 test_text = "int __page_size;";
2672 };
2673
2674 /*
2675 * On broken glibc-2.3.3 systems an array of incomplete structures is 3071 * On broken glibc-2.3.3 systems an array of incomplete structures is
2676 * passed to __sigsetjmp. Fix that to take a pointer instead. 3072 * passed to __sigsetjmp. Fix that to take a pointer instead.
2677 */ 3073 */
2678 fix = { 3074 fix = {
2679 hackname = pthread_incomplete_struct_argument; 3075 hackname = pthread_incomplete_struct_argument;
2769 test_text = 'extern int rename(const char *old, const char *new);'; 3165 test_text = 'extern int rename(const char *old, const char *new);';
2770 }; 3166 };
2771 3167
2772 3168
2773 /* 3169 /*
2774 * On OpenServer and on UnixWare 7, <math.h> uses the native compiler 3170 * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
2775 * __builtin_generic. We fix that usage to use the GCC equivalent. 3171 * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
2776 * It also has a plethora of inline functions that conflict with libstdc++. 3172 * and imaginary definitions which are not supported by GCC.
2777 */ 3173 */
2778 fix = { 3174 fix = {
2779 hackname = sco_math; 3175 hackname = solaris_complex;
2780 files = math.h, '*/math.h'; 3176 mach = "*-*-solaris2.*";
2781 select = "inline double abs"; 3177 files = complex.h;
2782 bypass = "__GNUG__"; 3178 select = "#define[ \t]_Complex_I[ \t]_Complex_I";
2783 sed = "/#define.*__fp_class(a) \\\\/i\\\n" 3179 sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
2784 "#ifndef __GNUC__\n"; 3180 "#define\t_Complex_I\t(__extension__ 1.0iF)/";
2785 sed = 3181 sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
2786 "/.*__builtin_generic/a\\\n" 3182 sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
2787 "#else\\\n" 3183 sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
2788 "#define __fp_class(a) \\\\\\\n" 3184 test_text = "#define _Complex_I _Complex_I\n"
2789 " __builtin_choose_expr(__builtin_types_compatible_p(typeof(a),long double),\\\\\\\n" 3185 "#define complex _Complex\n"
2790 " __fpclassifyl(a), \\\\\\\n" 3186 "#define _Imaginary_I _Imaginary_I\n"
2791 " __builtin_choose_expr(__builtin_types_compatible_p(typeof(a), float), \\\\\\\n" 3187 "#define imaginary _Imaginary\n"
2792 " __fpclassifyf(a),__fpclassify(a)))\\\n" 3188 "#undef I\n"
2793 "#endif"; 3189 "#define I _Imaginary_I";
2794
2795 sed = "/extern \"C\\+\\+\"/N;"
2796 "/inline double abs/i\\\n"
2797 "#ifndef __GNUC__\n";
2798 sed = "/inline long double trunc/N;"
2799 "/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n"
2800 "#endif /* ! __GNUC__ */";
2801
2802 test_text =
2803 "#define __fp_class(a) \\\\\n"
2804 " __builtin_generic(a,\"ld:__fplcassifyl;f:__fpclassifyf;:__fpclassify\")\n";
2805
2806 }; 3190 };
2807 3191
2808 3192
2809 /* 3193 /*
2810 * Sun Solaris 10 defines several C99 math macros in terms of 3194 * Sun Solaris 10 defines several C99 math macros in terms of
3055 "#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n"; 3439 "#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n";
3056 }; 3440 };
3057 3441
3058 3442
3059 /* 3443 /*
3060 * Solaris 2.8 has what appears to be some gross workaround for 3444 * Sun Solaris 10 has a version of sys/int_const.h that defines
3445 * UINT8_C and UINT16_C to unsigned constants.
3446 */
3447 fix = {
3448 hackname = solaris_int_const;
3449 select = '@\(#\)int_const.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3450 files = sys/int_const.h;
3451 c_fix = format;
3452 c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
3453 "%1\n"
3454 "#define\tUINT16_C(c)\t(c)";
3455 c_fix_arg = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
3456 "(/\*.*\*/)\n"
3457 "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
3458 test_text =
3459 '#pragma ident "@(#)int_const.h 1.5 04/09/28 SMI"'"\n"
3460 "#define UINT8_C(c) __CONCAT__(c,u)\n"
3461 "/* CSTYLED */\n"
3462 "#define UINT16_C(c) __CONCAT__(c,u)";
3463 };
3464
3465
3466 /*
3467 * Sun Solaris 10 has a version of sys/int_limits.h that defines
3468 * UINT8_MAX and UINT16_MAX to unsigned constants.
3469 */
3470 fix = {
3471 hackname = solaris_int_limits_1;
3472 select = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3473 files = sys/int_limits.h;
3474 c_fix = format;
3475 c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
3476 "#define\tUINT16_MAX\t(65535)";
3477 c_fix_arg = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
3478 "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
3479 test_text =
3480 '#pragma ident "@(#)int_limits.h 1.9 04/09/28 SMI"'"\n"
3481 "#define UINT8_MAX (255U)\n"
3482 "#define UINT16_MAX (65535U)";
3483 };
3484
3485
3486 /*
3487 * Sun Solaris 10 has a version of sys/int_limits.h that defines
3488 * INT_FAST16 limits to wrong values for sys/int_types.h.
3489 */
3490 fix = {
3491 hackname = solaris_int_limits_2;
3492 select = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
3493 files = sys/int_limits.h;
3494 c_fix = format;
3495 c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
3496 c_fix_arg = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
3497 test_text =
3498 '#pragma ident "@(#)int_limits.h 1.9 04/09/28 SMI"'"\n"
3499 "#define INT_FAST16_MAX INT16_MAX\n"
3500 "#define UINT_FAST16_MAX UINT16_MAX\n"
3501 "#define INT_FAST16_MIN INT16_MIN";
3502 };
3503
3504
3505 /*
3506 * Sun Solaris up to 9 has a version of sys/int_types.h that forbids use
3507 * of Standard C99 64-bit types in 32-bit mode.
3508 */
3509 fix = {
3510 hackname = solaris_int_types;
3511 select = "__STDC__ - 0 == 0";
3512 bypass = "_LONGLONG_TYPE";
3513 files = sys/int_types.h;
3514 c_fix = format;
3515 c_fix_arg =
3516 "(defined(_STDC_C99) || !defined(_STRICT_STDC) || defined(__GNUC__))";
3517 test_text =
3518 "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
3519 "typedef long long int64_t;\n"
3520 "#endif\n\n"
3521 "#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))\n"
3522 "typedef int64_t intmax_t;\n"
3523 "#endif";
3524 };
3525
3526
3527 /*
3528 * Sun Solaris 8 has what appears to be some gross workaround for
3061 * some old version of their c++ compiler. G++ doesn't want it 3529 * some old version of their c++ compiler. G++ doesn't want it
3062 * either, but doesn't want to be tied to SunPRO version numbers. 3530 * either, but doesn't want to be tied to SunPRO version numbers.
3063 */ 3531 */
3064 fix = { 3532 fix = {
3065 hackname = solaris_stdio_tag; 3533 hackname = solaris_stdio_tag;
3892 files = Xm/Traversal.h; 4360 files = Xm/Traversal.h;
3893 bypass = __cplusplus; 4361 bypass = __cplusplus;
3894 4362
3895 sed = "/Widget\told, new;/i\\\n" 4363 sed = "/Widget\told, new;/i\\\n"
3896 "#ifdef __cplusplus\\\n" 4364 "#ifdef __cplusplus\\\n"
3897 "\tWidget\told, c_new;\\\n" 4365 "\\\tWidget\told, c_new;\\\n"
3898 "#else\n"; 4366 "#else\n";
3899 4367
3900 sed = "/Widget\told, new;/a\\\n" 4368 sed = "/Widget\told, new;/a\\\n"
3901 "#endif\n"; 4369 "#endif\n";
3902 4370
3903 sed = "s/Widget new,/Widget c_new,/g"; 4371 sed = "s/Widget new,/Widget c_new,/g";
3904 test_text = 4372 test_text =
3905 "struct wedge {\n" 4373 "struct wedge {\n"
3906 " Widget\told, new; /* fixinc check FAILS ON BSD */\n" 4374 " Widget\told, new;\n"
3907 "};\nextern Wedged( Widget new, Widget old );"; 4375 "};\nextern Wedged( Widget new, Widget old );";
3908 }; 4376 };
3909 4377
3910 4378
3911 /* 4379 /*