Print this page
12257 resync smatch to 0.6.1-rc1-il-4

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/lib.c
          +++ new/usr/src/tools/smatch/src/lib.c
↓ open down ↓ 310 lines elided ↑ open up ↑
 311  311  int dbg_postorder = 0;
 312  312  
 313  313  unsigned long fdump_ir;
 314  314  int fmem_report = 0;
 315  315  unsigned long long fmemcpy_max_count = 100000;
 316  316  unsigned long fpasses = ~0UL;
 317  317  int funsigned_char = UNSIGNED_CHAR;
 318  318  
 319  319  int preprocess_only;
 320  320  
 321      -static enum { STANDARD_C89,
 322      -              STANDARD_C94,
 323      -              STANDARD_C99,
 324      -              STANDARD_C11,
 325      -              STANDARD_GNU11,
 326      -              STANDARD_GNU89,
 327      -              STANDARD_GNU99, } standard = STANDARD_GNU89;
      321 +enum standard standard = STANDARD_GNU89;
 328  322  
 329  323  int arch_m64 = ARCH_M64_DEFAULT;
 330  324  int arch_msize_long = 0;
 331  325  int arch_big_endian = ARCH_BIG_ENDIAN;
 332  326  int arch_mach = MACH_NATIVE;
 333  327  
 334  328  
 335  329  #define CMDLINE_INCLUDE 20
 336  330  static int cmdline_include_nr = 0;
 337  331  static char *cmdline_include[CMDLINE_INCLUDE];
↓ open down ↓ 968 lines elided ↑ open up ↑
1306 1300          } else {
1307 1301                  predefine("__LITTLE_ENDIAN__", 1, "1");
1308 1302                  predefine("__BYTE_ORDER__", 1, "__ORDER_LITTLE_ENDIAN__");
1309 1303          }
1310 1304  
1311 1305          if (optimize_level)
1312 1306                  predefine("__OPTIMIZE__", 0, "1");
1313 1307          if (optimize_size)
1314 1308                  predefine("__OPTIMIZE_SIZE__", 0, "1");
1315 1309  
     1310 +        predefine("__PRAGMA_REDEFINE_EXTNAME", 1, "1");
     1311 +
1316 1312          // Temporary hacks
1317 1313          predefine("__extension__", 0, NULL);
1318 1314          predefine("__pragma__", 0, NULL);
1319 1315  
1320 1316          switch (arch_m64) {
1321 1317          case ARCH_LP32:
1322 1318                  break;
1323 1319          case ARCH_X32:
1324 1320                  predefine("__ILP32__", 1, "1");
1325 1321                  predefine("_ILP32", 1, "1");
1326 1322                  break;
1327 1323          case ARCH_LP64:
1328 1324                  predefine("__LP64__", 1, "1");
1329      -                predefine("__LP64", 1, "1");
1330 1325                  predefine("_LP64", 1, "1");
1331 1326                  break;
1332 1327          case ARCH_LLP64:
1333 1328                  predefine("__LLP64__", 1, "1");
1334 1329                  break;
1335 1330          }
1336 1331  
1337 1332          switch (arch_mach) {
1338 1333          case MACH_ARM64:
1339 1334                  predefine("__aarch64__", 1, "1");
↓ open down ↓ 42 lines elided ↑ open up ↑
1382 1377                          predefine("__sparc_v9__", 1, "1");
1383 1378                          predefine("__sparcv9__", 1, "1");
1384 1379                          predefine("__sparcv9", 1, "1");
1385 1380                          predefine("__sparc64__", 1, "1");
1386 1381                          predefine("__arch64__", 1, "1");
1387 1382                  }
1388 1383                  /* fall-through */
1389 1384          case MACH_SPARC32:
1390 1385                  predefine("__sparc__", 1, "1");
1391 1386                  predefine("__sparc", 1, "1");
     1387 +                predefine_nostd("sparc");
1392 1388                  break;
1393 1389          case MACH_X86_64:
1394 1390                  if (arch_m64 != ARCH_LP32) {
1395 1391                          predefine("__x86_64__", 1, "1");
1396 1392                          predefine("__x86_64", 1, "1");
     1393 +                        predefine("__amd64__", 1, "1");
     1394 +                        predefine("__amd64", 1, "1");
1397 1395                          break;
1398 1396                  }
1399 1397                  /* fall-through */
1400 1398          case MACH_I386:
1401 1399                  predefine("__i386__", 1, "1");
1402 1400                  predefine("__i386", 1, "1");
1403      -                predefine("i386", 1, "1");
     1401 +                predefine_nostd("i386");
1404 1402                  break;
1405 1403          }
1406 1404  
1407      -        predefine("__PRAGMA_REDEFINE_EXTNAME", 1, "1");
1408      -
1409      -#ifdef  __sun
     1405 +#if defined(__unix__)
1410 1406          predefine("__unix__", 1, "1");
1411 1407          predefine("__unix", 1, "1");
1412      -        predefine("unix", 1, "1");
     1408 +        predefine_nostd("unix");
     1409 +#endif
     1410 +
     1411 +
     1412 +#if defined(__sun__) || defined(__sun)
1413 1413          predefine("__sun__", 1, "1");
1414 1414          predefine("__sun", 1, "1");
1415      -        predefine("sun", 1, "1");
     1415 +        predefine_nostd("sun");
1416 1416          predefine("__svr4__", 1, "1");
1417 1417  #endif
     1418 +
1418 1419  }
1419 1420  
1420 1421  static void create_builtin_stream(void)
1421 1422  {
1422 1423          // Temporary hack
1423 1424          add_pre_buffer("#define _Pragma(x)\n");
1424 1425  
1425 1426          /* add the multiarch include directories, if any */
1426 1427          if (multiarch_dir && *multiarch_dir) {
1427 1428                  add_pre_buffer("#add_system \"/usr/include/%s\"\n", multiarch_dir);
↓ open down ↓ 230 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX