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