NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/55648: Minor warnings in compilation of libexecinfo test2



>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
>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)



Home | Main Index | Thread Index | Old Index