[tz] USG_COMPAT and POSIX and XOPEN macros

Andras Farkas deepbluemistake at gmail.com
Sat Nov 23 08:33:24 UTC 2019

I've noticed that USG_COMPAT shouldn't be replaced by XOPEN macros
since it's clear USG_COMPAT is meant to be something users of tzcode
can toggle.

However, if someone has an application where they set _XOPEN_SOURCE to
700 or another value, I wonder if there should be something equivalent
to the following in private.h
#ifndef USG_COMPAT
#  define USG_COMPAT 0
# else
#  define USG_COMPAT 1
# endif
But using _XOPEN_SOURCE instead.  (while also retaining the block of
code using _XOPEN_VERSION too.  I think in cases where both macros are
involved, priority should be given to _XOPEN_SOURCE since it's
explicitly what an application programmer has asked for)

Right now, the code only reads _XOPEN_VERSION (from the OS) but not
_XOPEN_SOURCE (from the application)

This possibly could also apply to how only _POSIX_VERSION is currently
used, but not _POSIX_C_SOURCE (nor the obsolete _POSIX_SOURCE, but
that's been superseded for a long time now)

This topic originates in this thread:

More information about the tz mailing list