GNU bug report logs - #68267
[PATCH] maint: add attributes to two functions without side effects

Previous Next

Package: coreutils;

Reported by: Samuel Tardieu <sam <at> rfc1149.net>

Date: Fri, 5 Jan 2024 16:45:01 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 68267 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 68267 <at> debbugs.gnu.org, P <at> draigBrady.com, sam <at> rfc1149.net
Subject: Re: bug#68267: [PATCH] maint: add attributes to two functions without
 side effects
Date: Sat, 6 Jan 2024 08:34:22 -0800
On 2024-01-06 07:34, Pádraig Brady wrote:
> Though I'm not seeing this suggestion with GCC 13.2.1,
> so perhaps GCC 12 can determine the loops are finite?
> 
> I'll apply this since GCC 13 is less that a year old,
> but in general we try to avoid littering code like this.

I would not apply this, as it's a bug in GCC's warning code that has 
been fixed. There is no need to apply these attributes to static 
functions - as I understand it, with current GCC, either GCC figures out 
the attributes anyway (so no need for humans to do it) or it doesn't (so 
it doesn't know to warn). The attributes can help efficiency a bit with 
small extern functions, but with small static functions they're not 
worth the trouble.

More generally, we don't need to cater to older compilers simply to 
suppress false-positive warnings. We can simply tell users that they can 
either ignore the harmless warnings or upgrade to the current GCC.

Although there are some exceptions to this guideline (e.g., .h files 
that are intended to be used by other people) this doesn't seem to be 
one of them.




This bug report was last modified 1 year and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.