[vlc-devel] [PATCH 1/2] VLC_FALLTHROUGH macro to avoid unnecessary warnings

Steve Lhomme robux4 at ycbcr.xyz
Fri Mar 22 10:06:01 CET 2019


On 3/22/2019 9:36 AM, Awais Chishti wrote:
> Hi,
> Turns out a more portable way is to replace /* fallthrough */ with /* 
> fall through */.

We already use that in many places. I thought it allowed both variants. 
Did it change or was I wrong ?

> This should work will older versions of GCC and Clang as well.
> I'll send a different patch.
>
> On Fri, Mar 22, 2019 at 1:11 PM Awais Chishti 
> <chishtiawais511 at gmail.com <mailto:chishtiawais511 at gmail.com>> wrote:
>
>     I'll look into it right now. Thanks.
>
>     On Fri, Mar 22, 2019 at 1:09 PM Steve Lhomme <robux4 at ycbcr.xyz
>     <mailto:robux4 at ycbcr.xyz>> wrote:
>
>         Hi,
>
>          From a quick look it seems that this attribute was added in
>         gcc 7 but
>         we support older versions of gcc. So you need to check the gcc
>         version.
>
>         Also you may need to check if it works with Clang as well and
>         since what
>         version.
>
>         On 3/21/2019 8:10 PM, chishtiawais511 at gmail.com
>         <mailto:chishtiawais511 at gmail.com> wrote:
>         > From: Awais Chishti <chishtiawais511 at gmail.com
>         <mailto:chishtiawais511 at gmail.com>>
>         >
>         > ---
>         >   include/vlc_common.h | 13 +++++++++++++
>         >   1 file changed, 13 insertions(+)
>         >
>         > diff --git a/include/vlc_common.h b/include/vlc_common.h
>         > index 033c618677..f3eb10271a 100644
>         > --- a/include/vlc_common.h
>         > +++ b/include/vlc_common.h
>         > @@ -185,6 +185,19 @@
>         >   # define VLC_USED
>         >   #endif
>         >
>         > +/**
>         > + * Explicitly indicate fallthrough
>         > + *
>         > + * Use this macro as a replacement for //fallthrough
>         comments in switch blocks.
>         > + *
>         > + * This may disable inaccurate compiler warnings of
>         implicit fallthrough.
>         > + */
>         > +#ifdef __GNUC__
>         > +# define VLC_FALLTHROUGH __attribute__ ((fallthrough));
>         > +#else
>         > +# define VLC_FALLTHROUGH
>         > +#endif
>         > +
>         >   #if defined (__ELF__) || defined (__MACH__)
>         >   # define VLC_WEAK __attribute__((weak))
>         >   #else
>         > --
>         > 2.21.0
>         >
>         > _______________________________________________
>         > vlc-devel mailing list
>         > To unsubscribe or modify your subscription options:
>         > https://mailman.videolan.org/listinfo/vlc-devel
>
>         _______________________________________________
>         vlc-devel mailing list
>         To unsubscribe or modify your subscription options:
>         https://mailman.videolan.org/listinfo/vlc-devel
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list