diff options
author | redfish <redfish@galactica.pw> | 2016-07-05 01:21:02 +0000 |
---|---|---|
committer | redfish <redfish@galactica.pw> | 2016-07-22 18:08:33 -0400 |
commit | dca9fe175c3f91453e71a8012519fa07e3b7f646 (patch) | |
tree | 7bcd0230fad54594fa20b645cc7c8263156bff3d /src/platform | |
parent | Merge pull request #914 (diff) | |
download | monero-dca9fe175c3f91453e71a8012519fa07e3b7f646.tar.xz |
cmake: do not pass -Werror when building tests
The tests currently issue a warning that
"warning: -fassociative-math disabled; other options take precedence"
The associative math optimization is turned on indirectly by -Ofast.
Apparently, the optimization is forced to be disabled, while compiling
test harnesses generated by Google Test framework.
Unfortunately, there is no -Wno-error=* flag to disable this warning
(see gcc --help=warnings).
An alternative to this patch is to disable the optimization explicitly
with -fno-associative-math, but that seems worse.
Another alternative is to not pass -Ofast for tests build, but we
want the tests to be built with exact same optimization flags as
the code being tested, otherwise the value of the tests is diminished.
Another alternative is to remove -Werror from the entire build, but
it's good to include that flag to preclude people leaving warnings.
A note regarding implementation of not passing -Werror for tests:
I considered filtering out -Werror from CMAKE_{C,CXX}_FLAGS but
that seems to be worse because it's surprizing behavior, to those
reading the code that adds -Werror. It is better to add it for
when it is used and not added otherwise. I also considered relying
on order, adding -Werror after inluding 'tests' subdir, but before
including the other subdirs, but that also seems cryptic to the
reader. So, I settled with the current solution, of explicitly
setting CMAKE_{C,CXX}_FLAGS to different values before including the
respective subdir.
Testing done: compared compiler invocation for non-tests source files
using `make VERBOSE=1` with and without this commit: the only difference
is the position of -Werror. So, this commit doesn't change the binary.
Diffstat (limited to 'src/platform')
0 files changed, 0 insertions, 0 deletions