* tests/macros.h (test_exit_status) [!NO_MAIN_HERE]:
Declare test_exit_status too, as this is simpler
and we might as well check definition vs declaration.
---
 ChangeLog      | 7 +++++++
 tests/macros.h | 3 +--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 09c5b008df..75792d4fe2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-05-18  Paul Eggert  <egg...@cs.ucla.edu>
+
+       tests: simplify test_exit_status decl
+       * tests/macros.h (test_exit_status) [!NO_MAIN_HERE]:
+       Declare test_exit_status too, as this is simpler
+       and we might as well check definition vs declaration.
+
 2025-05-18  Bruno Haible  <br...@clisp.org>
 
        unigbrk/u*-grapheme-prev: Support Indic, Emojis, regional indicators.
diff --git a/tests/macros.h b/tests/macros.h
index a6ac1c9f3b..e65d8ebdc9 100644
--- a/tests/macros.h
+++ b/tests/macros.h
@@ -56,9 +56,8 @@
    Set to EXIT_FAILURE when an ASSERT or ASSERT_NO_STDIO fails.  */
 /* To satisfy the "one definition rule", we define the variable in the
    compilation unit that contains the main() function.  */
-#ifdef NO_MAIN_HERE
 extern int volatile test_exit_status;
-#else
+#ifndef NO_MAIN_HERE
 int volatile test_exit_status = EXIT_SUCCESS;
 #endif
 
-- 
2.49.0


Reply via email to