Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


On 05/09/2016 10:54 AM, Caolán McNamara wrote:
Does the clang version we use for all the spiffy warnings support
-Wimplicit-fallthrough ?

I see firefox has a MOZ_FALLTHROUGH macro that expands
to [[clang::fallthrough]] for clang and just plain /*fall-through*/ for
everything else.

If we had support for something like that, and could rewrite all our
current /*fall-through*/ and //FALL_THROUGH etc comments to that macro,
then perhaps we could enable this warning by default and we wouldn't
see as many of these missing breaks getting missed until the next
coverity run as I've been seeing over the last few weeks.

Clang's -Wimplicit-fallthrough is quite old (at least available already back in Clang 3.2). But not enabled with -Wall/-Wextra, so somehow always fell through the cracks of getting enabled for our code base.

C++17 will have a standard [[fallthrough]] annotation, but for now we can #ifdef some SAL_FALLTHROUGH as [[clang::fallthrough]], for LIBO_INTERNAL_ONLY at least, in sal/types.h. Will take a look.

(IIRC, some static analysis tools use a heuristic of not warning about fall-through switches if there's any kind of comment directly before (or after?) the switch, but Clang's -Wimplicit-fallthrough needs an explicit [[fallthrough]]; annotation.)

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.