Kaydet (Commit) 65ed581f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 40b5b007
......@@ -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:
--- 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment