[tz] [PROPOSED] Remove old Y2K code

Ian Abbott abbotti at mev.co.uk
Wed Jun 14 10:11:07 UTC 2017

On 13/06/17 20:47, Paul.Koning at dell.com wrote:
>> On Jun 13, 2017, at 2:17 PM, Jonathan Lennox <lennox at cs.columbia.edu> wrote:
>> On Monday, June 12 2017, "Paul Eggert" wrote to "Brian.Inglis at SystematicSw.ab.ca, Time zone mailing list" saying:
>>> Perhaps you're right, I was too hasty. I brought back that code under
>>> the name you suggested, by installing the attached.
>>> +    Y2K runtime checks are no longer enabled by default.  Add
>>> +    -DDEPRECATE_TWO_DIGIT_YEARS to CFLAGS to enable them, instead of
>>> +    to disable them.  (New name suggested by Brian Inglis.)
>>> +
>> Since DEPRECATE_TWO_DIGIT_YEARS is used in an if statement, shouldn't this
>> be -DDEPRECATE_TWO_DIGIT_YEARS=true ?  Otherwise it expands to
>>    if ( && warn != IN_NONE ...
>> which obviously won't compile.
> Not so, because -DFOO is equivalent to -DFOO=1 .

Yes, although technically this is compiler (or precompiler) behavior, 
not part of any C standard (since it only concerns the language).

The comments for the '-D' options in Makefile mostly seem to follow the 
style of omitting the default '=1' (as it assumes POSIX style C compiler 
options are being used), except for the cases where '=1' is one of two 
or more documented values (for example, in the comments for 'HAVE_TZNAME').

Perhaps a note could be added to the comments in the Makefile to make it 
clear that it is assuming that '-DFOO' is equivalent to '-DFOO=1', and 
that '-DFOO=bar' defines a macro with the given replacement, although I 
guess anyone porting the Makefile and compiler options ought to have a 
passing acquaintance with POSIX conventions.

-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

More information about the tz mailing list