diff options
| author | Eric Fiselier <eric@efcs.ca> | 2014-08-16 01:35:36 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2014-08-16 01:35:36 +0000 |
| commit | 1b44db22c6e378080539a35ce1fd1f9b1f85c9b1 (patch) | |
| tree | 7522d6c4739bed118acc72ae2af43266e8219944 /libcxx/test | |
| parent | 781a7b04f2557dc5e971f203bd5b681b866dfb45 (diff) | |
| download | bcm5719-llvm-1b44db22c6e378080539a35ce1fd1f9b1f85c9b1.tar.gz bcm5719-llvm-1b44db22c6e378080539a35ce1fd1f9b1f85c9b1.zip | |
[libcxx] Update the way the -std= flag is chosen by CMake and LibcxxTestFormat
Summary:
This patch does two things:
CMake Update:
- Add compiler flag checks for -std=c++11 and -std=c++1y and remove check for -std=c++0x.
- Add configuration option LIBCXX_ENABLE_CXX1Y to prevent/allow -std=c++1y from being chosen as the std version. LIBCXX_ENABLE_CXX1Y is set to OFF by default.
- if LIBCXX_ENABLE_CXX1Y is enabled then set LIBCXX_STD_VERSION to c++1y and fail if the compiler does not support -std=c++1y
- If c++1y is not enabled then use c++11 and fail if the compiler does not support c++11.
Lit Update:
- Update lit.site.cfg.in to capture LIBCXX_STD_VERSION information as config.std.
- Remove mentions of has_cxx0X configuration option.
- Check for `--param std=X' passed to lit on the command line.
- Choose the std for the tests either from command line parameter or (if it doesn't exist) the lit.site.cfg.
Reviewers: mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: emaste, rnk, ajwong, danalbert, cfe-commits
Differential Revision: http://reviews.llvm.org/D4329
llvm-svn: 215802
Diffstat (limited to 'libcxx/test')
| -rw-r--r-- | libcxx/test/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | libcxx/test/lit.cfg | 26 | ||||
| -rw-r--r-- | libcxx/test/lit.site.cfg.in | 2 |
3 files changed, 13 insertions, 16 deletions
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt index 4810b2c5748..b04bb97264d 100644 --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -28,7 +28,6 @@ if(PYTHONINTERP_FOUND) set(LIBCXX_BINARY_DIR ${CMAKE_BINARY_DIR}) set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE}) pythonize_bool(LIBCXX_ENABLE_SHARED) - pythonize_bool(LIBCXX_HAS_STDCXX0X_FLAG) set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!") diff --git a/libcxx/test/lit.cfg b/libcxx/test/lit.cfg index 8a6ff4154d4..edb0ab0d3cc 100644 --- a/libcxx/test/lit.cfg +++ b/libcxx/test/lit.cfg @@ -247,18 +247,6 @@ if libcxx_obj_root is None: if libcxx_obj_root is None: libcxx_obj_root = libcxx_src_root -cxx_has_stdcxx0x_flag_str = lit_config.params.get('cxx_has_stdcxx0x_flag', None) -if cxx_has_stdcxx0x_flag_str is not None: - if cxx_has_stdcxx0x_flag_str.lower() in ('1', 'true'): - cxx_has_stdcxx0x_flag = True - elif cxx_has_stdcxx0x_flag_str.lower() in ('', '0', 'false'): - cxx_has_stdcxx0x_flag = False - else: - lit_config.fatal( - 'user parameter cxx_has_stdcxx0x_flag_str should be 0 or 1') -else: - cxx_has_stdcxx0x_flag = getattr(config, 'cxx_has_stdcxx0x_flag', True) - # This test suite supports testing against either the system library or the # locally built one; the former mode is useful for testing ABI compatibility # between the current headers and a shipping dynamic library. @@ -313,8 +301,18 @@ include_paths = ['-I' + libcxx_src_root + '/include', '-I' + libcxx_src_root + '/test/support'] library_paths = ['-L' + libcxx_obj_root + '/lib'] compile_flags = [] -if cxx_has_stdcxx0x_flag: - compile_flags += ['-std=c++0x'] + +# 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 = lit_config.params.get('std', None) +if std is None: + std = getattr(config, 'std', None) + if std is None: + std = 'c++11' + lit_config.note('using default std: \'-std=c++11\'') +else: + lit_config.note('using user specified std: \'-std={}\''.format(std)) +compile_flags += ['-std={}'.format(std)] # Configure extra linker parameters. exec_env = {} diff --git a/libcxx/test/lit.site.cfg.in b/libcxx/test/lit.site.cfg.in index 1a73dff25cd..9ef332ca695 100644 --- a/libcxx/test/lit.site.cfg.in +++ b/libcxx/test/lit.site.cfg.in @@ -1,6 +1,6 @@ @AUTO_GEN_COMMENT@ config.cxx_under_test = "@LIBCXX_COMPILER@" -config.cxx_has_stdcxx0x_flag = @LIBCXX_HAS_STDCXX0X_FLAG@ +config.std = "@LIBCXX_STD_VERSION@" config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@" config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@" config.python_executable = "@PYTHON_EXECUTABLE@" |

