Skip to content

Commit cbbf20e

Browse files
Ci build update (#1151)
update ci build images, remove ubuntu 20.04 and update a few others, fix some newer clang-tidy warnings --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 70f98cb commit cbbf20e

17 files changed

+53
-38
lines changed

.clang-tidy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Checks: |
1414
-bugprone-easily-swappable-parameters,
1515
-bugprone-forwarding-reference-overload,
1616
-bugprone-exception-escape,
17+
-bugprone-crtp-constructor-accessibility,
18+
-bugprone-chained-comparison,
1719
clang-analyzer-optin.cplusplus.VirtualCall,
1820
clang-analyzer-optin.performance.Padding,
1921
-clang-diagnostic-float-equal,
@@ -40,9 +42,16 @@ Checks: |
4042
-modernize-make-unique,
4143
-modernize-type-traits,
4244
-modernize-macro-to-enum,
45+
-modernize-use-constraints,
46+
-modernize-use-ranges,
47+
-modernize-use-starts-ends-with,
48+
-modernize-use-integer-sign-comparison,
49+
-modernize-use-designated-initializers,
50+
-modernize-use-std-numbers,
4351
*performance*,
4452
-performance-unnecessary-value-param,
4553
-performance-inefficient-string-concatenation,
54+
-performance-enum-size,
4655
readability-const-return-type,
4756
readability-container-size-empty,
4857
readability-delete-null-pointer,
@@ -62,6 +71,7 @@ Checks: |
6271
readability-string-compare,
6372
readability-suspicious-call-argument,
6473
readability-uniqueptr-delete-release,
74+
-clang-analyzer-optin.core.EnumCastOutOfRange
6575
6676
CheckOptions:
6777
- key: google-readability-braces-around-statements.ShortStatementLines

.github/workflows/fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Configure
2323
run: |
2424
cmake -S . -B build \
25-
-DCMAKE_CXX_STANDARD=17 \
25+
-DCMAKE_CXX_STANDARD=20 \
2626
-DCLI11_SINGLE_FILE_TESTS=OFF \
2727
-DCLI11_BUILD_EXAMPLES=OFF \
2828
-DCLI11_FUZZ_TARGET=ON \

.github/workflows/tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ jobs:
8888
clang-tidy:
8989
name: Clang-Tidy
9090
runs-on: ubuntu-latest
91-
container: silkeh/clang:17
91+
container: silkeh/clang:20
9292
steps:
9393
- uses: actions/checkout@v4
9494

9595
- name: Configure
9696
run: >
97-
cmake -S . -B build -DCMAKE_CXX_STANDARD=17
97+
cmake -S . -B build -DCMAKE_CXX_STANDARD=20
9898
-DCMAKE_CXX_CLANG_TIDY="$(which
9999
clang-tidy);--use-color;--warnings-as-errors=*"
100100
@@ -133,7 +133,7 @@ jobs:
133133

134134
boost-build:
135135
name: Boost build
136-
runs-on: ubuntu-22.04
136+
runs-on: ubuntu-24.04
137137
steps:
138138
- uses: actions/checkout@v4
139139
with:
@@ -233,9 +233,9 @@ jobs:
233233
run: ctest --output-on-failure -L Packaging
234234
working-directory: build
235235

236-
cmake-config-ubuntu-2004:
237-
name: CMake config check (Ubuntu 20.04)
238-
runs-on: ubuntu-20.04
236+
cmake-config-ubuntu-2204:
237+
name: CMake config check (Ubuntu 22.04)
238+
runs-on: ubuntu-22.04
239239
steps:
240240
- uses: actions/checkout@v4
241241

@@ -282,9 +282,9 @@ jobs:
282282
cmake-version: "3.16"
283283
if: success() || failure()
284284

285-
cmake-config-ubuntu-2204:
286-
name: CMake config check (Ubuntu 22.04)
287-
runs-on: ubuntu-22.04
285+
cmake-config-ubuntu-2404:
286+
name: CMake config check (Ubuntu 24.04)
287+
runs-on: ubuntu-24.04
288288
steps:
289289
- uses: actions/checkout@v4
290290

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ jobs:
178178
containerImage: silkeh/clang:17
179179
cli11.std: 23
180180
cli11.options: -DCMAKE_CXX_FLAGS=-std=c++23
181-
clang19_26:
182-
containerImage: silkeh/clang:19
181+
clang20_26:
182+
containerImage: silkeh/clang:20
183183
cli11.std: 26
184184
cli11.options: -DCMAKE_CXX_FLAGS=-std=c++2c
185185
container: $[ variables['containerImage'] ]

examples/enum.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <map>
1010
#include <string>
1111

12+
// NOLINTNEXTLINE
1213
enum class Level : int { High, Medium, Low };
1314

1415
int main(int argc, char **argv) {

include/CLI/App.hpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,15 @@ namespace CLI {
4646
#endif
4747

4848
namespace detail {
49-
enum class Classifier { NONE, POSITIONAL_MARK, SHORT, LONG, WINDOWS_STYLE, SUBCOMMAND, SUBCOMMAND_TERMINATOR };
49+
enum class Classifier : std::uint8_t {
50+
NONE,
51+
POSITIONAL_MARK,
52+
SHORT,
53+
LONG,
54+
WINDOWS_STYLE,
55+
SUBCOMMAND,
56+
SUBCOMMAND_TERMINATOR
57+
};
5058
struct AppFriend;
5159
} // namespace detail
5260

@@ -60,7 +68,7 @@ CLI11_INLINE std::string help(const App *app, const Error &e);
6068

6169
/// enumeration of modes of how to deal with extras in config files
6270

63-
enum class config_extras_mode : char { error = 0, ignore, ignore_all, capture };
71+
enum class config_extras_mode : std::uint8_t { error = 0, ignore, ignore_all, capture };
6472

6573
class App;
6674

@@ -242,7 +250,7 @@ class App {
242250
/// specify that positional arguments come at the end of the argument sequence not inheritable
243251
bool positionals_at_end_{false};
244252

245-
enum class startup_mode : char { stable, enabled, disabled };
253+
enum class startup_mode : std::uint8_t { stable, enabled, disabled };
246254
/// specify the startup mode for the app
247255
/// stable=no change, enabled= startup enabled, disabled=startup disabled
248256
startup_mode default_startup{startup_mode::stable};

include/CLI/Error.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace CLI {
4141

4242
/// These codes are part of every error in CLI. They can be obtained from e using e.exit_code or as a quick shortcut,
4343
/// int values from e.get_error_code().
44-
enum class ExitCodes {
44+
enum class ExitCodes : int {
4545
Success = 0,
4646
IncorrectConstruction = 100,
4747
BadNameString,

include/CLI/FormatterFwd.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class App;
2929
/// This is passed in by App; all user classes must accept this as
3030
/// the second argument.
3131

32-
enum class AppFormatMode {
32+
enum class AppFormatMode : std::uint8_t {
3333
Normal, ///< The normal, detailed help
3434
All, ///< A fully expanded help
3535
Sub, ///< Used when printed as part of expanded subcommand

include/CLI/TypeTools.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace CLI {
3333
namespace detail {
3434
// Based generally on https://rmf.io/cxx11/almost-static-if
3535
/// Simple empty scoped class
36-
enum class enabler {};
36+
enum class enabler : std::uint8_t {};
3737

3838
/// An instance to use in EnableIf
3939
constexpr enabler dummy = {};
@@ -628,7 +628,7 @@ struct expected_count<T, typename std::enable_if<!is_mutable_container<T>::value
628628
};
629629

630630
// Enumeration of the different supported categorizations of objects
631-
enum class object_category : int {
631+
enum class object_category : std::uint8_t {
632632
char_value = 1,
633633
integral_value = 2,
634634
unsigned_integral = 4,

include/CLI/Validators.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class CustomValidator : public Validator {
185185
namespace detail {
186186

187187
/// CLI enumeration of different file types
188-
enum class path_type { nonexistent, file, directory };
188+
enum class path_type : std::uint8_t { nonexistent, file, directory };
189189

190190
/// get the type of the path from a file name
191191
CLI11_INLINE path_type check_path(const char *file) noexcept;
@@ -356,6 +356,7 @@ template <
356356
typename T,
357357
enable_if_t<!is_copyable_ptr<typename std::remove_reference<T>::type>::value, detail::enabler> = detail::dummy>
358358
typename std::remove_reference<T>::type &smart_deref(T &value) {
359+
// NOLINTNEXTLINE
359360
return value;
360361
}
361362
/// Generate a string representation of a set
@@ -721,7 +722,7 @@ class AsNumberWithUnit : public Validator {
721722
/// CASE_SENSITIVE/CASE_INSENSITIVE controls how units are matched.
722723
/// UNIT_OPTIONAL/UNIT_REQUIRED throws ValidationError
723724
/// if UNIT_REQUIRED is set and unit literal is not found.
724-
enum Options {
725+
enum Options : std::uint8_t {
725726
CASE_SENSITIVE = 0,
726727
CASE_INSENSITIVE = 1,
727728
UNIT_OPTIONAL = 0,

0 commit comments

Comments
 (0)