bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: "Marc Nieper-Wißkirchen" <marc.nieper+gnu@gmail.com>
To: Bruno Haible <bruno@clisp.org>
Cc: "Marc Nieper-Wißkirchen" <marc.nieper+gnu@gmail.com>, bug-gnulib@gnu.org
Subject: Re: Unused parameter warnings
Date: Sat, 10 Oct 2020 16:31:52 +0200	[thread overview]
Message-ID: <CAEYrNrSTnYcY-PiaVwN=UAOPpEg8+UvtL9SA+jeBs0jTyRQGWA@mail.gmail.com> (raw)
In-Reply-To: <2217733.79xrSNMHMn@omega>

I can ask for a better description of "pure" in the GCC manual. In any
case, if a function doesn't return at all due to a function call
marked with _Noreturn, it does not affect the observable state locally
and GCC can avoid "emitting some calls in repeated invocations of the
function with the same argument values". As I wrote before, this is an
important observation as otherwise "assert" couldn't be used in "pure"
functions.

Anyway, the function gl_linked_iterator_from_to in Gnulib should
probably be fixed independently by adding the "pure" attribute so that
the code is compilable with -Werror -Wall -Wextra.

Am Sa., 10. Okt. 2020 um 15:50 Uhr schrieb Bruno Haible <bruno@clisp.org>:
>
> Marc Nieper-Wißkirchen wrote:
> > > And a function that may invoke abort () does "affect observable state".
> >
> > This description of the a pure function does not seem to be accurate.
> > When a function calls another function like abort that is marked with
> > _Noreturn in a pure context, for the compiler the function can still
> > be pure (but not const). It can eliminate a second call to the
> > function with the same parameters. I am pretty sure that the warning
> > of GCC in line 938 is correct.
>
> The documentation of ATTRIBUTE_PURE in Gnulib is taken from the GCC
> documentation [1][2], therefore if you think it needs to be fixed, it's
> through a GCC bug report.
>
> Bruno
>
> [1] https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00105.html
> [2] https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Common-Function-Attributes.html
>


  reply	other threads:[~2020-10-10 14:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 20:23 Unused parameter warnings Marc Nieper-Wißkirchen
2020-10-04 22:08 ` Bruno Haible
2020-10-06  5:58   ` Marc Nieper-Wißkirchen
2020-10-06 21:05     ` Bruno Haible
2020-10-07  6:07       ` Marc Nieper-Wißkirchen
2020-10-10 13:50         ` Bruno Haible
2020-10-10 14:31           ` Marc Nieper-Wißkirchen [this message]
2020-10-10 14:39             ` Bruno Haible
2020-10-10 15:00               ` Marc Nieper-Wißkirchen
2020-10-10 18:50                 ` Paul Eggert
2020-10-10 21:00                   ` Bruno Haible
2020-10-11 23:10                     ` Paul Eggert
2020-10-12  2:21                       ` Jeffrey Walton
2020-10-14  1:24                     ` 'const' function attribute Bruno Haible
2020-10-14 14:57                       ` Paul Eggert
2020-10-18 14:27                         ` Bruno Haible
2020-10-10 20:43             ` Unused parameter warnings Bruno Haible

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='CAEYrNrSTnYcY-PiaVwN=UAOPpEg8+UvtL9SA+jeBs0jTyRQGWA@mail.gmail.com' \
    --to=marc.nieper+gnu@gmail.com \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /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).