Enabling warnings for library sources and tests but not for dependencies
Hi, I want to build at least the tests but better also the library sources itself with warnings enabled and warnings-as-errors to avoid regressions.
From BoostAssert I found the following snipped added to the top of test/Jamfile.v2:
project : requirements <warnings>pedantic <warnings-as-errors>on ; Further down I have a dependency on BoostFilesystem like: run test_stdio.cpp : : : <library>/boost/filesystem//boost_filesystem ; But now the build of BoostFilesystem fails: gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-5.4.0/release/cxxstd-11-iso/threading-multi/visibility-hidden/directory.o libs/filesystem/src/directory.cpp:217:48: error: unused parameter 'buffer' [-Werror=unused-parameter] Is there any way to restrict the warnings to my project only? Or at least the warnings-as-errors option? Is there a way to set warnings-as-errors via b2 command only for this library? This would avoid putting it in the Jamfile which could affect end-users, but having it on CI is actually enough. Alex
On Sun, Dec 15, 2019 at 7:21 AM Alexander Grund via Boost < boost@lists.boost.org> wrote:
Hi,
I want to build at least the tests but better also the library sources itself with warnings enabled and warnings-as-errors to avoid regressions.
From BoostAssert I found the following snipped added to the top of test/Jamfile.v2:
project : requirements <warnings>pedantic <warnings-as-errors>on ;
Further down I have a dependency on BoostFilesystem like:
run test_stdio.cpp : : : <library>/boost/filesystem//boost_filesystem ;
But now the build of BoostFilesystem fails:
gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-5.4.0/release/cxxstd-11-iso/threading-multi/visibility-hidden/directory.o libs/filesystem/src/directory.cpp:217:48: error: unused parameter 'buffer' [-Werror=unused-parameter]
Is there any way to restrict the warnings to my project only?
No, as warnings-as-error is a propagated feature.
Or at least the warnings-as-errors option?
You can instead depend on boost_filesystem sans error warns with: run test_stdio.cpp : : : <library>/boost/filesystem//boost_filesystem/<warnings-as-errors>off ;
Is there a way to set warnings-as-errors via b2 command only for this library? This would avoid putting it in the Jamfile which could affect end-users, but having it on CI is actually enough.
You can't selectively specify it in the CLI. It's going to be "global" at that point. I don't see how it can affect end-users if it's in the tests only. -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net
You can instead depend on boost_filesystem sans error warns with:
run test_stdio.cpp : : : <library>/boost/filesystem//boost_filesystem/<warnings-as-errors>off ;
Thanks this did work to some extent. But I'm still getting errors from other libs headers files included by my lib. Probably not much can to be done about that :-/ FTR: Errors are from e.g. - BOOST_DEFAULTED_FUNCTION(directory_iterator(directory_iterator const& that), : m_imp(that.m_imp) {}) -> unused param with c++11 and oldish g++ - locale/utf.hpp:224:17: error: this statement may fall through [-Werror=implicit-fallthrough=] on newer g++ (known issue, PR exists)
On Sun, Dec 15, 2019 at 11:17 AM Alexander Grund via Boost < boost@lists.boost.org> wrote:
You can instead depend on boost_filesystem sans error warns with:
run test_stdio.cpp : : : <library>/boost/filesystem//boost_filesystem/<warnings-as-errors>off ;
Thanks this did work to some extent. But I'm still getting errors from other libs headers files included by my lib. Probably not much can to be done about that :-/
If you can conceive of a compiler invocation that will let you have error warnings on your code but not any code your code happens to include then it can be done ;-) -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net
participants (2)
-
Alexander Grund
-
Rene Rivera