[vlc-devel] [PATCH 6/6] vlc_threads: use VLC_ATTR to apply attributes

Rémi Denis-Courmont remi at remlab.net
Mon Feb 27 17:47:36 CET 2017


Le sunnuntaina 26. helmikuuta 2017, 21.55.53 EET Filip Roséen a écrit :
> Hi Rémi,
> 
> On 2017-02-26 22:27, Rémi Denis-Courmont wrote:
> > >  static
> > > 
> > > -__attribute__((unused))
> > > -__attribute__((noinline))
> > > -__attribute__((error("sorry, cannot sleep for such short a time")))
> > 
> > The noinline attribute is required to inhibit optimization and let this
> > function do its magic. And then the unused attribute is required to avoid
> > one warning for each compilation. Finally the error attribute is the very
> > essence of the function.
> 
> To be pedantic: the usage of `__attribute__((noinline))` does not make
> much sense together with `__attribute__((error("")))` as usage of the
> function shall result in a diagnostic, and there is therefor nothing
> to inline nor optimized away.

This si totally wrong but you will never let go, will you?

As I tried to explain, error and warning attributes will not work if the 
function is inlined. Function call attributes do not apply if the function is 
not called. This is how GCC decided to implement that GCC extension. Sure, it 
would be easier another way. But I do not get to decide how GCC designs and 
implements their extensions, and neither do you.

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list