bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] hash: pacify gcc -Wsuggest-attribute=const


From: Paul Eggert
Subject: Re: [PATCH] hash: pacify gcc -Wsuggest-attribute=const
Date: Sat, 20 May 2023 00:47:37 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 2023-05-19 05:12, Bruno Haible wrote:
These are global data flow properties, that "gcc -flto" can well exploit to
produce better code. But a function's declaration must remain valid
independently of the global data flow in the surrounding program.

So I guess _GL_ATTRIBUTE_CONST is fine there.
No, it's not fine. You proposed a patch to gnulib, not to coreutils.

Yes, and besides, it's not helpful for GCC to issue -Wsuggest-attribute diagnostics for static functions. If GCC has already figured out that the function is pure or const or whatever then that's good enough: GCC shouldn't badger the programmer to complicate the program to record something that GCC can easily calculate for itself.

This sounds like GCC bug 85734, which has been marked as fixed. Evidently it's rearing its ugly head again. We should fix the bug rather than pollute the code with compiler pacifications.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85734



reply via email to

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