diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-08-12 13:13:53 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2017-09-24 11:45:18 -0700 |
commit | a7380dfdb9f7080cb552090f93d089e971558c80 (patch) | |
tree | bf9baf3ae6e54106b3aebdf6c7b608889c139327 | |
parent | 59773576b7adb3129cf77d19442b5a83937b3c84 (diff) | |
download | meta-clang-a7380dfdb9f7080cb552090f93d089e971558c80.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-- | recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch | 28 | ||||
-rw-r--r-- | recipes-devtools/clang/common.inc | 1 |
2 files changed, 29 insertions, 0 deletions
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 75df1b2..e850320 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc | |||
@@ -21,6 +21,7 @@ CLANGPATCHES = "\ | |||
21 | file://0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch;patchdir=tools/clang \ | 21 | file://0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch;patchdir=tools/clang \ |
22 | file://0006-clang-Define-releative-gcc-installation-dir.patch;patchdir=tools/clang \ | 22 | file://0006-clang-Define-releative-gcc-installation-dir.patch;patchdir=tools/clang \ |
23 | file://0008-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch;patchdir=tools/clang \ | 23 | file://0008-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch;patchdir=tools/clang \ |
24 | file://0008-clang-Default-to-gnu-14-for-c-standard.patch;patchdir=tools/clang \ | ||
24 | " | 25 | " |
25 | CLANGPATCHES += "${@'file://0007-clang-Enable-SSP-and-PIE-by-default.patch;patchdir=tools/clang' if '${GCCPIE}' else ''}" | 26 | CLANGPATCHES += "${@'file://0007-clang-Enable-SSP-and-PIE-by-default.patch;patchdir=tools/clang' if '${GCCPIE}' else ''}" |
26 | 27 | ||