Skip to content

Commit d752b42

Browse files
committed
Use defined(...) when testing for defined-ness of macros
Visual Studio rightfully complains that these macros, the value of which was being used, are not defined. We don't actually care about the value, just definedness matters.
1 parent 24eafa4 commit d752b42

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Diff for: src/util/config.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -1221,33 +1221,33 @@ irep_idt configt::this_architecture()
12211221

12221222
#ifdef __alpha__
12231223
this_arch="alpha";
1224-
#elif __armel__
1224+
#elif defined(__armel__)
12251225
this_arch="armel";
1226-
#elif __aarch64__
1226+
#elif defined(__aarch64__)
12271227
this_arch="arm64";
1228-
#elif __arm__
1228+
#elif defined(__arm__)
12291229
#ifdef __ARM_PCS_VFP
12301230
this_arch="armhf"; // variant of arm with hard float
12311231
#else
12321232
this_arch="arm";
12331233
#endif
1234-
#elif __mipsel__
1234+
#elif defined(__mipsel__)
12351235
#if _MIPS_SIM==_ABIO32
12361236
this_arch="mipsel";
12371237
#elif _MIPS_SIM==_ABIN32
12381238
this_arch="mipsn32el";
12391239
#else
12401240
this_arch="mips64el";
12411241
#endif
1242-
#elif __mips__
1242+
#elif defined(__mips__)
12431243
#if _MIPS_SIM==_ABIO32
12441244
this_arch="mips";
12451245
#elif _MIPS_SIM==_ABIN32
12461246
this_arch="mipsn32";
12471247
#else
12481248
this_arch="mips64";
12491249
#endif
1250-
#elif __powerpc__
1250+
#elif defined(__powerpc__)
12511251
#if defined(__ppc64__) || defined(__PPC64__) || \
12521252
defined(__powerpc64__) || defined(__POWERPC64__)
12531253
#ifdef __LITTLE_ENDIAN__
@@ -1258,33 +1258,33 @@ irep_idt configt::this_architecture()
12581258
#else
12591259
this_arch="powerpc";
12601260
#endif
1261-
#elif __sparc__
1261+
#elif defined(__sparc__)
12621262
#ifdef __arch64__
12631263
this_arch="sparc64";
12641264
#else
12651265
this_arch="sparc";
12661266
#endif
1267-
#elif __ia64__
1267+
#elif defined(__ia64__)
12681268
this_arch="ia64";
1269-
#elif __s390x__
1269+
#elif defined(__s390x__)
12701270
this_arch="s390x";
1271-
#elif __s390__
1271+
#elif defined(__s390__)
12721272
this_arch="s390";
1273-
#elif __x86_64__
1273+
#elif defined(__x86_64__)
12741274
#ifdef __ILP32__
12751275
this_arch="x32"; // variant of x86_64 with 32-bit pointers
12761276
#else
12771277
this_arch="x86_64";
12781278
#endif
1279-
#elif __i386__
1279+
#elif defined(__i386__)
12801280
this_arch="i386";
1281-
#elif _WIN64
1281+
#elif defined(_WIN64)
12821282
this_arch="x86_64";
1283-
#elif _WIN32
1283+
#elif defined(_WIN32)
12841284
this_arch="i386";
1285-
#elif __hppa__
1285+
#elif defined(__hppa__)
12861286
this_arch="hppa";
1287-
#elif __sh__
1287+
#elif defined(__sh__)
12881288
this_arch="sh4";
12891289
#else
12901290
// something new and unknown!

0 commit comments

Comments
 (0)