Commit 75b19db1d88252947ba9dabc6f22f3a79f9c99a9

Authored by Philip Top
Committed by GitHub
1 parent 71755e4f

fix: some GCC warnings and update codecov (#813)

* add some warning for GCC output

* fix some warnings

* style: pre-commit.ci fixes

* update ubuntu image used for cmake tests so it doesn't auto transition to 22.04

* try a few more warning flags

* install the correct files

* style: pre-commit.ci fixes

* fix install files

* add a few more things to pre-commit

* try a fix for codacy

* another try at codecov

* more coverage tweaks

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
.codecov.yml
1 1 ignore:
2 2 - "tests"
3 3 - "examples"
  4 + - "book"
  5 + - "docs"
  6 + - "test_package"
... ...
.github/actions/quick_cmake/action.yml
... ... @@ -13,7 +13,7 @@ runs:
13 13 using: composite
14 14 steps:
15 15 - name: CMake ${{ inputs.cmake-version }}
16   - uses: jwlawson/actions-setup-cmake@v1.12
  16 + uses: jwlawson/actions-setup-cmake@v1.13
17 17 with:
18 18 cmake-version: "${{ inputs.cmake-version }}"
19 19 - run: |
... ...
.github/workflows/tests.yml
... ... @@ -48,14 +48,15 @@ jobs:
48 48 - name: Prepare coverage
49 49 run: |
50 50 lcov --directory . --capture --output-file coverage.info
51   - lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' --output-file coverage.info
  51 + lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' '*/book/*' --output-file coverage.info
52 52 lcov --list coverage.info
53 53 working-directory: build
54 54  
55 55 - uses: codecov/codecov-action@v3
56 56 with:
  57 + files: build/coverage.info
57 58 fail_ci_if_error: true
58   - working-directory: build
  59 + functionalities: fixes
59 60  
60 61 clang-tidy:
61 62 name: Clang-Tidy
... ... @@ -129,7 +130,7 @@ jobs:
129 130  
130 131 cmake-config:
131 132 name: CMake config check
132   - runs-on: ubuntu-latest
  133 + runs-on: ubuntu-20.04
133 134 steps:
134 135 - uses: actions/checkout@v3
135 136  
... ...
.pre-commit-config.yaml
... ... @@ -16,9 +16,13 @@ repos:
16 16 - id: check-merge-conflict
17 17 - id: check-symlinks
18 18 - id: check-yaml
  19 + - id: check-toml
19 20 - id: end-of-file-fixer
20 21 - id: mixed-line-ending
21 22 - id: trailing-whitespace
  23 + - id: check-shebang-scripts-are-executable
  24 + - id: check-executables-have-shebangs
  25 + - id: debug-statements
22 26  
23 27 - repo: https://github.com/pre-commit/mirrors-clang-format
24 28 rev: v15.0.4
... ...
azure-pipelines.yml
... ... @@ -110,13 +110,14 @@ jobs:
110 110 gcc11:
111 111 containerImage: gcc:11
112 112 cli11.std: 20
113   - gcc8:
114   - containerImage: gcc:8
115   - cli11.std: 17
  113 + cli11.options: -DCMAKE_CXX_FLAGS="-Wredundant-decls -Wconversion"
  114 + gcc7:
  115 + containerImage: gcc:7
  116 + cli11.std: 14
  117 + cli11.options: -DCMAKE_CXX_FLAGS="-Wconversion"
116 118 gcc4.8:
117 119 containerImage: helics/buildenv:gcc4-8-builder
118 120 cli11.std: 11
119   - cli11.options:
120 121 clang3.4:
121 122 containerImage: silkeh/clang:3.4
122 123 cli11.std: 11
... ...
include/CLI/App.hpp
... ... @@ -49,8 +49,11 @@ struct AppFriend;
49 49 } // namespace detail
50 50  
51 51 namespace FailureMessage {
52   -std::string simple(const App *app, const Error &e);
53   -std::string help(const App *app, const Error &e);
  52 +/// Printout a clean, simple message on error (the default in CLI11 1.5+)
  53 +CLI11_INLINE std::string simple(const App *app, const Error &e);
  54 +
  55 +/// Printout the full help string on error (if this fn is set, the old default for CLI11)
  56 +CLI11_INLINE std::string help(const App *app, const Error &e);
54 57 } // namespace FailureMessage
55 58  
56 59 /// enumeration of modes of how to deal with extras in config files
... ... @@ -1352,16 +1355,6 @@ CLI11_INLINE void retire_option(App *app, const std::string &amp;option_name);
1352 1355 /// Helper function to mark an option as retired
1353 1356 CLI11_INLINE void retire_option(App &app, const std::string &option_name);
1354 1357  
1355   -namespace FailureMessage {
1356   -
1357   -/// Printout a clean, simple message on error (the default in CLI11 1.5+)
1358   -CLI11_INLINE std::string simple(const App *app, const Error &e);
1359   -
1360   -/// Printout the full help string on error (if this fn is set, the old default for CLI11)
1361   -CLI11_INLINE std::string help(const App *app, const Error &e);
1362   -
1363   -} // namespace FailureMessage
1364   -
1365 1358 namespace detail {
1366 1359 /// This class is simply to allow tests access to App's protected functions
1367 1360 struct AppFriend {
... ...
src/CMakeLists.txt
... ... @@ -2,7 +2,6 @@ set(CLI11_headerLoc &quot;${PROJECT_SOURCE_DIR}/include/CLI&quot;)
2 2  
3 3 set(CLI11_headers
4 4 ${CLI11_headerLoc}/App.hpp
5   - ${CLI11_headerLoc}/CLI.hpp
6 5 ${CLI11_headerLoc}/Config.hpp
7 6 ${CLI11_headerLoc}/ConfigFwd.hpp
8 7 ${CLI11_headerLoc}/Error.hpp
... ... @@ -12,7 +11,6 @@ set(CLI11_headers
12 11 ${CLI11_headerLoc}/Option.hpp
13 12 ${CLI11_headerLoc}/Split.hpp
14 13 ${CLI11_headerLoc}/StringTools.hpp
15   - ${CLI11_headerLoc}/Timer.hpp
16 14 ${CLI11_headerLoc}/TypeTools.hpp
17 15 ${CLI11_headerLoc}/Validators.hpp
18 16 ${CLI11_headerLoc}/Version.hpp)
... ... @@ -28,10 +26,13 @@ set(CLI11_impl_headers
28 26 ${CLI11_implLoc}/StringTools_inl.hpp
29 27 ${CLI11_implLoc}/Validators_inl.hpp)
30 28  
  29 +set(CLI11_library_headers ${CLI11_headerLoc}/CLI.hpp ${CLI11_headerLoc}/Timer.hpp)
  30 +
31 31 if(CLI11_PRECOMPILED)
32 32 # Create static lib
33 33 file(GLOB CLI11_precompile_sources "${PROJECT_SOURCE_DIR}/src/*.cpp")
34   - add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_impl_headers} ${CLI11_precompile_sources})
  34 + add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_library_headers} ${CLI11_impl_headers}
  35 + ${CLI11_precompile_sources})
35 36 target_compile_definitions(CLI11 PUBLIC -DCLI11_COMPILE)
36 37  
37 38 set(PUBLIC_OR_INTERFACE PUBLIC)
... ... @@ -39,7 +40,7 @@ else()
39 40 add_library(CLI11 INTERFACE)
40 41 if(CMAKE_VERSION VERSION_GREATER 3.19)
41 42 # This is only useful for visual studio and other IDE builds
42   - target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_impl_headers})
  43 + target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_library_headers} ${CLI11_impl_headers})
43 44 endif()
44 45  
45 46 set(PUBLIC_OR_INTERFACE INTERFACE)
... ... @@ -112,7 +113,8 @@ if(CLI11_INSTALL)
112 113 # Make an export target
113 114 install(TARGETS CLI11 EXPORT CLI11Targets)
114 115 if(NOT CLI11_SINGLE_FILE)
115   - install(FILES ${CLI11_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI")
  116 + install(FILES ${CLI11_headers} ${CLI11_library_headers}
  117 + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI")
116 118 if(NOT CLI11_COMPILE)
117 119 install(FILES ${CLI11_impl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI/impl")
118 120 endif()
... ...