[tz] make error

Brian Inglis Brian.Inglis at Shaw.ca
Thu Nov 16 21:33:25 UTC 2023


Nobody else admits to running such old compilers and systems! ;^>

I would reduce that test to:

#if __STDC_VERSION__ < 199901
# define restrict
#endif

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__ >= 199901L)
#   define C99
#  endif
#  if (__STDC_VERSION__ >= 201112L)
#   define C11
#  endif
#  if (__STDC_VERSION__ >= 201710L)
#   define C17
#  endif
#  if (__STDC_VERSION__ >= 202000L) /* TBD */
#   define C2X
#  endif
# endif
#endif

For updates see:

	$ info cpp macros predef standard

also:

https://en.wikipedia.org/wiki/Microsoft_Visual_C++#Internal_version_numbering

On 2023-11-16 12:58, Alois Treindl via tz wrote:
> I fixed it by adding after private.h line 558:
> 
> It now reads
> 
> #if (__STDC_VERSION__ < 199901 && !defined restrict \
>       && (PORT_TO_C89 || defined _MSC_VER))
> # define restrict
> #else
> # define restrict
> #endif
> 
> But I wonder why nobody stumbled upon this.
> 
> On 16.11.23 20:51, Alois Treindl via tz wrote:
>>
>> I just made a new clone of tz.
>>
>> I work normally on RHEL 7 (redhat enterprise Linux)
>> with gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
>>
>> When I say make or make all, I get something I never observed before:
>>
>> cc -DTZDIR='"/usr/share/zoneinfo"'    -c -o zic.o zic.c
>> In file included from zic.c:16:0:
>> private.h:791:60: error: conflicting types for ‘restrict’
>>  struct tm *localtime_rz(timezone_t restrict, time_t const *restrict,
>>                                                             ^
>> private.h:791:36: note: previous definition of ‘restrict’ was here
>>  struct tm *localtime_rz(timezone_t restrict, time_t const *restrict,
>>                                     ^
>> private.h:792:15: error: conflicting types for ‘restrict’
>>     struct tm *restrict);
>>                ^
>> private.h:791:60: note: previous definition of ‘restrict’ was here
>>  struct tm *localtime_rz(timezone_t restrict, time_t const *restrict,
>>                                                             ^
>> private.h:793:49: error: conflicting types for ‘restrict’
>>  time_t mktime_z(timezone_t restrict, struct tm *restrict);
>>                                                  ^
>> private.h:793:28: note: previous definition of ‘restrict’ was here
>>  time_t mktime_z(timezone_t restrict, struct tm *restrict);
>>
>>
>> This does not happen when I compile on RHEL 9
>> gcc version 11.4.1 20230605 (Red Hat 11.4.1-2) (GCC)
>>
>> Can anyone point me to a fix?
>>
>>
>>
>>
>>

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry




More information about the tz mailing list