bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: "Marc Nieper-Wißkirchen" <marc.nieper+gnu@gmail.com>
Subject: Re: Inline warnings in gl_xlist.h
Date: Wed, 21 Jul 2021 19:55:51 +0200	[thread overview]
Message-ID: <2039192.4SuEsemZSP@omega> (raw)
In-Reply-To: <CAEYrNrTtFYj-B0qFFUZnMWWcBCoJhY1bN9dTeyVmtJRQ6rxjXA@mail.gmail.com>

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	other threads:[~2021-07-21 17:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  8:34 Inline warnings in gl_xlist.h Marc Nieper-Wißkirchen
2021-07-21 17:55 ` Bruno Haible [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2039192.4SuEsemZSP@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=marc.nieper+gnu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).