[vlc-devel] [vlc-commits] imem: fix warning

Rémi Denis-Courmont remi at remlab.net
Tue Jul 25 12:38:49 CEST 2017


Le 25 juillet 2017 12:27:38 GMT+03:00, Steve Lhomme <robux4 at gmail.com> a écrit :
>On Tue, Jul 25, 2017 at 10:37 AM, Rémi Denis-Courmont <remi at remlab.net>
>wrote:
>> Le 25 juillet 2017 10:06:00 GMT+03:00, Steve Lhomme
><robux4 at gmail.com> a
>> écrit :
>>>
>>> On Tue, Jul 25, 2017 at 8:07 AM, Tristan Matthews
><tmatth at videolan.org>
>>> wrote:
>>>>
>>>>  On Tue, Jul 25, 2017 at 1:34 AM, Steve Lhomme <robux4 at gmail.com>
>wrote:
>>>>>
>>>>>  On Mon, Jul 24, 2017 at 6:32 PM, Rémi Denis-Courmont
><git at videolan.org>
>>>>> wrote:
>>>>>>
>>>>>>  vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> |
>Mon Jul
>>>>>> 24 19:19:00 2017 +0300|
>[5efc79cf91cfb9b151e7e47de3a4f589116293df] |
>>>>>> committer: Rémi Denis-Courmont
>>>>>>
>>>>>>  imem: fix warning
>>>>>>
>>>>>>>
>>>>>>>
>http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5efc79cf91cfb9b151e7e47de3a4f589116293df
>>>>>>
>>>>>>  ---
>>>>>>
>>>>>>   modules/access/imem.c | 1 +
>>>>>>   1 file changed, 1 insertion(+)
>>>>>>
>>>>>>  diff --git a/modules/access/imem.c b/modules/access/imem.c
>>>>>>  index 08426eafde..09a74f1c15 100644
>>>>>>  --- a/modules/access/imem.c
>>>>>>  +++ b/modules/access/imem.c
>>>>>>  @@ -403,6 +403,7 @@ static inline int GetCategory(vlc_object_t
>>>>>> *object)
>>>>>>           return SPU_ES;
>>>>>>       default:
>>>>>>           msg_Err(object, "Invalid ES category");
>>>>>>  +        /* fall through */
>>>>>
>>>>>
>>>>>  How does adding a comment "fix a warning" ?
>>>>
>>>>
>>>>  See e.g., "-Wimplicit-fallthrough=3" in gcc-7. [1]
>>>
>>>
>>> So now rather than telling the compiler explicitly what we want, we
>>> let it guesstimate via comments ? That's very odd.
>>>
>>>>  Best,
>>>>  -t
>>>>
>>>>  [1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
>>>>
>>>>>
>>>>>>       case 4:
>>>>>>           return UNKNOWN_ES;
>>>>>>       }
>>>>>>
>>>>>> ________________________________
>>>>>>
>>>>>>  vlc-commits mailing list
>>>>>>  vlc-commits at videolan.org
>>>>>>  https://mailman.videolan.org/listinfo/vlc-commits
>>>>>
>>>>> ________________________________
>>>>>
>>>>>  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
>>
>>
>> This is a consequence of the ISO C++ push for annotating fall-through
>> explicitly. GCC now wants it also for existing C and C++.
>
>There is __attribute__((fallthrough)) for that. Other compilers might
>have other ways. But unlikely to look at comments.
>
>> --
>> Rémi Denis-Courmont
>> Typed on an inconvenient virtual keyboard
>>
>> _______________________________________________
>> 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

Attribute fall through is GCC-specific. Comments compile anywhere. Furthermore the commentd reflect an old defacto standard and are backward compatible with many preexistent instances that our code base had before GCC 7.

ISO C (not ++) probably won't have a proper way to deal with this anytime soon, so that's that.
-- 
Rémi Denis-Courmont
Typed on an inconvenient virtual keyboard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170725/ac22a5b9/attachment.html>


More information about the vlc-devel mailing list