1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-11-30 11:41:39 +03:00
Files
glibc/timezone
Joseph Myers cd748a63ab Implement C23 const-preserving standard library macros
C23 makes various standard library functions, that return a pointer
into an input array, into macros that return a pointer to const when
the relevant argument passed to the macro is a pointer to const.  (The
requirement is for macros, with the existing function types applying
when macro expansion is suppressed.  When a null pointer constant is
passed, such as integer 0, that's the same as a pointer to non-const.)

Implement this feature.  This only applies to C, not C++, since such
macros are not an appropriate way of doing this for C++ and all the
affected functions other than bsearch have overloads to implement an
equivalent feature for C++ anyway.  Nothing is done to apply such a
change to any non-C23 functions with the same property of returning a
pointer into an input array.

The feature is also disabled when _LIBC is defined, since there are
various places in glibc that either redefine these identifiers as
macros, or define the functions themselves, and would need changing to
work in the presence of these macro definitions.  A natural question
is whether we should in fact change those places and not disable the
macro definitions for _LIBC.  If so, we'd need a solution for the
places in glibc that define the macro *before* including the relevant
header (in order in effect to disable the header declaration of the
function by renaming that declaration).

One testcase has #undef added to avoid conflicting with this feature
and another has const added; -Wno-discarded-qualifiers is added for
building zic (but could be removed once there's a new upstream tzcode
release that's const-safe with this C23 change and glibc has updated
to code from that new release).  Probably other places in glibc proper
would need const added if we remove the _LIBC conditionals.

Another question would be whether some GCC extension should be added
to support this feature better with macros that only expand each
argument once (as well as reducing duplication of diagnostics for bad
usages such as non-pointer and pointer-to-volatile-qualfied
arguments).

Tested for x86_64.
2025-11-20 19:31:04 +00:00
..
2024-09-05 20:57:17 +00:00
2020-01-09 23:00:25 -08:00
2024-09-05 20:57:17 +00:00
2024-09-05 20:57:17 +00:00
2024-04-07 13:35:48 -07:00
2024-09-05 20:57:17 +00:00

The files
	zic.c zdump.c tzfile.h private.h tzselect.ksh version
come from the tzcode package by Arthur David Olson et.al.
The 'version' file specifies which tzcode version was used.

The files
	africa antarctica asia australasia europe
	northamerica southamerica pacificnew etcetera factory
	backward systemv solar87 solar88 solar89
	iso3166.tab zone.tab leapseconds yearistype
come from the tzdata package by Arthur David Olson et.al.
except that its 'yearistype.sh' file is renamed to 'yearistype'.
These tzdata files were taken from tzdata 2009i and have not been
updated since, as they do not affect glibc installation and are
present only for regression testing.

Please also see: https://sourceware.org/glibc/wiki/SharedSourceFiles

These packages may be found at https://ftp.iana.org/tz/releases/.
Commentary should be addressed to tz@iana.org.

The subdirectory testdata contains manually edited data files for
regression testing purposes.