diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -306,8 +306,7 @@ #define TEST_NOT_WIN32(...) __VA_ARGS__ #endif -#if (defined(_WIN32) && !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)) || \ - defined(__MVS__) || defined(_AIX) +#if defined(TEST_WINDOWS_DLL) ||defined(__MVS__) || defined(_AIX) // Macros for waiving cases when we can't count allocations done within // the library implementation. // @@ -325,8 +324,7 @@ #define TEST_SUPPORTS_LIBRARY_INTERNAL_ALLOCATIONS 1 #endif -#if (defined(_WIN32) && !defined(_MSC_VER) && \ - !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)) || \ +#if (defined(TEST_WINDOWS_DLL) && !defined(_MSC_VER)) || \ defined(__MVS__) // Normally, a replaced e.g. 'operator new' ends up used if the user code // does a call to e.g. 'operator new[]'; it's enough to replace the base diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -219,7 +219,31 @@ DEFAULT_FEATURES += [ Feature(name='darwin', when=lambda cfg: '__APPLE__' in compilerMacros(cfg)), Feature(name='windows', when=lambda cfg: '_WIN32' in compilerMacros(cfg)), - Feature(name='windows-dll', when=lambda cfg: '_WIN32' in compilerMacros(cfg) and not '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS' in compilerMacros(cfg)), + Feature(name='windows-dll', when=lambda cfg: '_WIN32' in compilerMacros(cfg) and programSucceeds(cfg, """ + #include + #include + void *ptr; + int main(int, char**) { + ptr = &std::cout; + if (GetModuleHandle("libc++.dll") || GetModuleHandle("c++.dll")) + return 0; + return 1; + } + """), actions=[AddCompileFlag('-DTEST_WINDOWS_DLL')]), +# #include +# #include +# #include +# int main(int, char**) { +# void *ptr = &std::cout; +# void *exe = GetModuleHandle(NULL); +# PIMAGE_DOS_HEADER dosheader = (PIMAGE_DOS_HEADER)exe; +# PIMAGE_NT_HEADERS ntheader = (PIMAGE_NT_HEADERS)((BYTE *)dosheader + dosheader->e_lfanew); +# PIMAGE_OPTIONAL_HEADER peheader = &ntheader->OptionalHeader; +# void *exeend = (BYTE*)exe + peheader->SizeOfImage; +# if (ptr >= exe && ptr <= exeend) +# return 1; +# return 0; +# } Feature(name='linux', when=lambda cfg: '__linux__' in compilerMacros(cfg)), Feature(name='netbsd', when=lambda cfg: '__NetBSD__' in compilerMacros(cfg)), Feature(name='freebsd', when=lambda cfg: '__FreeBSD__' in compilerMacros(cfg))