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.



Reply via email to