Catch2: Don't use -Werror in production

Created on 14 Jan 2018  路  9Comments  路  Source: catchorg/Catch2

Adding -Werror by default is very very bad idea, because it works fine only on one compiler, in future it might change. -Werror should be used only in CI.

Most helpful comment

@SoapGentoo Next week, I have several fixes I want to bring in before next release.

All 9 comments

What production? The released artefact for further consumption is single_include/catch.hpp and potentially the reporters in the same folder. Everything else is for development purposes.

There are people who package catch and they run cmake and that is failing on Fedora with

[ 71%] Building CXX object CMakeFiles/SelfTest.dir/include/internal/catch_tag_alias_autoregistrar.cpp.o
/usr/bin/c++   -I/home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/include  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic   -Wall -Wextra -Wunreachable-code -Werror -std=c++11 -o CMakeFiles/SelfTest.dir/include/internal/catch_tag_alias_autoregistrar.cpp.o -c /home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/include/internal/catch_tag_alias_autoregistrar.cpp
make[2]: Leaving directory '/home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/build'
/home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/include/internal/catch_commandline.cpp: In member function 'Catch::clara::detail::ParserResult Catch::clara::detail::BoundLambda<L>::setValue(const string&) [with L = Catch::makeCommandLineParser(Catch::ConfigData&)::<lambda(bool)>]':
/home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/include/internal/catch_commandline.cpp:138:67: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
             | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
                                                              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/include/internal/catch_clara.h:26:0,
                 from /home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/include/internal/catch_commandline.h:12,
                 from /home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/include/internal/catch_commandline.cpp:9:
/home/brain/Projects/fedora/rpms/catch/Catch2-2.1.0/include/internal/../external/clara.hpp:751:17: note: 'temp' was declared here
         ArgType temp;
                 ^~~~

So if I understand this correctly, you want to build the tests before packaging the single include header?

tests are run as part of build process ( packaging).

Some further changes towards making packaging easier are ongoing in #1150

@horenmar now that distributors can build Catch2 without -Werror,would it be possible for you to issue a patch release 2.1.1 so we can package it?

@SoapGentoo Next week, I have several fixes I want to bring in before next release.

The new version is out.

@horenmar thanks!

Was this page helpful?
0 / 5 - 0 ratings