-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add cmake presets #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Break down build arguments into groups into their own CMake files. Same with linking arguments. Start building out CMakePresets. Remove CMakeSettings.
Move "included" files into the CMakePresets.json file since having the include block didn't work like I thought it would.
CMakePresets is now modified such that: - there are buildPresets that correspond to all configurationPresets, so the proper base native tool options are applied to all relevant configurations when running a build in VS or on the command line - issues are addressed - added descriptions/names where missing - made presets hidden where appropriate so they don't show up in the VS build configurations menu, and so they can't be referenced when the cmake tool is invoked on the command line Fixed an issue in BuildTypeHandling.cmake where when building with ClangCL for running clang-tidy on Windows with (or without) VS, it was selecting MSVC++ tool options instead of GCC/Clang tool options since it is indeed running an MSBuild build, but the underlying toolchain is ClangCL Added some whitespace where it seemed to make it easier to read. Added the following gcc/clang switches: -Wno-c++98-compat - Because there are C++11 and greater features that conflict with C++98 compatibility, but that's ok because the project is only intended to be built with C++11 or newer -Wno-c++98-compat-pedantic - Same reason as for Wno-c++98-compat -Wno-covered-switch-default - Clang was giving me some confusing results... keep the default: case in my switch, and it would output this from -Wcovered-switch-default: error : default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default] Then in rewriting it so there's no default: case but basically works the same way, Clang would output this from -Wswitch-default: error : 'switch' missing 'default' label [-Werror,-Wswitch-default] So I go look it up and find this gem on SE-SoftwareEngineering-design: https://lnkd.in/gg8d7U2T I opted for defensive programming, as I usually do, left the default: case in the switch, and added -Wno-covered-switch-default to my build. It seems like it's probably the most correct thing to do... at risk of having an extremely weird (read: improbable) situation where disabling this warning would cause me to miss a bug. I think it's more likely that there would be a bug as a result of not having a default case to handle erroneous values since enums in C/C++ are not strongly-typed (a la Java). I'm not using -Weverything, so I find it odd that there are clashes in warnings, but it was an interesting exercise to work through this issue. I would much rather have -Wswitch-default enabled, because that can catch some really nasty issues; this is just a weird pedantic annoyance, where the default: case is for "just in case" because of the lack of type checking, as I mentioned already. I did not find arguments on StackOverflow very compelling that argued against a default case when all known explicitly-defined cases are covered; since enums are value-based types, they can hold any value of the underlying type, which the compiler might or might not warn about/catch; the collection of known cases is typically a very tiny subset of the set of all possible values (4+ billion with the default underlying int type), so there should be an escape hatch for if the programmer knowningly or unknowingly ventures outside those explicitly-defined cases, where it would make sense to do so and a sensible default can be used or an error/exception can be generated, instead of just crashing the host application with no information about why there was a crash; I didn't want to use an assert because the values can change and are not tied explicitly to the symbols, so an assert could easily be broken.
Fixed documentation - wrong parameter name, @return on a constructor Fixed not explicitly specifying that the fail function never returns a value with [[noreturn]] even though it's void Fix problematic names of constants No need to have unsigned long long when std::chrono::nanoseconds. count() returns long long, as implicit conversions can cause unexpected problems.
Fix std::move being unqualified in a whole bunch of places; remove using std::move where it is no longer needed because std::move is supposed to be qualified. Specify explicitly that auto-destructors are not to be created and used with stream buffer and string stream pointers, because these "exit-destructors" can cause segfaults because the type destructor handles dismantling and destroying these unique_ptr objects. Refactoring problematic names of constants. Fixed missing EOF newlines. Fixed implicitly casting INT_MIN to unsigned.
Clang-Tidy configuration and .clang-tidy file: - Disable *-use-nullptr clang-tidy checks because they are broken on Windows in the Visual Studio 2022-provided Clang builds, as evidenced by the following issues I discovered in researching why clang-tidy was failing with an ACCESS_VIOLATION (0xc0000005) error: > https://developercommunity.visualstudio.com/t/clang-tidy-terminates-with-Exception-Cod/10822069?pageSize=15&sort=active&openOnly=false&closedOnly=false&topics=repos > llvm/llvm-project#53778 - Set FormatStyle to none so clang-tidy doesn't auto-format files, that is not what I want - Added HeaderFilterRegex that includes all headers, then added ExcludeHeaderFilterRegex to exclude the external headers (boost) - Added WarningsAsErrors * to treat all warnings as errors - Added SystemHeaders false so all system headers are excluded from analysis - Added ExtraArgs: > -Iinclude so library headers are discovered and included in analysis > -I3rdparty/include so boost headers are discovered and properly excluded from analysis - Now formatted as JSON so its format is more obvious without the weird opening/closing 3-character strings that indicate YAML but cause issues. Added hidden windows-specific presets that are intended to be inherited so the descendant presets will have the proper toolchain loaded; these are new to the presets here and have the toolchainFile property defined so as to load a toolchain from the cmake/toolchains location. There are ancestor toolchain presets defined for MSVC and ClangCL. ClangCL is only used for running clang-tidy analysis on Windows with the VS-packaged LLVM distribution. Split MSVC ancestor toolchain presets into stacktrace-enabled and no- stacktrace variants. Set CMAKE_SYSTEM_PROCESSOR so the toolchain scripts select the proper toolchain tools. Changed all VS-specific names, descriptions, and display names to be architecture-specific and also either Windows- or MSVC-specific, depending on context. Add CMAKE_C_FLAGS, CMAKE_CXX_FLAGS, and CMAKE_EXE_LINKER_FLAGS where appropriate and necessary, particularly where static code analysis is to be run. Fix nativeToolOptions since we're now using Ninja instead of MSBuild. Moved nativeToolOptions in code analysis buildPresets to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS in the corresponding configurePresets, because these are cl arguments, not MSBuild/Ninja arguments. Added buildPresets for clang-tidy configurePresets. Added an EOF newline. Added toolchain files since we're no longer using MSBuild, courtesy of https://github.com/MarkSchofield/WindowsToolchain, with some great CMake toolchain files; thank you @MarkSchofield; awesome work, they work wonderfully: - cmake/toolchains/VSWhere.cmake - cmake/toolchains/Windows.Clang.toolchain.cmake - cmake/toolchains/Windows.Kits.cmake - cmake/toolchains/Windows.MSVC.toolchain.cmake These are referenced through CMakePresets.json and are loaded such that the build has all the necessary tools. Fixed find_program for clang-tidy so it is now NO_CACHE. Fixed CLANG_TIDY_COMMAND such that it now uses the --config-file parameter, so all configurations are loaded through that instead of specified on the command line; added cache string description, and force-load the new value. Ignore the global-constructors warnings, as explained in the comment in the CMake files that define the GCC/Clang build flags for different configurations; this only applies to Clang until this issue gets resolved: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71482 Noted in GCCCoverage.cmake for if/when that ref issue gets resolved. Add /external:anglebrackets, /external:W0, and in the case where stacktraces are enabled /external:I3rdparty/include, so warnings in these external headers are ignored. Removed warning suppressions that are now unnecessary because warnings in external headers (boost, system headers) are now ignored thanks to the above CL parameters: - /wd4625 > Implicitly-deleted copy constructors. - /wd4626 > Implicitly-deleted copy assignment operators. - /wd4668 > Undefined preprocessor macros in the Windows SDK internal headers. - /wd5026 > Implicitly-deleted move constructors. - /wd5027 > Implicitly-deleted move assignment operators. - /wd5039 > Windows SDK functions that are passed to extern 'C' APIs that are not marked as noexcept. Added /nologo so if CMake doesn't configure the build to have it, it will be there. Added /Zi to the debug build ensuring all debug information is generated. /FS to avoid file locking issues. Added explicit exception handling enablement in MSVC to fix issues with noexcept generating warnings because there's no exception handling mode specified: /EHscr for Debug (adds noexcept runtime checks with the r), and /EHsc for Release (no runtime noexcept checks). Added runtime checks to Debug (/RTC1) so running the debug build can catch issues during testing or give more information if there's user code that is causing an issue inside the library. Make sure that if we are running an MSVC analysis build, and a ruleset file is explicitly selected, that we add the standard location for built-in ruleset files with /analyze:rulesetdirectory and the VS_INSTALLATION_PATH specified by the toolchain. CMake for some reason automatically adds /RTC1 to Release builds, which causes compilation to fail because /RTC1 and /O2 are incompatible, so the build generator now manually removes the RTC flags from release build compilation commands.
⚡ Static analysis result ⚡ 🔴 cppcheck found 20 issues! Click here to see details.TestCPP/include/internal/TestCPPAssertions.h Lines 78 to 83 in ac88b62
!Line: 78 - performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
TestCPP/include/internal/TestCPPAssertions.h Lines 109 to 114 in ac88b62
!Line: 109 - performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
TestCPP/include/internal/TestCPPAssertions.h Lines 136 to 141 in ac88b62
!Line: 136 - performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
TestCPP/include/internal/TestCPPAssertions.h Lines 163 to 168 in ac88b62
!Line: 163 - performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
TestCPP/src/TestCPPAssertions.cpp Lines 92 to 97 in ac88b62
!Line: 92 - performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
TestCPP/src/TestCPPAssertions.cpp Lines 107 to 112 in ac88b62
!Line: 107 - performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
TestCPP/src/TestCPPTestCase.cpp Lines 171 to 176 in ac88b62
!Line: 171 - error: Exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]
TestCPP/src/TestCPPTestCase.cpp Lines 262 to 267 in ac88b62
!Line: 262 - error: Exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]
TestCPP/src/TestCPPTestCase.cpp Lines 479 to 484 in ac88b62
!Line: 479 - performance: Function parameter 'against' should be passed by const reference. [passedByValue]
TestCPP/src/TestCPPTestCase.cpp Lines 484 to 489 in ac88b62
!Line: 484 - performance: Function parameter 'against' should be passed by const reference. [passedByValue]
TestCPP/src/TestCPPTestCase.cpp Lines 489 to 494 in ac88b62
!Line: 489 - performance: Function parameter 'against' should be passed by const reference. [passedByValue]
TestCPP/src/TestCPPTestCase.cpp Lines 494 to 499 in ac88b62
!Line: 494 - performance: Function parameter 'source' should be passed by const reference. [passedByValue]
TestCPP/src/TestCPPTestCase.cpp Lines 494 to 499 in ac88b62
!Line: 494 - performance: Function parameter 'against' should be passed by const reference. [passedByValue]
TestCPP/src/TestCPPTestCase.cpp Lines 145 to 150 in ac88b62
!Line: 145 - style: Parameter 'o' can be declared as reference to const [constParameterReference]
TestCPP/src/TestCPPTestCase.cpp Lines 234 to 239 in ac88b62
!Line: 234 - style: Parameter 'rhs' can be declared as reference to const [constParameterReference]
TestCPP/src/TestCPPTestCase.cpp Lines 292 to 297 in ac88b62
!Line: 292 - style: Parameter 'reason' can be declared as reference to const [constParameterReference]
TestCPP/include/internal/TestCPPTestSuite.h Lines 80 to 85 in ac88b62
!Line: 80 - warning: Member variable 'TestSuite::lastRunSucceeded' is not initialized in the constructor. [uninitMemberVar]
TestCPP/include/internal/TestCPPTestSuite.h Lines 80 to 85 in ac88b62
!Line: 80 - warning: Member variable 'TestSuite::lastRunSuccessCount' is not initialized in the constructor. [uninitMemberVar]
TestCPP/include/internal/TestCPPTestSuite.h Lines 80 to 85 in ac88b62
!Line: 80 - warning: Member variable 'TestSuite::lastRunFailCount' is not initialized in the constructor. [uninitMemberVar]
TestCPP/include/internal/TestCPPTestSuite.h Lines 80 to 85 in ac88b62
!Line: 80 - warning: Member variable 'TestSuite::totalRuntime' is not initialized in the constructor. [uninitMemberVar]
🔴 clang-tidy found 157 issues! Click here to see details.Lines 4 to 9 in ac88b62
!Line: 4 - error: unknown key 'ExcludeHeaderFilterRegex'
TestCPP/src/TestCPPExceptions.cpp Lines 36 to 41 in ac88b62
!Line: 36 - warning: using decl 'clog' is unused [misc-unused-using-decls]
!Line: 36 - note: remove the using TestCPP/src/TestCPPExceptions.cpp Lines 37 to 42 in ac88b62
!Line: 37 - warning: no header providing "std::string" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPExceptions.cpp Lines 38 to 43 in ac88b62
!Line: 38 - warning: no header providing "std::runtime_error" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPExceptions.cpp Lines 50 to 55 in ac88b62
!Line: 50 - warning: passing result of std::move() as a const reference argument; no move will actually happen [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPExceptions.cpp Lines 50 to 55 in ac88b62
!Line: 50 - warning: no header providing "std::move" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 30 to 35 in ac88b62
!Line: 30 - warning: no header providing "std::clog" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 31 to 36 in ac88b62
!Line: 31 - warning: no header providing "std::current_exception" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 33 to 38 in ac88b62
!Line: 33 - warning: no header providing "std::exception" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 34 to 39 in ac88b62
!Line: 34 - warning: no header providing "std::__exception_ptr::exception_ptr" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 36 to 41 in ac88b62
!Line: 36 - warning: no header providing "std::rethrow_exception" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 37 to 42 in ac88b62
!Line: 37 - warning: no header providing "std::string" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 38 to 43 in ac88b62
!Line: 38 - warning: no header providing "std::stringstream" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 43 to 48 in ac88b62
!Line: 43 - warning: the parameter 'shouldThrow' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
TestCPP/src/TestCPPAssertions.cpp Lines 51 to 56 in ac88b62
!Line: 51 - warning: variable 'eptr' of type 'exception_ptr' can be declared 'const' [misc-const-correctness]
TestCPP/src/TestCPPAssertions.cpp Lines 60 to 65 in ac88b62
!Line: 60 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPAssertions.cpp Lines 64 to 69 in ac88b62
!Line: 64 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPAssertions.cpp Lines 74 to 79 in ac88b62
!Line: 74 - warning: no header providing "std::move" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPAssertions.cpp Lines 78 to 83 in ac88b62
!Line: 78 - warning: the parameter 'shouldNotThrow' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
TestCPP/src/TestCPPAssertions.cpp Lines 92 to 97 in ac88b62
!Line: 92 - warning: the parameter 'failureMessage' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
TestCPP/src/TestCPPAssertions.cpp Lines 98 to 103 in ac88b62
!Line: 98 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPAssertions.cpp Lines 99 to 104 in ac88b62
!Line: 99 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPAssertions.cpp Lines 107 to 112 in ac88b62
!Line: 107 - warning: the parameter 'failureMessage' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
TestCPP/src/TestCPPAssertions.cpp Lines 113 to 118 in ac88b62
!Line: 113 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPAssertions.cpp Lines 114 to 119 in ac88b62
!Line: 114 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
Lines 51 to 56 in ac88b62
!Line: 51 - warning: implicit conversion 'const char *' -> 'bool' [readability-implicit-bool-conversion]
Lines 59 to 64 in ac88b62
!Line: 59 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
Lines 63 to 68 in ac88b62
!Line: 63 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
Lines 64 to 69 in ac88b62
!Line: 64 - warning: parameter name 's' is too short, expected at least 3 characters [readability-identifier-length]
Lines 78 to 83 in ac88b62
!Line: 78 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
Lines 83 to 88 in ac88b62
!Line: 83 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
Lines 89 to 94 in ac88b62
!Line: 89 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestSuite.cpp Lines 36 to 41 in ac88b62
!Line: 36 - warning: no header providing "std::cerr" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 37 to 42 in ac88b62
!Line: 37 - warning: no header providing "std::clog" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 38 to 43 in ac88b62
!Line: 38 - warning: using decl 'cout' is unused [misc-unused-using-decls]
!Line: 38 - note: remove the using TestCPP/src/TestCPPTestSuite.cpp Lines 40 to 45 in ac88b62
!Line: 40 - warning: no header providing "std::exception" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 41 to 46 in ac88b62
!Line: 41 - warning: no header providing "std::fixed" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 43 to 48 in ac88b62
!Line: 43 - warning: using decl 'invalid_argument' is unused [misc-unused-using-decls]
!Line: 43 - note: remove the using TestCPP/src/TestCPPTestSuite.cpp Lines 44 to 49 in ac88b62
!Line: 44 - warning: no header providing "std::ostream" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 45 to 50 in ac88b62
!Line: 45 - warning: no header providing "std::rethrow_exception" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 45 to 50 in ac88b62
!Line: 45 - warning: using decl 'rethrow_exception' is unused [misc-unused-using-decls]
!Line: 45 - note: remove the using TestCPP/src/TestCPPTestSuite.cpp Lines 46 to 51 in ac88b62
!Line: 46 - warning: no header providing "std::runtime_error" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 46 to 51 in ac88b62
!Line: 46 - warning: using decl 'runtime_error' is unused [misc-unused-using-decls]
!Line: 46 - note: remove the using TestCPP/src/TestCPPTestSuite.cpp Lines 48 to 53 in ac88b62
!Line: 48 - warning: no header providing "std::string" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 69 to 74 in ac88b62
!Line: 69 - warning: no header providing "TestCPP::TestObjName" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 70 to 75 in ac88b62
!Line: 70 - warning: no header providing "std::move" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestSuite.cpp Lines 73 to 78 in ac88b62
!Line: 73 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestSuite.cpp Lines 73 to 78 in ac88b62
!Line: 73 - warning: method 'getLastRunFailCount' can be made const [readability-make-member-function-const]
TestCPP/src/TestCPPTestSuite.cpp Lines 78 to 83 in ac88b62
!Line: 78 - warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
TestCPP/src/TestCPPTestSuite.cpp Lines 79 to 84 in ac88b62
!Line: 79 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 88 to 93 in ac88b62
!Line: 88 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 91 to 96 in ac88b62
!Line: 91 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 92 to 97 in ac88b62
!Line: 92 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 101 to 106 in ac88b62
!Line: 101 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 105 to 110 in ac88b62
!Line: 105 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 122 to 127 in ac88b62
!Line: 122 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 128 to 133 in ac88b62
!Line: 128 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 131 to 136 in ac88b62
!Line: 131 - warning: variable 'suiteRuntimeElapsed' of type 'double' can be declared 'const' [misc-const-correctness]
TestCPP/src/TestCPPTestSuite.cpp Lines 142 to 147 in ac88b62
!Line: 142 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestSuite.cpp Lines 151 to 156 in ac88b62
!Line: 151 - warning: rvalue reference parameter 'test' is never moved from inside the function body [cppcoreguidelines-rvalue-reference-param-not-moved]
TestCPP/src/TestCPPTestSuite.cpp Lines 164 to 169 in ac88b62
!Line: 164 - warning: rvalue reference parameter 'test' is never moved from inside the function body [cppcoreguidelines-rvalue-reference-param-not-moved]
TestCPP/include/internal/TestCPPTestCase.h Lines 131 to 136 in ac88b62
!Line: 131 - warning: function 'TestCPP::TestCase::TestCase' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
!Line: 114 - note: the definition seen here
!Line: 131 - note: differing parameters are named here: ('testPassedMessage'), in definition: ('msg') TestCPP/include/internal/TestCPPTestCase.h Lines 299 to 304 in ac88b62
!Line: 299 - warning: function 'TestCPP::TestCase::logTestFailure' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
!Line: 304 - note: the definition seen here
!Line: 299 - note: differing parameters are named here: ('failureMessage'), in definition: ('reason') TestCPP/src/TestCPPTestCase.cpp Lines 45 to 50 in ac88b62
!Line: 45 - warning: no header providing "std::cerr" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 46 to 51 in ac88b62
!Line: 46 - warning: no header providing "std::clog" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 47 to 52 in ac88b62
!Line: 47 - warning: no header providing "std::cout" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 49 to 54 in ac88b62
!Line: 49 - warning: no header providing "std::exception" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 50 to 55 in ac88b62
!Line: 50 - warning: no header providing "std::fixed" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 52 to 57 in ac88b62
!Line: 52 - warning: using decl 'invalid_argument' is unused [misc-unused-using-decls]
!Line: 52 - note: remove the using TestCPP/src/TestCPPTestCase.cpp Lines 53 to 58 in ac88b62
!Line: 53 - warning: no header providing "std::rethrow_exception" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 53 to 58 in ac88b62
!Line: 53 - warning: using decl 'rethrow_exception' is unused [misc-unused-using-decls]
!Line: 53 - note: remove the using TestCPP/src/TestCPPTestCase.cpp Lines 54 to 59 in ac88b62
!Line: 54 - warning: no header providing "std::runtime_error" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 54 to 59 in ac88b62
!Line: 54 - warning: using decl 'runtime_error' is unused [misc-unused-using-decls]
!Line: 54 - note: remove the using TestCPP/src/TestCPPTestCase.cpp Lines 56 to 61 in ac88b62
!Line: 56 - warning: no header providing "std::string" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 57 to 62 in ac88b62
!Line: 57 - warning: using decl 'tuple' is unused [misc-unused-using-decls]
!Line: 57 - note: remove the using TestCPP/src/TestCPPTestCase.cpp Lines 64 to 69 in ac88b62
!Line: 64 - warning: no header providing "atomic_int" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 72 to 77 in ac88b62
!Line: 72 - warning: initialization of 'stdoutBuffer' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
!Line: 109 - note: possibly throwing constructor declared here TestCPP/src/TestCPPTestCase.cpp Lines 79 to 84 in ac88b62
!Line: 79 - warning: initialization of 'clogBuffer' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
!Line: 109 - note: possibly throwing constructor declared here TestCPP/src/TestCPPTestCase.cpp Lines 86 to 91 in ac88b62
!Line: 86 - warning: initialization of 'stderrBuffer' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
!Line: 109 - note: possibly throwing constructor declared here TestCPP/src/TestCPPTestCase.cpp Lines 93 to 98 in ac88b62
!Line: 93 - warning: initialization of 'stdoutOriginal' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
!Line: 109 - note: possibly throwing constructor declared here TestCPP/src/TestCPPTestCase.cpp Lines 100 to 105 in ac88b62
!Line: 100 - warning: initialization of 'clogOriginal' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
!Line: 109 - note: possibly throwing constructor declared here TestCPP/src/TestCPPTestCase.cpp Lines 107 to 112 in ac88b62
!Line: 107 - warning: initialization of 'stderrOriginal' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
!Line: 109 - note: possibly throwing constructor declared here TestCPP/src/TestCPPTestCase.cpp Lines 114 to 119 in ac88b62
!Line: 114 - warning: rvalue reference parameter 'name' is never moved from inside the function body [cppcoreguidelines-rvalue-reference-param-not-moved]
TestCPP/src/TestCPPTestCase.cpp Lines 121 to 126 in ac88b62
!Line: 121 - warning: 'notifyTestPassed' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 122 to 127 in ac88b62
!Line: 122 - warning: 'test' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 122 to 127 in ac88b62
!Line: 122 - warning: parameter 'testFn' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
TestCPP/src/TestCPPTestCase.cpp Lines 124 to 129 in ac88b62
!Line: 124 - warning: 'testName' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 145 to 150 in ac88b62
!Line: 145 - warning: parameter name 'o' is too short, expected at least 3 characters [readability-identifier-length]
TestCPP/src/TestCPPTestCase.cpp Lines 149 to 154 in ac88b62
!Line: 149 - warning: 'pass' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 150 to 155 in ac88b62
!Line: 150 - warning: 'lastRunTime' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 152 to 157 in ac88b62
!Line: 152 - warning: 'stdoutCaptured' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 153 to 158 in ac88b62
!Line: 153 - warning: 'clogCaptured' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 154 to 159 in ac88b62
!Line: 154 - warning: 'stderrCaptured' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 170 to 175 in ac88b62
!Line: 170 - warning: an exception may be thrown in function 'TestCase' which should not throw exceptions [bugprone-exception-escape]
TestCPP/src/TestCPPTestCase.cpp Lines 170 to 175 in ac88b62
!Line: 170 - warning: parameter name 'o' is too short, expected at least 3 characters [readability-identifier-length]
TestCPP/src/TestCPPTestCase.cpp Lines 171 to 176 in ac88b62
!Line: 171 - warning: std::move of the expression of the trivially-copyable type 'TestCaseOutCompareOptions' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 171 to 176 in ac88b62
!Line: 171 - warning: no header providing "std::move" is directly included [misc-include-cleaner]
TestCPP/src/TestCPPTestCase.cpp Lines 172 to 177 in ac88b62
!Line: 172 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 174 to 179 in ac88b62
!Line: 174 - warning: 'pass' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 174 to 179 in ac88b62
!Line: 174 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 175 to 180 in ac88b62
!Line: 175 - warning: 'lastRunTime' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 175 to 180 in ac88b62
!Line: 175 - warning: std::move of the expression of the trivially-copyable type 'long long' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 177 to 182 in ac88b62
!Line: 177 - warning: 'stdoutCaptured' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 177 to 182 in ac88b62
!Line: 177 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 178 to 183 in ac88b62
!Line: 178 - warning: 'clogCaptured' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 178 to 183 in ac88b62
!Line: 178 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 179 to 184 in ac88b62
!Line: 179 - warning: 'stderrCaptured' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
TestCPP/src/TestCPPTestCase.cpp Lines 179 to 184 in ac88b62
!Line: 179 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 202 to 207 in ac88b62
!Line: 202 - warning: deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
!Line: 71 - note: variable declared here TestCPP/src/TestCPPTestCase.cpp Lines 214 to 219 in ac88b62
!Line: 214 - warning: deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
!Line: 78 - note: variable declared here TestCPP/src/TestCPPTestCase.cpp Lines 226 to 231 in ac88b62
!Line: 226 - warning: deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
!Line: 85 - note: variable declared here TestCPP/src/TestCPPTestCase.cpp Lines 234 to 239 in ac88b62
!Line: 234 - warning: operator=() should take 'TestCase const&', 'TestCase&&' or 'TestCase' [cppcoreguidelines-c-copy-assignment-signature,misc-unconventional-assign-operator]
TestCPP/src/TestCPPTestCase.cpp Lines 234 to 239 in ac88b62
!Line: 234 - warning: operator=() does not handle self-assignment properly [cert-oop54-cpp]
TestCPP/src/TestCPPTestCase.cpp Lines 234 to 239 in ac88b62
!Line: 234 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestCase.cpp Lines 261 to 266 in ac88b62
!Line: 261 - warning: an exception may be thrown in function 'operator=' which should not throw exceptions [bugprone-exception-escape]
TestCPP/src/TestCPPTestCase.cpp Lines 261 to 266 in ac88b62
!Line: 261 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestCase.cpp Lines 262 to 267 in ac88b62
!Line: 262 - warning: std::move of the expression of the trivially-copyable type 'TestCaseOutCompareOptions' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 263 to 268 in ac88b62
!Line: 263 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 265 to 270 in ac88b62
!Line: 265 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 266 to 271 in ac88b62
!Line: 266 - warning: std::move of the expression of the trivially-copyable type 'long long' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 268 to 273 in ac88b62
!Line: 268 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 269 to 274 in ac88b62
!Line: 269 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 270 to 275 in ac88b62
!Line: 270 - warning: std::move of the expression of the trivially-copyable type 'bool' has no effect; remove std::move() [hicpp-move-const-arg,performance-move-const-arg]
TestCPP/src/TestCPPTestCase.cpp Lines 288 to 293 in ac88b62
!Line: 288 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestCase.cpp Lines 300 to 305 in ac88b62
!Line: 300 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestCase.cpp Lines 301 to 306 in ac88b62
!Line: 301 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestCase.cpp Lines 307 to 312 in ac88b62
!Line: 307 - warning: static member accessed through instance [readability-static-accessed-through-instance]
TestCPP/src/TestCPPTestCase.cpp Lines 309 to 314 in ac88b62
!Line: 309 - warning: static member accessed through instance [readability-static-accessed-through-instance]
TestCPP/src/TestCPPTestCase.cpp Lines 318 to 323 in ac88b62
!Line: 318 - warning: static member accessed through instance [readability-static-accessed-through-instance]
TestCPP/src/TestCPPTestCase.cpp Lines 326 to 331 in ac88b62
!Line: 326 - warning: the value returned by this function should not be disregarded; neglecting it may lead to errors [bugprone-unused-return-value]
TestCPP/src/TestCPPTestCase.cpp Lines 331 to 336 in ac88b62
!Line: 331 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestCase.cpp Lines 341 to 346 in ac88b62
!Line: 341 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestCase.cpp Lines 346 to 351 in ac88b62
!Line: 346 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestCase.cpp Lines 375 to 380 in ac88b62
!Line: 375 - warning: method 'captureStdout' can be made static [readability-convert-member-functions-to-static]
TestCPP/src/TestCPPTestCase.cpp Lines 399 to 404 in ac88b62
!Line: 399 - warning: method 'captureClog' can be made static [readability-convert-member-functions-to-static]
TestCPP/src/TestCPPTestCase.cpp Lines 423 to 428 in ac88b62
!Line: 423 - warning: method 'captureStdErr' can be made static [readability-convert-member-functions-to-static]
TestCPP/src/TestCPPTestCase.cpp Lines 461 to 466 in ac88b62
!Line: 461 - warning: method 'clearStdoutCapture' can be made static [readability-convert-member-functions-to-static]
TestCPP/src/TestCPPTestCase.cpp Lines 467 to 472 in ac88b62
!Line: 467 - warning: method 'clearLogCapture' can be made static [readability-convert-member-functions-to-static]
TestCPP/src/TestCPPTestCase.cpp Lines 473 to 478 in ac88b62
!Line: 473 - warning: method 'clearStderrCapture' can be made static [readability-convert-member-functions-to-static]
TestCPP/src/TestCPPTestCase.cpp Lines 479 to 484 in ac88b62
!Line: 479 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestCase.cpp Lines 481 to 486 in ac88b62
!Line: 481 - warning: parameter 'against' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
TestCPP/src/TestCPPTestCase.cpp Lines 484 to 489 in ac88b62
!Line: 484 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestCase.cpp Lines 486 to 491 in ac88b62
!Line: 486 - warning: parameter 'against' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
TestCPP/src/TestCPPTestCase.cpp Lines 489 to 494 in ac88b62
!Line: 489 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestCase.cpp Lines 491 to 496 in ac88b62
!Line: 491 - warning: parameter 'against' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
TestCPP/src/TestCPPTestCase.cpp Lines 494 to 499 in ac88b62
!Line: 494 - warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TestCPP/src/TestCPPTestCase.cpp Lines 494 to 499 in ac88b62
!Line: 494 - warning: the parameter 'source' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
TestCPP/src/TestCPPTestCase.cpp Lines 494 to 499 in ac88b62
!Line: 494 - warning: the parameter 'against' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
TestCPP/src/TestCPPTestCase.cpp Lines 507 to 512 in ac88b62
!Line: 507 - warning: static member accessed through instance [readability-static-accessed-through-instance]
TestCPP/src/TestCPPTestCase.cpp Lines 508 to 513 in ac88b62
!Line: 508 - warning: static member accessed through instance [readability-static-accessed-through-instance]
TestCPP/src/TestCPPTestCase.cpp Lines 509 to 514 in ac88b62
!Line: 509 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestCase.cpp Lines 513 to 518 in ac88b62
!Line: 513 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestCase.cpp Lines 529 to 534 in ac88b62
!Line: 529 - warning: static member accessed through instance [readability-static-accessed-through-instance]
TestCPP/src/TestCPPTestCase.cpp Lines 530 to 535 in ac88b62
!Line: 530 - warning: static member accessed through instance [readability-static-accessed-through-instance]
TestCPP/src/TestCPPTestCase.cpp Lines 531 to 536 in ac88b62
!Line: 531 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestCase.cpp Lines 535 to 540 in ac88b62
!Line: 535 - warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]
TestCPP/src/TestCPPTestCase.cpp Lines 542 to 547 in ac88b62
!Line: 542 - warning: variable name 're' is too short, expected at least 3 characters [readability-identifier-length]
|
Add noexcept to constructors and operators that should not throw exceptions. Apply const to getLastRuntime function. Add no_destroy template type that replaces the clang::no_destroy attribute since it is not implemented in GCC or MSVC. There are some downsides, but they don't really bother me given the types it's applied to and the operations applied to those statics. For more info, see: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1247r0.html Applied some fixes based on this new level of indirection (calls to no_destroy::get).
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17 +/- ##
==========================================
+ Coverage 77.36% 77.46% +0.10%
==========================================
Files 19 19
Lines 561 568 +7
Branches 70 70
==========================================
+ Hits 434 440 +6
- Misses 110 111 +1
Partials 17 17 ☔ View full report in Codecov by Sentry. |
Closes #16