bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Collin Funk <collin.funk1@gmail.com>
To: "bug-gnulib@gnu.org" <bug-gnulib@gnu.org>
Subject: Pacify -Wmissing-variable-declarations in unit tests.
Date: Sat, 27 Apr 2024 23:52:16 -0700	[thread overview]
Message-ID: <bb19c781-6785-43e9-89a9-5730676f4c4b@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

When building Coreutils I noticed that GCC 14's
-Wmissing-variable-declarations option spams the test output.

Can I apply the attached patch which adds the 'static' specifier to
global variables in unit tests?

Or would it be better to just disable the warning in tests? I'm used
to marking things static even in small single file programs, but maybe
others will forget the convention.

I think a few of the unistr, etc. tests also trigger this warning. I
left them unchanged since IIRC most are auto-generated.

Collin

[-- Attachment #2: 0001-Pacify-Wmissing-variable-declarations-in-unit-tests.patch --]
[-- Type: text/x-patch, Size: 99955 bytes --]

From a81727a18045c64b56f2bfd2cebbf61bb072f529 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Sat, 27 Apr 2024 23:37:38 -0700
Subject: [PATCH] Pacify -Wmissing-variable-declarations in unit tests.

* tests/jit/test-cache.c: Add a static specifier to global variables.
* tests/minus-zero.h: Likewise.
* tests/test-acos.c: Likewise.
* tests/test-acosf.c: Likewise.
* tests/test-acosl.c: Likewise.
* tests/test-alignasof.c: Likewise.
* tests/test-alignof.c: Likewise.
* tests/test-alloca-opt.c: Likewise.
* tests/test-argp-version-etc.c: Likewise.
* tests/test-argp.c: Likewise.
* tests/test-asin.c: Likewise.
* tests/test-asinf.c: Likewise.
* tests/test-asinl.c: Likewise.
* tests/test-asyncsafe-spin1.c: Likewise.
* tests/test-atan.c: Likewise.
* tests/test-atan2.c: Likewise.
* tests/test-atan2f.c: Likewise.
* tests/test-atanf.c: Likewise.
* tests/test-atanl.c: Likewise.
* tests/test-cbrt.h: Likewise.
* tests/test-copysign.c: Likewise.
* tests/test-copysignf.c: Likewise.
* tests/test-copysignl.c: Likewise.
* tests/test-cos.c: Likewise.
* tests/test-cosf.c: Likewise.
* tests/test-cosh.c: Likewise.
* tests/test-coshf.c: Likewise.
* tests/test-cosl.c: Likewise.
* tests/test-erf.c: Likewise.
* tests/test-erfc.c: Likewise.
* tests/test-errno.c: Likewise.
* tests/test-exclude.c: Likewise.
* tests/test-exp.h: Likewise.
* tests/test-exp2.h: Likewise.
* tests/test-expm1.h: Likewise.
* tests/test-fabs.h: Likewise.
* tests/test-fcntl-h.c: Likewise.
* tests/test-fenv.c: Likewise.
* tests/test-float.c: Likewise.
* tests/test-fma2.c: Likewise.
* tests/test-fmaf2.c: Likewise.
* tests/test-fmal2.c: Likewise.
* tests/test-fmod.h: Likewise.
* tests/test-fnmatch-h.c: Likewise.
* tests/test-gc-pbkdf2-sha1.c: Likewise.
* tests/test-gc-pbkdf2.c: Likewise.
* tests/test-get-rusage-as.c: Likewise.
* tests/test-get-rusage-data.c: Likewise.
* tests/test-getentropy.c: Likewise.
* tests/test-getrusage.c: Likewise.
* tests/test-glob-h.c: Likewise.
* tests/test-hypot.h: Likewise.
* tests/test-iconv-utf.c: Likewise.
* tests/test-ilogb.h: Likewise.
* tests/test-intprops.c: Likewise.
* tests/test-inttypes.c: Likewise.
* tests/test-isfinite.c: Likewise.
* tests/test-isinf.c: Likewise.
* tests/test-iswblank.c: Likewise.
* tests/test-j0.c: Likewise.
* tests/test-j1.c: Likewise.
* tests/test-jn.c: Likewise.
* tests/test-langinfo.c: Likewise.
* tests/test-lgamma.c: Likewise.
* tests/test-limits-h.c: Likewise.
* tests/test-locale.c: Likewise.
* tests/test-log.h: Likewise.
* tests/test-log10.h: Likewise.
* tests/test-log1p.h: Likewise.
* tests/test-log2.h: Likewise.
* tests/test-logb.h: Likewise.
* tests/test-malloca.c: Likewise.
* tests/test-modf.h: Likewise.
* tests/test-nan-1.c: Likewise.
* tests/test-nan-2.c: Likewise.
* tests/test-netdb.c: Likewise.
* tests/test-nextafter.c: Likewise.
* tests/test-noreturn.c: Likewise.
* tests/test-nullptr.c: Likewise.
* tests/test-pathmax.c: Likewise.
* tests/test-poll-h.c: Likewise.
* tests/test-pow.c: Likewise.
* tests/test-powf.c: Likewise.
* tests/test-pthread.c: Likewise.
* tests/test-remainder.h: Likewise.
* tests/test-sched.c: Likewise.
* tests/test-sethostname1.c: Likewise.
* tests/test-signal-h.c: Likewise.
* tests/test-signbit.c: Likewise.
* tests/test-sigpipe.c: Likewise.
* tests/test-sigsegv-catch-segv1.c: Likewise.
* tests/test-sigsegv-catch-segv2.c: Likewise.
* tests/test-sin.c: Likewise.
* tests/test-sinf.c: Likewise.
* tests/test-sinh.c: Likewise.
* tests/test-sinhf.c: Likewise.
* tests/test-sinl.c: Likewise.
* tests/test-snan-1.c: Likewise.
* tests/test-snan-2.c: Likewise.
* tests/test-spawn.c: Likewise.
* tests/test-sqrt.h: Likewise.
* tests/test-stdbool.c: Likewise.
* tests/test-stddef.c: Likewise.
* tests/test-stdint.c: Likewise.
* tests/test-stdio.c: Likewise.
* tests/test-string-buffer.c: Likewise.
* tests/test-sys_random.c: Likewise.
* tests/test-sys_resource.c: Likewise.
* tests/test-sys_select.c: Likewise.
* tests/test-sys_socket.c: Likewise.
* tests/test-sys_stat.c: Likewise.
* tests/test-sys_time.c: Likewise.
* tests/test-sys_types.c: Likewise.
* tests/test-sys_uio.c: Likewise.
* tests/test-sysexits.c: Likewise.
* tests/test-tan.c: Likewise.
* tests/test-tanf.c: Likewise.
* tests/test-tanh.c: Likewise.
* tests/test-tanhf.c: Likewise.
* tests/test-tanl.c: Likewise.
* tests/test-termios.c: Likewise.
* tests/test-thrd_current.c: Likewise.
* tests/test-thread_self.c: Likewise.
* tests/test-threads.c: Likewise.
* tests/test-time-h.c: Likewise.
* tests/test-uchar.c: Likewise.
* tests/test-unistd.c: Likewise.
* tests/test-utime-h.c: Likewise.
* tests/test-verify.c: Likewise.
* tests/test-wchar.c: Likewise.
* tests/test-wctype-h.c: Likewise.
* tests/test-y0.c: Likewise.
* tests/test-y1.c: Likewise.
* tests/test-yn.c: Likewise.
---
 ChangeLog                        | 138 +++++++++++++++++++++++++++
 tests/jit/test-cache.c           |  60 ++++++------
 tests/minus-zero.h               |   6 +-
 tests/test-acos.c                |   4 +-
 tests/test-acosf.c               |   4 +-
 tests/test-acosl.c               |   4 +-
 tests/test-alignasof.c           |   4 +-
 tests/test-alignof.c             |   4 +-
 tests/test-alloca-opt.c          |   2 +-
 tests/test-argp-version-etc.c    |   4 +-
 tests/test-argp.c                |  22 ++---
 tests/test-asin.c                |   4 +-
 tests/test-asinf.c               |   4 +-
 tests/test-asinl.c               |   4 +-
 tests/test-asyncsafe-spin1.c     |   2 +-
 tests/test-atan.c                |   4 +-
 tests/test-atan2.c               |   6 +-
 tests/test-atan2f.c              |   6 +-
 tests/test-atanf.c               |   4 +-
 tests/test-atanl.c               |   4 +-
 tests/test-cbrt.h                |   4 +-
 tests/test-copysign.c            |   8 +-
 tests/test-copysignf.c           |   8 +-
 tests/test-copysignl.c           |   8 +-
 tests/test-cos.c                 |   4 +-
 tests/test-cosf.c                |   4 +-
 tests/test-cosh.c                |   4 +-
 tests/test-coshf.c               |   4 +-
 tests/test-cosl.c                |   4 +-
 tests/test-erf.c                 |   4 +-
 tests/test-erfc.c                |   4 +-
 tests/test-errno.c               | 154 +++++++++++++++----------------
 tests/test-exclude.c             |   4 +-
 tests/test-exp.h                 |   4 +-
 tests/test-exp2.h                |   4 +-
 tests/test-expm1.h               |   4 +-
 tests/test-fabs.h                |   4 +-
 tests/test-fcntl-h.c             |  18 ++--
 tests/test-fenv.c                |   8 +-
 tests/test-float.c               |  18 ++--
 tests/test-fma2.c                |   6 +-
 tests/test-fmaf2.c               |   6 +-
 tests/test-fmal2.c               |   6 +-
 tests/test-fmod.h                |   6 +-
 tests/test-fnmatch-h.c           |   4 +-
 tests/test-gc-pbkdf2-sha1.c      |   2 +-
 tests/test-gc-pbkdf2.c           |   2 +-
 tests/test-get-rusage-as.c       |   4 +-
 tests/test-get-rusage-data.c     |   4 +-
 tests/test-getentropy.c          |   4 +-
 tests/test-getrusage.c           |   2 +-
 tests/test-glob-h.c              |   6 +-
 tests/test-hypot.h               |   6 +-
 tests/test-iconv-utf.c           |  10 +-
 tests/test-ilogb.h               |   4 +-
 tests/test-intprops.c            |   4 +-
 tests/test-inttypes.c            |   4 +-
 tests/test-isfinite.c            |   6 +-
 tests/test-isinf.c               |   6 +-
 tests/test-iswblank.c            |   2 +-
 tests/test-j0.c                  |   4 +-
 tests/test-j1.c                  |   4 +-
 tests/test-jn.c                  |   4 +-
 tests/test-langinfo.c            |   2 +-
 tests/test-lgamma.c              |   4 +-
 tests/test-limits-h.c            |  28 +++---
 tests/test-locale.c              |   6 +-
 tests/test-log.h                 |   4 +-
 tests/test-log10.h               |   4 +-
 tests/test-log1p.h               |   4 +-
 tests/test-log2.h                |   4 +-
 tests/test-logb.h                |   4 +-
 tests/test-malloca.c             |   2 +-
 tests/test-modf.h                |   6 +-
 tests/test-nan-1.c               |   6 +-
 tests/test-nan-2.c               |   6 +-
 tests/test-netdb.c               |   4 +-
 tests/test-nextafter.c           |   4 +-
 tests/test-noreturn.c            |   8 +-
 tests/test-nullptr.c             |   2 +-
 tests/test-pathmax.c             |   2 +-
 tests/test-poll-h.c              |   6 +-
 tests/test-pow.c                 |   6 +-
 tests/test-powf.c                |   6 +-
 tests/test-pthread.c             |  42 ++++-----
 tests/test-remainder.h           |   6 +-
 tests/test-sched.c               |   6 +-
 tests/test-sethostname1.c        |   2 +-
 tests/test-signal-h.c            |   4 +-
 tests/test-signbit.c             |   6 +-
 tests/test-sigpipe.c             |   2 +-
 tests/test-sigsegv-catch-segv1.c |   4 +-
 tests/test-sigsegv-catch-segv2.c |  10 +-
 tests/test-sin.c                 |   4 +-
 tests/test-sinf.c                |   4 +-
 tests/test-sinh.c                |   4 +-
 tests/test-sinhf.c               |   4 +-
 tests/test-sinl.c                |   4 +-
 tests/test-snan-1.c              |   6 +-
 tests/test-snan-2.c              |   6 +-
 tests/test-spawn.c               |   2 +-
 tests/test-sqrt.h                |   4 +-
 tests/test-stdbool.c             |  28 +++---
 tests/test-stddef.c              |   8 +-
 tests/test-stdint.c              |  56 +++++------
 tests/test-stdio.c               |  16 ++--
 tests/test-string-buffer.c       |   4 +-
 tests/test-sys_random.c          |   2 +-
 tests/test-sys_resource.c        |  24 ++---
 tests/test-sys_select.c          |   4 +-
 tests/test-sys_socket.c          |  12 +--
 tests/test-sys_stat.c            |  10 +-
 tests/test-sys_time.c            |   2 +-
 tests/test-sys_types.c           |  12 +--
 tests/test-sys_uio.c             |   6 +-
 tests/test-sysexits.c            |   2 +-
 tests/test-tan.c                 |   4 +-
 tests/test-tanf.c                |   4 +-
 tests/test-tanh.c                |   4 +-
 tests/test-tanhf.c               |   4 +-
 tests/test-tanl.c                |   4 +-
 tests/test-termios.c             |   2 +-
 tests/test-thrd_current.c        |   2 +-
 tests/test-thread_self.c         |   2 +-
 tests/test-threads.c             |   4 +-
 tests/test-time-h.c              |   6 +-
 tests/test-uchar.c               |  10 +-
 tests/test-unistd.c              |  20 ++--
 tests/test-utime-h.c             |   2 +-
 tests/test-verify.c              |   2 +-
 tests/test-wchar.c               |   4 +-
 tests/test-wctype-h.c            |   8 +-
 tests/test-y0.c                  |   4 +-
 tests/test-y1.c                  |   4 +-
 tests/test-yn.c                  |   4 +-
 135 files changed, 663 insertions(+), 525 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 185daab415..b486532916 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,141 @@
+2024-04-27  Collin Funk  <collin.funk1@gmail.com>
+
+	Pacify -Wmissing-variable-declarations in unit tests.
+	* tests/jit/test-cache.c: Add a static specifier to global variables.
+	* tests/minus-zero.h: Likewise.
+	* tests/test-acos.c: Likewise.
+	* tests/test-acosf.c: Likewise.
+	* tests/test-acosl.c: Likewise.
+	* tests/test-alignasof.c: Likewise.
+	* tests/test-alignof.c: Likewise.
+	* tests/test-alloca-opt.c: Likewise.
+	* tests/test-argp-version-etc.c: Likewise.
+	* tests/test-argp.c: Likewise.
+	* tests/test-asin.c: Likewise.
+	* tests/test-asinf.c: Likewise.
+	* tests/test-asinl.c: Likewise.
+	* tests/test-asyncsafe-spin1.c: Likewise.
+	* tests/test-atan.c: Likewise.
+	* tests/test-atan2.c: Likewise.
+	* tests/test-atan2f.c: Likewise.
+	* tests/test-atanf.c: Likewise.
+	* tests/test-atanl.c: Likewise.
+	* tests/test-cbrt.h: Likewise.
+	* tests/test-copysign.c: Likewise.
+	* tests/test-copysignf.c: Likewise.
+	* tests/test-copysignl.c: Likewise.
+	* tests/test-cos.c: Likewise.
+	* tests/test-cosf.c: Likewise.
+	* tests/test-cosh.c: Likewise.
+	* tests/test-coshf.c: Likewise.
+	* tests/test-cosl.c: Likewise.
+	* tests/test-erf.c: Likewise.
+	* tests/test-erfc.c: Likewise.
+	* tests/test-errno.c: Likewise.
+	* tests/test-exclude.c: Likewise.
+	* tests/test-exp.h: Likewise.
+	* tests/test-exp2.h: Likewise.
+	* tests/test-expm1.h: Likewise.
+	* tests/test-fabs.h: Likewise.
+	* tests/test-fcntl-h.c: Likewise.
+	* tests/test-fenv.c: Likewise.
+	* tests/test-float.c: Likewise.
+	* tests/test-fma2.c: Likewise.
+	* tests/test-fmaf2.c: Likewise.
+	* tests/test-fmal2.c: Likewise.
+	* tests/test-fmod.h: Likewise.
+	* tests/test-fnmatch-h.c: Likewise.
+	* tests/test-gc-pbkdf2-sha1.c: Likewise.
+	* tests/test-gc-pbkdf2.c: Likewise.
+	* tests/test-get-rusage-as.c: Likewise.
+	* tests/test-get-rusage-data.c: Likewise.
+	* tests/test-getentropy.c: Likewise.
+	* tests/test-getrusage.c: Likewise.
+	* tests/test-glob-h.c: Likewise.
+	* tests/test-hypot.h: Likewise.
+	* tests/test-iconv-utf.c: Likewise.
+	* tests/test-ilogb.h: Likewise.
+	* tests/test-intprops.c: Likewise.
+	* tests/test-inttypes.c: Likewise.
+	* tests/test-isfinite.c: Likewise.
+	* tests/test-isinf.c: Likewise.
+	* tests/test-iswblank.c: Likewise.
+	* tests/test-j0.c: Likewise.
+	* tests/test-j1.c: Likewise.
+	* tests/test-jn.c: Likewise.
+	* tests/test-langinfo.c: Likewise.
+	* tests/test-lgamma.c: Likewise.
+	* tests/test-limits-h.c: Likewise.
+	* tests/test-locale.c: Likewise.
+	* tests/test-log.h: Likewise.
+	* tests/test-log10.h: Likewise.
+	* tests/test-log1p.h: Likewise.
+	* tests/test-log2.h: Likewise.
+	* tests/test-logb.h: Likewise.
+	* tests/test-malloca.c: Likewise.
+	* tests/test-modf.h: Likewise.
+	* tests/test-nan-1.c: Likewise.
+	* tests/test-nan-2.c: Likewise.
+	* tests/test-netdb.c: Likewise.
+	* tests/test-nextafter.c: Likewise.
+	* tests/test-noreturn.c: Likewise.
+	* tests/test-nullptr.c: Likewise.
+	* tests/test-pathmax.c: Likewise.
+	* tests/test-poll-h.c: Likewise.
+	* tests/test-pow.c: Likewise.
+	* tests/test-powf.c: Likewise.
+	* tests/test-pthread.c: Likewise.
+	* tests/test-remainder.h: Likewise.
+	* tests/test-sched.c: Likewise.
+	* tests/test-sethostname1.c: Likewise.
+	* tests/test-signal-h.c: Likewise.
+	* tests/test-signbit.c: Likewise.
+	* tests/test-sigpipe.c: Likewise.
+	* tests/test-sigsegv-catch-segv1.c: Likewise.
+	* tests/test-sigsegv-catch-segv2.c: Likewise.
+	* tests/test-sin.c: Likewise.
+	* tests/test-sinf.c: Likewise.
+	* tests/test-sinh.c: Likewise.
+	* tests/test-sinhf.c: Likewise.
+	* tests/test-sinl.c: Likewise.
+	* tests/test-snan-1.c: Likewise.
+	* tests/test-snan-2.c: Likewise.
+	* tests/test-spawn.c: Likewise.
+	* tests/test-sqrt.h: Likewise.
+	* tests/test-stdbool.c: Likewise.
+	* tests/test-stddef.c: Likewise.
+	* tests/test-stdint.c: Likewise.
+	* tests/test-stdio.c: Likewise.
+	* tests/test-string-buffer.c: Likewise.
+	* tests/test-sys_random.c: Likewise.
+	* tests/test-sys_resource.c: Likewise.
+	* tests/test-sys_select.c: Likewise.
+	* tests/test-sys_socket.c: Likewise.
+	* tests/test-sys_stat.c: Likewise.
+	* tests/test-sys_time.c: Likewise.
+	* tests/test-sys_types.c: Likewise.
+	* tests/test-sys_uio.c: Likewise.
+	* tests/test-sysexits.c: Likewise.
+	* tests/test-tan.c: Likewise.
+	* tests/test-tanf.c: Likewise.
+	* tests/test-tanh.c: Likewise.
+	* tests/test-tanhf.c: Likewise.
+	* tests/test-tanl.c: Likewise.
+	* tests/test-termios.c: Likewise.
+	* tests/test-thrd_current.c: Likewise.
+	* tests/test-thread_self.c: Likewise.
+	* tests/test-threads.c: Likewise.
+	* tests/test-time-h.c: Likewise.
+	* tests/test-uchar.c: Likewise.
+	* tests/test-unistd.c: Likewise.
+	* tests/test-utime-h.c: Likewise.
+	* tests/test-verify.c: Likewise.
+	* tests/test-wchar.c: Likewise.
+	* tests/test-wctype-h.c: Likewise.
+	* tests/test-y0.c: Likewise.
+	* tests/test-y1.c: Likewise.
+	* tests/test-yn.c: Likewise.
+
 2024-04-27  Collin Funk  <collin.funk1@gmail.com>
 
 	gnulib-tool.py: Preserve module ordering in --create-megatestdir.
diff --git a/tests/jit/test-cache.c b/tests/jit/test-cache.c
index d19c720eb9..cd6ddef4d6 100644
--- a/tests/jit/test-cache.c
+++ b/tests/jit/test-cache.c
@@ -172,63 +172,63 @@ return2 (void)
  */
 
 #if defined __x86_64__ || defined __x86_64_x32__ || defined __i386__
-unsigned char const return1_code[] = { 0xb8,0x01,0x00,0x00,0x00, 0xc3 };
-unsigned char const return2_code[] = { 0xb8,0x02,0x00,0x00,0x00, 0xc3 };
+static unsigned char const return1_code[] = { 0xb8,0x01,0x00,0x00,0x00, 0xc3 };
+static unsigned char const return2_code[] = { 0xb8,0x02,0x00,0x00,0x00, 0xc3 };
 #endif
 #if defined __alpha__
-unsigned int const return1_code[] = { 0x201f0001, 0x6bfa8001 };
-unsigned int const return2_code[] = { 0x201f0002, 0x6bfa8001 };
+static unsigned int const return1_code[] = { 0x201f0001, 0x6bfa8001 };
+static unsigned int const return2_code[] = { 0x201f0002, 0x6bfa8001 };
 #endif
 #if defined __arm64__ || defined __arm64_ilp32__
-unsigned int const return1_code[] = { 0x52800020, 0xd65f03c0 };
-unsigned int const return2_code[] = { 0x52800040, 0xd65f03c0 };
+static unsigned int const return1_code[] = { 0x52800020, 0xd65f03c0 };
+static unsigned int const return2_code[] = { 0x52800040, 0xd65f03c0 };
 #elif defined __arm__ || defined __armhf__
-unsigned int const return1_code[] = { 0xe3a00001, 0xe1a0f00e };
-unsigned int const return2_code[] = { 0xe3a00002, 0xe1a0f00e };
+static unsigned int const return1_code[] = { 0xe3a00001, 0xe1a0f00e };
+static unsigned int const return2_code[] = { 0xe3a00002, 0xe1a0f00e };
 #endif
 #if defined __hppa64__
-unsigned int const return1_code[] = { 0xe840d000, 0x341c0002 };
-unsigned int const return2_code[] = { 0xe840d000, 0x341c0004 };
+static unsigned int const return1_code[] = { 0xe840d000, 0x341c0002 };
+static unsigned int const return2_code[] = { 0xe840d000, 0x341c0004 };
 #elif defined __hppa__
-unsigned int const return1_code[] = { 0xe840c000, 0x341c0002 };
-unsigned int const return2_code[] = { 0xe840c000, 0x341c0004 };
+static unsigned int const return1_code[] = { 0xe840c000, 0x341c0002 };
+static unsigned int const return2_code[] = { 0xe840c000, 0x341c0004 };
 #endif
 #if defined __ia64__ || defined __ia64_ilp32__
-unsigned char const return1_code[] =
+static unsigned char const return1_code[] =
   { 0x11,0x00,0x00,0x00,0x01,0x00,0x80,0x08,0x00,0x00,0x48,0x80,0x08,0x00,0x84,0x00 };
-unsigned char const return2_code[] =
+static unsigned char const return2_code[] =
   { 0x11,0x00,0x00,0x00,0x01,0x00,0x80,0x10,0x00,0x00,0x48,0x80,0x08,0x00,0x84,0x00 };
 #endif
 #if defined __loongarch64__
-unsigned int const return1_code[] = { 0x02800404, 0x4c000020 };
-unsigned int const return2_code[] = { 0x02800804, 0x4c000020 };
+static unsigned int const return1_code[] = { 0x02800404, 0x4c000020 };
+static unsigned int const return2_code[] = { 0x02800804, 0x4c000020 };
 #endif
 #if defined __m68k__
-unsigned short const return1_code[] = { 0x7001, 0x4e75 };
-unsigned short const return2_code[] = { 0x7002, 0x4e75 };
+static unsigned short const return1_code[] = { 0x7001, 0x4e75 };
+static unsigned short const return2_code[] = { 0x7002, 0x4e75 };
 #endif
 #if defined __mips64__ || defined __mipsn32__ || defined __mips__
-unsigned int const return1_code[] = { 0x03e00008, 0x24020001 };
-unsigned int const return2_code[] = { 0x03e00008, 0x24020002};
+static unsigned int const return1_code[] = { 0x03e00008, 0x24020001 };
+static unsigned int const return2_code[] = { 0x03e00008, 0x24020002};
 #endif
 #if defined __powerpc64__ || defined __powerpc64_elfv2__ || defined __powerpc__
-unsigned int const return1_code[] = { 0x38600001, 0x4e800020 };
-unsigned int const return2_code[] = { 0x38600002, 0x4e800020 };
+static unsigned int const return1_code[] = { 0x38600001, 0x4e800020 };
+static unsigned int const return2_code[] = { 0x38600002, 0x4e800020 };
 #endif
 #if defined __riscv64__ || defined __riscv32__
-unsigned short const return1_code[] = { 0x4505, 0x8082 };
-unsigned short const return2_code[] = { 0x4509, 0x8082 };
+static unsigned short const return1_code[] = { 0x4505, 0x8082 };
+static unsigned short const return2_code[] = { 0x4509, 0x8082 };
 #endif
 #if defined __s390x__
-unsigned short const return1_code[] = { 0xa729,0x0001, 0x07fe, 0x0707 };
-unsigned short const return2_code[] = { 0xa729,0x0002, 0x07fe, 0x0707 };
+static unsigned short const return1_code[] = { 0xa729,0x0001, 0x07fe, 0x0707 };
+static unsigned short const return2_code[] = { 0xa729,0x0002, 0x07fe, 0x0707 };
 #elif defined __s390__
-unsigned short const return1_code[] = { 0xa728,0x0001, 0x07fe, 0x0707 };
-unsigned short const return2_code[] = { 0xa728,0x0002, 0x07fe, 0x0707 };
+static unsigned short const return1_code[] = { 0xa728,0x0001, 0x07fe, 0x0707 };
+static unsigned short const return2_code[] = { 0xa728,0x0002, 0x07fe, 0x0707 };
 #endif
 #if defined __sparc64__ || defined __sparc__
-unsigned int const return1_code[] = { 0x81c3e008, 0x90102001 };
-unsigned int const return2_code[] = { 0x81c3e008, 0x90102002 };
+static unsigned int const return1_code[] = { 0x81c3e008, 0x90102001 };
+static unsigned int const return2_code[] = { 0x81c3e008, 0x90102002 };
 #endif
 
 int
diff --git a/tests/minus-zero.h b/tests/minus-zero.h
index 73a388f69e..4f9cf52e1a 100644
--- a/tests/minus-zero.h
+++ b/tests/minus-zero.h
@@ -33,7 +33,7 @@ compute_minus_zerof (void)
 }
 # define minus_zerof compute_minus_zerof ()
 #else
-float minus_zerof = -0.0f;
+static float minus_zerof = -0.0f;
 #endif
 
 
@@ -51,7 +51,7 @@ compute_minus_zerod (void)
 }
 # define minus_zerod compute_minus_zerod ()
 #else
-double minus_zerod = -0.0;
+static double minus_zerod = -0.0;
 #endif
 
 
@@ -70,5 +70,5 @@ compute_minus_zerol (void)
 }
 # define minus_zerol compute_minus_zerol ()
 #else
-long double minus_zerol = -0.0L;
+static long double minus_zerol = -0.0L;
 #endif
diff --git a/tests/test-acos.c b/tests/test-acos.c
index 5cd95d9e58..b94f9629b0 100644
--- a/tests/test-acos.c
+++ b/tests/test-acos.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (acos, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-acosf.c b/tests/test-acosf.c
index 861b5345d7..5b8f870a91 100644
--- a/tests/test-acosf.c
+++ b/tests/test-acosf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (acosf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-acosl.c b/tests/test-acosl.c
index 07325e4cd0..483a1bdc77 100644
--- a/tests/test-acosl.c
+++ b/tests/test-acosl.c
@@ -26,8 +26,8 @@ SIGNATURE_CHECK (acosl, long double, (long double));
 #include "fpucw.h"
 #include "macros.h"
 
-volatile long double x;
-long double y;
+static volatile long double x;
+static long double y;
 
 int
 main ()
diff --git a/tests/test-alignasof.c b/tests/test-alignasof.c
index 1cc75b0f3d..7dc1ef9aee 100644
--- a/tests/test-alignasof.c
+++ b/tests/test-alignasof.c
@@ -43,8 +43,8 @@ typedef struct { char a[4]; } struct4;
 #define CHECK_STATIC(type) \
   typedef struct { char slot1; type slot2; } type##_helper; \
   static_assert (alignof (type) == offsetof (type##_helper, slot2)); \
-  const int type##_alignment = alignof (type); \
-  type alignas (TEST_ALIGNMENT) static_##type##_alignas
+  static const int type##_alignment = alignof (type); \
+  static type alignas (TEST_ALIGNMENT) static_##type##_alignas
 
 #define CHECK_ALIGNED(var) ASSERT ((uintptr_t) &(var) % TEST_ALIGNMENT == 0)
 
diff --git a/tests/test-alignof.c b/tests/test-alignof.c
index 107b0e7f01..7badb39a8a 100644
--- a/tests/test-alignof.c
+++ b/tests/test-alignof.c
@@ -32,8 +32,8 @@ typedef struct { char a[4]; } struct4;
 #define CHECK(type) \
   typedef struct { char slot1; type slot2; } type##_helper; \
   static_assert (alignof_slot (type) == offsetof (type##_helper, slot2)); \
-  const int type##_slot_alignment = alignof_slot (type); \
-  const int type##_type_alignment = alignof_type (type);
+  static const int type##_slot_alignment = alignof_slot (type); \
+  static const int type##_type_alignment = alignof_type (type);
 
 CHECK (char)
 CHECK (short)
diff --git a/tests/test-alloca-opt.c b/tests/test-alloca-opt.c
index 3f20779c9e..3ac1fe0d92 100644
--- a/tests/test-alloca-opt.c
+++ b/tests/test-alloca-opt.c
@@ -29,7 +29,7 @@ do_allocation (int n)
   (void) ptr;
 }
 
-void (*func) (int) = do_allocation;
+static void (*func) (int) = do_allocation;
 
 #endif
 
diff --git a/tests/test-argp-version-etc.c b/tests/test-argp-version-etc.c
index 9c0cfa6a5f..565257d3f9 100644
--- a/tests/test-argp-version-etc.c
+++ b/tests/test-argp-version-etc.c
@@ -21,7 +21,7 @@
 
 static char doc[] = "test for the argp-version-etc module";
 
-struct argp test_argp =
+static struct argp test_argp =
 {
   NULL,
   NULL,
@@ -32,7 +32,7 @@ struct argp test_argp =
   NULL
 };
 
-const char *authors[] =
+static const char *authors[] =
 {
   "Sergey Poznyakoff",
   NULL
diff --git a/tests/test-argp.c b/tests/test-argp.c
index f74d753765..94a2bf2a14 100644
--- a/tests/test-argp.c
+++ b/tests/test-argp.c
@@ -80,12 +80,12 @@ group1_parser (int key, char *arg, struct argp_state *state)
   return 0;
 }
 
-struct argp group1_argp = {
+static struct argp group1_argp = {
   group1_option,
   group1_parser
 };
 
-struct argp_child group1_child = {
+static struct argp_child group1_child = {
   &group1_argp,
   0,
   "",
@@ -116,12 +116,12 @@ group1_1_parser (int key, char *arg, struct argp_state *state)
   return 0;
 }
 
-struct argp group1_1_argp = {
+static struct argp group1_1_argp = {
   group1_1_option,
   group1_1_parser
 };
 
-struct argp_child group1_1_child = {
+static struct argp_child group1_1_child = {
   &group1_1_argp,
   0,
   "",
@@ -162,12 +162,12 @@ group2_parser (int key, char *arg, struct argp_state *state)
   return 0;
 }
 
-struct argp group2_argp = {
+static struct argp group2_argp = {
   group2_option,
   group2_parser
 };
 
-struct argp_child group2_child = {
+static struct argp_child group2_child = {
   &group2_argp,
   0,
   "",
@@ -198,12 +198,12 @@ group2_1_parser (int key, char *arg, struct argp_state *state)
   return 0;
 }
 
-struct argp group2_1_argp = {
+static struct argp group2_1_argp = {
   group2_1_option,
   group2_1_parser
 };
 
-struct argp_child group2_1_child = {
+static struct argp_child group2_1_child = {
   &group2_1_argp,
   0,
   "",
@@ -244,7 +244,7 @@ const char *argp_program_version = "test_argp (" PACKAGE_NAME ") " VERSION;
 const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
 static char doc[] = "documentation string";
 
-struct argp test_argp = {
+static struct argp test_argp = {
   main_options,
   parse_opt,
   "ARGS...",
@@ -276,8 +276,8 @@ struct argp test_argp = {
  char *argv[] = { ARGV0, arg1, arg2, arg3, NULL }; \
  INIT_TEST_COMMON (n)
 
-int test_number;
-unsigned failure_count = 0;
+static int test_number;
+static unsigned failure_count = 0;
 
 static void
 fail (const char *msg)
diff --git a/tests/test-asin.c b/tests/test-asin.c
index 3af1b7b871..c7141f2ae6 100644
--- a/tests/test-asin.c
+++ b/tests/test-asin.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (asin, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-asinf.c b/tests/test-asinf.c
index cdf8060249..bdd305c4bd 100644
--- a/tests/test-asinf.c
+++ b/tests/test-asinf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (asinf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-asinl.c b/tests/test-asinl.c
index c4afec8c4e..0832a04ba1 100644
--- a/tests/test-asinl.c
+++ b/tests/test-asinl.c
@@ -26,8 +26,8 @@ SIGNATURE_CHECK (asinl, long double, (long double));
 #include "fpucw.h"
 #include "macros.h"
 
-volatile long double x;
-long double y;
+static volatile long double x;
+static long double y;
 
 int
 main ()
diff --git a/tests/test-asyncsafe-spin1.c b/tests/test-asyncsafe-spin1.c
index ad20283c56..d7b93ed1db 100644
--- a/tests/test-asyncsafe-spin1.c
+++ b/tests/test-asyncsafe-spin1.c
@@ -23,7 +23,7 @@
 
 #include <signal.h>
 
-asyncsafe_spinlock_t global_spin_lock = ASYNCSAFE_SPIN_INIT;
+static asyncsafe_spinlock_t global_spin_lock = ASYNCSAFE_SPIN_INIT;
 
 int
 main (void)
diff --git a/tests/test-atan.c b/tests/test-atan.c
index 0c5bee8845..e200ad7699 100644
--- a/tests/test-atan.c
+++ b/tests/test-atan.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (atan, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-atan2.c b/tests/test-atan2.c
index 1d9d28020a..2af334bc9d 100644
--- a/tests/test-atan2.c
+++ b/tests/test-atan2.c
@@ -25,9 +25,9 @@ SIGNATURE_CHECK (atan2, double, (double, double));
 
 #include "macros.h"
 
-volatile double x;
-volatile double y;
-double z;
+static volatile double x;
+static volatile double y;
+static double z;
 
 int
 main ()
diff --git a/tests/test-atan2f.c b/tests/test-atan2f.c
index 72bb4d8ea6..38add36495 100644
--- a/tests/test-atan2f.c
+++ b/tests/test-atan2f.c
@@ -25,9 +25,9 @@ SIGNATURE_CHECK (atan2f, float, (float, float));
 
 #include "macros.h"
 
-volatile float x;
-volatile float y;
-float z;
+static volatile float x;
+static volatile float y;
+static float z;
 
 int
 main ()
diff --git a/tests/test-atanf.c b/tests/test-atanf.c
index d16c29eac5..4c7430f242 100644
--- a/tests/test-atanf.c
+++ b/tests/test-atanf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (atanf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-atanl.c b/tests/test-atanl.c
index d148e5af89..04e97a04ce 100644
--- a/tests/test-atanl.c
+++ b/tests/test-atanl.c
@@ -26,8 +26,8 @@ SIGNATURE_CHECK (atanl, long double, (long double));
 #include "fpucw.h"
 #include "macros.h"
 
-volatile long double x;
-long double y;
+static volatile long double x;
+static long double y;
 
 int
 main ()
diff --git a/tests/test-cbrt.h b/tests/test-cbrt.h
index 52f9148d55..4cad984e6c 100644
--- a/tests/test-cbrt.h
+++ b/tests/test-cbrt.h
@@ -55,5 +55,5 @@ test_function (void)
       }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-copysign.c b/tests/test-copysign.c
index cf291f80d6..e6a9264e1e 100644
--- a/tests/test-copysign.c
+++ b/tests/test-copysign.c
@@ -28,10 +28,10 @@ SIGNATURE_CHECK (copysign, double, (double, double));
 
 #include <string.h>
 
-volatile double x;
-volatile double y;
-double z;
-double zero = 0.0;
+static volatile double x;
+static volatile double y;
+static double z;
+static double zero = 0.0;
 
 int
 main ()
diff --git a/tests/test-copysignf.c b/tests/test-copysignf.c
index 8a0c51f46f..9bb7d2516e 100644
--- a/tests/test-copysignf.c
+++ b/tests/test-copysignf.c
@@ -28,10 +28,10 @@ SIGNATURE_CHECK (copysignf, float, (float, float));
 
 #include <string.h>
 
-volatile float x;
-volatile float y;
-float z;
-float zero = 0.0f;
+static volatile float x;
+static volatile float y;
+static float z;
+static float zero = 0.0f;
 
 int
 main ()
diff --git a/tests/test-copysignl.c b/tests/test-copysignl.c
index b2b78aa849..6f63a993ea 100644
--- a/tests/test-copysignl.c
+++ b/tests/test-copysignl.c
@@ -28,10 +28,10 @@ SIGNATURE_CHECK (copysignl, long double, (long double, long double));
 
 #include <string.h>
 
-volatile long double x;
-volatile long double y;
-long double z;
-long double zero = 0.0L;
+static volatile long double x;
+static volatile long double y;
+static long double z;
+static long double zero = 0.0L;
 
 int
 main ()
diff --git a/tests/test-cos.c b/tests/test-cos.c
index 5025d6ce85..a629b37f32 100644
--- a/tests/test-cos.c
+++ b/tests/test-cos.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (cos, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-cosf.c b/tests/test-cosf.c
index 2aa43661f8..0ce6e584d8 100644
--- a/tests/test-cosf.c
+++ b/tests/test-cosf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (cosf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-cosh.c b/tests/test-cosh.c
index 432679c51e..7856894918 100644
--- a/tests/test-cosh.c
+++ b/tests/test-cosh.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (cosh, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-coshf.c b/tests/test-coshf.c
index 4c8d090146..0682c806d7 100644
--- a/tests/test-coshf.c
+++ b/tests/test-coshf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (coshf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-cosl.c b/tests/test-cosl.c
index aaabf5947e..1ac23f149f 100644
--- a/tests/test-cosl.c
+++ b/tests/test-cosl.c
@@ -26,8 +26,8 @@ SIGNATURE_CHECK (cosl, long double, (long double));
 #include "fpucw.h"
 #include "macros.h"
 
-volatile long double x;
-long double y;
+static volatile long double x;
+static long double y;
 
 int
 main ()
diff --git a/tests/test-erf.c b/tests/test-erf.c
index 5fc26addb8..f43bf1e3cd 100644
--- a/tests/test-erf.c
+++ b/tests/test-erf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (erf, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-erfc.c b/tests/test-erfc.c
index d65f05c016..90aa78f878 100644
--- a/tests/test-erfc.c
+++ b/tests/test-erfc.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (erfc, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-errno.c b/tests/test-errno.c
index 99600add83..b646157134 100644
--- a/tests/test-errno.c
+++ b/tests/test-errno.c
@@ -23,83 +23,83 @@
 /* Verify that the POSIX mandated errno values exist and can be used as
    initializers outside of a function.
    The variable names happen to match the Linux/x86 error numbers.  */
-int e1 = EPERM;
-int e2 = ENOENT;
-int e3 = ESRCH;
-int e4 = EINTR;
-int e5 = EIO;
-int e6 = ENXIO;
-int e7 = E2BIG;
-int e8 = ENOEXEC;
-int e9 = EBADF;
-int e10 = ECHILD;
-int e11 = EAGAIN;
-int e11a = EWOULDBLOCK;
-int e12 = ENOMEM;
-int e13 = EACCES;
-int e14 = EFAULT;
-int e16 = EBUSY;
-int e17 = EEXIST;
-int e18 = EXDEV;
-int e19 = ENODEV;
-int e20 = ENOTDIR;
-int e21 = EISDIR;
-int e22 = EINVAL;
-int e23 = ENFILE;
-int e24 = EMFILE;
-int e25 = ENOTTY;
-int e26 = ETXTBSY;
-int e27 = EFBIG;
-int e28 = ENOSPC;
-int e29 = ESPIPE;
-int e30 = EROFS;
-int e31 = EMLINK;
-int e32 = EPIPE;
-int e33 = EDOM;
-int e34 = ERANGE;
-int e35 = EDEADLK;
-int e36 = ENAMETOOLONG;
-int e37 = ENOLCK;
-int e38 = ENOSYS;
-int e39 = ENOTEMPTY;
-int e40 = ELOOP;
-int e42 = ENOMSG;
-int e43 = EIDRM;
-int e67 = ENOLINK;
-int e71 = EPROTO;
-int e72 = EMULTIHOP;
-int e74 = EBADMSG;
-int e75 = EOVERFLOW;
-int e84 = EILSEQ;
-int e88 = ENOTSOCK;
-int e89 = EDESTADDRREQ;
-int e90 = EMSGSIZE;
-int e91 = EPROTOTYPE;
-int e92 = ENOPROTOOPT;
-int e93 = EPROTONOSUPPORT;
-int e95 = EOPNOTSUPP;
-int e95a = ENOTSUP;
-int e97 = EAFNOSUPPORT;
-int e98 = EADDRINUSE;
-int e99 = EADDRNOTAVAIL;
-int e100 = ENETDOWN;
-int e101 = ENETUNREACH;
-int e102 = ENETRESET;
-int e103 = ECONNABORTED;
-int e104 = ECONNRESET;
-int e105 = ENOBUFS;
-int e106 = EISCONN;
-int e107 = ENOTCONN;
-int e110 = ETIMEDOUT;
-int e111 = ECONNREFUSED;
-int e113 = EHOSTUNREACH;
-int e114 = EALREADY;
-int e115 = EINPROGRESS;
-int e116 = ESTALE;
-int e122 = EDQUOT;
-int e125 = ECANCELED;
-int e130 = EOWNERDEAD;
-int e131 = ENOTRECOVERABLE;
+static int e1 = EPERM;
+static int e2 = ENOENT;
+static int e3 = ESRCH;
+static int e4 = EINTR;
+static int e5 = EIO;
+static int e6 = ENXIO;
+static int e7 = E2BIG;
+static int e8 = ENOEXEC;
+static int e9 = EBADF;
+static int e10 = ECHILD;
+static int e11 = EAGAIN;
+static int e11a = EWOULDBLOCK;
+static int e12 = ENOMEM;
+static int e13 = EACCES;
+static int e14 = EFAULT;
+static int e16 = EBUSY;
+static int e17 = EEXIST;
+static int e18 = EXDEV;
+static int e19 = ENODEV;
+static int e20 = ENOTDIR;
+static int e21 = EISDIR;
+static int e22 = EINVAL;
+static int e23 = ENFILE;
+static int e24 = EMFILE;
+static int e25 = ENOTTY;
+static int e26 = ETXTBSY;
+static int e27 = EFBIG;
+static int e28 = ENOSPC;
+static int e29 = ESPIPE;
+static int e30 = EROFS;
+static int e31 = EMLINK;
+static int e32 = EPIPE;
+static int e33 = EDOM;
+static int e34 = ERANGE;
+static int e35 = EDEADLK;
+static int e36 = ENAMETOOLONG;
+static int e37 = ENOLCK;
+static int e38 = ENOSYS;
+static int e39 = ENOTEMPTY;
+static int e40 = ELOOP;
+static int e42 = ENOMSG;
+static int e43 = EIDRM;
+static int e67 = ENOLINK;
+static int e71 = EPROTO;
+static int e72 = EMULTIHOP;
+static int e74 = EBADMSG;
+static int e75 = EOVERFLOW;
+static int e84 = EILSEQ;
+static int e88 = ENOTSOCK;
+static int e89 = EDESTADDRREQ;
+static int e90 = EMSGSIZE;
+static int e91 = EPROTOTYPE;
+static int e92 = ENOPROTOOPT;
+static int e93 = EPROTONOSUPPORT;
+static int e95 = EOPNOTSUPP;
+static int e95a = ENOTSUP;
+static int e97 = EAFNOSUPPORT;
+static int e98 = EADDRINUSE;
+static int e99 = EADDRNOTAVAIL;
+static int e100 = ENETDOWN;
+static int e101 = ENETUNREACH;
+static int e102 = ENETRESET;
+static int e103 = ECONNABORTED;
+static int e104 = ECONNRESET;
+static int e105 = ENOBUFS;
+static int e106 = EISCONN;
+static int e107 = ENOTCONN;
+static int e110 = ETIMEDOUT;
+static int e111 = ECONNREFUSED;
+static int e113 = EHOSTUNREACH;
+static int e114 = EALREADY;
+static int e115 = EINPROGRESS;
+static int e116 = ESTALE;
+static int e122 = EDQUOT;
+static int e125 = ECANCELED;
+static int e130 = EOWNERDEAD;
+static int e131 = ENOTRECOVERABLE;
 
 /* Don't verify that these errno values are all different, except for possibly
    EWOULDBLOCK == EAGAIN.  Even Linux/x86 does not pass this check: it has
diff --git a/tests/test-exclude.c b/tests/test-exclude.c
index 2af6014d68..3e036311a2 100644
--- a/tests/test-exclude.c
+++ b/tests/test-exclude.c
@@ -33,7 +33,7 @@
 # define FNM_LEADING_DIR 0
 #endif
 
-char const * const exclude_keywords[] = {
+static char const * const exclude_keywords[] = {
   "noescape",
   "pathname",
   "period",
@@ -45,7 +45,7 @@ char const * const exclude_keywords[] = {
   NULL
 };
 
-int exclude_flags[] = {
+static int exclude_flags[] = {
   FNM_NOESCAPE,
   FNM_PATHNAME,
   FNM_PERIOD,
diff --git a/tests/test-exp.h b/tests/test-exp.h
index f7ef2a4063..371e61c62f 100644
--- a/tests/test-exp.h
+++ b/tests/test-exp.h
@@ -86,5 +86,5 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-exp2.h b/tests/test-exp2.h
index a17e30ea49..0050fd09f4 100644
--- a/tests/test-exp2.h
+++ b/tests/test-exp2.h
@@ -120,5 +120,5 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-expm1.h b/tests/test-expm1.h
index fc92617a05..b94dac39df 100644
--- a/tests/test-expm1.h
+++ b/tests/test-expm1.h
@@ -111,5 +111,5 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-fabs.h b/tests/test-fabs.h
index 058ca27fdc..6c2ac31ae7 100644
--- a/tests/test-fabs.h
+++ b/tests/test-fabs.h
@@ -44,5 +44,5 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-fcntl-h.c b/tests/test-fcntl-h.c
index 6020a11e72..6d8f828704 100644
--- a/tests/test-fcntl-h.c
+++ b/tests/test-fcntl-h.c
@@ -21,21 +21,21 @@
 #include <fcntl.h>
 
 /* Check that the various O_* macros are defined.  */
-int o = (O_DIRECT | O_DIRECTORY | O_DSYNC | O_IGNORE_CTTY | O_NDELAY | O_NOATIME
-         | O_NONBLOCK | O_NOCTTY | O_NOFOLLOW | O_NOLINK | O_NOLINKS | O_NOTRANS
-         | O_RSYNC | O_SYNC | O_TTY_INIT | O_BINARY | O_TEXT);
+static int o = (O_DIRECT | O_DIRECTORY | O_DSYNC | O_IGNORE_CTTY | O_NDELAY | O_NOATIME
+                | O_NONBLOCK | O_NOCTTY | O_NOFOLLOW | O_NOLINK | O_NOLINKS | O_NOTRANS
+                | O_RSYNC | O_SYNC | O_TTY_INIT | O_BINARY | O_TEXT);
 
 /* Check that the various SEEK_* macros are defined.  */
-int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+static int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 
 /* Check that the FD_* macros are defined.  */
-int i = FD_CLOEXEC;
+static int i = FD_CLOEXEC;
 
 /* Check that the types are all defined.  */
-pid_t t1;
-off_t t2;
-mode_t t3;
-off64_t t4;
+static pid_t t1;
+static off_t t2;
+static mode_t t3;
+static off64_t t4;
 
 int
 main (void)
diff --git a/tests/test-fenv.c b/tests/test-fenv.c
index 1698299edd..8d41a1a448 100644
--- a/tests/test-fenv.c
+++ b/tests/test-fenv.c
@@ -24,7 +24,7 @@
 #include "verify.h"
 
 /* Check that the various FE_* macros are defined.  */
-int r[] =
+static int r[] =
   {
 #ifdef FE_DOWNWARD
     FE_DOWNWARD,
@@ -37,11 +37,11 @@ int r[] =
 #endif
     FE_TONEAREST
   };
-int e[] = { FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW, FE_UNDERFLOW };
+static int e[] = { FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW, FE_UNDERFLOW };
 
 /* Check that the types are all defined.  */
-fenv_t t1;
-fexcept_t t2;
+static fenv_t t1;
+static fexcept_t t2;
 
 /* On many platforms, other FE_* constants are included in FE_ALL_EXCEPT,
    therefore in general
diff --git a/tests/test-float.c b/tests/test-float.c
index e9dc4609fd..03699da42b 100644
--- a/tests/test-float.c
+++ b/tests/test-float.c
@@ -21,40 +21,40 @@
 #include <float.h>
 
 /* Check that FLT_RADIX is a constant expression.  */
-int a[] = { FLT_RADIX };
+static int a[] = { FLT_RADIX };
 
 /* ----------------------- Check macros for 'float' ----------------------- */
 
 /* Check that the FLT_* macros expand to constant expressions.  */
-int fb[] =
+static int fb[] =
   {
     FLT_MANT_DIG, FLT_MIN_EXP, FLT_MAX_EXP,
     FLT_DIG, FLT_MIN_10_EXP, FLT_MAX_10_EXP
   };
-float fc[] = { FLT_EPSILON, FLT_MIN, FLT_MAX };
+static float fc[] = { FLT_EPSILON, FLT_MIN, FLT_MAX };
 
 /* ----------------------- Check macros for 'double' ----------------------- */
 
 /* Check that the DBL_* macros expand to constant expressions.  */
-int db[] =
+static int db[] =
   {
     DBL_MANT_DIG, DBL_MIN_EXP, DBL_MAX_EXP,
     DBL_DIG, DBL_MIN_10_EXP, DBL_MAX_10_EXP
   };
-double dc[] = { DBL_EPSILON, DBL_MIN, DBL_MAX };
+static double dc[] = { DBL_EPSILON, DBL_MIN, DBL_MAX };
 
 /* -------------------- Check macros for 'long double' -------------------- */
 
 /* Check that the LDBL_* macros expand to constant expressions.  */
-int lb[] =
+static int lb[] =
   {
     LDBL_MANT_DIG, LDBL_MIN_EXP, LDBL_MAX_EXP,
     LDBL_DIG, LDBL_MIN_10_EXP, LDBL_MAX_10_EXP
   };
-long double lc1 = LDBL_EPSILON;
-long double lc2 = LDBL_MIN;
+static long double lc1 = LDBL_EPSILON;
+static long double lc2 = LDBL_MIN;
 #if 0 /* LDBL_MAX is not a constant expression on some platforms.  */
-long double lc3 = LDBL_MAX;
+static long double lc3 = LDBL_MAX;
 #endif
 
 /* ------------------------------------------------------------------------- */
diff --git a/tests/test-fma2.c b/tests/test-fma2.c
index eb4d67dffa..a2e95504db 100644
--- a/tests/test-fma2.c
+++ b/tests/test-fma2.c
@@ -28,11 +28,11 @@
 
 #define DOUBLE double
 #define LDEXP ldexp
-const int MIN_EXP = DBL_MIN_EXP; /* for gdb */
+static const int MIN_EXP = DBL_MIN_EXP; /* for gdb */
 #define MIN_EXP DBL_MIN_EXP
-const int MAX_EXP = DBL_MAX_EXP; /* for gdb */
+static const int MAX_EXP = DBL_MAX_EXP; /* for gdb */
 #define MAX_EXP DBL_MAX_EXP
-const int MANT_BIT = DBL_MANT_BIT; /* for gdb */
+static const int MANT_BIT = DBL_MANT_BIT; /* for gdb */
 #define MANT_BIT DBL_MANT_BIT
 #define INFINITY Infinityd ()
 #define L_(literal) literal
diff --git a/tests/test-fmaf2.c b/tests/test-fmaf2.c
index 5369ce5ff5..23ca6b8515 100644
--- a/tests/test-fmaf2.c
+++ b/tests/test-fmaf2.c
@@ -28,11 +28,11 @@
 
 #define DOUBLE float
 #define LDEXP ldexpf
-const int MIN_EXP = FLT_MIN_EXP; /* for gdb */
+static const int MIN_EXP = FLT_MIN_EXP; /* for gdb */
 #define MIN_EXP FLT_MIN_EXP
-const int MAX_EXP = FLT_MAX_EXP; /* for gdb */
+static const int MAX_EXP = FLT_MAX_EXP; /* for gdb */
 #define MAX_EXP FLT_MAX_EXP
-const int MANT_BIT = FLT_MANT_BIT; /* for gdb */
+static const int MANT_BIT = FLT_MANT_BIT; /* for gdb */
 #define MANT_BIT FLT_MANT_BIT
 #define INFINITY Infinityf ()
 #define L_(literal) literal##f
diff --git a/tests/test-fmal2.c b/tests/test-fmal2.c
index b9e0fe7710..f023c8c2e6 100644
--- a/tests/test-fmal2.c
+++ b/tests/test-fmal2.c
@@ -29,11 +29,11 @@
 
 #define DOUBLE long double
 #define LDEXP ldexpl
-const int MIN_EXP = LDBL_MIN_EXP; /* for gdb */
+static const int MIN_EXP = LDBL_MIN_EXP; /* for gdb */
 #define MIN_EXP LDBL_MIN_EXP
-const int MAX_EXP = LDBL_MAX_EXP; /* for gdb */
+static const int MAX_EXP = LDBL_MAX_EXP; /* for gdb */
 #define MAX_EXP LDBL_MAX_EXP
-const int MANT_BIT = LDBL_MANT_BIT; /* for gdb */
+static const int MANT_BIT = LDBL_MANT_BIT; /* for gdb */
 #define MANT_BIT LDBL_MANT_BIT
 #define INFINITY Infinityl ()
 #define L_(literal) literal##L
diff --git a/tests/test-fmod.h b/tests/test-fmod.h
index cae69b0b10..d6c5d23c44 100644
--- a/tests/test-fmod.h
+++ b/tests/test-fmod.h
@@ -118,6 +118,6 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-volatile DOUBLE y;
-DOUBLE z;
+static volatile DOUBLE x;
+static volatile DOUBLE y;
+static DOUBLE z;
diff --git a/tests/test-fnmatch-h.c b/tests/test-fnmatch-h.c
index 9084cb2686..de6146c75b 100644
--- a/tests/test-fnmatch-h.c
+++ b/tests/test-fnmatch-h.c
@@ -21,8 +21,8 @@
 #include <fnmatch.h>
 
 /* Check that the various FNM_* macros are defined.  */
-int ret = FNM_NOMATCH;
-int options[] = { FNM_PATHNAME, FNM_PERIOD, FNM_NOESCAPE };
+static int ret = FNM_NOMATCH;
+static int options[] = { FNM_PATHNAME, FNM_PERIOD, FNM_NOESCAPE };
 
 int
 main (void)
diff --git a/tests/test-gc-pbkdf2-sha1.c b/tests/test-gc-pbkdf2-sha1.c
index b1ed1f89f7..39a4162668 100644
--- a/tests/test-gc-pbkdf2-sha1.c
+++ b/tests/test-gc-pbkdf2-sha1.c
@@ -35,7 +35,7 @@ struct pkcs5
   int dklen;
   const char *expected;
 };
-const struct pkcs5 pkcs5[] = {
+static const struct pkcs5 pkcs5[] = {
   {1, "password", "ATHENA.MIT.EDUraeburn", 16,
    "\xCD\xED\xB5\x28\x1B\xB2\xF8\x01\x56\x5A\x11\x22\xB2\x56\x35\x15"},
   {2, "password", "ATHENA.MIT.EDUraeburn", 16,
diff --git a/tests/test-gc-pbkdf2.c b/tests/test-gc-pbkdf2.c
index 8afb0efeec..0ef28ac3b8 100644
--- a/tests/test-gc-pbkdf2.c
+++ b/tests/test-gc-pbkdf2.c
@@ -36,7 +36,7 @@ struct pkcs5
   int dklen;
   const char *expected;
 };
-const struct pkcs5 pkcs5[] = {
+static const struct pkcs5 pkcs5[] = {
 #if GNULIB_GC_HMAC_SHA1
   {GC_SHA1, 1, "password", "ATHENA.MIT.EDUraeburn", 16,
    "\xCD\xED\xB5\x28\x1B\xB2\xF8\x01\x56\x5A\x11\x22\xB2\x56\x35\x15"},
diff --git a/tests/test-get-rusage-as.c b/tests/test-get-rusage-as.c
index ad5cdf931b..d8d977b33a 100644
--- a/tests/test-get-rusage-as.c
+++ b/tests/test-get-rusage-as.c
@@ -24,8 +24,8 @@
 #include "qemu.h"
 #include "macros.h"
 
-void *memchunk1;
-void *memchunk2;
+static void *memchunk1;
+static void *memchunk2;
 
 int
 main ()
diff --git a/tests/test-get-rusage-data.c b/tests/test-get-rusage-data.c
index eab165ee01..05b2537e0f 100644
--- a/tests/test-get-rusage-data.c
+++ b/tests/test-get-rusage-data.c
@@ -24,8 +24,8 @@
 #include "qemu.h"
 #include "macros.h"
 
-void *memchunk1;
-void *memchunk2;
+static void *memchunk1;
+static void *memchunk2;
 
 int
 main ()
diff --git a/tests/test-getentropy.c b/tests/test-getentropy.c
index 983690ea62..37db510c0b 100644
--- a/tests/test-getentropy.c
+++ b/tests/test-getentropy.c
@@ -27,8 +27,8 @@ SIGNATURE_CHECK (getentropy, int, (void *, size_t));
 
 #include "macros.h"
 
-char empty_buf[256];
-char buf[256];
+static char empty_buf[256];
+static char buf[256];
 
 int
 main (int argc, char *argv[])
diff --git a/tests/test-getrusage.c b/tests/test-getrusage.c
index a6549374f7..0bc4653432 100644
--- a/tests/test-getrusage.c
+++ b/tests/test-getrusage.c
@@ -27,7 +27,7 @@ SIGNATURE_CHECK (getrusage, int, (int, struct rusage *));
 
 #include "macros.h"
 
-volatile unsigned int counter;
+static volatile unsigned int counter;
 
 int
 main (void)
diff --git a/tests/test-glob-h.c b/tests/test-glob-h.c
index 67febac8c3..1136717647 100644
--- a/tests/test-glob-h.c
+++ b/tests/test-glob-h.c
@@ -21,10 +21,10 @@
 #include <glob.h>
 
 /* Check that size_t is defined.  */
-size_t a;
+static size_t a;
 
 /* Check that the various GLOB_* macros are defined.  */
-int flags[] =
+static int flags[] =
   {
     GLOB_APPEND,
     GLOB_DOOFFS,
@@ -34,7 +34,7 @@ int flags[] =
     GLOB_NOESCAPE,
     GLOB_NOSORT
   };
-int ret[] =
+static int ret[] =
   {
     GLOB_ABORTED,
     GLOB_NOMATCH,
diff --git a/tests/test-hypot.h b/tests/test-hypot.h
index 2d2605c27f..ed9ad3f07c 100644
--- a/tests/test-hypot.h
+++ b/tests/test-hypot.h
@@ -67,6 +67,6 @@ test_function (void)
       }
 }
 
-volatile DOUBLE x;
-volatile DOUBLE y;
-DOUBLE z;
+static volatile DOUBLE x;
+static volatile DOUBLE y;
+static DOUBLE z;
diff --git a/tests/test-iconv-utf.c b/tests/test-iconv-utf.c
index 42e0619692..ae5330e89f 100644
--- a/tests/test-iconv-utf.c
+++ b/tests/test-iconv-utf.c
@@ -35,15 +35,15 @@
 
 /* The text is "Japanese (日本語) [\U0001D50D\U0001D51E\U0001D52D]".  */
 
-const char test_utf8_string[] = "Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
+static const char test_utf8_string[] = "Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
 
-const char test_utf16be_string[] = "\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]";
+static const char test_utf16be_string[] = "\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]";
 
-const char test_utf16le_string[] = "J\000a\000p\000a\000n\000e\000s\000e\000 \000(\000\345\145\054\147\236\212)\000 \000[\000\065\330\015\335\065\330\036\335\065\330\055\335]\000";
+static const char test_utf16le_string[] = "J\000a\000p\000a\000n\000e\000s\000e\000 \000(\000\345\145\054\147\236\212)\000 \000[\000\065\330\015\335\065\330\036\335\065\330\055\335]\000";
 
-const char test_utf32be_string[] = "\000\000\000J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\145\345\000\000\147\054\000\000\212\236\000\000\000)\000\000\000 \000\000\000[\000\001\325\015\000\001\325\036\000\001\325\055\000\000\000]";
+static const char test_utf32be_string[] = "\000\000\000J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\145\345\000\000\147\054\000\000\212\236\000\000\000)\000\000\000 \000\000\000[\000\001\325\015\000\001\325\036\000\001\325\055\000\000\000]";
 
-const char test_utf32le_string[] = "J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\000\345\145\000\000\054\147\000\000\236\212\000\000)\000\000\000 \000\000\000[\000\000\000\015\325\001\000\036\325\001\000\055\325\001\000]\000\000\000";
+static const char test_utf32le_string[] = "J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\000\345\145\000\000\054\147\000\000\236\212\000\000)\000\000\000 \000\000\000[\000\000\000\015\325\001\000\036\325\001\000\055\325\001\000]\000\000\000";
 
 #ifdef CONVERT_ENABLED
 # pragma convert(pop)
diff --git a/tests/test-ilogb.h b/tests/test-ilogb.h
index a39eba1101..d65e75ac5c 100644
--- a/tests/test-ilogb.h
+++ b/tests/test-ilogb.h
@@ -147,5 +147,5 @@ test_function (void)
     }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-intprops.c b/tests/test-intprops.c
index e0d63d4741..eb0ffa9b91 100644
--- a/tests/test-intprops.c
+++ b/tests/test-intprops.c
@@ -61,8 +61,8 @@
 
 #define DONTCARE __LINE__
 
-int int_minus_2 = -2;
-int int_1 = 1;
+static int int_minus_2 = -2;
+static int int_1 = 1;
 
 int
 main (void)
diff --git a/tests/test-inttypes.c b/tests/test-inttypes.c
index 036ca510cf..961b92bf97 100644
--- a/tests/test-inttypes.c
+++ b/tests/test-inttypes.c
@@ -22,7 +22,7 @@
 
 /* Tests for macros supposed to be defined in inttypes.h.  */
 
-const char *k = /* implicit string concatenation */
+static const char *k = /* implicit string concatenation */
 #ifdef INT8_MAX
   PRId8 PRIi8
 #endif
@@ -65,7 +65,7 @@ const char *k = /* implicit string concatenation */
   PRIoPTR PRIuPTR PRIxPTR PRIXPTR
 #endif
   ;
-const char *l = /* implicit string concatenation */
+static const char *l = /* implicit string concatenation */
 #ifdef INT8_MAX
   SCNd8 SCNi8
 #endif
diff --git a/tests/test-isfinite.c b/tests/test-isfinite.c
index 05e15bb705..b6b0da0c9a 100644
--- a/tests/test-isfinite.c
+++ b/tests/test-isfinite.c
@@ -33,9 +33,9 @@
 #include "snan.h"
 #include "macros.h"
 
-float zerof = 0.0f;
-double zerod = 0.0;
-long double zerol = 0.0L;
+static float zerof = 0.0f;
+static double zerod = 0.0;
+static long double zerol = 0.0L;
 
 static void
 test_isfinitef ()
diff --git a/tests/test-isinf.c b/tests/test-isinf.c
index 0cd96d7208..e7c75f7138 100644
--- a/tests/test-isinf.c
+++ b/tests/test-isinf.c
@@ -33,9 +33,9 @@
 #include "snan.h"
 #include "macros.h"
 
-float zerof = 0.0f;
-double zerod = 0.0;
-long double zerol = 0.0L;
+static float zerof = 0.0f;
+static double zerod = 0.0;
+static long double zerol = 0.0L;
 
 static void
 test_isinff ()
diff --git a/tests/test-iswblank.c b/tests/test-iswblank.c
index e59251791f..21edb0acf5 100644
--- a/tests/test-iswblank.c
+++ b/tests/test-iswblank.c
@@ -21,7 +21,7 @@
 #include "macros.h"
 
 /* Check that WEOF is defined.  */
-wint_t e = WEOF;
+static wint_t e = WEOF;
 
 int
 main (void)
diff --git a/tests/test-j0.c b/tests/test-j0.c
index 856b6e8c9d..7652f29bd6 100644
--- a/tests/test-j0.c
+++ b/tests/test-j0.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (j0, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-j1.c b/tests/test-j1.c
index d18c652747..8ca900db6c 100644
--- a/tests/test-j1.c
+++ b/tests/test-j1.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (j1, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-jn.c b/tests/test-jn.c
index c2bfaba5e2..1ab0deee69 100644
--- a/tests/test-jn.c
+++ b/tests/test-jn.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (jn, double, (int, double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-langinfo.c b/tests/test-langinfo.c
index 9561793bb9..bc57008486 100644
--- a/tests/test-langinfo.c
+++ b/tests/test-langinfo.c
@@ -21,7 +21,7 @@
 #include <langinfo.h>
 
 /* Check that all the nl_item values are defined.  */
-int items[] =
+static int items[] =
   {
     /* nl_langinfo items of the LC_CTYPE category */
     CODESET,
diff --git a/tests/test-lgamma.c b/tests/test-lgamma.c
index 0db2b64c49..4f30ade97f 100644
--- a/tests/test-lgamma.c
+++ b/tests/test-lgamma.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (lgamma, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-limits-h.c b/tests/test-limits-h.c
index 6f574c88a0..51b86ac288 100644
--- a/tests/test-limits-h.c
+++ b/tests/test-limits-h.c
@@ -38,7 +38,7 @@
 
 /* Type width macros.  */
 
-int type_bits[] =
+static int type_bits[] =
   {
     CHAR_BIT,
     WORD_BIT,
@@ -50,53 +50,53 @@ verify_width (LONG_BIT, LONG_MIN, LONG_MAX);
 
 /* Numerical limit macros.  */
 
-char               limits1[]  = { CHAR_MIN, CHAR_MAX };
+static char               limits1[]  = { CHAR_MIN, CHAR_MAX };
 static_assert (TYPE_MINIMUM (char) == CHAR_MIN);
 static_assert (TYPE_MAXIMUM (char) == CHAR_MAX);
 
-signed char        limits2[]  = { SCHAR_MIN, SCHAR_MAX };
+static signed char        limits2[]  = { SCHAR_MIN, SCHAR_MAX };
 static_assert (TYPE_MINIMUM (signed char) == SCHAR_MIN);
 static_assert (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
 
-unsigned char      limits3[]  = { UCHAR_MAX };
+static unsigned char      limits3[]  = { UCHAR_MAX };
 static_assert (TYPE_MINIMUM (unsigned char) == 0);
 static_assert (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX);
 
-short              limits4[]  = { SHRT_MIN, SHRT_MAX };
+static short              limits4[]  = { SHRT_MIN, SHRT_MAX };
 static_assert (TYPE_MINIMUM (short int) == SHRT_MIN);
 static_assert (TYPE_MAXIMUM (short int) == SHRT_MAX);
 
-unsigned short     limits5[]  = { USHRT_MAX };
+static unsigned short     limits5[]  = { USHRT_MAX };
 static_assert (TYPE_MINIMUM (unsigned short int) == 0);
 static_assert (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX);
 
-int                limits6[]  = { INT_MIN, INT_MAX };
+static int                limits6[]  = { INT_MIN, INT_MAX };
 static_assert (TYPE_MINIMUM (int) == INT_MIN);
 static_assert (TYPE_MAXIMUM (int) == INT_MAX);
 
-unsigned int       limits7[]  = { UINT_MAX };
+static unsigned int       limits7[]  = { UINT_MAX };
 static_assert (TYPE_MINIMUM (unsigned int) == 0);
 static_assert (TYPE_MAXIMUM (unsigned int) == UINT_MAX);
 
-long               limits8[]  = { LONG_MIN, LONG_MAX };
+static long               limits8[]  = { LONG_MIN, LONG_MAX };
 static_assert (TYPE_MINIMUM (long int) == LONG_MIN);
 static_assert (TYPE_MAXIMUM (long int) == LONG_MAX);
 
-unsigned long      limits9[]  = { ULONG_MAX };
+static unsigned long      limits9[]  = { ULONG_MAX };
 static_assert (TYPE_MINIMUM (unsigned long int) == 0);
 static_assert (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX);
 
-long long          limits10[] = { LLONG_MIN, LLONG_MAX };
+static long long          limits10[] = { LLONG_MIN, LLONG_MAX };
 static_assert (TYPE_MINIMUM (long long int) == LLONG_MIN);
 static_assert (TYPE_MAXIMUM (long long int) == LLONG_MAX);
 
-unsigned long long limits11[] = { ULLONG_MAX };
+static unsigned long long limits11[] = { ULLONG_MAX };
 static_assert (TYPE_MINIMUM (unsigned long long int) == 0);
 static_assert (TYPE_MAXIMUM (unsigned long long int) == ULLONG_MAX);
 
 /* Specified by POSIX, not by ISO C.  */
 
-long long limits12[] = { SSIZE_MAX };
+static long long limits12[] = { SSIZE_MAX };
 
 /* Macros specified by C23 and by ISO/IEC TS 18661-1:2014.  */
 
@@ -114,7 +114,7 @@ verify_width (ULLONG_WIDTH, 0, ULLONG_MAX);
 
 /* Macros specified by C23.  */
 
-int bool_attrs[] = { BOOL_MAX, BOOL_WIDTH };
+static int bool_attrs[] = { BOOL_MAX, BOOL_WIDTH };
 static_assert (BOOL_MAX == 1);
 
 static_assert (0 < MB_LEN_MAX);
diff --git a/tests/test-locale.c b/tests/test-locale.c
index e4e61aad98..511ba17f44 100644
--- a/tests/test-locale.c
+++ b/tests/test-locale.c
@@ -20,7 +20,7 @@
 
 #include <locale.h>
 
-int a[] =
+static int a[] =
   {
     LC_ALL,
     LC_COLLATE,
@@ -32,8 +32,8 @@ int a[] =
   };
 
 /* Check that the 'struct lconv' type is defined.  */
-struct lconv l;
-int ls;
+static struct lconv l;
+static int ls;
 
 /* Check that NULL can be passed through varargs as a pointer type,
    per POSIX 2008.  */
diff --git a/tests/test-log.h b/tests/test-log.h
index f88818771a..56478b2c21 100644
--- a/tests/test-log.h
+++ b/tests/test-log.h
@@ -106,5 +106,5 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-log10.h b/tests/test-log10.h
index 55d24c4a8a..6d90215860 100644
--- a/tests/test-log10.h
+++ b/tests/test-log10.h
@@ -100,5 +100,5 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-log1p.h b/tests/test-log1p.h
index eb6267e8d5..58c1736079 100644
--- a/tests/test-log1p.h
+++ b/tests/test-log1p.h
@@ -96,5 +96,5 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-log2.h b/tests/test-log2.h
index 37872a7bab..a3947d0a58 100644
--- a/tests/test-log2.h
+++ b/tests/test-log2.h
@@ -127,5 +127,5 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-logb.h b/tests/test-logb.h
index c2d371d745..119a142889 100644
--- a/tests/test-logb.h
+++ b/tests/test-logb.h
@@ -141,5 +141,5 @@ test_function (void)
     }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-malloca.c b/tests/test-malloca.c
index 9d46cd424e..557d1f5572 100644
--- a/tests/test-malloca.c
+++ b/tests/test-malloca.c
@@ -30,7 +30,7 @@ do_allocation (int n)
   safe_alloca (n);
 }
 
-void (*func) (int) = do_allocation;
+static void (*func) (int) = do_allocation;
 
 int
 main ()
diff --git a/tests/test-modf.h b/tests/test-modf.h
index 3b92c9f0c3..2235d60dbd 100644
--- a/tests/test-modf.h
+++ b/tests/test-modf.h
@@ -57,6 +57,6 @@ test_function (void)
     }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
-DOUBLE z;
+static volatile DOUBLE x;
+static DOUBLE y;
+static DOUBLE z;
diff --git a/tests/test-nan-1.c b/tests/test-nan-1.c
index efbef9869d..f3f0c5ad57 100644
--- a/tests/test-nan-1.c
+++ b/tests/test-nan-1.c
@@ -41,9 +41,9 @@ main ()
 
 # include "macros.h"
 
-float volatile resultf;
-double volatile resultd;
-long double volatile resultl;
+static float volatile resultf;
+static double volatile resultd;
+static long double volatile resultl;
 
 int
 main ()
diff --git a/tests/test-nan-2.c b/tests/test-nan-2.c
index 205f1437fd..1231cd9bbf 100644
--- a/tests/test-nan-2.c
+++ b/tests/test-nan-2.c
@@ -31,9 +31,9 @@
 
 # include "macros.h"
 
-float volatile resultf;
-double volatile resultd;
-long double volatile resultl;
+static float volatile resultf;
+static double volatile resultd;
+static long double volatile resultl;
 
 int
 main ()
diff --git a/tests/test-netdb.c b/tests/test-netdb.c
index 9517057a5e..d83545fa0b 100644
--- a/tests/test-netdb.c
+++ b/tests/test-netdb.c
@@ -20,10 +20,10 @@
 #include <netdb.h>
 
 /* Check that the 'struct hostent' type is defined.  */
-struct hostent t1;
+static struct hostent t1;
 
 /* Check that the 'socklen_t' type is defined.  */
-socklen_t t2;
+static socklen_t t2;
 
 int
 main (void)
diff --git a/tests/test-nextafter.c b/tests/test-nextafter.c
index 9b75f0fcd6..cc5157d859 100644
--- a/tests/test-nextafter.c
+++ b/tests/test-nextafter.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (nextafter, double, (double, double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-noreturn.c b/tests/test-noreturn.c
index fa2d27a85e..9026962eda 100644
--- a/tests/test-noreturn.c
+++ b/tests/test-noreturn.c
@@ -36,10 +36,10 @@ _GL_NORETURN_FUNC void funcd (void)
 
 /* Test _GL_NORETURN_FUNCPTR.  */
 
-_GL_NORETURN_FUNCPTR void (*func1_ptr) (void) = func1;
-_GL_NORETURN_FUNCPTR void (*func2_ptr) (void) = func2;
-_GL_NORETURN_FUNCPTR void (*func3_ptr) (void) = func3;
-_GL_NORETURN_FUNCPTR void (*funcd_ptr) (void) = funcd;
+static _GL_NORETURN_FUNCPTR void (*func1_ptr) (void) = func1;
+static _GL_NORETURN_FUNCPTR void (*func2_ptr) (void) = func2;
+static _GL_NORETURN_FUNCPTR void (*func3_ptr) (void) = func3;
+static _GL_NORETURN_FUNCPTR void (*funcd_ptr) (void) = funcd;
 
 /* These could also be defined in a separate compilation unit.  */
 
diff --git a/tests/test-nullptr.c b/tests/test-nullptr.c
index 5c8f99e65f..3be719cd81 100644
--- a/tests/test-nullptr.c
+++ b/tests/test-nullptr.c
@@ -18,7 +18,7 @@
 
 #include <config.h>
 
-int *my_null = nullptr;
+static int *my_null = nullptr;
 
 #if 0 /* not yet */
 /* Header that is supposed to define nullptr_t.  */
diff --git a/tests/test-pathmax.c b/tests/test-pathmax.c
index a80ee06562..21d161c0e2 100644
--- a/tests/test-pathmax.c
+++ b/tests/test-pathmax.c
@@ -22,7 +22,7 @@
 
 /* Check that PATH_MAX is a constant if it is defined.  */
 #ifdef PATH_MAX
-int a = PATH_MAX;
+static int a = PATH_MAX;
 #endif
 
 int
diff --git a/tests/test-poll-h.c b/tests/test-poll-h.c
index 3e616dfa48..1d1495fa95 100644
--- a/tests/test-poll-h.c
+++ b/tests/test-poll-h.c
@@ -21,11 +21,11 @@
 #include <poll.h>
 
 /* Check that the nfds_t type is defined.  */
-nfds_t a;
+static nfds_t a;
 
 /* Check that the various POLL* macros are defined.  */
-int b = POLLIN | POLLPRI | POLLOUT | POLLERR | POLLHUP | POLLNVAL
-        | POLLRDNORM | POLLRDBAND | POLLWRNORM | POLLWRBAND;
+static int b = (POLLIN | POLLPRI | POLLOUT | POLLERR | POLLHUP | POLLNVAL
+                | POLLRDNORM | POLLRDBAND | POLLWRNORM | POLLWRBAND);
 
 int
 main (void)
diff --git a/tests/test-pow.c b/tests/test-pow.c
index d0b8e8d569..5e48bb5e07 100644
--- a/tests/test-pow.c
+++ b/tests/test-pow.c
@@ -25,9 +25,9 @@ SIGNATURE_CHECK (pow, double, (double, double));
 
 #include "macros.h"
 
-volatile double x;
-volatile double y;
-double z;
+static volatile double x;
+static volatile double y;
+static double z;
 
 int
 main ()
diff --git a/tests/test-powf.c b/tests/test-powf.c
index 57f4f90c7c..1211181634 100644
--- a/tests/test-powf.c
+++ b/tests/test-powf.c
@@ -25,9 +25,9 @@ SIGNATURE_CHECK (powf, float, (float, float));
 
 #include "macros.h"
 
-volatile float x;
-volatile float y;
-float z;
+static volatile float x;
+static volatile float y;
+static float z;
 
 int
 main ()
diff --git a/tests/test-pthread.c b/tests/test-pthread.c
index f7e89c667c..1d00855a9f 100644
--- a/tests/test-pthread.c
+++ b/tests/test-pthread.c
@@ -22,39 +22,39 @@
 
 /* Check that the types are all defined.  */
 
-pthread_t t1;
-pthread_attr_t t2;
+static pthread_t t1;
+static pthread_attr_t t2;
 
-pthread_once_t t3 = PTHREAD_ONCE_INIT;
+static pthread_once_t t3 = PTHREAD_ONCE_INIT;
 
-pthread_mutex_t t4 = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutexattr_t t5;
+static pthread_mutex_t t4 = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutexattr_t t5;
 
-pthread_rwlock_t t6 = PTHREAD_RWLOCK_INITIALIZER;
-pthread_rwlockattr_t t7;
+static pthread_rwlock_t t6 = PTHREAD_RWLOCK_INITIALIZER;
+static pthread_rwlockattr_t t7;
 
-pthread_cond_t t8 = PTHREAD_COND_INITIALIZER;
-pthread_condattr_t t9;
+static pthread_cond_t t8 = PTHREAD_COND_INITIALIZER;
+static pthread_condattr_t t9;
 
-pthread_key_t t10;
+static pthread_key_t t10;
 
-pthread_spinlock_t t11;
+static pthread_spinlock_t t11;
 
 #ifdef TODO /* Not implemented in gnulib yet */
-pthread_barrier_t t12;
-pthread_barrierattr_t t13;
+static pthread_barrier_t t12;
+static pthread_barrierattr_t t13;
 #endif
 
 /* Check that the various macros are defined.  */
 
 /* Constants for pthread_attr_setdetachstate().  */
-int ds[] = { PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED };
+static int ds[] = { PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED };
 
 /* Constants for pthread_exit().  */
-void *canceled = PTHREAD_CANCELED;
+static void *canceled = PTHREAD_CANCELED;
 
 /* Constants for pthread_mutexattr_settype().  */
-int mt[] = {
+static int mt[] = {
   PTHREAD_MUTEX_DEFAULT,
   PTHREAD_MUTEX_NORMAL,
   PTHREAD_MUTEX_RECURSIVE,
@@ -64,19 +64,19 @@ int mt[] = {
 #ifdef TODO /* Not implemented in gnulib yet */
 
 /* Constants for pthread_mutexattr_setrobust().  */
-int mr[] = { PTHREAD_MUTEX_ROBUST, PTHREAD_MUTEX_STALLED };
+static int mr[] = { PTHREAD_MUTEX_ROBUST, PTHREAD_MUTEX_STALLED };
 
 /* Constants for pthread_barrierattr_setpshared().  */
-int bp[] = { PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE };
+static int bp[] = { PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE };
 
 /* Constants for pthread_barrier_wait().  */
-int bw[] = { PTHREAD_BARRIER_SERIAL_THREAD };
+static int bw[] = { PTHREAD_BARRIER_SERIAL_THREAD };
 
 /* Constants for pthread_setcancelstate().  */
-int cs[] = { PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE };
+static int cs[] = { PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE };
 
 /* Constants for pthread_setcanceltype().  */
-int ct[] = { PTHREAD_CANCEL_DEFERRED, PTHREAD_CANCEL_ASYNCHRONOUS };
+static int ct[] = { PTHREAD_CANCEL_DEFERRED, PTHREAD_CANCEL_ASYNCHRONOUS };
 
 #endif
 
diff --git a/tests/test-remainder.h b/tests/test-remainder.h
index 57e2746845..69fab707e2 100644
--- a/tests/test-remainder.h
+++ b/tests/test-remainder.h
@@ -119,6 +119,6 @@ test_function (void)
   }
 }
 
-volatile DOUBLE x;
-volatile DOUBLE y;
-DOUBLE z;
+static volatile DOUBLE x;
+static volatile DOUBLE y;
+static DOUBLE z;
diff --git a/tests/test-sched.c b/tests/test-sched.c
index afefc7d5a7..6af9816f5b 100644
--- a/tests/test-sched.c
+++ b/tests/test-sched.c
@@ -24,12 +24,12 @@
 static struct sched_param a;
 
 /* Check that the SCHED_* macros are defined and compile-time constants.  */
-int b[] = { SCHED_FIFO, SCHED_RR, SCHED_OTHER };
+static int b[] = { SCHED_FIFO, SCHED_RR, SCHED_OTHER };
 
 /* Check that the types are all defined.  */
-pid_t t1;
+static pid_t t1;
 
-int f1;
+static int f1;
 
 int
 main ()
diff --git a/tests/test-sethostname1.c b/tests/test-sethostname1.c
index 888e964ae6..7f39ac4934 100644
--- a/tests/test-sethostname1.c
+++ b/tests/test-sethostname1.c
@@ -24,7 +24,7 @@
 SIGNATURE_CHECK (sethostname, int, (const char *, size_t));
 #endif
 
-int do_dangerous_things;
+static int do_dangerous_things;
 
 int
 main ()
diff --git a/tests/test-signal-h.c b/tests/test-signal-h.c
index c4b3220787..1901682461 100644
--- a/tests/test-signal-h.c
+++ b/tests/test-signal-h.c
@@ -21,7 +21,7 @@
 #include <signal.h>
 
 /* Check for required types.  */
-struct
+static struct
 {
   size_t a;
   uid_t b;
@@ -36,7 +36,7 @@ struct
 } s;
 
 /* Check that NSIG is defined.  */
-int nsig = NSIG;
+static int nsig = NSIG;
 
 int
 main (void)
diff --git a/tests/test-signbit.c b/tests/test-signbit.c
index da5b7981e5..f55d7df688 100644
--- a/tests/test-signbit.c
+++ b/tests/test-signbit.c
@@ -34,9 +34,9 @@
 #include "signed-snan.h"
 #include "macros.h"
 
-float zerof = 0.0f;
-double zerod = 0.0;
-long double zerol = 0.0L;
+static float zerof = 0.0f;
+static double zerod = 0.0;
+static long double zerol = 0.0L;
 
 static void
 test_signbitf ()
diff --git a/tests/test-sigpipe.c b/tests/test-sigpipe.c
index 76396253f9..f2144831be 100644
--- a/tests/test-sigpipe.c
+++ b/tests/test-sigpipe.c
@@ -19,7 +19,7 @@
 #include <signal.h>
 
 /* Check that SIGPIPE is defined.  */
-int s = SIGPIPE;
+static int s = SIGPIPE;
 
 #include <errno.h>
 #include <stdio.h>
diff --git a/tests/test-sigsegv-catch-segv1.c b/tests/test-sigsegv-catch-segv1.c
index 8c04ef0888..fe9cdc7145 100644
--- a/tests/test-sigsegv-catch-segv1.c
+++ b/tests/test-sigsegv-catch-segv1.c
@@ -36,9 +36,9 @@
 #  define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0
 # endif
 
-uintptr_t page;
+static uintptr_t page;
 
-volatile int handler_called = 0;
+static volatile int handler_called = 0;
 
 static int
 handler (void *fault_address, int serious)
diff --git a/tests/test-sigsegv-catch-segv2.c b/tests/test-sigsegv-catch-segv2.c
index 397359e344..357cf1e162 100644
--- a/tests/test-sigsegv-catch-segv2.c
+++ b/tests/test-sigsegv-catch-segv2.c
@@ -45,13 +45,13 @@
 #  define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0
 # endif
 
-jmp_buf mainloop;
-sigset_t mainsigset;
+static jmp_buf mainloop;
+static sigset_t mainsigset;
 
-volatile int pass = 0;
-uintptr_t page;
+static volatile int pass = 0;
+static uintptr_t page;
 
-volatile int handler_called = 0;
+static volatile int handler_called = 0;
 
 static void
 handler_continuation (void *arg1, void *arg2, void *arg3)
diff --git a/tests/test-sin.c b/tests/test-sin.c
index 8a0e14c667..59afeac1c2 100644
--- a/tests/test-sin.c
+++ b/tests/test-sin.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (sin, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-sinf.c b/tests/test-sinf.c
index a5ad675021..88ad7c9f4c 100644
--- a/tests/test-sinf.c
+++ b/tests/test-sinf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (sinf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-sinh.c b/tests/test-sinh.c
index d78aa99ae8..c645aa4e61 100644
--- a/tests/test-sinh.c
+++ b/tests/test-sinh.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (sinh, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-sinhf.c b/tests/test-sinhf.c
index ce1f6857a0..d934883969 100644
--- a/tests/test-sinhf.c
+++ b/tests/test-sinhf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (sinhf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-sinl.c b/tests/test-sinl.c
index 9ea27ae89c..5c4f382d9b 100644
--- a/tests/test-sinl.c
+++ b/tests/test-sinl.c
@@ -26,8 +26,8 @@ SIGNATURE_CHECK (sinl, long double, (long double));
 #include "fpucw.h"
 #include "macros.h"
 
-volatile long double x;
-long double y;
+static volatile long double x;
+static long double y;
 
 int
 main ()
diff --git a/tests/test-snan-1.c b/tests/test-snan-1.c
index 856eb2376b..652aa5cebc 100644
--- a/tests/test-snan-1.c
+++ b/tests/test-snan-1.c
@@ -41,9 +41,9 @@ main ()
 
 # include "macros.h"
 
-float volatile resultf;
-double volatile resultd;
-long double volatile resultl;
+static float volatile resultf;
+static double volatile resultd;
+static long double volatile resultl;
 
 int
 main ()
diff --git a/tests/test-snan-2.c b/tests/test-snan-2.c
index 7d6313a50f..03b3df7409 100644
--- a/tests/test-snan-2.c
+++ b/tests/test-snan-2.c
@@ -31,9 +31,9 @@
 
 # include "macros.h"
 
-float volatile resultf;
-double volatile resultd;
-long double volatile resultl;
+static float volatile resultf;
+static double volatile resultd;
+static long double volatile resultl;
 
 int
 main (int argc, char *argv[])
diff --git a/tests/test-spawn.c b/tests/test-spawn.c
index f1bbe32ee7..c73b40494b 100644
--- a/tests/test-spawn.c
+++ b/tests/test-spawn.c
@@ -21,7 +21,7 @@
 #include <spawn.h>
 
 /* Check for existence of required types.  */
-struct check
+static struct check
 {
   posix_spawnattr_t a;
   posix_spawn_file_actions_t b;
diff --git a/tests/test-sqrt.h b/tests/test-sqrt.h
index edf9383cf4..8dd51d5d17 100644
--- a/tests/test-sqrt.h
+++ b/tests/test-sqrt.h
@@ -56,5 +56,5 @@ test_function (void)
       }
 }
 
-volatile DOUBLE x;
-DOUBLE y;
+static volatile DOUBLE x;
+static DOUBLE y;
diff --git a/tests/test-stdbool.c b/tests/test-stdbool.c
index 9322b500b6..d741d7b2ac 100644
--- a/tests/test-stdbool.c
+++ b/tests/test-stdbool.c
@@ -55,38 +55,38 @@
 #endif
 
 #if WORKING_BOOL
-struct s { bool s: 1; bool t; } s;
+static struct s { bool s: 1; bool t; } s;
 #endif
 
-char a[true == 1 ? 1 : -1];
-char b[false == 0 ? 1 : -1];
+static char a[true == 1 ? 1 : -1];
+static char b[false == 0 ? 1 : -1];
 #if WORKING_BOOL
-char d[(bool) 0.5 == true ? 1 : -1];
+static char d[(bool) 0.5 == true ? 1 : -1];
 # ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning.  */
 /* C99 may plausibly be interpreted as not requiring support for a cast from
    a variable's address to bool in a static initializer.  So treat it like a
    GCC extension.  */
 #  if defined __GNUC__ || defined __clang__
-bool e = &s;
+static bool e = &s;
 #  endif
 # endif
-char f[(bool) 0.0 == false ? 1 : -1];
+static char f[(bool) 0.0 == false ? 1 : -1];
 #endif
-char g[true];
-char h[sizeof (bool)];
+static char g[true];
+static char h[sizeof (bool)];
 #if WORKING_BOOL
-char i[sizeof s.t];
+static char i[sizeof s.t];
 #endif
 enum { j = false, k = true, l = false * true, m = true * 256 };
-bool n[m];
-char o[sizeof n == m * sizeof n[0] ? 1 : -1];
-char p[-1 - (bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+static bool n[m];
+static char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+static char p[-1 - (bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
 /* Catch a bug in an HP-UX C compiler.  See
    https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
    https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html
  */
-bool q = true;
-bool *pq = &q;
+static bool q = true;
+static bool *pq = &q;
 
 int
 main ()
diff --git a/tests/test-stddef.c b/tests/test-stddef.c
index 5bceb18a29..e5b132ce8b 100644
--- a/tests/test-stddef.c
+++ b/tests/test-stddef.c
@@ -21,10 +21,10 @@
 #include <stddef.h>
 
 /* Check that appropriate types are defined.  */
-wchar_t a = 'c';
-ptrdiff_t b = 1;
-size_t c = 2;
-max_align_t mat;
+static wchar_t a = 'c';
+static ptrdiff_t b = 1;
+static size_t c = 2;
+static max_align_t mat;
 
 /* Check that NULL can be passed through varargs as a pointer type,
    per POSIX 2008.  */
diff --git a/tests/test-stdint.c b/tests/test-stdint.c
index 47bedc8959..8653cb442b 100644
--- a/tests/test-stdint.c
+++ b/tests/test-stdint.c
@@ -39,46 +39,46 @@
 /* 7.18.1.1. Exact-width integer types */
 /* 7.18.2.1. Limits of exact-width integer types */
 
-int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX };
+static int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX };
 verify (TYPE_MINIMUM (int8_t) == INT8_MIN);
 verify (TYPE_MAXIMUM (int8_t) == INT8_MAX);
 verify_same_types (INT8_MIN, (int8_t) 0 + 0);
 verify_same_types (INT8_MAX, (int8_t) 0 + 0);
 
-int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX };
+static int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX };
 verify (TYPE_MINIMUM (int16_t) == INT16_MIN);
 verify (TYPE_MAXIMUM (int16_t) == INT16_MAX);
 verify_same_types (INT16_MIN, (int16_t) 0 + 0);
 verify_same_types (INT16_MAX, (int16_t) 0 + 0);
 
-int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX };
+static int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX };
 verify (TYPE_MINIMUM (int32_t) == INT32_MIN);
 verify (TYPE_MAXIMUM (int32_t) == INT32_MAX);
 verify_same_types (INT32_MIN, (int32_t) 0 + 0);
 verify_same_types (INT32_MAX, (int32_t) 0 + 0);
 
 #ifdef INT64_MAX
-int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX };
+static int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX };
 verify (TYPE_MINIMUM (int64_t) == INT64_MIN);
 verify (TYPE_MAXIMUM (int64_t) == INT64_MAX);
 verify_same_types (INT64_MIN, (int64_t) 0 + 0);
 verify_same_types (INT64_MAX, (int64_t) 0 + 0);
 #endif
 
-uint8_t b1[2] = { UINT8_C (17), UINT8_MAX };
+static uint8_t b1[2] = { UINT8_C (17), UINT8_MAX };
 verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX);
 verify_same_types (UINT8_MAX, (uint8_t) 0 + 0);
 
-uint16_t b2[2] = { UINT16_C (17), UINT16_MAX };
+static uint16_t b2[2] = { UINT16_C (17), UINT16_MAX };
 verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX);
 verify_same_types (UINT16_MAX, (uint16_t) 0 + 0);
 
-uint32_t b3[2] = { UINT32_C (17), UINT32_MAX };
+static uint32_t b3[2] = { UINT32_C (17), UINT32_MAX };
 verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX);
 verify_same_types (UINT32_MAX, (uint32_t) 0 + 0);
 
 #ifdef UINT64_MAX
-uint64_t b4[2] = { UINT64_C (17), UINT64_MAX };
+static uint64_t b4[2] = { UINT64_C (17), UINT64_MAX };
 verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX);
 verify_same_types (UINT64_MAX, (uint64_t) 0 + 0);
 #endif
@@ -98,46 +98,46 @@ err or;
 /* 7.18.1.2. Minimum-width integer types */
 /* 7.18.2.2. Limits of minimum-width integer types */
 
-int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX };
+static int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX };
 verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN);
 verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX);
 verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0);
 verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0);
 
-int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX };
+static int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX };
 verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN);
 verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX);
 verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0);
 verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0);
 
-int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX };
+static int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX };
 verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN);
 verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX);
 verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0);
 verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0);
 
 #ifdef INT_LEAST64_MAX
-int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX };
+static int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX };
 verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN);
 verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX);
 verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0);
 verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0);
 #endif
 
-uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX };
+static uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX };
 verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX);
 verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0);
 
-uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX };
+static uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX };
 verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX);
 verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0);
 
-uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX };
+static uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX };
 verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX);
 verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0);
 
 #ifdef UINT_LEAST64_MAX
-uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX };
+static uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX };
 verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX);
 verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0);
 #endif
@@ -157,46 +157,46 @@ err or;
 /* 7.18.1.3. Fastest minimum-width integer types */
 /* 7.18.2.3. Limits of fastest minimum-width integer types */
 
-int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX };
+static int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX };
 verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN);
 verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX);
 verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0);
 verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0);
 
-int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX };
+static int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX };
 verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN);
 verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX);
 verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0);
 verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0);
 
-int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX };
+static int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX };
 verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN);
 verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX);
 verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0);
 verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0);
 
 #ifdef INT_FAST64_MAX
-int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX };
+static int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX };
 verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN);
 verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX);
 verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0);
 verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0);
 #endif
 
-uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX };
+static uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX };
 verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX);
 verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0);
 
-uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX };
+static uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX };
 verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX);
 verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0);
 
-uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX };
+static uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX };
 verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX);
 verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0);
 
 #ifdef UINT_FAST64_MAX
-uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX };
+static uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX };
 verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX);
 verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0);
 #endif
@@ -217,7 +217,7 @@ err or;
 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
 
 #ifdef INTPTR_MAX
-intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX };
+static intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX };
 verify (sizeof (void *) <= sizeof (intptr_t));
 # ifndef __CHERI_PURE_CAPABILITY__
 verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN);
@@ -228,7 +228,7 @@ verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0);
 #endif
 
 #ifdef UINTPTR_MAX
-uintptr_t h[2] = { 17, UINTPTR_MAX };
+static uintptr_t h[2] = { 17, UINTPTR_MAX };
 verify (sizeof (void *) <= sizeof (uintptr_t));
 # ifndef __CHERI_PURE_CAPABILITY__
 verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX);
@@ -239,13 +239,13 @@ verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0);
 /* 7.18.1.5. Greatest-width integer types */
 /* 7.18.2.5. Limits of greatest-width integer types */
 
-intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX };
+static intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX };
 verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN);
 verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX);
 verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0);
 verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0);
 
-uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX };
+static uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX };
 verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX);
 verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0);
 
diff --git a/tests/test-stdio.c b/tests/test-stdio.c
index 44d58f0556..d6fd203b96 100644
--- a/tests/test-stdio.c
+++ b/tests/test-stdio.c
@@ -21,22 +21,22 @@
 #include <stdio.h>
 
 /* Check that the various SEEK_* macros are defined.  */
-int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+static int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 
 /* Check that the _PRINTF_NAN_LEN_MAX macro is defined.  */
-int pnlm[] = { _PRINTF_NAN_LEN_MAX };
+static int pnlm[] = { _PRINTF_NAN_LEN_MAX };
 
 /* Check that NULL can be passed through varargs as a pointer type,
    per POSIX 2008.  */
 static_assert (sizeof NULL == sizeof (void *));
 
 /* Check that the types are all defined.  */
-fpos_t t1;
-off_t t2;
-size_t t3;
-ssize_t t4;
-va_list t5;
-off64_t t6;
+static fpos_t t1;
+static off_t t2;
+static size_t t3;
+static ssize_t t4;
+static va_list t5;
+static off64_t t6;
 
 #include <string.h>
 
diff --git a/tests/test-string-buffer.c b/tests/test-string-buffer.c
index cbaa02e153..4b1dbb0d13 100644
--- a/tests/test-string-buffer.c
+++ b/tests/test-string-buffer.c
@@ -37,8 +37,8 @@ my_appendf (struct string_buffer *buffer, const char *formatstring, ...)
   return ret;
 }
 
-char invalid_format_string_1[] = "%&";
-char invalid_format_string_2[] = "%^";
+static char invalid_format_string_1[] = "%&";
+static char invalid_format_string_2[] = "%^";
 
 int
 main ()
diff --git a/tests/test-sys_random.c b/tests/test-sys_random.c
index 16cacd31d7..e1dd74f22c 100644
--- a/tests/test-sys_random.c
+++ b/tests/test-sys_random.c
@@ -19,7 +19,7 @@
 #include <sys/random.h>
 
 /* Check that the necessary constants are defined.  */
-int flags[] =
+static int flags[] =
   {
     GRND_RANDOM,
     GRND_NONBLOCK
diff --git a/tests/test-sys_resource.c b/tests/test-sys_resource.c
index 0d7a0f5a50..9a822415fb 100644
--- a/tests/test-sys_resource.c
+++ b/tests/test-sys_resource.c
@@ -20,40 +20,40 @@
 
 /* Check that necessary types are defined.  */
 #ifdef TODO /* Not implemented in gnulib yet */
-rlim_t t1;
-struct rlimit t2;
+static rlim_t t1;
+static struct rlimit t2;
 #endif
-struct rusage t3;
+static struct rusage t3;
 #ifdef TODO
-struct timeval t4;
-id_t t5;
-time_t t10;
-suseconds_t t11;
-fd_set t12;
+static struct timeval t4;
+static id_t t5;
+static time_t t10;
+static suseconds_t t11;
+static fd_set t12;
 #endif
 
 /* Check that the necessary constants are defined.  */
 #ifdef TODO /* Not implemented in gnulib yet */
-int prios[] =
+static int prios[] =
   {
     PRIO_PROCESS,
     PRIO_PGRP,
     PRIO_USER
   };
-int rlims[] =
+static int rlims[] =
   {
     RLIM_INFINITY,
     RLIM_SAVED_MAX,
     RLIM_SAVED_CUR
   };
 #endif
-int rusages[] =
+static int rusages[] =
   {
     RUSAGE_SELF,
     RUSAGE_CHILDREN
   };
 #ifdef TODO
-int rlimits[] =
+static int rlimits[] =
   {
     RLIMIT_CORE,
     RLIMIT_CPU,
diff --git a/tests/test-sys_select.c b/tests/test-sys_select.c
index db791de189..9361c24a54 100644
--- a/tests/test-sys_select.c
+++ b/tests/test-sys_select.c
@@ -21,14 +21,14 @@
 #include <sys/select.h>
 
 /* Check that the 'struct timeval' type is defined.  */
-struct timeval a;
+static struct timeval a;
 
 /* Check that a.tv_sec is wide enough to hold a time_t, ignoring
    signedness issues.  */
 typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1];
 
 /* Check that sigset_t is defined.  */
-sigset_t t2;
+static sigset_t t2;
 
 #include "signature.h"
 
diff --git a/tests/test-sys_socket.c b/tests/test-sys_socket.c
index 4e0f9ad46e..ecf82ac2a3 100644
--- a/tests/test-sys_socket.c
+++ b/tests/test-sys_socket.c
@@ -22,21 +22,21 @@
 
 #if HAVE_SHUTDOWN
 /* Check some integer constant expressions.  */
-int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
+static int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
 #endif
 
 /* Check that the 'socklen_t' type is defined.  */
-socklen_t t1;
+static socklen_t t1;
 
 /* Check that the 'size_t' and 'ssize_t' types are defined.  */
-size_t t2;
-ssize_t t3;
+static size_t t2;
+static ssize_t t3;
 
 /* Check that 'struct iovec' is defined.  */
-struct iovec io;
+static struct iovec io;
 
 /* Check that a minimal set of 'struct msghdr' is defined.  */
-struct msghdr msg;
+static struct msghdr msg;
 
 #include <errno.h>
 
diff --git a/tests/test-sys_stat.c b/tests/test-sys_stat.c
index 7c4ec1fe0a..bf1dae2258 100644
--- a/tests/test-sys_stat.c
+++ b/tests/test-sys_stat.c
@@ -21,7 +21,7 @@
 #include <sys/stat.h>
 
 /* Check the existence of some macros.  */
-int a[] =
+static int a[] =
   {
     S_IFMT,
 #ifdef S_IFBLK /* missing on MSVC */
@@ -325,11 +325,11 @@ invalid UTIME macros
 #endif
 
 /* Check the existence of some types.  */
-nlink_t t1;
-off_t t2;
-mode_t t3;
+static nlink_t t1;
+static off_t t2;
+static mode_t t3;
 
-struct timespec st;
+static struct timespec st;
 
 int
 main (void)
diff --git a/tests/test-sys_time.c b/tests/test-sys_time.c
index 5db5c2c0c6..b69dd67d8c 100644
--- a/tests/test-sys_time.c
+++ b/tests/test-sys_time.c
@@ -21,7 +21,7 @@
 #include <sys/time.h>
 
 /* Check that the 'struct timeval' type is defined.  */
-struct timeval a;
+static struct timeval a;
 
 /* Check that a.tv_sec is wide enough to hold a time_t, ignoring
    signedness issues.  */
diff --git a/tests/test-sys_types.c b/tests/test-sys_types.c
index 46da846ef2..e16cf941bd 100644
--- a/tests/test-sys_types.c
+++ b/tests/test-sys_types.c
@@ -21,12 +21,12 @@
 #include <sys/types.h>
 
 /* Check that the types are all defined.  */
-pid_t t1;
-size_t t2;
-ssize_t t3;
-off_t t4;
-mode_t t5;
-off64_t t6;
+static pid_t t1;
+static size_t t2;
+static ssize_t t3;
+static off_t t4;
+static mode_t t5;
+static off64_t t6;
 
 int
 main (void)
diff --git a/tests/test-sys_uio.c b/tests/test-sys_uio.c
index d371471f87..6bcc2e5569 100644
--- a/tests/test-sys_uio.c
+++ b/tests/test-sys_uio.c
@@ -21,9 +21,9 @@
 #include <sys/uio.h>
 
 /* Check that necessary types are defined.  */
-size_t a;
-ssize_t b;
-struct iovec c;
+static size_t a;
+static ssize_t b;
+static struct iovec c;
 
 int
 main (void)
diff --git a/tests/test-sysexits.c b/tests/test-sysexits.c
index 636b23fef3..13f4b37703 100644
--- a/tests/test-sysexits.c
+++ b/tests/test-sysexits.c
@@ -20,7 +20,7 @@
 
 #include <sysexits.h>
 
-int exitcode;
+static int exitcode;
 
 int
 main ()
diff --git a/tests/test-tan.c b/tests/test-tan.c
index eecaf84f50..e62c46da00 100644
--- a/tests/test-tan.c
+++ b/tests/test-tan.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (tan, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-tanf.c b/tests/test-tanf.c
index 7a84b18fec..cc3eadbe7b 100644
--- a/tests/test-tanf.c
+++ b/tests/test-tanf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (tanf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-tanh.c b/tests/test-tanh.c
index 9885efa3d1..023547777d 100644
--- a/tests/test-tanh.c
+++ b/tests/test-tanh.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (tanh, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-tanhf.c b/tests/test-tanhf.c
index 9844084ec1..b62573f060 100644
--- a/tests/test-tanhf.c
+++ b/tests/test-tanhf.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (tanhf, float, (float));
 
 #include "macros.h"
 
-volatile float x;
-float y;
+static volatile float x;
+static float y;
 
 int
 main ()
diff --git a/tests/test-tanl.c b/tests/test-tanl.c
index a21e8afc58..5646984e42 100644
--- a/tests/test-tanl.c
+++ b/tests/test-tanl.c
@@ -26,8 +26,8 @@ SIGNATURE_CHECK (tanl, long double, (long double));
 #include "fpucw.h"
 #include "macros.h"
 
-volatile long double x;
-long double y;
+static volatile long double x;
+static long double y;
 
 int
 main ()
diff --git a/tests/test-termios.c b/tests/test-termios.c
index 93a6b458cf..201e9b49b7 100644
--- a/tests/test-termios.c
+++ b/tests/test-termios.c
@@ -21,7 +21,7 @@
 #include <termios.h>
 
 /* Check that the types are all defined.  */
-pid_t t1;
+static pid_t t1;
 
 int
 main (void)
diff --git a/tests/test-thrd_current.c b/tests/test-thrd_current.c
index 0110f4ed13..a14e8118cb 100644
--- a/tests/test-thrd_current.c
+++ b/tests/test-thrd_current.c
@@ -20,7 +20,7 @@
 
 #include <threads.h>
 
-thrd_t main_thread;
+static thrd_t main_thread;
 
 int
 main ()
diff --git a/tests/test-thread_self.c b/tests/test-thread_self.c
index e494613bf9..56dce07f44 100644
--- a/tests/test-thread_self.c
+++ b/tests/test-thread_self.c
@@ -20,7 +20,7 @@
 
 #include "glthread/thread.h"
 
-gl_thread_t main_thread;
+static gl_thread_t main_thread;
 
 int
 main ()
diff --git a/tests/test-threads.c b/tests/test-threads.c
index aec648eb7c..3f909b05ae 100644
--- a/tests/test-threads.c
+++ b/tests/test-threads.c
@@ -27,13 +27,13 @@
 #ifndef ONCE_FLAG_INIT
 "oops1"
 #endif
-once_flag a = ONCE_FLAG_INIT;
+static once_flag a = ONCE_FLAG_INIT;
 
 /* Check that TSS_DTOR_ITERATIONS is defined.  */
 #ifndef TSS_DTOR_ITERATIONS
 "oops2"
 #endif
-int b = TSS_DTOR_ITERATIONS;
+static int b = TSS_DTOR_ITERATIONS;
 
 int
 main (void)
diff --git a/tests/test-time-h.c b/tests/test-time-h.c
index 01f9fff8a3..b94dd62079 100644
--- a/tests/test-time-h.c
+++ b/tests/test-time-h.c
@@ -21,11 +21,11 @@
 #include <time.h>
 
 /* Check that the types are all defined.  */
-struct timespec t1;
+static struct timespec t1;
 #if 0
 /* POSIX:2008 does not require pid_t in <time.h> unconditionally, and indeed
    it's missing on Mac OS X 10.5, FreeBSD 6.4, OpenBSD 4.9, mingw.  */
-pid_t t2;
+static pid_t t2;
 #endif
 
 /* Check that NULL can be passed through varargs as a pointer type,
@@ -33,7 +33,7 @@ pid_t t2;
 static_assert (sizeof NULL == sizeof (void *));
 
 /* Check that TIME_UTC is defined and a positive integer.  */
-int t3 = TIME_UTC;
+static int t3 = TIME_UTC;
 static_assert (TIME_UTC > 0);
 
 int
diff --git a/tests/test-uchar.c b/tests/test-uchar.c
index dfb368e052..ed978785be 100644
--- a/tests/test-uchar.c
+++ b/tests/test-uchar.c
@@ -21,11 +21,11 @@
 #include <uchar.h>
 
 /* Check that the types are defined.  */
-mbstate_t a = { 0 };
-size_t b = 5;
-char8_t c = 'x';
-char16_t d = 'y';
-char32_t e = 'z';
+static mbstate_t a = { 0 };
+static size_t b = 5;
+static char8_t c = 'x';
+static char16_t d = 'y';
+static char32_t e = 'z';
 
 /* Check that char8_t, char16_t, and char32_t are unsigned types.  */
 static_assert ((char8_t)(-1) >= 0);
diff --git a/tests/test-unistd.c b/tests/test-unistd.c
index e131302ab6..2f728a5dc5 100644
--- a/tests/test-unistd.c
+++ b/tests/test-unistd.c
@@ -25,7 +25,7 @@
 static_assert (sizeof NULL == sizeof (void *));
 
 /* Check that the various SEEK_* macros are defined.  */
-int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+static int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 
 /* Check that the various *_FILENO macros are defined.  */
 #if ! (defined STDIN_FILENO                                     \
@@ -34,19 +34,19 @@ missing or broken *_FILENO macros
 #endif
 
 /* Check that the types are all defined.  */
-size_t t1;
-ssize_t t2;
+static size_t t1;
+static ssize_t t2;
 #ifdef TODO /* Not implemented in gnulib yet */
-uid_t t3;
-gid_t t4;
+static uid_t t3;
+static gid_t t4;
 #endif
-off_t t5;
-pid_t t6;
+static off_t t5;
+static pid_t t6;
 #ifdef TODO
-useconds_t t7;
-intptr_t t8;
+static useconds_t t7;
+static intptr_t t8;
 #endif
-off64_t t9;
+static off64_t t9;
 
 int
 main (void)
diff --git a/tests/test-utime-h.c b/tests/test-utime-h.c
index 908a0e7254..d225291ce1 100644
--- a/tests/test-utime-h.c
+++ b/tests/test-utime-h.c
@@ -21,7 +21,7 @@
 #include <utime.h>
 
 /* Check that 'struct utimbuf' is defined.  */
-struct utimbuf b;
+static struct utimbuf b;
 
 int
 main (void)
diff --git a/tests/test-verify.c b/tests/test-verify.c
index 1d8f43c7a7..3a8088693d 100644
--- a/tests/test-verify.c
+++ b/tests/test-verify.c
@@ -27,7 +27,7 @@
 
 /* ======================= Test verify, verify_expr ======================= */
 
-int gx;
+static int gx;
 enum { A, B, C };
 
 #if EXP_FAIL == 1
diff --git a/tests/test-wchar.c b/tests/test-wchar.c
index 663a5a4ea6..ddc72770c0 100644
--- a/tests/test-wchar.c
+++ b/tests/test-wchar.c
@@ -21,8 +21,8 @@
 #include <wchar.h>
 
 /* Check that the types wchar_t and wint_t are defined.  */
-wchar_t a = 'c';
-wint_t b = 'x';
+static wchar_t a = 'c';
+static wint_t b = 'x';
 
 /* Check that NULL can be passed through varargs as a pointer type,
    per POSIX 2008.  */
diff --git a/tests/test-wctype-h.c b/tests/test-wctype-h.c
index 016fd8fcfb..2f7628552e 100644
--- a/tests/test-wctype-h.c
+++ b/tests/test-wctype-h.c
@@ -21,15 +21,15 @@
 #include <wctype.h>
 
 /* Check that the type wint_t is defined.  */
-wint_t a = 'x';
+static wint_t a = 'x';
 /* Check that WEOF is defined.  */
-wint_t e = WEOF;
+static wint_t e = WEOF;
 
 /* Check that the type wctype_t is defined.  */
-wctype_t p;
+static wctype_t p;
 
 /* Check that the type wctrans_t is defined.  */
-wctrans_t q;
+static wctrans_t q;
 
 #include "macros.h"
 
diff --git a/tests/test-y0.c b/tests/test-y0.c
index 3115e6d041..404ae3f3e1 100644
--- a/tests/test-y0.c
+++ b/tests/test-y0.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (y0, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-y1.c b/tests/test-y1.c
index 1da561dd0d..fa28d128c0 100644
--- a/tests/test-y1.c
+++ b/tests/test-y1.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (y1, double, (double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
diff --git a/tests/test-yn.c b/tests/test-yn.c
index 90e3b9c901..cad82d50f7 100644
--- a/tests/test-yn.c
+++ b/tests/test-yn.c
@@ -25,8 +25,8 @@ SIGNATURE_CHECK (yn, double, (int, double));
 
 #include "macros.h"
 
-volatile double x;
-double y;
+static volatile double x;
+static double y;
 
 int
 main ()
-- 
2.44.0


             reply	other threads:[~2024-04-28  6:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28  6:52 Collin Funk [this message]
2024-04-28 10:11 ` Pacify -Wmissing-variable-declarations in unit tests Bruno Haible
2024-04-28 11:03   ` Collin Funk
2024-04-28 23:27     ` Paul Eggert
2024-04-29  0:58       ` Collin Funk
2024-04-29 22:12         ` warnings " Bruno Haible
2024-04-30  0:31           ` Collin Funk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb19c781-6785-43e9-89a9-5730676f4c4b@gmail.com \
    --to=collin.funk1@gmail.com \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).