[tz] make error
Guy Harris
gharris at sonic.net
Thu Nov 16 21:50:59 UTC 2023
On Nov 16, 2023, at 1:33 PM, Brian Inglis via tz <tz at iana.org> wrote:
> Nobody else admits to running such old compilers and systems! ;^>
>
> I would reduce that test to:
>
> #if __STDC_VERSION__ < 199901
> # define restrict
> #endif
Or perhaps
#if __STDC_VERSION__ < 199901 && !defined restrict
# define restrict
#endif
so as not to redefine it.
If that doesn't work, what is the environment Alois is using defining restrict as?
> In general for standards feature tests:
>
> #if defined(__STDC__)
> # define C89
> # if defined(__STDC_VERSION__)
> # define C90
> # if (__STDC_VERSION__ >= 199409L)
> # define C94
> # endif
...
> # if (__STDC_VERSION__ >= 202000L) /* TBD */
> # define C2X
> # endif
> # endif
> #endif
...and hope that the compiler doesn't define __STDC_VERSION__ for a particular version of the standard without implementing *all* of the compiler-implemented parts of the standard.
The *other* parts, implemented by header files and libraries, might also be a problem, e.g. installing a Shiny New GCC on a system where 1) the C library is provided by the operating system rather than the compiler and 2) the OS has an old library that, for example, doesn't support all the Shiny New Features of *printf formats. If the compiler claims Cnn support but the library only offers Cmm support, where mm is an earlier year than nn, relying on __STDC_VERSION__ won't work as a test for missing library features.
> For updates see:
>
> $ info cpp macros predef standard
$ info cpp macros predef standard
-bash: info: command not found
More information about the tz
mailing list