summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-03 19:08:55 (GMT)
committerBrad King <brad.king@kitware.com>2020-04-03 19:18:46 (GMT)
commitc1066893b0bde812408e958c033e9fc2d929c866 (patch)
tree23e0809ef5cff931c781d4d3ace9f1634297d6e6 /test
parent4ef8cb855487f6a7b8673e771d26e55e0067be56 (diff)
downloadCastXML-c1066893b0bde812408e958c033e9fc2d929c866.zip
CastXML-c1066893b0bde812408e958c033e9fc2d929c866.tar.gz
CastXML-c1066893b0bde812408e958c033e9fc2d929c866.tar.bz2
test: Fix cc-gnu predefined macros on Windows
For Windows targets, GNU compilers predefine `_WIN32` and `__MINGW32__`. CastXML uses those to set the target triple correctly when using `--castxml-cc-gnu`. Teach our fake GNU compiler in the test suite to define these too. Otherwise CastXML does not add `gnu` to the target triple. This causes the Windows-hosted Clang to choose `msvc` in the default triple and enable MS compatibility, which is incorrect.
Diffstat (limited to 'test')
-rw-r--r--test/cc-gnu.c4
-rw-r--r--test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt6
-rw-r--r--test/expect/cmd.cc-gnu-c-tgt-i386-opt-E.stdout.txt6
-rw-r--r--test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt6
-rw-r--r--test/expect/cmd.cc-gnu-tgt-i386-opt-E.stdout.txt6
5 files changed, 20 insertions, 8 deletions
diff --git a/test/cc-gnu.c b/test/cc-gnu.c
index e74ccf7..92d2085 100644
--- a/test/cc-gnu.c
+++ b/test/cc-gnu.c
@@ -27,6 +27,10 @@ int main(int argc, const char* argv[])
);
}
fprintf(stdout,
+#ifdef _WIN32
+ "#define _WIN32 1\n"
+ "#define __MINGW32__ 1\n"
+#endif
"#define __GNUC__ 1\n"
"#define __has_include(x) x\n"
"#define __has_include_next(x) x\n"
diff --git a/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt b/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
index bf866e4..b248fb8 100644
--- a/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
+++ b/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
@@ -1,5 +1,7 @@
-^#define __GNUC_MINOR__ 1
-#define __GNUC__ 1
+^(#define _WIN32 1
+)?#define __GNUC_MINOR__ 1
+#define __GNUC__ 1(
+#define __MINGW32__ 1)?
#define __builtin_va_arg_pack\(\) 0
#define __builtin_va_arg_pack_len\(\) 1
#define __castxml__ [^
diff --git a/test/expect/cmd.cc-gnu-c-tgt-i386-opt-E.stdout.txt b/test/expect/cmd.cc-gnu-c-tgt-i386-opt-E.stdout.txt
index 74eecc9..43df3e4 100644
--- a/test/expect/cmd.cc-gnu-c-tgt-i386-opt-E.stdout.txt
+++ b/test/expect/cmd.cc-gnu-c-tgt-i386-opt-E.stdout.txt
@@ -1,5 +1,7 @@
-^#define __GNUC_MINOR__ 1
-#define __GNUC__ 1
+^(#define _WIN32 1
+)?#define __GNUC_MINOR__ 1
+#define __GNUC__ 1(
+#define __MINGW32__ 1)?
#define __NO_MATH_INLINES 1
#define __OPTIMIZE__ 1
#define __builtin_va_arg_pack\(\) 0
diff --git a/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt b/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
index 629d8cc..1c7bf1f 100644
--- a/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
+++ b/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
@@ -1,5 +1,7 @@
-^#define __GNUC_MINOR__ 1
-#define __GNUC__ 1
+^(#define _WIN32 1
+)?#define __GNUC_MINOR__ 1
+#define __GNUC__ 1(
+#define __MINGW32__ 1)?
#define __builtin_va_arg_pack\(\) 0
#define __builtin_va_arg_pack_len\(\) 1
#define __castxml__ [^
diff --git a/test/expect/cmd.cc-gnu-tgt-i386-opt-E.stdout.txt b/test/expect/cmd.cc-gnu-tgt-i386-opt-E.stdout.txt
index 6d34ab7..4e6d6d0 100644
--- a/test/expect/cmd.cc-gnu-tgt-i386-opt-E.stdout.txt
+++ b/test/expect/cmd.cc-gnu-tgt-i386-opt-E.stdout.txt
@@ -1,5 +1,7 @@
-^#define __GNUC_MINOR__ 1
-#define __GNUC__ 1
+^(#define _WIN32 1
+)?#define __GNUC_MINOR__ 1
+#define __GNUC__ 1(
+#define __MINGW32__ 1)?
#define __NO_MATH_INLINES 1
#define __OPTIMIZE__ 1
#define __builtin_va_arg_pack\(\) 0