You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I updated Catch2 used in my project from some old Catch2v2 version to v3. When including Catch2 in my project tests through the CMake fetcher as a dependency, compiling the project with Clang (clang 17.0.6) does not issue any warnings, but compiling with GCC (g++ 13.3.0) issues a number of -Weffc++ and -W-ctod-dtor-privacy warnings.
I presume the code in Catch2 is supposed to behave as it does. Therefore, suppressing these warnings on a per-header file level should be the correct answer (or anything similar to this) to removing these warnings, while still allowing the users of Catch2 to include specific header files with the warnings set up for their tests source code.
I also managed to suppress the warnings on a per-project basis by setting the Catch2 library as a system library in CMake: (include inside the above-mentioned CMake code after the line include(Catch)):
Nevertheless, I think that the preferred approach would be to suppress these warnings on the Catch2 side once and for all (whichever approach is chosen), as opposed to forcing each user of Catch2 to suppress the warnings manually in their projects.
Description
I updated Catch2 used in my project from some old Catch2v2 version to v3. When including Catch2 in my project tests through the CMake fetcher as a dependency, compiling the project with Clang (clang 17.0.6) does not issue any warnings, but compiling with GCC (g++ 13.3.0) issues a number of
-Weffc++
and-W-ctod-dtor-privacy
warnings.I presume the code in Catch2 is supposed to behave as it does. Therefore, suppressing these warnings on a per-header file level should be the correct answer (or anything similar to this) to removing these warnings, while still allowing the users of Catch2 to include specific header files with the warnings set up for their tests source code.
Steps to reproduce
CMake snippet:
Tests source C++ file:
Additional context
Generated warnings:
user-defined <some class>::operator ... always evaluates both arguments
,all member functions in class <some class> are private
,<some class> has pointer data members ... but does not declare ...
,Log of the build process: warnings.txt.
Suggested alternative
There are a number of options to suppress these warnings.
Manually, each user can disable the warnings for each test source file, for example by wrapping the includes of Catch2 headers in pragmas:
I also managed to suppress the warnings on a per-project basis by setting the Catch2 library as a system library in CMake: (include inside the above-mentioned CMake code after the line
include(Catch)
):Nevertheless, I think that the preferred approach would be to suppress these warnings on the Catch2 side once and for all (whichever approach is chosen), as opposed to forcing each user of Catch2 to suppress the warnings manually in their projects.
Related issues
#208
#407
The text was updated successfully, but these errors were encountered: