bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / code / Atom feed
* Inline warnings in gl_xlist.h
@ 2021-07-21  8:34 Marc Nieper-Wißkirchen
  2021-07-21 17:55 ` Bruno Haible
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Nieper-Wißkirchen @ 2021-07-21  8:34 UTC (permalink / raw)
  To: bug-gnulib@gnu.org List

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

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."

Is there a way to suppress this warning using Gnulib or can the inline
functions of gl_xlist.h be implemented in a way so that this warning cannot
show up?

[-- Attachment #2: Type: text/html, Size: 598 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Inline warnings in gl_xlist.h
  2021-07-21  8:34 Inline warnings in gl_xlist.h Marc Nieper-Wißkirchen
@ 2021-07-21 17:55 ` Bruno Haible
  0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2021-07-21 17:55 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Marc Nieper-Wißkirchen

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-21 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21  8:34 Inline warnings in gl_xlist.h Marc Nieper-Wißkirchen
2021-07-21 17:55 ` Bruno Haible

Code repositories for project(s) associated with this inbox:

	../../../mirrors/gnulib.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).