@@ -574,40 +574,6 @@ config.substitutions.append( ('%clang',
574
574
"%r %s" %
575
575
(config .clang , clang_mcp_opt )) )
576
576
577
- extraCheckWarningFlags = (
578
- # Turn on all warnings and promote them to errors
579
- '-Weverything -Werror '
580
- # Don't warn about unused macros in our clang header.
581
- '-Wno-unused-macros '
582
- # Don't warn about module imports used at #includes.
583
- '-Wno-incomplete-module -Wno-auto-import '
584
- # Don't warn about any variadic macros we might have.
585
- '-Wno-variadic-macros '
586
- # Don't warn about any C++98 compatibility issues.
587
- '-Wno-c++98-compat-pedantic '
588
- # Don't warn about poison system directories in the Linux system paths.
589
- '-Wno-poison-system-directories '
590
- # For -fmodules-cache-path, when modules are off.
591
- '-Wno-unused-command-line-argument '
592
- # Don't warn about nullability specifiers in C/C++ code.
593
- '-Wno-nullability-extension ' )
594
-
595
- # Verifies that a C++ file can be compiled without warnings except for some exceptions.
596
- config .substitutions .insert (0 , ('%check-c-header-in-clang' ,
597
- '%clang -fsyntax-only -x c-header ' + extraCheckWarningFlags +
598
- # Use standard header/framework search paths.
599
- '-F %%clang-importer-sdk-path/frameworks '
600
- '-I %%clang-include-dir '
601
- '-isysroot %r/Inputs/clang-importer-sdk' % config .test_source_root ) )
602
-
603
- # Verifies that a C++ file can be compiled without warnings except for some exceptions.
604
- config .substitutions .insert (0 , ('%check-cxx-header-in-clang' ,
605
- '%clangxx -fsyntax-only -x c++-header ' + extraCheckWarningFlags +
606
- # Use standard header/framework search paths.
607
- '-F %%clang-importer-sdk-path/frameworks '
608
- '-I %%clang-include-dir '
609
- '-isysroot %r/Inputs/clang-importer-sdk' % config .test_source_root ) )
610
-
611
577
###
612
578
613
579
def disallow (execName ):
@@ -984,6 +950,7 @@ config.target_msvc_runtime_opt = ''
984
950
config .target_static_library_prefix = 'lib'
985
951
config .target_static_library_suffix = '.a'
986
952
config .target_env_prefix = ''
953
+ config .target_sdk_libcxx_path = ''
987
954
988
955
if run_vendor == 'apple' :
989
956
target_specific_module_triple = '{}-apple-{}' .format (
@@ -1000,6 +967,7 @@ if run_vendor == 'apple':
1000
967
config .target_codesign = "codesign -f -s -"
1001
968
config .target_library_path_var = "DYLD_LIBRARY_PATH"
1002
969
config .target_runtime = "objc"
970
+ config .target_sdk_libcxx_path = os .path .join (config .variant_sdk , 'usr' , 'include' , 'c++' , 'v1' )
1003
971
1004
972
config .available_features .add ('libdispatch' )
1005
973
config .available_features .add ('foundation' )
@@ -2297,6 +2265,45 @@ if platform.system() != 'Darwin' or swift_test_mode == 'optimize_none_with_impli
2297
2265
# When changing substitutions, update docs/Testing.md.
2298
2266
#
2299
2267
2268
+ if config .target_sdk_libcxx_path != '' :
2269
+ config .substitutions .append (('%cxx-stdlib-include' , '-nostdinc++ -isystem "%s"' % config .target_sdk_libcxx_path ))
2270
+ else :
2271
+ config .substitutions .append (('%cxx-stdlib-include' , '' ))
2272
+
2273
+ extraCheckWarningFlags = (
2274
+ # Turn on all warnings and promote them to errors
2275
+ '-Weverything -Werror '
2276
+ # Don't warn about unused macros in our clang header.
2277
+ '-Wno-unused-macros '
2278
+ # Don't warn about module imports used at #includes.
2279
+ '-Wno-incomplete-module -Wno-auto-import '
2280
+ # Don't warn about any variadic macros we might have.
2281
+ '-Wno-variadic-macros '
2282
+ # Don't warn about any C++98 compatibility issues.
2283
+ '-Wno-c++98-compat-pedantic '
2284
+ # Don't warn about poison system directories in the Linux system paths.
2285
+ '-Wno-poison-system-directories '
2286
+ # For -fmodules-cache-path, when modules are off.
2287
+ '-Wno-unused-command-line-argument '
2288
+ # Don't warn about nullability specifiers in C/C++ code.
2289
+ '-Wno-nullability-extension ' )
2290
+
2291
+ # Verifies that a C++ file can be compiled without warnings except for some exceptions.
2292
+ config .substitutions .insert (0 , ('%check-c-header-in-clang' ,
2293
+ '%clang -fsyntax-only -x c-header ' + extraCheckWarningFlags +
2294
+ # Use standard header/framework search paths.
2295
+ '-F %%clang-importer-sdk-path/frameworks '
2296
+ '-I %%clang-include-dir '
2297
+ '-isysroot %r/Inputs/clang-importer-sdk' % config .test_source_root ) )
2298
+
2299
+ # Verifies that a C++ file can be compiled without warnings except for some exceptions.
2300
+ config .substitutions .insert (0 , ('%check-cxx-header-in-clang' ,
2301
+ '%clangxx -fsyntax-only -x c++-header ' + extraCheckWarningFlags +
2302
+ # Use standard header/framework search paths.
2303
+ '-F %%clang-importer-sdk-path/frameworks '
2304
+ '-I %%clang-include-dir %%cxx-stdlib-include '
2305
+ '-isysroot %r/Inputs/clang-importer-sdk' % config .test_source_root ) )
2306
+
2300
2307
# Different OS's require different prefixes for the environment variables to be
2301
2308
# propagated to the calling contexts.
2302
2309
# In order to make tests OS-agnostic, names of environment variables should be
0 commit comments