NetBSD Problem Report #55648
From www@netbsd.org Wed Sep 9 17:46:06 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 2A5AB1A9239
for <gnats-bugs@gnats.NetBSD.org>; Wed, 9 Sep 2020 17:46:06 +0000 (UTC)
Message-Id: <20200909174604.B473C1A923A@mollari.NetBSD.org>
Date: Wed, 9 Sep 2020 17:46:04 +0000 (UTC)
From: kevans@FreeBSD.org
Reply-To: kevans@FreeBSD.org
To: gnats-bugs@NetBSD.org
Subject: Minor warnings in compilation of libexecinfo test2
X-Send-Pr-Version: www-1.0
>Number: 55648
>Category: misc
>Synopsis: Minor warnings in compilation of libexecinfo test2
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: misc-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Sep 09 17:50:00 +0000 2020
>Last-Modified: Wed Sep 09 20:05:01 +0000 2020
>Originator: Kyle Evans
>Release: N/A
>Organization:
>Environment:
FreeBSD
>Description:
Actually encountered on FreeBSD, WARNS=6 turns on -Wmissing-variable- declarations which hits the following in the libexecinfo test (sourced from NetBSD):
```
/usr/src/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c:50:14: error: no previous extern declaration for non-static variable 'prevent_inline' [-Werror,-Wmissing-variable-declarations]
volatile int prevent_inline;
^
/usr/src/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c:50:10: note: declare 'static' if the variable is not intended to be used outside of this translation unit
volatile int prevent_inline;
```
>How-To-Repeat:
>Fix:
Patch also available @ https://people.freebsd.org/~kevans/netbsd-tests.diff, but inline below for convenience since it's fairly trivial. My understanding of volatile optimizations is that giving prevent_inline internal linkage shouldn't defeat the purpose of the global and was otherwise arbitrarily chosen based on it not needing a declaration added to the line count...
diff --git a/tests/lib/libexecinfo/t_backtrace.c b/tests/lib/libexecinfo/t_backtrace.c
index da69207e727..32e8994396c 100644
--- a/tests/lib/libexecinfo/t_backtrace.c
+++ b/tests/lib/libexecinfo/t_backtrace.c
@@ -47,7 +47,7 @@ void myfunc2(size_t ncalls);
void myfunc1(size_t origcalls, volatile size_t ncalls);
void myfunc(size_t ncalls);
-volatile int prevent_inline;
+static volatile int prevent_inline;
void
myfunc3(size_t ncalls)
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55648 CVS commit: src/tests/lib/libexecinfo
Date: Wed, 9 Sep 2020 16:04:10 -0400
Module Name: src
Committed By: christos
Date: Wed Sep 9 20:04:10 UTC 2020
Modified Files:
src/tests/lib/libexecinfo: t_backtrace.c
Log Message:
PR/55648: Kyle Evans: Minor warnings in compilation of libexecinfo test2
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libexecinfo/t_backtrace.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.