[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inline warnings in gl_xlist.h

From: Bruno Haible
Subject: Re: Inline warnings in gl_xlist.h
Date: Wed, 21 Jul 2021 19:55:51 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; )

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.


[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

[Prev in Thread] Current Thread [Next in Thread]