From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id E047A1F8C6 for ; Mon, 2 Aug 2021 01:20:46 +0000 (UTC) Received: from localhost ([::1]:49950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAMdK-0002HW-1Y for normalperson@yhbt.net; Sun, 01 Aug 2021 21:20:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAMcB-00008K-Ht for bug-gnulib@gnu.org; Sun, 01 Aug 2021 21:19:35 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:34506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAMc9-0001Im-MU for bug-gnulib@gnu.org; Sun, 01 Aug 2021 21:19:35 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 385C81600FB for ; Sun, 1 Aug 2021 18:19:12 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 5ZlcEKVgMCXX; Sun, 1 Aug 2021 18:19:11 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6958F16010F; Sun, 1 Aug 2021 18:19:09 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id YdK1jqFm34Rz; Sun, 1 Aug 2021 18:19:09 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 4626B160100; Sun, 1 Aug 2021 18:19:09 -0700 (PDT) From: Paul Eggert To: bug-gnulib@gnu.org Subject: [PATCH 26/27] sigsegv-tests: make more things static Date: Sun, 1 Aug 2021 18:18:20 -0700 Message-Id: <20210802011821.1057057-26-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210802011821.1057057-1-eggert@cs.ucla.edu> References: <20210802011821.1057057-1-eggert@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" * 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 =20 + 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; =20 volatile int handler_called =3D 0; =20 -int +static int handler (void *fault_address, int serious) { handler_called++; @@ -54,7 +54,7 @@ handler (void *fault_address, int serious) return 0; } =20 -void +static void crasher (uintptr_t p) { *(volatile int *) (p + 0x678) =3D 42; diff --git a/tests/test-sigsegv-catch-stackoverflow1.c b/tests/test-sigse= gv-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" =20 -jmp_buf mainloop; -sigset_t mainsigset; +static jmp_buf mainloop; +static sigset_t mainsigset; =20 -volatile int pass =3D 0; +static volatile int pass =3D 0; =20 -volatile char *stack_lower_bound; -volatile char *stack_upper_bound; +static volatile char *stack_lower_bound; +static volatile char *stack_upper_bound; =20 static void stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3) @@ -59,7 +59,7 @@ stackoverflow_handler_continuation (void *arg1, void *a= rg2, void *arg3) longjmp (mainloop, arg); } =20 -void +static void stackoverflow_handler (int emergency, stackoverflow_context_t scp) { char dummy; @@ -73,7 +73,7 @@ stackoverflow_handler (int emergency, stackoverflow_con= text_t scp) (void *) (long) (emergency ? -1 : pass), NULL, = NULL); } =20 -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; } =20 -int +static int recurse (volatile int n) { return *recurse_1 (n, &n); diff --git a/tests/test-sigsegv-catch-stackoverflow2.c b/tests/test-sigse= gv-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" =20 -jmp_buf mainloop; -sigset_t mainsigset; +static jmp_buf mainloop; +static sigset_t mainsigset; =20 -volatile int pass =3D 0; -uintptr_t page; -volatile int *null_pointer_to_volatile_int /* =3D NULL */; +static volatile int pass =3D 0; +static uintptr_t page; +static volatile int *null_pointer_to_volatile_int /* =3D NULL */; =20 static void stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3) @@ -60,7 +60,7 @@ stackoverflow_handler_continuation (void *arg1, void *a= rg2, void *arg3) longjmp (mainloop, arg); } =20 -void +static void stackoverflow_handler (int emergency, stackoverflow_context_t scp) { pass++; @@ -76,7 +76,7 @@ stackoverflow_handler (int emergency, stackoverflow_con= text_t scp) (void *) (long) (emergency ? -1 : pass), NULL, = NULL); } =20 -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); } =20 -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; } =20 -int +static int recurse (volatile int n) { return *recurse_1 (n, &n); --=20 2.31.1