summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-08-01 17:57:43 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-08-01 18:06:59 -0700
commitdbc0251f52475b58a9724f4d42907abeada0f091 (patch)
tree37848d89df140611ed5042a61dde9e0071e956af /tests
parent3ffd764325f24c041021e1100dcbc769a324c47c (diff)
downloadgnulib-dbc0251f52475b58a9724f4d42907abeada0f091.tar.gz
sigsegv-tests: make more things static
* tests/test-sigsegv-catch-segv1.c: * tests/test-sigsegv-catch-stackoverflow1.c: * tests/test-sigsegv-catch-stackoverflow2.c: Declare some functions and variables static, to pacify GCC when warning about external functions missing declarations.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-sigsegv-catch-segv1.c4
-rw-r--r--tests/test-sigsegv-catch-stackoverflow1.c16
-rw-r--r--tests/test-sigsegv-catch-stackoverflow2.c18
3 files changed, 19 insertions, 19 deletions
diff --git a/tests/test-sigsegv-catch-segv1.c b/tests/test-sigsegv-catch-segv1.c
index 68f65c55c6..4f6989efe9 100644
--- a/tests/test-sigsegv-catch-segv1.c
+++ b/tests/test-sigsegv-catch-segv1.c
@@ -40,7 +40,7 @@ uintptr_t page;
volatile int handler_called = 0;
-int
+static int
handler (void *fault_address, int serious)
{
handler_called++;
@@ -54,7 +54,7 @@ handler (void *fault_address, int serious)
return 0;
}
-void
+static void
crasher (uintptr_t p)
{
*(volatile int *) (p + 0x678) = 42;
diff --git a/tests/test-sigsegv-catch-stackoverflow1.c b/tests/test-sigsegv-catch-stackoverflow1.c
index 2f1e6f4879..3c229975b3 100644
--- a/tests/test-sigsegv-catch-stackoverflow1.c
+++ b/tests/test-sigsegv-catch-stackoverflow1.c
@@ -44,13 +44,13 @@
# endif
# include "altstack-util.h"
-jmp_buf mainloop;
-sigset_t mainsigset;
+static jmp_buf mainloop;
+static sigset_t mainsigset;
-volatile int pass = 0;
+static volatile int pass = 0;
-volatile char *stack_lower_bound;
-volatile char *stack_upper_bound;
+static volatile char *stack_lower_bound;
+static volatile char *stack_upper_bound;
static void
stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3)
@@ -59,7 +59,7 @@ stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3)
longjmp (mainloop, arg);
}
-void
+static void
stackoverflow_handler (int emergency, stackoverflow_context_t scp)
{
char dummy;
@@ -73,7 +73,7 @@ stackoverflow_handler (int emergency, stackoverflow_context_t scp)
(void *) (long) (emergency ? -1 : pass), NULL, NULL);
}
-volatile int *
+static volatile int *
recurse_1 (int n, volatile int *p)
{
if (n < INT_MAX)
@@ -81,7 +81,7 @@ recurse_1 (int n, volatile int *p)
return p;
}
-int
+static int
recurse (volatile int n)
{
return *recurse_1 (n, &n);
diff --git a/tests/test-sigsegv-catch-stackoverflow2.c b/tests/test-sigsegv-catch-stackoverflow2.c
index 5914e32504..ea79b96e7f 100644
--- a/tests/test-sigsegv-catch-stackoverflow2.c
+++ b/tests/test-sigsegv-catch-stackoverflow2.c
@@ -46,12 +46,12 @@
# endif
# include "altstack-util.h"
-jmp_buf mainloop;
-sigset_t mainsigset;
+static jmp_buf mainloop;
+static sigset_t mainsigset;
-volatile int pass = 0;
-uintptr_t page;
-volatile int *null_pointer_to_volatile_int /* = NULL */;
+static volatile int pass = 0;
+static uintptr_t page;
+static volatile int *null_pointer_to_volatile_int /* = NULL */;
static void
stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3)
@@ -60,7 +60,7 @@ stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3)
longjmp (mainloop, arg);
}
-void
+static void
stackoverflow_handler (int emergency, stackoverflow_context_t scp)
{
pass++;
@@ -76,7 +76,7 @@ stackoverflow_handler (int emergency, stackoverflow_context_t scp)
(void *) (long) (emergency ? -1 : pass), NULL, NULL);
}
-int
+static int
sigsegv_handler (void *address, int emergency)
{
/* This test is necessary to distinguish stack overflow and SIGSEGV. */
@@ -96,7 +96,7 @@ sigsegv_handler (void *address, int emergency)
(void *) (long) pass, NULL, NULL);
}
-volatile int *
+static volatile int *
recurse_1 (int n, volatile int *p)
{
if (n < INT_MAX)
@@ -104,7 +104,7 @@ recurse_1 (int n, volatile int *p)
return p;
}
-int
+static int
recurse (volatile int n)
{
return *recurse_1 (n, &n);