Opened 4 years ago
Closed 4 years ago
#13625 closed Bugs (fixed)
Boost.test fail to compile with -Werror=missing-declarations on some architectures
Reported by: | Owned by: | Raffi Enficiaud | |
---|---|---|---|
Milestone: | Boost 1.69 | Component: | test |
Version: | Boost 1.67.0 | Severity: | Problem |
Keywords: | Cc: | mquinson@… |
Description
Hello,
here is the error code we get:
18:07:49 In file included from /opt/boost/include/boost/test/unit_test.hpp:19:0, 18:07:49 from /builds/workspace/SimGrid-Multi/build_mode/ModelChecker/node/simgrid-centos7-x64/build/SimGrid-3.20.90/src/mc/sosp/PageStore_test.cpp:8: 18:07:49 /opt/boost/include/boost/test/unit_test_suite.hpp: In function 'bool init_unit_test()': 18:07:49 /opt/boost/include/boost/test/unit_test_suite.hpp:375:6: error: no previous declaration for 'bool init_unit_test()' [-Werror=missing-declarations] 18:07:49 bool init_unit_test() { 18:07:49 ^~~~~~~~~~~~~~ 18:07:49 cc1plus: all warnings being treated as errors
- System::
Centos7 with Boost 1.67 compiled from sources in /opt.
- Full logs::
- Workaround::
simply add
bool init_unit_test();
before including boost/test/unit_test.hpp
The weird thing is that the exact same code is compiling like a charm on many other platforms that we test. We saw another instance of this bug back in May 2017, on NetBSD systems where we compiled Boost.test from the sources. At that time, we simply added the workaround described above without too much thinking.
Thanks for this great libraries, Mt
Change History (5)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Owner: | changed from | to
---|
comment:3 by , 4 years ago
I checked the option -Werror=missing-declarations
on GCC and clang (apple). With GCC, nothing compiles and with clang everything works well.
I believe that enabling this option is a bit annoying as it renders legit C++ to be erroneous. What I can do instead is to add the declaration of init_unit_test
(and other variants) such that your code compiles.
Would that be ok?
comment:4 by , 4 years ago
I removed the warning from boost.test instead. See rev 972cdd4f367db2f4b3b67521b4259cfa8bf4ba1d
.
comment:5 by , 4 years ago
Milestone: | To Be Determined → Boost 1.69 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Hi,
I am trying to reproduce this. The header
that contains the definition of
bool init_unit_test();
is included at the top ofboost/test/unit_test.hpp
.I do not quite understand why you are experiencing this error. I do not have access to the logs you mentioned.