mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 14:50:05 +00:00
support: Expose TEST_VERIFY_EXIT behavior to GCC optimizers
Previously, the implementation would conditionally exit based on the status argument, which GCC did not know about. This leads to false uninitialized variable warnings when data is accessed after a TEST_VERIFY_EXIT failure (from code which would never execute).
This commit is contained in:
parent
6c85cc2852
commit
48bd8cda09
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2017-06-09 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
Expose TEST_VERIFY_EXIT process termination to GCC optimizers.
|
||||
* support/support_test_verify_impl.c
|
||||
(support_test_verify_exit_impl): Split from
|
||||
support_test_verify_impl.
|
||||
* support/check.h (TEST_VERIFY): Drop status argument from
|
||||
support_test_verify_impl call.
|
||||
(TEST_VERIFY_EXIT): Call support_test_verify_exit_impl.
|
||||
(support_test_verify_impl): Remove status argument.
|
||||
(support_test_verify_exit_impl): Declare.
|
||||
|
||||
2017-06-09 Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
|
||||
* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h: Remove
|
||||
|
@ -51,7 +51,7 @@ __BEGIN_DECLS
|
||||
if (expr) \
|
||||
; \
|
||||
else \
|
||||
support_test_verify_impl (-1, __FILE__, __LINE__, #expr); \
|
||||
support_test_verify_impl (__FILE__, __LINE__, #expr); \
|
||||
})
|
||||
|
||||
/* Record a test failure and exit if EXPR evaluates to false. */
|
||||
@ -60,7 +60,8 @@ __BEGIN_DECLS
|
||||
if (expr) \
|
||||
; \
|
||||
else \
|
||||
support_test_verify_impl (1, __FILE__, __LINE__, #expr); \
|
||||
support_test_verify_exit_impl \
|
||||
(1, __FILE__, __LINE__, #expr); \
|
||||
})
|
||||
|
||||
int support_print_failure_impl (const char *file, int line,
|
||||
@ -70,8 +71,11 @@ void support_exit_failure_impl (int exit_status,
|
||||
const char *file, int line,
|
||||
const char *format, ...)
|
||||
__attribute__ ((noreturn, nonnull (2), format (printf, 4, 5)));
|
||||
void support_test_verify_impl (int status, const char *file, int line,
|
||||
void support_test_verify_impl (const char *file, int line,
|
||||
const char *expr);
|
||||
void support_test_verify_exit_impl (int status, const char *file, int line,
|
||||
const char *expr)
|
||||
__attribute__ ((noreturn));
|
||||
|
||||
/* Record a test failure. This function returns and does not
|
||||
terminate the process. The failure counter is stored in a shared
|
||||
|
@ -22,12 +22,16 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
support_test_verify_impl (int status, const char *file, int line,
|
||||
const char *expr)
|
||||
support_test_verify_impl (const char *file, int line, const char *expr)
|
||||
{
|
||||
support_record_failure ();
|
||||
printf ("error: %s:%d: not true: %s\n", file, line, expr);
|
||||
if (status >= 0)
|
||||
exit (status);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
support_test_verify_exit_impl (int status, const char *file, int line,
|
||||
const char *expr)
|
||||
{
|
||||
support_test_verify_impl (file, line, expr);
|
||||
exit (status);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user