musl/include/time.h, branch master musl - an implementation of the standard library for Linux-based systems define NULL as nullptr when used in C++11 or later 2021年11月29日T22:45:21+00:00 Ismael Luceno ismael@iodev.co.uk 2021年08月15日T15:51:57+00:00 98e688a9da5e7b2925dda17a2d6820dddf1fb287 This should be safer for casting and more compatible with existing code bases that wrongly assume it must be defined as a pointer.
This should be safer for casting and more compatible with existing code
bases that wrongly assume it must be defined as a pointer.
add time64 symbol name redirects to public headers, under arch control 2019年10月28日T23:26:52+00:00 Rich Felker dalias@aerifal.cx 2019年07月31日T19:24:58+00:00 1febd21d3fb7b78f6fc13e48b3ff2a396a607a15 a _REDIR_TIME64 macro is introduced, which the arch's alltypes.h is expected to define, to control redirection of symbol names for interfaces that involve time_t and derived types. this ensures that object files will only be linked to libc interfaces matching the ABI whose headers they were compiled against. along with time32 compat shims, which will be introduced separately, the redirection also makes it possible for a single libc (static or shared) to be used with object files produced with either the old (32-bit time_t) headers or the new ones after 64-bit time_t switchover takes place. mixing of such object files (or shared libraries) in the same program will also be possible, but must be done with care; ABI between libc and a consumer of the libc interfaces is guaranteed to match by the the symbol name redirection, but pairwise ABI between consumers of libc that define interfaces between each other in terms of time_t is not guaranteed to match. this change adds a dependency on an additional "GNU C" feature to the public headers for existing 32-bit archs, which is generally undesirable; however, the feature is one which glibc has depended on for a long time, and thus which any viable alternative compiler is going to need to provide. 64-bit archs are not affected, nor will future 32-bit archs be, regardless of whether they are "new" on the kernel side (e.g. riscv32) or just newly-added (e.g. a new sparc or xtensa port). the same applies to newly-added ABIs for existing machine-level archs.
a _REDIR_TIME64 macro is introduced, which the arch's alltypes.h is
expected to define, to control redirection of symbol names for
interfaces that involve time_t and derived types. this ensures that
object files will only be linked to libc interfaces matching the ABI
whose headers they were compiled against.
along with time32 compat shims, which will be introduced separately,
the redirection also makes it possible for a single libc (static or
shared) to be used with object files produced with either the old
(32-bit time_t) headers or the new ones after 64-bit time_t switchover
takes place. mixing of such object files (or shared libraries) in the
same program will also be possible, but must be done with care; ABI
between libc and a consumer of the libc interfaces is guaranteed to
match by the the symbol name redirection, but pairwise ABI between
consumers of libc that define interfaces between each other in terms
of time_t is not guaranteed to match.
this change adds a dependency on an additional "GNU C" feature to the
public headers for existing 32-bit archs, which is generally
undesirable; however, the feature is one which glibc has depended on
for a long time, and thus which any viable alternative compiler is
going to need to provide. 64-bit archs are not affected, nor will
future 32-bit archs be, regardless of whether they are "new" on the
kernel side (e.g. riscv32) or just newly-added (e.g. a new sparc or
xtensa port). the same applies to newly-added ABIs for existing
machine-level archs.
fix various header namespace issues under feature-test-macro control 2016年10月20日T21:20:01+00:00 Rich Felker dalias@aerifal.cx 2016年10月20日T21:20:01+00:00 7597fc25a2743d49500926a286da71f8e033936c reported and changes suggested by Daniel Sabogal.
reported and changes suggested by Daniel Sabogal.
make brace placement in public header struct definitions consistent 2016年07月03日T19:02:25+00:00 Rich Felker dalias@aerifal.cx 2016年07月03日T18:40:11+00:00 befa5866ee30d09c0c96e88af2eabff5911342ea placing the opening brace on the same line as the struct keyword/tag is the style I prefer and seems to be the prevailing practice in more recent additions. these changes were generated by the command: find include/ arch/*/bits -name '*.h' \ -exec sed -i '/^struct [^;{]*$/{N;s/\n/ /;}' {} + and subsequently checked by hand to ensure that the regex did not pick up any false positives.
placing the opening brace on the same line as the struct keyword/tag
is the style I prefer and seems to be the prevailing practice in more
recent additions.
these changes were generated by the command:
find include/ arch/*/bits -name '*.h' \
-exec sed -i '/^struct [^;{]*$/{N;s/\n/ /;}' {} +
and subsequently checked by hand to ensure that the regex did not pick
up any false positives.
fix places where _BSD_SOURCE failed to yield a superset of _XOPEN_SOURCE 2014年09月10日T16:27:33+00:00 Rich Felker dalias@aerifal.cx 2014年09月10日T16:27:33+00:00 ab8f6a6e42ff893041f7545a23e6d6a0edde07fb the vast majority of these failures seem to have been oversights at the time _BSD_SOURCE was added, or perhaps shortly afterward. the one which may have had some reason behind it is omission of setpgrp from the _BSD_SOURCE feature profile, since the standard setpgrp interface conflicts with a legacy (pre-POSIX) BSD interface by the same name. however, such omission is not aligned with our general policy in this area (for example, handling of similar _GNU_SOURCE cases) and should not be preserved.
the vast majority of these failures seem to have been oversights at
the time _BSD_SOURCE was added, or perhaps shortly afterward. the one
which may have had some reason behind it is omission of setpgrp from
the _BSD_SOURCE feature profile, since the standard setpgrp interface
conflicts with a legacy (pre-POSIX) BSD interface by the same name.
however, such omission is not aligned with our general policy in this
area (for example, handling of similar _GNU_SOURCE cases) and should
not be preserved.
add C11 timespec_get function, with associated time.h changes for C11 2014年09月06日T16:58:09+00:00 Rich Felker dalias@aerifal.cx 2014年09月06日T16:58:09+00:00 6eb19505bc10eb7964c4863e53ef1028944044f2 based on patch by Jens Gustedt for inclusion with C11 threads implementation, but committed separately since it's independent of threads.
based on patch by Jens Gustedt for inclusion with C11 threads
implementation, but committed separately since it's independent of
threads.
fix const-correctness of argument to stime 2014年01月07日T08:02:14+00:00 Rich Felker dalias@aerifal.cx 2014年01月07日T08:02:14+00:00 1d23b3c9136f606276142ec0037ff78fbb95e26d it's unclear what the historical signature for this function was, but semantically, the argument should be a pointer to const, and this is what glibc uses. correct programs should not be using this function anyway, so it's unlikely to matter.
it's unclear what the historical signature for this function was, but
semantically, the argument should be a pointer to const, and this is
what glibc uses. correct programs should not be using this function
anyway, so it's unlikely to matter.
restore type of NULL to void * except when used in C++ programs 2013年11月25日T02:42:55+00:00 Rich Felker dalias@aerifal.cx 2013年11月25日T02:42:55+00:00 c8a9c22173f485c8c053709e1dfa0a617cb6be1a unfortunately this eliminates the ability of the compiler to diagnose some dangerous/incorrect usage, but POSIX requires (as an extension to the C language, i.e. CX shaded) that NULL have type void *. plain C allows it to be defined as any null pointer constant. the definition 0L is preserved for C++ rather than reverting to plain 0 to avoid dangerous behavior in non-conforming programs which use NULL as a variadic sentinel. (it's impossible to use (void *)0 for C++ since C++ lacks the proper implicit pointer conversions, and other popular alternatives like the GCC __null extension seem non-conforming to the standard's requirements.)
unfortunately this eliminates the ability of the compiler to diagnose
some dangerous/incorrect usage, but POSIX requires (as an extension to
the C language, i.e. CX shaded) that NULL have type void *. plain C
allows it to be defined as any null pointer constant.
the definition 0L is preserved for C++ rather than reverting to plain
0 to avoid dangerous behavior in non-conforming programs which use
NULL as a variadic sentinel. (it's impossible to use (void *)0 for C++
since C++ lacks the proper implicit pointer conversions, and other
popular alternatives like the GCC __null extension seem non-conforming
to the standard's requirements.)
fix clockid macro names in time.h, reported by Paul Schutte 2013年10月07日T13:28:03+00:00 Szabolcs Nagy nsz@port70.net 2013年10月07日T13:28:03+00:00 551da2c1916e3166a0562ac6f2e76fd46781f3d7
add CLOCK_TAI (and CLOCK_SGI_CYCLE) clock ids to time.h 2013年07月24日T22:17:24+00:00 Szabolcs Nagy nsz@port70.net 2013年07月24日T21:29:17+00:00 d74e462a76d37ce10a048d3794ca89ca7d480ddb added in linux-v3.10 commit 1ff3c9677bff7e468e0c487d0ffefe4e901d33f4
added in linux-v3.10 commit 1ff3c9677bff7e468e0c487d0ffefe4e901d33f4

AltStyle によって変換されたページ (->オリジナル) /