Index: test/libcxx/test/config.py =================================================================== --- test/libcxx/test/config.py +++ test/libcxx/test/config.py @@ -91,13 +91,8 @@ self.configure_use_clang_verify() self.configure_execute_external() self.configure_ccache() - self.configure_compile_flags() - self.configure_link_flags() + self.configure_compiler_flags() self.configure_env() - self.configure_color_diagnostics() - self.configure_debug_mode() - self.configure_warnings() - self.configure_sanitizer() self.configure_substitutions() self.configure_features() @@ -323,24 +318,41 @@ if self.long_tests: self.config.available_features.add('long_tests') - def configure_compile_flags(self): + def configure_compiler_flags(self): no_default_flags = self.get_lit_bool('no_default_flags', False) if not no_default_flags: - self.configure_default_compile_flags() - # Configure extra flags + self.configure_compile_flags() compile_flags_str = self.get_lit_conf('compile_flags', '') self.cxx.compile_flags += shlex.split(compile_flags_str) + if not no_default_flags: + self.configure_link_flags() + link_flags_str = self.get_lit_conf('link_flags', '') + self.cxx.link_flags += shlex.split(link_flags_str) + if not no_default_flags: + self.configure_color_diagnostics() + self.configure_debug_mode() + self.configure_warnings() + self.configure_sanitizer() - def configure_default_compile_flags(self): + def configure_compile_flags(self): + no_library_flags = self.get_lit_bool('no_library_flags', False) + if not no_library_flags: + self.configure_library_include_paths() + self.configure_test_include_paths() + if not no_library_flags: + self.configure_library_compile_flags() + self.configure_test_compile_flags() + + def configure_library_compile_flags(self): + pass + + def configure_test_compile_flags(self): # Try and get the std version from the command line. Fall back to # default given in lit.site.cfg is not present. If default is not # present then force c++11. std = self.get_lit_conf('std', 'c++11') self.cxx.compile_flags += ['-std={0}'.format(std)] self.config.available_features.add(std) - # Configure include paths - self.cxx.compile_flags += ['-nostdinc++'] - self.configure_compile_flags_header_includes() if self.target_info.platform() == 'linux': self.cxx.compile_flags += ['-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', @@ -374,10 +386,8 @@ if self.use_target: self.cxx.flags += ['-target', self.config.target_triple] - def configure_compile_flags_header_includes(self): - support_path = os.path.join(self.libcxx_src_root, 'test/support') - self.cxx.compile_flags += ['-I' + support_path] - self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')] + def configure_library_include_paths(self): + self.cxx.compile_flags += ['-nostdinc++'] libcxx_headers = self.get_lit_conf( 'libcxx_headers', os.path.join(self.libcxx_src_root, 'include')) if not os.path.isdir(libcxx_headers): @@ -385,6 +395,11 @@ % libcxx_headers) self.cxx.compile_flags += ['-I' + libcxx_headers] + def configure_test_include_paths(self): + support_path = os.path.join(self.libcxx_src_root, 'test/support') + self.cxx.compile_flags += ['-I' + support_path] + self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')] + def configure_compile_flags_exceptions(self): enable_exceptions = self.get_lit_bool('enable_exceptions', True) if not enable_exceptions: @@ -415,8 +430,8 @@ self.config.available_features.add('libcpp-has-no-monotonic-clock') def configure_link_flags(self): - no_default_flags = self.get_lit_bool('no_default_flags', False) - if not no_default_flags: + no_library_flags = self.get_lit_bool('no_library_flags', False) + if not no_library_flags: self.cxx.link_flags += ['-nodefaultlibs'] # Configure library path @@ -428,8 +443,6 @@ self.configure_link_flags_abi_library() self.configure_extra_library_flags() - link_flags_str = self.get_lit_conf('link_flags', '') - self.cxx.link_flags += shlex.split(link_flags_str) def configure_link_flags_cxx_library_path(self): libcxx_library = self.get_lit_conf('libcxx_library')