about summary refs log tree commit diff
path: root/support/check.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-06-09 14:08:13 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-06-09 14:08:13 +0200
commit48bd8cda09535e2344a7969755d3fd87013f8f9f (patch)
tree91bf20d327f9f97c0249f4acde91baf8d3dfaf3c /support/check.h
parent6c85cc2852367ea2db91ff6a1fc0f6fc0653788d (diff)
downloadglibc-48bd8cda09535e2344a7969755d3fd87013f8f9f.tar.gz
glibc-48bd8cda09535e2344a7969755d3fd87013f8f9f.tar.xz
glibc-48bd8cda09535e2344a7969755d3fd87013f8f9f.zip
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).
Diffstat (limited to 'support/check.h')
-rw-r--r--support/check.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/support/check.h b/support/check.h
index 1d244a3557..bdcd12952a 100644
--- a/support/check.h
+++ b/support/check.h
@@ -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