Kaydet (Commit) 50cb9634 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use correct __cplusplus value with MSVC

...now that /Zc:__cplusplus is available in Visual Studio 2017 version 15.7
(see <https://blogs.msdn.microsoft.com/vcblog/2018/04/09/
msvc-now-correctly-reports-__cplusplus/>).

Some external projects might run into issues when picking up /Zc:__cplusplus
directly with $(CXXFLAGS_CXX11) or indirectly via $(gb_CXXFLAGS) now, but that
appears not to be the case.

Some obsolete MSVC-specific __cplusplus checks can be removed now.  (The ones in
external/libebook/libebook-msvc.patch.1 pick up /Zc:__cplusplus via
$(gb_CXXFLAGS) in external/libebook/ExternalProject_libebook.mk.)

Change-Id: Idc6849a0000ea424522f30f61caba112fae25d40
Reviewed-on: https://gerrit.libreoffice.org/64755
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst f2b70baa
......@@ -6208,7 +6208,7 @@ dnl ===================================================================
AC_MSG_CHECKING([whether $CXX supports C++17])
CXXFLAGS_CXX11=
if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
CXXFLAGS_CXX11=-std:c++17
CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
for flag in $my_flags; do
......
......@@ -15,10 +15,6 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libebook,0))
$(eval $(call gb_UnpackedTarball_update_autoconf_configs,libebook))
$(eval $(call gb_UnpackedTarball_add_patches,libebook, \
external/libebook/libebook-msvc.patch.1 \
))
ifeq ($(COM_IS_CLANG),TRUE)
ifneq ($(filter -fsanitize=%,$(CC)),)
$(eval $(call gb_UnpackedTarball_add_patches,libebook, \
......
From 49f6461d4751d3b16e32ab8f9c93a3856b33be49 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Wed, 2 Aug 2017 14:53:36 +0200
Subject: [PATCH] m4: MSVC defines __cplusplus as 199711L still
See e.g.
<https://stackoverflow.com/questions/37503029/cplusplus-is-equal-to-199711-in-msvc-does-it-support-c11>,
on MSVC we can't depend on the value of __cplusplus, since that one is a
too low value, even if everything else works fine.
---
m4/ax_cxx_compile_stdcxx.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -Naur a/configure b/configure
--- a/configure 2017-08-02 14:50:09.000000000 +0200
+++ b/configure 2017-08-02 14:50:57.000000000 +0200
@@ -16001,7 +16001,7 @@
#error "This is not a C++ compiler"
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
#error "This is not a C++11 compiler"
@@ -16314,7 +16314,7 @@
#error "This is not a C++ compiler"
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
#error "This is not a C++11 compiler"
@@ -16636,7 +16636,7 @@
#error "This is not a C++ compiler"
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
#error "This is not a C++11 compiler"
--
2.12.3
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