|
From: | Paul Eggert |
Subject: | Re: Pacify -Wmissing-variable-declarations in unit tests. |
Date: | Sun, 28 Apr 2024 16:27:52 -0700 |
User-agent: | Mozilla Thunderbird |
On 2024-04-28 04:03, Collin Funk wrote:
I will listen to the Makefile and*ignore* them now, or disable them if they start annoying me. :)
Another possibility is to make each such variable 'static' if it's OK to make it static, and to precede every other variable declaration like this:
int foo; with a declaration like this: extern int foo;I do this sort of thing in code that's not a test case, as I find it helpful to put the extern declaration into a .h file so that it's tested for compatibility when other modules use it.
For test cases this is more a judgment call, but I prefer doing either the above or adjusting the warning flags, to ignoring warnings, as the other warnings can be useful at time.
[Prev in Thread] | Current Thread | [Next in Thread] |