summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-11 16:26:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-11 22:59:24 +0200
commit65ed581fc1cca7052665e53a149f78b06b44970a (patch)
tree04f47e461b6ea0735cc3a585878061414fc2aeb4 /external
parent40b5b00788aafd9e723061b419b366ea8b281b8b (diff)
clang-cl: Don't define "const" away in external/mariadb-connector-c
Mimicing MSCV, clang-cl doesn't predefine __STDC__ (InitializeStandardPredefinedMacros in clang/lib/Frontend/InitPreprocessor.cpp) when LangOpts.MSVCCompat aka -fms-compatibility is set, which it is by default for clang-cl (Clang::ConstructJob in clang/lib/Driver/ToolChains/Clang.cpp). But clang-cl still needs to be called with /FIIntrin.h to preload declarations of intrinsics from the Clang-provided Intrin.h, some of which like unsigned char _bittest(long const *, long); both make use of "const" (which isn't defined away because the file is loaded so early) and are duplicated in the system-provided winnt.h---where the "const" /is/ defined away when that header is included later, causing "conflicting types" errors. ("Real" MSVC also runs into the #if defining "const" away, but it seems it happens to not have bad consequences there.) Change-Id: Ice92a059330bd945f8a3d9e5fa1635a01d08ad8b Reviewed-on: https://gerrit.libreoffice.org/60321 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external')
-rw-r--r--external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk1
-rw-r--r--external/mariadb-connector-c/clang-cl.patch.011
2 files changed, 12 insertions, 0 deletions
diff --git a/external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk b/external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk
index 4318dbfa7aae..71af2847a5b2 100644
--- a/external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk
+++ b/external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,mariadb-connector-c,\
$(if $(filter MSC,$(COM)),external/mariadb-connector-c/mariadb-msvc.patch.1) \
external/mariadb-connector-c/mariadb-inline.patch.1 \
external/mariadb-connector-c/mariadb-CONC-104.patch.1 \
+ external/mariadb-connector-c/clang-cl.patch.0 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/mariadb-connector-c/clang-cl.patch.0 b/external/mariadb-connector-c/clang-cl.patch.0
new file mode 100644
index 000000000000..7a886e67cf7c
--- /dev/null
+++ b/external/mariadb-connector-c/clang-cl.patch.0
@@ -0,0 +1,11 @@
+--- libmariadb/getopt.c
++++ libmariadb/getopt.c
+@@ -38,7 +38,7 @@
+ #include <config.h>
+ #endif
+
+-#if (!defined (__STDC__) || !__STDC__) && !defined(MSDOS) && !defined(OS2)
++#if (!defined (__STDC__) || !__STDC__) && !defined(MSDOS) && !defined(OS2) && !(defined _MSC_VER && defined __clang__)
+ /* This is a separate conditional since some stdc systems
+ reject `defined (const)'. */
+ #ifndef const