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
This commit is contained in:
Robert Pavel 2022-05-07 10:09:20 -07:00 committed by GitHub
parent 654a07d642
commit 5ab526185a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -78,10 +78,8 @@ def cxx14_flag(self):
self, "the C++14 standard", "cxx14_flag", "< 4.8") self, "the C++14 standard", "cxx14_flag", "< 4.8")
elif self.real_version < ver('4.9'): elif self.real_version < ver('4.9'):
return "-std=c++1y" return "-std=c++1y"
elif self.real_version < ver('6.0'):
return "-std=c++14"
else: else:
return "" return "-std=c++14"
@property @property
def cxx17_flag(self): def cxx17_flag(self):

View File

@ -501,7 +501,7 @@ def test_gcc_flags():
unsupported_flag_test("cxx14_flag", "gcc@4.7") 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++1y", "gcc@4.8")
supported_flag_test("cxx14_flag", "-std=c++14", "gcc@4.9") 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") 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++1z", "gcc@5.0")
supported_flag_test("cxx17_flag", "-std=c++17", "gcc@6.0") supported_flag_test("cxx17_flag", "-std=c++17", "gcc@6.0")