On 2023-03-11 03:18, Martin Jansa via tz wrote:
I was building tz with gcc-13 and noticed that without explicit -std=c2x it fails to build 2022g version with: ``` zic.c:462:1: warning: ‘noreturn’ attribute ignored [-Wattributes] 462 | static ATTRIBUTE_NORETURN void | ^~~~~~ zic.c:462:27: error: expected identifier or ‘(’ before ‘void’ 462 | static ATTRIBUTE_NORETURN void | ^~~~ ```
The last code change on github in this are was: https://github.com/eggert/tz/commit/dbfcefe0c129e36e8c5acbcedf1400c1b486d962 <https://github.com/eggert/tz/commit/dbfcefe0c129e36e8c5acbcedf1400c1b486d962>
It builds fine for me with gcc-12 without -std: ``` __STDC_VERSION__ = 201710 __has_c_attribute(noreturn) = 0 ``` and with -std=c2x: ``` __STDC_VERSION__ = 202000 __has_c_attribute(noreturn) = 0 __STRICT_ANSI__ ```
but with gcc-13 it builds only with explicit -std=c2x: ``` __STDC_VERSION__ = 202000 __has_c_attribute(noreturn) = 202202 __STRICT_ANSI__ ```
Maybe because __has_c_attribute(noreturn) returns 202202 even when __STDC_VERSION__ doesn't accept it yet? ``` __STDC_VERSION__ = 201710 __has_c_attribute(noreturn) = 202202 ```
From https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf> it's not clear to me when exactly [[noreturn]] can be used. It says only this about the value `Drafting note: The value used for __has_c_attribute is a placeholder that is to be replaced by the editors with the year and month the proposal is accepted into the working draft.`
Is it a bug in gcc or should it be handled somehow by private.h? Does it build with -std=gnu2x - does it relax the order constraints?
-- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry