2021-08-01 Paul Eggert <eggert@cs.ucla.edu>
+ 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.
+
maint: improve -fanalyzer malloc checking
* lib/backup-internal.h, lib/backupfile.h:
* lib/canonicalize.h, lib/dfa.h, lib/dirname.h, lib/exclude.h:
volatile int handler_called = 0;
-int
+static int
handler (void *fault_address, int serious)
{
handler_called++;
return 0;
}
-void
+static void
crasher (uintptr_t p)
{
*(volatile int *) (p + 0x678) = 42;
# 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)
longjmp (mainloop, arg);
}
-void
+static void
stackoverflow_handler (int emergency, stackoverflow_context_t scp)
{
char dummy;
(void *) (long) (emergency ? -1 : pass), NULL, NULL);
}
-volatile int *
+static volatile int *
recurse_1 (int n, volatile int *p)
{
if (n < INT_MAX)
return p;
}
-int
+static int
recurse (volatile int n)
{
return *recurse_1 (n, &n);
# 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)
longjmp (mainloop, arg);
}
-void
+static void
stackoverflow_handler (int emergency, stackoverflow_context_t scp)
{
pass++;
(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. */
(void *) (long) pass, NULL, NULL);
}
-volatile int *
+static volatile int *
recurse_1 (int n, volatile int *p)
{
if (n < INT_MAX)
return p;
}
-int
+static int
recurse (volatile int n)
{
return *recurse_1 (n, &n);