On Tue, 3 Nov 2026, Richard Biener wrote: > Thanks for working on this. I wonder how one would practically > use this to audit code for the time_t issues without patching > glibc headers though? We're using a somewhat evolved variant > of the original prototype where it is just enabling a new -W flag. > > I suppose the most practical solution would be to indeed patch > glibc headers but gate the attribute with some preprocessor > conditional like _TIME_T_NO_IMPLICIT_TRUNCATION and > have that set?
The intended way to use this is to change glibc headers to use the attribute on time_t (possibly it's relevant for other types such as off_t as well, but time_t is the original motivating case). (I expect distribution builds will help establish the impact before proposing such a change to glibc, as well as showing up if there are common idioms for which the warning should be tuned.) If it's desired to have it available but disabled by default, either condition it in glibc headers as you suggest, or modify GCC locally to default to -Wno-conversion-attribute and then pass explicit -Wconversion-attribute to enable the warnings. -- Joseph S. Myers [email protected]
