22
22
from libcxx .test .executor import *
23
23
from libcxx .test .tracing import *
24
24
import libcxx .util
25
+ import libcxx .test .features
25
26
26
27
def loadSiteConfig (lit_config , config , param_name , env_name ):
27
28
# We haven't loaded the site specific configuration (the user is
@@ -130,7 +131,6 @@ def configure(self):
130
131
self .configure_obj_root ()
131
132
self .configure_cxx_stdlib_under_test ()
132
133
self .configure_cxx_library_root ()
133
- self .configure_use_thread_safety ()
134
134
self .configure_ccache ()
135
135
self .configure_compile_flags ()
136
136
self .configure_link_flags ()
@@ -141,11 +141,14 @@ def configure(self):
141
141
self .configure_sanitizer ()
142
142
self .configure_coverage ()
143
143
self .configure_modules ()
144
- self .configure_coroutines ()
145
- self .configure_blocks ()
146
- self .configure_objc_arc ()
147
144
self .configure_substitutions ()
148
145
self .configure_features ()
146
+ self .configure_new_features ()
147
+
148
+ def configure_new_features (self ):
149
+ supportedFeatures = [f for f in libcxx .test .features .features if f .isSupported (self .config )]
150
+ for feature in supportedFeatures :
151
+ feature .enableIn (self .config )
149
152
150
153
def print_config_info (self ):
151
154
# Print the final compile and link flags.
@@ -322,14 +325,6 @@ def configure_cxx_stdlib_under_test(self):
322
325
if self .get_lit_conf ('enable_experimental' ) is None :
323
326
self .config .enable_experimental = 'true'
324
327
325
- def configure_use_thread_safety (self ):
326
- '''If set, run clang with -verify on failing tests.'''
327
- has_thread_safety = self .cxx .hasCompileFlag ('-Werror=thread-safety' )
328
- if has_thread_safety :
329
- self .cxx .compile_flags += ['-Werror=thread-safety' ]
330
- self .config .available_features .add ('thread-safety' )
331
- self .lit_config .note ("enabling thread-safety annotations" )
332
-
333
328
def configure_ccache (self ):
334
329
use_ccache_default = os .environ .get ('LIBCXX_USE_CCACHE' ) is not None
335
330
use_ccache = self .get_lit_bool ('use_ccache' , use_ccache_default )
@@ -384,36 +379,9 @@ def configure_features(self):
384
379
if not self .get_lit_bool ('enable_filesystem' , default = True ):
385
380
self .config .available_features .add ('c++filesystem-disabled' )
386
381
387
-
388
- # Run a compile test for the -fsized-deallocation flag. This is needed
389
- # in test/std/language.support/support.dynamic/new.delete
390
- if self .cxx .hasCompileFlag ('-fsized-deallocation' ):
391
- self .config .available_features .add ('-fsized-deallocation' )
392
-
393
- if self .cxx .hasCompileFlag ('-faligned-allocation' ):
394
- self .config .available_features .add ('-faligned-allocation' )
395
-
396
- if self .cxx .hasCompileFlag ('-fdelayed-template-parsing' ):
397
- self .config .available_features .add ('fdelayed-template-parsing' )
398
-
399
382
if self .get_lit_bool ('has_libatomic' , False ):
400
383
self .config .available_features .add ('libatomic' )
401
384
402
- macros = self ._dump_macros_verbose ()
403
- if '__cpp_if_constexpr' not in macros :
404
- self .config .available_features .add ('libcpp-no-if-constexpr' )
405
-
406
- if '__cpp_structured_bindings' not in macros :
407
- self .config .available_features .add ('libcpp-no-structured-bindings' )
408
-
409
- if '__cpp_deduction_guides' not in macros or \
410
- intMacroValue (macros ['__cpp_deduction_guides' ]) < 201611 :
411
- self .config .available_features .add ('libcpp-no-deduction-guides' )
412
-
413
- if '__cpp_concepts' not in macros or \
414
- intMacroValue (macros ['__cpp_concepts' ]) < 201811 :
415
- self .config .available_features .add ('libcpp-no-concepts' )
416
-
417
385
if self .target_info .is_windows ():
418
386
self .config .available_features .add ('windows' )
419
387
if self .cxx_stdlib_under_test == 'libc++' :
@@ -429,12 +397,6 @@ def configure_features(self):
429
397
self .config .available_features .add ('libcxx_gdb' )
430
398
self .cxx .libcxx_gdb = libcxx_gdb
431
399
432
- # Support Objective-C++ only on MacOS and if the compiler supports it.
433
- if self .target_info .platform () == "darwin" and \
434
- self .target_info .is_host_macosx () and \
435
- self .cxx .hasCompileFlag (["-x" , "objective-c++" , "-fobjc-arc" ]):
436
- self .config .available_features .add ("objective-c++" )
437
-
438
400
def configure_compile_flags (self ):
439
401
self .configure_default_compile_flags ()
440
402
# Configure extra flags
@@ -820,9 +782,6 @@ def configure_warnings(self):
820
782
# don't enable warnings in system headers on GCC.
821
783
if self .cxx .type != 'gcc' :
822
784
self .cxx .warning_flags += ['-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER' ]
823
- if self .cxx .hasWarningFlag ('-Wuser-defined-warnings' ):
824
- self .cxx .warning_flags += ['-Wuser-defined-warnings' ]
825
- self .config .available_features .add ('diagnose-if-support' )
826
785
self .cxx .addWarningFlagIfSupported ('-Wshadow' )
827
786
self .cxx .addWarningFlagIfSupported ('-Wno-unused-command-line-argument' )
828
787
self .cxx .addWarningFlagIfSupported ('-Wno-attributes' )
@@ -908,27 +867,6 @@ def configure_coverage(self):
908
867
self .cxx .flags += ['-g' , '--coverage' ]
909
868
self .cxx .compile_flags += ['-O0' ]
910
869
911
- def configure_coroutines (self ):
912
- if self .cxx .hasCompileFlag ('-fcoroutines-ts' ):
913
- macros = self ._dump_macros_verbose (flags = ['-fcoroutines-ts' ])
914
- if '__cpp_coroutines' not in macros :
915
- self .lit_config .warning ('-fcoroutines-ts is supported but '
916
- '__cpp_coroutines is not defined' )
917
- # Consider coroutines supported only when the feature test macro
918
- # reflects a recent value.
919
- if intMacroValue (macros ['__cpp_coroutines' ]) >= 201703 :
920
- self .config .available_features .add ('fcoroutines-ts' )
921
-
922
- def configure_blocks (self ):
923
- if self .cxx .hasCompileFlag ('-fblocks' ):
924
- self .config .available_features .add ('has-fblocks' )
925
-
926
- def configure_objc_arc (self ):
927
- cxx = copy .deepcopy (self .cxx )
928
- cxx .source_lang = 'objective-c++'
929
- if cxx .hasCompileFlag ('-fobjc-arc' ):
930
- self .config .available_features .add ('has-fobjc-arc' )
931
-
932
870
def configure_modules (self ):
933
871
modules_flags = ['-fmodules' ]
934
872
if not self .target_info .is_darwin ():
0 commit comments