[CMake] Remove CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
When Clang is used as a cross compiler, it should respect the target platform default. Defaulting to a configure-time CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX does not make much sense. When Clang is used as a single-platform compiler, we should use Clang configuration file (https://discourse.llvm.org/t/configuration-files/42529 https://clang.llvm.org/docs/UsersManual.html#configuration-files). The Gentoo needs from D34365 has been satisfied by a configuration file. Reviewed By: mgorny Differential Revision: https://reviews.llvm.org/D133375
This commit is contained in:
parent
dc884f0f43
commit
3baadff896
|
@ -189,12 +189,6 @@ set(CLANG_SPAWN_CC1 OFF CACHE BOOL
|
|||
|
||||
option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu" ON)
|
||||
|
||||
# TODO: verify the values against LangStandards.def?
|
||||
set(CLANG_DEFAULT_STD_C "" CACHE STRING
|
||||
"Default standard to use for C/ObjC code (IDENT from LangStandards.def, empty for platform default)")
|
||||
set(CLANG_DEFAULT_STD_CXX "" CACHE STRING
|
||||
"Default standard to use for C++/ObjC++ code (IDENT from LangStandards.def, empty for platform default)")
|
||||
|
||||
set(CLANG_DEFAULT_LINKER "" CACHE STRING
|
||||
"Default linker to use (linker name or absolute path, empty for platform default)")
|
||||
|
||||
|
|
|
@ -14,24 +14,6 @@
|
|||
/* Default linker to use. */
|
||||
#define CLANG_DEFAULT_LINKER "${CLANG_DEFAULT_LINKER}"
|
||||
|
||||
/* Default C/ObjC standard to use. */
|
||||
#cmakedefine CLANG_DEFAULT_STD_C LangStandard::lang_${CLANG_DEFAULT_STD_C}
|
||||
/* Always #define something so that missing the config.h #include at use sites
|
||||
* becomes a compile error.
|
||||
*/
|
||||
#ifndef CLANG_DEFAULT_STD_C
|
||||
#define CLANG_DEFAULT_STD_C LangStandard::lang_unspecified
|
||||
#endif
|
||||
|
||||
/* Default C++/ObjC++ standard to use. */
|
||||
#cmakedefine CLANG_DEFAULT_STD_CXX LangStandard::lang_${CLANG_DEFAULT_STD_CXX}
|
||||
/* Always #define something so that missing the config.h #include at use sites
|
||||
* becomes a compile error.
|
||||
*/
|
||||
#ifndef CLANG_DEFAULT_STD_CXX
|
||||
#define CLANG_DEFAULT_STD_CXX LangStandard::lang_unspecified
|
||||
#endif
|
||||
|
||||
/* Default C++ stdlib to use. */
|
||||
#define CLANG_DEFAULT_CXX_STDLIB "${CLANG_DEFAULT_CXX_STDLIB}"
|
||||
|
||||
|
|
|
@ -58,23 +58,14 @@ LangStandard::Kind clang::getDefaultLanguageStandard(clang::Language Lang,
|
|||
return LangStandard::lang_cuda;
|
||||
case Language::Asm:
|
||||
case Language::C:
|
||||
if (CLANG_DEFAULT_STD_C != LangStandard::lang_unspecified)
|
||||
return CLANG_DEFAULT_STD_C;
|
||||
|
||||
// The PS4 uses C99 as the default C standard.
|
||||
if (T.isPS4())
|
||||
return LangStandard::lang_gnu99;
|
||||
return LangStandard::lang_gnu17;
|
||||
case Language::ObjC:
|
||||
if (CLANG_DEFAULT_STD_C != LangStandard::lang_unspecified)
|
||||
return CLANG_DEFAULT_STD_C;
|
||||
|
||||
return LangStandard::lang_gnu11;
|
||||
case Language::CXX:
|
||||
case Language::ObjCXX:
|
||||
if (CLANG_DEFAULT_STD_CXX != LangStandard::lang_unspecified)
|
||||
return CLANG_DEFAULT_STD_CXX;
|
||||
|
||||
if (T.isPS())
|
||||
return LangStandard::lang_gnucxx14;
|
||||
return LangStandard::lang_gnucxx17;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// UNSUPPORTED: default-std-cxx, ps4, ps5
|
||||
/// Test default standards when CLANG_DEFAULT_STD_CXX is unspecified.
|
||||
// UNSUPPORTED: ps4, ps5
|
||||
/// Test default standards.
|
||||
/// PS4/PS5 default to gnu++14.
|
||||
|
||||
// RUN: %clang_cc1 -dM -E %s | FileCheck --check-prefix=CXX17 %s
|
||||
|
|
|
@ -126,9 +126,6 @@ if config.has_plugins and config.llvm_plugin_ext:
|
|||
if config.clang_default_pie_on_linux:
|
||||
config.available_features.add('default-pie-on-linux')
|
||||
|
||||
if config.clang_default_std_cxx != '':
|
||||
config.available_features.add('default-std-cxx')
|
||||
|
||||
# Set available features we allow tests to conditionalize on.
|
||||
#
|
||||
if config.clang_default_cxx_stdlib != '':
|
||||
|
|
|
@ -24,7 +24,6 @@ config.have_zlib = @LLVM_ENABLE_ZLIB@
|
|||
config.have_zstd = @LLVM_ENABLE_ZSTD@
|
||||
config.clang_arcmt = @CLANG_ENABLE_ARCMT@
|
||||
config.clang_default_pie_on_linux = @CLANG_DEFAULT_PIE_ON_LINUX@
|
||||
config.clang_default_std_cxx = "@CLANG_DEFAULT_STD_CXX@"
|
||||
config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
|
||||
config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
|
||||
config.clang_staticanalyzer_z3 = @LLVM_WITH_Z3@
|
||||
|
|
|
@ -11,8 +11,6 @@ write_cmake_config("Config") {
|
|||
"BUG_REPORT_URL=https://github.com/llvm/llvm-project/issues/",
|
||||
"CLANG_DEFAULT_PIE_ON_LINUX=1",
|
||||
"CLANG_DEFAULT_LINKER=",
|
||||
"CLANG_DEFAULT_STD_C=",
|
||||
"CLANG_DEFAULT_STD_CXX=",
|
||||
"CLANG_DEFAULT_CXX_STDLIB=",
|
||||
"CLANG_DEFAULT_RTLIB=",
|
||||
"CLANG_DEFAULT_OBJCOPY=objcopy",
|
||||
|
|
|
@ -46,7 +46,6 @@ write_lit_config("lit_site_cfg") {
|
|||
"LLVM_WITH_Z3=0",
|
||||
"CLANG_BUILD_EXAMPLES=0",
|
||||
"CLANG_BUILT_STANDALONE=0",
|
||||
"CLANG_DEFAULT_STD_CXX=",
|
||||
"CLANG_DEFAULT_CXX_STDLIB=", # Empty string means "default value" here.
|
||||
"CLANG_DEFAULT_PIE_ON_LINUX=0",
|
||||
"CLANG_PLUGIN_SUPPORT=0", # FIXME: Analysis/plugins need global -fPIC
|
||||
|
|
|
@ -28,24 +28,6 @@
|
|||
/* Default linker to use. */
|
||||
#define CLANG_DEFAULT_LINKER ""
|
||||
|
||||
/* Default C/ObjC standard to use. */
|
||||
/* #undef CLANG_DEFAULT_STD_C */
|
||||
/* Always #define something so that missing the config.h #include at use sites
|
||||
* becomes a compile error.
|
||||
*/
|
||||
#ifndef CLANG_DEFAULT_STD_C
|
||||
#define CLANG_DEFAULT_STD_C LangStandard::lang_unspecified
|
||||
#endif
|
||||
|
||||
/* Default C++/ObjC++ standard to use. */
|
||||
/* #undef CLANG_DEFAULT_STD_CXX */
|
||||
/* Always #define something so that missing the config.h #include at use sites
|
||||
* becomes a compile error.
|
||||
*/
|
||||
#ifndef CLANG_DEFAULT_STD_CXX
|
||||
#define CLANG_DEFAULT_STD_CXX LangStandard::lang_unspecified
|
||||
#endif
|
||||
|
||||
/* Default C++ stdlib to use. */
|
||||
#define CLANG_DEFAULT_CXX_STDLIB ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue