bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 26/27] sigsegv-tests: make more things static
Date: Sun,  1 Aug 2021 18:18:20 -0700	[thread overview]
Message-ID: <20210802011821.1057057-26-eggert@cs.ucla.edu> (raw)
In-Reply-To: <20210802011821.1057057-1-eggert@cs.ucla.edu>

* 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.
---
 ChangeLog                                 |  7 +++++++
 tests/test-sigsegv-catch-segv1.c          |  4 ++--
 tests/test-sigsegv-catch-stackoverflow1.c | 16 ++++++++--------
 tests/test-sigsegv-catch-stackoverflow2.c | 18 +++++++++---------
 4 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f72226809..f908d4ef5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 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:
diff --git a/tests/test-sigsegv-catch-segv1.c b/tests/test-sigsegv-catch-segv1.c
index 68f65c55c..4f6989efe 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 2f1e6f487..3c229975b 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 5914e3250..ea79b96e7 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);
-- 
2.31.1



  parent reply	other threads:[~2021-08-02  1:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02  1:17 [PATCH 01/27] backupfile: improve -fanalyzer malloc checking Paul Eggert
2021-08-02  1:17 ` [PATCH 02/27] maint: " Paul Eggert
2021-08-02  1:17 ` [PATCH 03/27] dfa: " Paul Eggert
2021-08-07 13:03   ` Bruno Haible
2021-08-02  1:17 ` [PATCH 04/27] dirname: " Paul Eggert
2021-08-07 13:13   ` Bruno Haible
2021-08-02  1:17 ` [PATCH 05/27] exclude: " Paul Eggert
2021-08-02  1:18 ` [PATCH 06/27] filenamecat-lgpl: " Paul Eggert
2021-08-02  1:18 ` [PATCH 07/27] malloca: " Paul Eggert
2021-08-07 13:20   ` Bruno Haible
2021-08-02  1:18 ` [PATCH 08/27] modechange: " Paul Eggert
2021-08-02  1:18 ` [PATCH 09/27] mountlist: " Paul Eggert
2021-08-02  1:18 ` [PATCH 10/27] pagalign_alloc: " Paul Eggert
2021-08-02  1:18 ` [PATCH 11/27] quotearg: " Paul Eggert
2021-08-07 13:25   ` Bruno Haible
2021-08-02  1:18 ` [PATCH 12/27] readutmp: " Paul Eggert
2021-08-02  1:18 ` [PATCH 13/27] savedir: " Paul Eggert
2021-08-02  1:18 ` [PATCH 14/27] sh-quote: " Paul Eggert
2021-08-02  1:18 ` [PATCH 15/27] system-quote: " Paul Eggert
2021-08-02  1:18 ` [PATCH 16/27] trim: " Paul Eggert
2021-08-02  1:18 ` [PATCH 17/27] xgetcwd: " Paul Eggert
2021-08-02  1:18 ` [PATCH 18/27] xgethostname: " Paul Eggert
2021-08-02  1:18 ` [PATCH 19/27] xmalloca: " Paul Eggert
2021-08-02  1:18 ` [PATCH 20/27] xreadlink: " Paul Eggert
2021-08-02  1:18 ` [PATCH 21/27] xstriconv: " Paul Eggert
2021-08-02  1:18 ` [PATCH 22/27] xvasprintf: " Paul Eggert
2021-08-02  1:18 ` [PATCH 23/27] vasnprintf: " Paul Eggert
2021-08-02  1:18 ` [PATCH 24/27] argmatch-tests: " Paul Eggert
2021-08-02  1:18 ` [PATCH 25/27] manywarnings: " Paul Eggert
2021-08-02  1:18 ` Paul Eggert [this message]
2021-08-07 13:47   ` [PATCH 26/27] sigsegv-tests: make more things static Bruno Haible
2021-08-02  1:18 ` [PATCH 27/27] * lib/quotarg.c: remove wrong, unneeded comment Paul Eggert

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=20210802011821.1057057-26-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --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).