[tz] Building tz with gcc-13

Martin Jansa martin.jansa at gmail.com
Sat Mar 11 10:18:43 UTC 2023


Hello,

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

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 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?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mm.icann.org/pipermail/tz/attachments/20230311/992556b7/attachment.html>


More information about the tz mailing list