On 2026-01-07 12:58 pm, Paul Eggert wrote:
On 2026-01-07 09:12, Christos Zoulas via tz wrote:
Hello,
The new tzcode uses static_assert() with no message which is a c2x extension. clang does not like that by default (without specifying - std=gnu2x).
/home/source/ab/HEAD-llvm/src/lib/libc/time/private.h:1017:52: error: '_Static_assert' with no message is a C2x extension [-Werror,-Wc2x- extensions] || TIME_T_MAX >> (TYPE_BIT(time_t) - 2) == 1); ^ , ""
Which clang? I'm not seeing that diagnostic with clang version 20.1.8 (Fedora 20.1.8-4.fc42).
clang-19.1.7
Also, that code appears on line 994 in upstream tzcode, whereas your diagnostic says line 1017. So I suppose you're using a modified private.h? The upstream private.h contains this:
Yes, it is slightly modified, but not in a way to affect this.
/* For pre-C23 compilers, a substitute for static_assert.
Some of these compilers may warn if it is used outside the top level. */ #if __STDC_VERSION__ < 202311 && !defined static_assert # define static_assert(cond) extern int static_assert_check[(cond) ? 1 : -1] #endif
so you might use 'clang -E' to see why that isn't working for you as it should.
The problem is that the static_assert macro is defined for pre-2023 compilers. It has been present in stdc11 and stdc17 IIRC. What is new in stdc2023, is that the message can be optional. I.e. prior to std2023, you needed static_assert(cond, message), with 2023 you can have static_assert(cond). This is what clang is complaining about when I am building using -std=gnu11: the missing message which was made optional in stdc2023. christos