Skip to content

Commit

Permalink
fix cppstd checks for c++26 in newer compiler versions (#17250)
Browse files Browse the repository at this point in the history
* fix cppstd checks for c++26 in newer compiler versions

* more tests

* Conan 2.9.1

---------

Co-authored-by: czoido <mrgalleta@gmail.com>
  • Loading branch information
memsharded and czoido authored Oct 30, 2024
1 parent 02a98bb commit b3ad884
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
23 changes: 19 additions & 4 deletions conan/tools/build/cppstd.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,14 @@ def _apple_clang_supported_cppstd(version):
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
if version < "13.0":
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]
# https://github.com/conan-io/conan/pull/17092 doesn't show c++23 full support until 16
# but it was this before Conan 2.9, so keeping it to not break
if version < "16.0":
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20",
"23", "gnu23"]

return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23"]
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23",
"26", "gnu26"]


def _gcc_supported_cppstd(version):
Expand All @@ -184,8 +190,13 @@ def _gcc_supported_cppstd(version):
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
if version < "11":
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]
# https://github.com/conan-io/conan/pull/17092
if version < "14.0":
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20",
"23", "gnu23"]

return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23"]
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23",
"26", "gnu26"]


def _msvc_supported_cppstd(version):
Expand Down Expand Up @@ -222,8 +233,12 @@ def _clang_supported_cppstd(version):
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
if version < "12":
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]

return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23"]
# https://github.com/conan-io/conan/pull/17092
if version < "17.0":
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20",
"23", "gnu23"]
return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23",
"26", "gnu26"]


def _mcst_lcc_supported_cppstd(version):
Expand Down
2 changes: 1 addition & 1 deletion conans/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CHECKSUM_DEPLOY = "checksum_deploy" # Only when v2
REVISIONS = "revisions" # Only when enabled in config, not by default look at server_launcher.py

__version__ = '2.9.0'
__version__ = '2.9.1'
11 changes: 11 additions & 0 deletions test/integration/configuration/test_profile_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ def test_remove_plugin_file(self):
c.run("profile show", assert_error=True)
assert "ERROR: The 'profile.py' plugin file doesn't exist" in c.out

def test_regresion_29(self):
# https://github.com/conan-io/conan/issues/17247
c = TestClient()
c.save({"conanfile.txt": ""})
c.run("install . -s compiler=clang -s compiler.version=19 -s compiler.cppstd=26")
# doesn't fail anymore
c.run("install . -s compiler=apple-clang -s compiler.version=16 -s compiler.cppstd=26")
# doesn't fail anymore
c.run("install . -s compiler=gcc -s compiler.version=14 -s compiler.cppstd=26")
# doesn't fail anymore


def test_android_ndk_version():
c = TestClient()
Expand Down

0 comments on commit b3ad884

Please sign in to comment.