Hi Marc,

> When compiling my code with "-Winline", I suddenly get a warning from
> calling gl_list_add_last: "Call is unlikely and code size would grow."

'-Winline' is documented here: [1]

You asked the compiler "tell me when your heuristics have the effect that
the function is not inlined, as expected", and the compiler told you.

> or can the inline
> functions of gl_xlist.h be implemented in a way so that this warning cannot
> show up?

If we were to add an __attribute__ ((__always_inline__)) to the declaration
of 'gl_list_add_last', it would have the effect to override GCC's heuristics.
In other words, it would generate code that is worse than the code that
it generates by default. I don't find this desirable.

> Is there a way to suppress this warning using Gnulib

Well, just don't specify '-Winline', if you are not interested in the
nitty gritty details of the generated code.

The Gnulib module 'manywarnings' [2] helps you eliminate warning options that
produce clutter.

Bruno

[1] https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Warning-Options.html
[2] https://www.gnu.org/software/gnulib/manual/html_node/manywarnings.html


Reply via email to