diff options
| author | Khem Raj <raj.khem@gmail.com> | 2017-08-12 13:13:53 -0700 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2017-08-12 13:13:53 -0700 |
| commit | d57536af86b27779125cb30202d562d6d4fbbfdc (patch) | |
| tree | d21a720625ee2f572b2530eb8c4076ff540241d0 | |
| parent | a32eecdf6ca62210381b0a8808829dd867ff06d4 (diff) | |
| download | meta-clang-d57536af86b27779125cb30202d562d6d4fbbfdc.tar.gz | |
clang: Switch c++ default to gnu++14 standard
Using cmdline options -std doesnt always work e.g. boost
where it uses c++ driver (clang++) to invoke compilation
but then passes '-x c' to choose the language for compilation
Which ends in errors like below
error: invalid argument '-std=c++14' not allowed with 'C'
Therefore change the defaults in driver itself to use gnu++14
which is default with g++ from gcc7+ too.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | classes/clang.bbclass | 2 | ||||
| -rw-r--r-- | recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch | 28 | ||||
| -rw-r--r-- | recipes-devtools/clang/common.inc | 1 |
3 files changed, 30 insertions, 1 deletions
diff --git a/classes/clang.bbclass b/classes/clang.bbclass index e4b35cf..d527b26 100644 --- a/classes/clang.bbclass +++ b/classes/clang.bbclass | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # Add the necessary override | 1 | # Add the necessary override |
| 2 | CC_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" | 2 | CC_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" |
| 3 | CXX_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang++ -std=c++14 ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" | 3 | CXX_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" |
| 4 | CPP_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E" | 4 | CPP_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E" |
| 5 | CCLD_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" | 5 | CCLD_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" |
| 6 | 6 | ||
diff --git a/recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch b/recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch new file mode 100644 index 0000000..74bfc69 --- /dev/null +++ b/recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | From 521fdfcc2031d22b50125b3295b837229c77abd6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 12 Aug 2017 12:56:06 -0700 | ||
| 4 | Subject: [PATCH 8/8] clang: Default to gnu++14 for c++ standard | ||
| 5 | |||
| 6 | GCC 7.x and newer default to same as well | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | lib/Frontend/CompilerInvocation.cpp | 2 +- | ||
| 11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 12 | |||
| 13 | diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp | ||
| 14 | index b2c14554a4..eed925fac4 100644 | ||
| 15 | --- a/lib/Frontend/CompilerInvocation.cpp | ||
| 16 | +++ b/lib/Frontend/CompilerInvocation.cpp | ||
| 17 | @@ -1667,7 +1667,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, | ||
| 18 | if (T.isPS4()) | ||
| 19 | LangStd = LangStandard::lang_gnucxx11; | ||
| 20 | else | ||
| 21 | - LangStd = LangStandard::lang_gnucxx98; | ||
| 22 | + LangStd = LangStandard::lang_gnucxx14; | ||
| 23 | break; | ||
| 24 | case InputKind::RenderScript: | ||
| 25 | LangStd = LangStandard::lang_c99; | ||
| 26 | -- | ||
| 27 | 2.14.1 | ||
| 28 | |||
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index f5e7acb..3846a1f 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc | |||
| @@ -18,6 +18,7 @@ CLANGPATCHES = "\ | |||
| 18 | file://0004-clang-Prepend-trailing-to-sysroot.patch;patchdir=tools/clang \ | 18 | file://0004-clang-Prepend-trailing-to-sysroot.patch;patchdir=tools/clang \ |
| 19 | file://0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch;patchdir=tools/clang \ | 19 | file://0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch;patchdir=tools/clang \ |
| 20 | file://0006-clang-Define-releative-gcc-installation-dir.patch;patchdir=tools/clang \ | 20 | file://0006-clang-Define-releative-gcc-installation-dir.patch;patchdir=tools/clang \ |
| 21 | file://0008-clang-Default-to-gnu-14-for-c-standard.patch;patchdir=tools/clang \ | ||
| 21 | " | 22 | " |
| 22 | CLANGPATCHES += "${@'file://0007-clang-Enable-SSP-and-PIE-by-default.patch;patchdir=tools/clang' if '${GCCPIE}' else ''}" | 23 | CLANGPATCHES += "${@'file://0007-clang-Enable-SSP-and-PIE-by-default.patch;patchdir=tools/clang' if '${GCCPIE}' else ''}" |
| 23 | 24 | ||
