On 24/11/17 00:31, Paul Eggert wrote:
> Pádraig Brady wrote:
>> It's not introducing any new issue I think, but
>> seems to be triggering the compiler warning due
>> to tm_year being explicitly set?
> 
> Actually, I think it's pointing out an issue with the API. If the caller to 
> posixtime were to specify neither PDS_LEADING_YEAR nor PDS_TRAILING_YEAR, the 
> 'year' function would never get called, which means that tm0.tm_year would be 
> uninitialized.
> 
> No caller ever does that. In practice, PDS_LEADING_YEAR and PDS_TRAILING_YEAR 
> are mutually exclusive and one or the other should always be specified. This 
> suggests that there should be just a single bit in the API, not two bits. I 
> installed the attached patch, which changes the API accordingly, in a way 
> that I 
> think will not break any current callers. Does it pacify your GCC?

It does indeed since bitwise ops are not in all paths to initializing tm_year.

thanks!
Pádraig

Reply via email to