Skip to content

Commit

Permalink
Add Clang 17 to settings.yml with support for its new C++23 flag (#…
Browse files Browse the repository at this point in the history
…14781)

Add clang 17 to settings.yml, support new C++23 flag
  • Loading branch information
AbrilRBS authored Sep 20, 2023
1 parent 2d78b86 commit 35973ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions conan/tools/build/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ def _cppstd_clang(clang_version, cppstd):
v23 = "c++2b"
vgnu23 = "gnu++2b"

if clang_version >= "17":
v23 = "c++23"
vgnu23 = "gnu++23"

flag = {"98": v98, "gnu98": vgnu98,
"11": v11, "gnu11": vgnu11,
"14": v14, "gnu14": vgnu14,
Expand Down
2 changes: 1 addition & 1 deletion conans/client/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
clang:
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0",
"5.0", "6.0", "7.0", "7.1",
"8", "9", "10", "11", "12", "13", "14", "15", "16"]
"8", "9", "10", "11", "12", "13", "14", "15", "16", "17"]
libcxx: [null, libstdc++, libstdc++11, libc++, c++_shared, c++_static]
cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
runtime: [null, static, dynamic]
Expand Down
6 changes: 6 additions & 0 deletions conans/test/unittests/client/build/cpp_std_flags_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ def test_clang_cppstd_flags(self):
self.assertEqual(_make_cppstd_flag("clang", "12", "20"), '-std=c++20')
self.assertEqual(_make_cppstd_flag("clang", "12", "23"), '-std=c++2b')

self.assertEqual(_make_cppstd_flag("clang", "17", "11"), '-std=c++11')
self.assertEqual(_make_cppstd_flag("clang", "17", "14"), '-std=c++14')
self.assertEqual(_make_cppstd_flag("clang", "17", "17"), '-std=c++17')
self.assertEqual(_make_cppstd_flag("clang", "17", "20"), '-std=c++20')
self.assertEqual(_make_cppstd_flag("clang", "17", "23"), '-std=c++23')

def test_clang_cppstd_defaults(self):
self.assertEqual(_make_cppstd_default("clang", "2"), "gnu98")
self.assertEqual(_make_cppstd_default("clang", "2.1"), "gnu98")
Expand Down

0 comments on commit 35973ac

Please sign in to comment.