summaryrefslogtreecommitdiffstats
path: root/config.tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-07-15 12:38:18 -0700
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-22 01:45:50 +0000
commitdd4875b54c85d14e0489af66c1e6697de862ce17 (patch)
tree34589ab19ecf9e133a340ffe15ffd94342259bef /config.tests
parentd8e584c7a6466483039a1ddba8d65800d58c1052 (diff)
Fix attempt to use -mno-direct-extern-access with Clang
Clang has the option, but spells it differently. Fixes: QTBUG-105002 Change-Id: I36b24183fbd041179f2ffffd170217e82ff6d14d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 78ef9e9d14f170c410c2fb52f5aada8421ed8f07) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'config.tests')
-rw-r--r--config.tests/direct_extern_access/CMakeLists.txt6
-rw-r--r--config.tests/direct_extern_access/lib.cpp3
-rw-r--r--config.tests/direct_extern_access/lib.h3
3 files changed, 9 insertions, 3 deletions
diff --git a/config.tests/direct_extern_access/CMakeLists.txt b/config.tests/direct_extern_access/CMakeLists.txt
index 50a35f1d02..7c82348751 100644
--- a/config.tests/direct_extern_access/CMakeLists.txt
+++ b/config.tests/direct_extern_access/CMakeLists.txt
@@ -5,5 +5,9 @@ project(direct_extern_access LANGUAGES CXX)
add_library(no_extern_access_lib SHARED lib.cpp)
add_executable(no_extern_access_main main.cpp)
-target_compile_options(no_extern_access_lib PUBLIC "-mno-direct-extern-access")
+
+target_compile_options(no_extern_access_lib PRIVATE "-Werror")
+target_compile_options(no_extern_access_lib PUBLIC "$<$<CXX_COMPILER_ID:GNU>:-mno-direct-extern-access>")
+target_compile_options(no_extern_access_lib PUBLIC "$<$<CXX_COMPILER_ID:Clang>:-fno-direct-access-external-data>")
+
target_link_libraries(no_extern_access_main no_extern_access_lib)
diff --git a/config.tests/direct_extern_access/lib.cpp b/config.tests/direct_extern_access/lib.cpp
index 6cbc85571f..cf3b18bb38 100644
--- a/config.tests/direct_extern_access/lib.cpp
+++ b/config.tests/direct_extern_access/lib.cpp
@@ -6,5 +6,6 @@
#define BUILD
#include "lib.h"
+void *S::ptr = nullptr;
S::~S() { }
-void S::f() { }
+void *S::f() { return ptr; }
diff --git a/config.tests/direct_extern_access/lib.h b/config.tests/direct_extern_access/lib.h
index d35b52f135..1a9c3c5533 100644
--- a/config.tests/direct_extern_access/lib.h
+++ b/config.tests/direct_extern_access/lib.h
@@ -12,5 +12,6 @@
struct LIB_API S
{
virtual ~S();
- virtual void f();
+ virtual void *f();
+ static void *ptr;
};