Skip to content

Commit

Permalink
fix: some GCC warnings and update codecov (#813)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
phlptp and pre-commit-ci[bot] authored Dec 10, 2022
1 parent 71755e4 commit 75b19db
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ignore:
- "tests"
- "examples"
- "book"
- "docs"
- "test_package"
2 changes: 1 addition & 1 deletion .github/actions/quick_cmake/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
using: composite
steps:
- name: CMake ${{ inputs.cmake-version }}
uses: jwlawson/actions-setup-cmake@v1.12
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: "${{ inputs.cmake-version }}"
- run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ jobs:
- name: Prepare coverage
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' '*/book/*' --output-file coverage.info
lcov --list coverage.info
working-directory: build

- uses: codecov/codecov-action@v3
with:
files: build/coverage.info
fail_ci_if_error: true
working-directory: build
functionalities: fixes

clang-tidy:
name: Clang-Tidy
Expand Down Expand Up @@ -129,7 +130,7 @@ jobs:

cmake-config:
name: CMake config check
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ repos:
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs
- id: debug-statements

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.4
Expand Down
9 changes: 5 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ jobs:
gcc11:
containerImage: gcc:11
cli11.std: 20
gcc8:
containerImage: gcc:8
cli11.std: 17
cli11.options: -DCMAKE_CXX_FLAGS="-Wredundant-decls -Wconversion"
gcc7:
containerImage: gcc:7
cli11.std: 14
cli11.options: -DCMAKE_CXX_FLAGS="-Wconversion"
gcc4.8:
containerImage: helics/buildenv:gcc4-8-builder
cli11.std: 11
cli11.options:
clang3.4:
containerImage: silkeh/clang:3.4
cli11.std: 11
Expand Down
17 changes: 5 additions & 12 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ struct AppFriend;
} // namespace detail

namespace FailureMessage {
std::string simple(const App *app, const Error &e);
std::string help(const App *app, const Error &e);
/// Printout a clean, simple message on error (the default in CLI11 1.5+)
CLI11_INLINE std::string simple(const App *app, const Error &e);

/// Printout the full help string on error (if this fn is set, the old default for CLI11)
CLI11_INLINE std::string help(const App *app, const Error &e);
} // namespace FailureMessage

/// enumeration of modes of how to deal with extras in config files
Expand Down Expand Up @@ -1352,16 +1355,6 @@ CLI11_INLINE void retire_option(App *app, const std::string &option_name);
/// Helper function to mark an option as retired
CLI11_INLINE void retire_option(App &app, const std::string &option_name);

namespace FailureMessage {

/// Printout a clean, simple message on error (the default in CLI11 1.5+)
CLI11_INLINE std::string simple(const App *app, const Error &e);

/// Printout the full help string on error (if this fn is set, the old default for CLI11)
CLI11_INLINE std::string help(const App *app, const Error &e);

} // namespace FailureMessage

namespace detail {
/// This class is simply to allow tests access to App's protected functions
struct AppFriend {
Expand Down
12 changes: 7 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(CLI11_headerLoc "${PROJECT_SOURCE_DIR}/include/CLI")

set(CLI11_headers
${CLI11_headerLoc}/App.hpp
${CLI11_headerLoc}/CLI.hpp
${CLI11_headerLoc}/Config.hpp
${CLI11_headerLoc}/ConfigFwd.hpp
${CLI11_headerLoc}/Error.hpp
Expand All @@ -12,7 +11,6 @@ set(CLI11_headers
${CLI11_headerLoc}/Option.hpp
${CLI11_headerLoc}/Split.hpp
${CLI11_headerLoc}/StringTools.hpp
${CLI11_headerLoc}/Timer.hpp
${CLI11_headerLoc}/TypeTools.hpp
${CLI11_headerLoc}/Validators.hpp
${CLI11_headerLoc}/Version.hpp)
Expand All @@ -28,18 +26,21 @@ set(CLI11_impl_headers
${CLI11_implLoc}/StringTools_inl.hpp
${CLI11_implLoc}/Validators_inl.hpp)

set(CLI11_library_headers ${CLI11_headerLoc}/CLI.hpp ${CLI11_headerLoc}/Timer.hpp)

if(CLI11_PRECOMPILED)
# Create static lib
file(GLOB CLI11_precompile_sources "${PROJECT_SOURCE_DIR}/src/*.cpp")
add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_impl_headers} ${CLI11_precompile_sources})
add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_library_headers} ${CLI11_impl_headers}
${CLI11_precompile_sources})
target_compile_definitions(CLI11 PUBLIC -DCLI11_COMPILE)

set(PUBLIC_OR_INTERFACE PUBLIC)
else()
add_library(CLI11 INTERFACE)
if(CMAKE_VERSION VERSION_GREATER 3.19)
# This is only useful for visual studio and other IDE builds
target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_impl_headers})
target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_library_headers} ${CLI11_impl_headers})
endif()

set(PUBLIC_OR_INTERFACE INTERFACE)
Expand Down Expand Up @@ -112,7 +113,8 @@ if(CLI11_INSTALL)
# Make an export target
install(TARGETS CLI11 EXPORT CLI11Targets)
if(NOT CLI11_SINGLE_FILE)
install(FILES ${CLI11_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI")
install(FILES ${CLI11_headers} ${CLI11_library_headers}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI")
if(NOT CLI11_COMPILE)
install(FILES ${CLI11_impl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI/impl")
endif()
Expand Down

0 comments on commit 75b19db

Please sign in to comment.