[PATCH] D34002: [clang-tidy] When" -fno-exceptions is used", this warning is better to be suppressed.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 9 00:52:16 PDT 2017


alexfh added a comment.

In https://reviews.llvm.org/D34002#776551, @chh wrote:

> Android source is suppressing misc-noexcept-move-constructor warnings
>  because -fno-exceptions is used and Android does not like to add more
>  exception specific code.


As I've said, the lack of `noexcept` on move constructor of a type will make certain operations on STL containers of that type slower regardless of whether exceptions are turned on or off. `-fno-exceptions` will in no way help to recover the lost performance, so there's absolutely no reason to silence this check on the code that is otherwise not using exceptions.

Reverted in r305057.

> It's not a big deal for Android to suppress this check one way or the other.
>  I don't mind reverting it, just curious why a compiler cannot assume noexcept under -fno-exceptions.

One reason for compiler not to treat each function as `noexcept`, when compiled with `-fno-exceptions` is that it would make it hard to link this code together with code compiled with `-fexceptions` without causing ODR violations.


https://reviews.llvm.org/D34002





More information about the cfe-commits mailing list