mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-06 09:15:23 +08:00
qt 6.5.1 original
This commit is contained in:
14
config.tests/no_direct_extern_access/CMakeLists.txt
Normal file
14
config.tests/no_direct_extern_access/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(direct_extern_access LANGUAGES CXX)
|
||||
|
||||
# this is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087
|
||||
# and https://sourceware.org/bugzilla/show_bug.cgi?id=29377
|
||||
|
||||
add_library(no_extern_access_lib SHARED lib.cpp)
|
||||
add_executable(no_extern_access_main other.cpp main.cpp)
|
||||
|
||||
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)
|
11
config.tests/no_direct_extern_access/lib.cpp
Normal file
11
config.tests/no_direct_extern_access/lib.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2022 Intel Corporation.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// This is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087
|
||||
|
||||
#define BUILD
|
||||
#include "lib.h"
|
||||
|
||||
void *S::ptr = nullptr;
|
||||
S::~S() { }
|
||||
void *S::f() { return ptr; }
|
17
config.tests/no_direct_extern_access/lib.h
Normal file
17
config.tests/no_direct_extern_access/lib.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2022 Intel Corporation.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// This is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087
|
||||
|
||||
#ifdef BUILD
|
||||
# define LIB_API __attribute__((visibility("protected")))
|
||||
#else
|
||||
# define LIB_API __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
struct LIB_API S
|
||||
{
|
||||
virtual ~S();
|
||||
virtual void *f();
|
||||
static void *ptr;
|
||||
};
|
20
config.tests/no_direct_extern_access/main.cpp
Normal file
20
config.tests/no_direct_extern_access/main.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2022 Intel Corporation.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// This is combining the tests found in:
|
||||
// https://sourceware.org/bugzilla/show_bug.cgi?id=29087
|
||||
// https://sourceware.org/bugzilla/show_bug.cgi?id=29377
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
extern void foo(); // other.cpp
|
||||
void (*get_foo())()
|
||||
{
|
||||
return foo;
|
||||
}
|
||||
|
||||
struct Local : S { };
|
||||
int main()
|
||||
{
|
||||
Local l;
|
||||
}
|
8
config.tests/no_direct_extern_access/other.cpp
Normal file
8
config.tests/no_direct_extern_access/other.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright (C) 2022 Intel Corporation.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// This is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29377
|
||||
|
||||
__attribute__((visibility("protected"))) void foo()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user