@@ -562,40 +562,6 @@ config.substitutions.append( ('%clang',
562
562
"%r %s" %
563
563
(config .clang , clang_mcp_opt )) )
564
564
565
- extraCheckWarningFlags = (
566
- # Turn on all warnings and promote them to errors
567
- '-Weverything -Werror '
568
- # Don't warn about unused macros in our clang header.
569
- '-Wno-unused-macros '
570
- # Don't warn about module imports used at #includes.
571
- '-Wno-incomplete-module -Wno-auto-import '
572
- # Don't warn about any variadic macros we might have.
573
- '-Wno-variadic-macros '
574
- # Don't warn about any C++98 compatibility issues.
575
- '-Wno-c++98-compat-pedantic '
576
- # Don't warn about poison system directories in the Linux system paths.
577
- '-Wno-poison-system-directories '
578
- # For -fmodules-cache-path, when modules are off.
579
- '-Wno-unused-command-line-argument '
580
- # Don't warn about nullability specifiers in C/C++ code.
581
- '-Wno-nullability-extension ' )
582
-
583
- # Verifies that a C++ file can be compiled without warnings except for some exceptions.
584
- config .substitutions .insert (0 , ('%check-c-header-in-clang' ,
585
- '%clang -fsyntax-only -x c-header ' + extraCheckWarningFlags +
586
- # Use standard header/framework search paths.
587
- '-F %%clang-importer-sdk-path/frameworks '
588
- '-I %%clang-include-dir '
589
- '-isysroot %r/Inputs/clang-importer-sdk' % config .test_source_root ) )
590
-
591
- # Verifies that a C++ file can be compiled without warnings except for some exceptions.
592
- config .substitutions .insert (0 , ('%check-cxx-header-in-clang' ,
593
- '%clangxx -fsyntax-only -x c++-header ' + extraCheckWarningFlags +
594
- # Use standard header/framework search paths.
595
- '-F %%clang-importer-sdk-path/frameworks '
596
- '-I %%clang-include-dir '
597
- '-isysroot %r/Inputs/clang-importer-sdk' % config .test_source_root ) )
598
-
599
565
###
600
566
601
567
def disallow (execName ):
@@ -972,6 +938,7 @@ config.target_msvc_runtime_opt = ''
972
938
config .target_static_library_prefix = 'lib'
973
939
config .target_static_library_suffix = '.a'
974
940
config .target_env_prefix = ''
941
+ config .target_sdk_libcxx_path = ''
975
942
976
943
if run_vendor == 'apple' :
977
944
target_specific_module_triple = '{}-apple-{}' .format (
@@ -988,6 +955,7 @@ if run_vendor == 'apple':
988
955
config .target_codesign = "codesign -f -s -"
989
956
config .target_library_path_var = "DYLD_LIBRARY_PATH"
990
957
config .target_runtime = "objc"
958
+ config .target_sdk_libcxx_path = os .path .join (config .variant_sdk , 'usr' , 'include' , 'c++' , 'v1' )
991
959
992
960
config .available_features .add ('libdispatch' )
993
961
config .available_features .add ('foundation' )
@@ -2285,6 +2253,45 @@ if platform.system() != 'Darwin' or swift_test_mode == 'optimize_none_with_impli
2285
2253
# When changing substitutions, update docs/Testing.md.
2286
2254
#
2287
2255
2256
+ if config .target_sdk_libcxx_path != '' :
2257
+ config .substitutions .append (('%cxx-stdlib-include' , '-nostdinc++ -isystem "%s"' % config .target_sdk_libcxx_path ))
2258
+ else :
2259
+ config .substitutions .append (('%cxx-stdlib-include' , '' ))
2260
+
2261
+ extraCheckWarningFlags = (
2262
+ # Turn on all warnings and promote them to errors
2263
+ '-Weverything -Werror '
2264
+ # Don't warn about unused macros in our clang header.
2265
+ '-Wno-unused-macros '
2266
+ # Don't warn about module imports used at #includes.
2267
+ '-Wno-incomplete-module -Wno-auto-import '
2268
+ # Don't warn about any variadic macros we might have.
2269
+ '-Wno-variadic-macros '
2270
+ # Don't warn about any C++98 compatibility issues.
2271
+ '-Wno-c++98-compat-pedantic '
2272
+ # Don't warn about poison system directories in the Linux system paths.
2273
+ '-Wno-poison-system-directories '
2274
+ # For -fmodules-cache-path, when modules are off.
2275
+ '-Wno-unused-command-line-argument '
2276
+ # Don't warn about nullability specifiers in C/C++ code.
2277
+ '-Wno-nullability-extension ' )
2278
+
2279
+ # Verifies that a C++ file can be compiled without warnings except for some exceptions.
2280
+ config .substitutions .insert (0 , ('%check-c-header-in-clang' ,
2281
+ '%clang -fsyntax-only -x c-header ' + extraCheckWarningFlags +
2282
+ # Use standard header/framework search paths.
2283
+ '-F %%clang-importer-sdk-path/frameworks '
2284
+ '-I %%clang-include-dir '
2285
+ '-isysroot %r/Inputs/clang-importer-sdk' % config .test_source_root ) )
2286
+
2287
+ # Verifies that a C++ file can be compiled without warnings except for some exceptions.
2288
+ config .substitutions .insert (0 , ('%check-cxx-header-in-clang' ,
2289
+ '%clangxx -fsyntax-only -x c++-header ' + extraCheckWarningFlags +
2290
+ # Use standard header/framework search paths.
2291
+ '-F %%clang-importer-sdk-path/frameworks '
2292
+ '-I %%clang-include-dir %%cxx-stdlib-include '
2293
+ '-isysroot %r/Inputs/clang-importer-sdk' % config .test_source_root ) )
2294
+
2288
2295
# Different OS's require different prefixes for the environment variables to be
2289
2296
# propagated to the calling contexts.
2290
2297
# In order to make tests OS-agnostic, names of environment variables should be
0 commit comments