From 5ab526185ac0ceab31d1f9039f1c79e42b7b7f26 Mon Sep 17 00:00:00 2001 From: Robert Pavel Date: Sat, 7 May 2022 10:09:20 -0700 Subject: Force GCC to always provide a C++14 flag (#29781) * Force GCC to always provide a C++14 flag Updated gnu logic so that the c++14 flag for g++ is always propagated. This fixes issues with build systems that error out if passed an empty string for a flag. Engaging in the best kind of software engineering by updating the unit test to pass with the value it is now passed. This should better match the expected flag for g++ compiling with the C++14 standard --- lib/spack/spack/compilers/gcc.py | 4 +--- lib/spack/spack/test/compilers/basics.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py index 60c4a75978..40794103f6 100644 --- a/lib/spack/spack/compilers/gcc.py +++ b/lib/spack/spack/compilers/gcc.py @@ -78,10 +78,8 @@ class Gcc(spack.compiler.Compiler): self, "the C++14 standard", "cxx14_flag", "< 4.8") elif self.real_version < ver('4.9'): return "-std=c++1y" - elif self.real_version < ver('6.0'): - return "-std=c++14" else: - return "" + return "-std=c++14" @property def cxx17_flag(self): diff --git a/lib/spack/spack/test/compilers/basics.py b/lib/spack/spack/test/compilers/basics.py index 7610280123..4d4794663d 100644 --- a/lib/spack/spack/test/compilers/basics.py +++ b/lib/spack/spack/test/compilers/basics.py @@ -501,7 +501,7 @@ def test_gcc_flags(): unsupported_flag_test("cxx14_flag", "gcc@4.7") supported_flag_test("cxx14_flag", "-std=c++1y", "gcc@4.8") supported_flag_test("cxx14_flag", "-std=c++14", "gcc@4.9") - supported_flag_test("cxx14_flag", "", "gcc@6.0") + supported_flag_test("cxx14_flag", "-std=c++14", "gcc@6.0") unsupported_flag_test("cxx17_flag", "gcc@4.9") supported_flag_test("cxx17_flag", "-std=c++1z", "gcc@5.0") supported_flag_test("cxx17_flag", "-std=c++17", "gcc@6.0") -- cgit v1.2.3-60-g2f50