1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-10-27 12:15:39 +03:00
Files
glibc/support
Sam James a9944a52c9 malloc: add indirection for malloc(-like) functions in tests [BZ #32366]
GCC 15 introduces allocation dead code removal (DCE) for PR117370 in
r15-5255-g7828dc070510f8. This breaks various glibc tests which want
to assert various properties of the allocator without doing anything
obviously useful with the allocated memory.

Alexander Monakov rightly pointed out that we can and should do better
than passing -fno-malloc-dce to paper over the problem. Not least because
GCC 14 already does such DCE where there's no testing of malloc's return
value against NULL, and LLVM has such optimisations too.

Handle this by providing malloc (and friends) wrappers with a volatile
function pointer to obscure that we're calling malloc (et. al) from the
compiler.

Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2024-12-10 01:50:56 +00:00
..
2024-07-26 13:21:34 +01:00
2024-11-12 10:19:58 -05:00
2024-09-12 09:40:45 +02:00
2024-09-05 12:05:32 +02:00
2024-01-08 17:09:36 -03:00
2024-09-05 12:05:32 +02:00
2024-09-05 12:05:32 +02:00
2024-11-12 10:19:58 -05:00
2024-09-05 12:05:32 +02:00
2024-04-10 18:10:22 +02:00
2024-09-05 12:05:32 +02:00
2024-04-10 18:10:22 +02:00
2024-08-16 16:05:19 +02:00
2024-11-12 10:19:58 -05:00

This subdirectory contains infrastructure which is not put into
installed libraries, but may be linked into programs (installed or
not) and tests.

# Error-checking wrappers

These wrappers test for error return codes an terminate the process on
error.  They are declared in these header files:

* support.h
* xsignal.h
* xthread.h
* xtime.h

In general, new wrappers should be added to support.h if possible.
However, support.h must remain fully compatible with C90 and therefore
cannot include headers which use identifiers not reserved in C90.  If
the wrappers need additional types, additional headers such as
signal.h need to be introduced.

# Test framework

The test framework provides a main program for tests, including a
timeout for hanging tests.  See README-testing.c for a minimal
example, and test-driver.c for details how to use it.  The following
header files provide related declarations:

* check.h
* temp_file.h
* test-driver.h

For tests that make use of struct timespec, the following header files
contain additional macros and helper functions:

* timespec.h