From 62dfaa229e2d0287126eb0672a1de21c7a5e75d1 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sun, 17 Mar 2024 12:09:21 +0100 Subject: meson: use loops to unify repeated checks --- src/systemd/meson.build | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/systemd/meson.build b/src/systemd/meson.build index d50edb413f..8ff79648ca 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -62,30 +62,28 @@ opts = [['c'], ['c', '-std=iso9899:1990'], ['c', '-std=iso9899:2011']] -if cc.has_argument('-std=iso9899:2017') - opts += [['c', '-std=iso9899:2017']] -endif - -if cc.has_argument('-std=c2x') - opts += [['c', '-std=c2x']] -endif +foreach opt : ['-std=iso9899:2017', + '-std=c2x', + ] + if cc.has_argument(opt) + opts += [['c', opt]] + endif +endforeach if cxx_cmd != '' opts += [['c++'], ['c++', '-std=c++98'], ['c++', '-std=c++11']] - if cxx.has_argument('-std=c++14') - opts += [['c++', '-std=c++14']] - endif - if cxx.has_argument('-std=c++17') - opts += [['c++', '-std=c++17']] - endif - if cxx.has_argument('-std=c++20') - opts += [['c++', '-std=c++20']] - endif - if cxx.has_argument('-std=c++23') - opts += [['c++', '-std=c++23']] - endif + + foreach opt : ['-std=c++14', + '-std=c++17', + '-std=c++20', + '-std=c++23', + ] + if cxx.has_argument(opt) + opts += [['c++', opt]] + endif + endforeach endif foreach header : _systemd_headers + _not_installed_headers + [libudev_h_path] -- cgit v1.2.3 From 345ef6eb565e325c90c73af4ec73ae27ec205cbe Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sun, 17 Mar 2024 12:19:52 +0100 Subject: meson: gcc docs say that name "c2x" is deprecated --- src/systemd/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemd/meson.build b/src/systemd/meson.build index 8ff79648ca..b1f4d4e00b 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -63,7 +63,7 @@ opts = [['c'], ['c', '-std=iso9899:2011']] foreach opt : ['-std=iso9899:2017', - '-std=c2x', + '-std=c23', ] if cc.has_argument(opt) opts += [['c', opt]] -- cgit v1.2.3 From 3317aedff0901e08a8efc8346ad76b184d5d40ea Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sun, 17 Mar 2024 12:20:54 +0100 Subject: meson: test with c++26 too The docs say that support is experimental, but it's better for us if we know about any problems early. Header tests pass without any issue with gcc-14.0.1-0.8.fc40.x86_64. --- src/systemd/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/src/systemd/meson.build b/src/systemd/meson.build index b1f4d4e00b..a91d7064bb 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -79,6 +79,7 @@ if cxx_cmd != '' '-std=c++17', '-std=c++20', '-std=c++23', + '-std=c++26', ] if cxx.has_argument(opt) opts += [['c++', opt]] -- cgit v1.2.3