From owner-dev-commits-src-branches@freebsd.org Fri Aug 27 01:12:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54F5E674C80; Fri, 27 Aug 2021 01:12:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GwhXM2kFZz4k1M; Fri, 27 Aug 2021 01:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CCD21A3B7; Fri, 27 Aug 2021 01:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17R1CZh6037925; Fri, 27 Aug 2021 01:12:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17R1CZTd037924; Fri, 27 Aug 2021 01:12:35 GMT (envelope-from git) Date: Fri, 27 Aug 2021 01:12:35 GMT Message-Id: <202108270112.17R1CZTd037924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 46e1f6a8b7b3 - stable/12 - crunchide: address complaints from WARNS=6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 46e1f6a8b7b31679e73a4ec1575bc995b142e122 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2021 01:12:36 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=46e1f6a8b7b31679e73a4ec1575bc995b142e122 commit 46e1f6a8b7b31679e73a4ec1575bc995b142e122 Author: Kyle Evans AuthorDate: 2021-08-19 06:17:36 +0000 Commit: Kyle Evans CommitDate: 2021-08-27 01:10:58 +0000 crunchide: address complaints from WARNS=6 - One (1) constify - One (1) argument is unused - One (1) local shadows a global - Various globals that should be static (cherry picked from commit dd7c7ff192d07912fb7f5874868649c3aa05944a) --- usr.sbin/crunch/crunchide/crunchide.c | 8 ++++---- usr.sbin/crunch/crunchide/exec_elf32.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/usr.sbin/crunch/crunchide/crunchide.c b/usr.sbin/crunch/crunchide/crunchide.c index b7eba3995173..324402501491 100644 --- a/usr.sbin/crunch/crunchide/crunchide.c +++ b/usr.sbin/crunch/crunchide/crunchide.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -char *pname = "crunchide"; +static const char *pname = "crunchide"; void usage(void); @@ -85,7 +85,7 @@ void add_file_to_keep_list(char *filename); int hide_syms(const char *filename); -int verbose; +static int verbose; int main(int, char *[]); @@ -137,7 +137,7 @@ usage(void) /* ---------------------------- */ -struct keep { +static struct keep { struct keep *next; char *sym; } *keep_list; @@ -206,7 +206,7 @@ add_file_to_keep_list(char *filename) /* ---------------------------- */ -struct { +static struct { const char *name; int (*check)(int, const char *); /* 1 if match, zero if not */ int (*hide)(int, const char *); /* non-zero if error */ diff --git a/usr.sbin/crunch/crunchide/exec_elf32.c b/usr.sbin/crunch/crunchide/exec_elf32.c index 28641107cc5c..f7b8601911fe 100644 --- a/usr.sbin/crunch/crunchide/exec_elf32.c +++ b/usr.sbin/crunch/crunchide/exec_elf32.c @@ -155,7 +155,7 @@ xrealloc(void *ptr, size_t size, const char *fn, const char *use) } int -ELFNAMEEND(check)(int fd, const char *fn) +ELFNAMEEND(check)(int fd, const char *fn __unused) { Elf_Ehdr eh; struct stat sb; @@ -435,12 +435,12 @@ ELFNAMEEND(hide)(int fd, const char *fn) * update section header table in ascending order of offset */ for (i = strtabidx + 1; i < shnum; i++) { - Elf_Off off, align; - off = xewtoh(layoutp[i - 1].shdr->sh_offset) + + Elf_Off soff, align; + soff = xewtoh(layoutp[i - 1].shdr->sh_offset) + xewtoh(layoutp[i - 1].shdr->sh_size); align = xewtoh(layoutp[i].shdr->sh_addralign); - off = (off + (align - 1)) & ~(align - 1); - layoutp[i].shdr->sh_offset = htoxew(off); + soff = (soff + (align - 1)) & ~(align - 1); + layoutp[i].shdr->sh_offset = htoxew(soff); } /*