bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Collin Funk <collin.funk1@gmail.com>,
	Bruno Haible <bruno@clisp.org>,
	bug-gnulib@gnu.org
Subject: Re: Pacify -Wmissing-variable-declarations in unit tests.
Date: Sun, 28 Apr 2024 16:27:52 -0700	[thread overview]
Message-ID: <d4565b0f-ed11-493d-8a64-de59419336d5@cs.ucla.edu> (raw)
In-Reply-To: <dcba33e1-0383-4d79-9668-834d4d8c0190@gmail.com>

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.


  reply	other threads:[~2024-04-28 23:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28  6:52 Pacify -Wmissing-variable-declarations in unit tests Collin Funk
2024-04-28 10:11 ` Bruno Haible
2024-04-28 11:03   ` Collin Funk
2024-04-28 23:27     ` Paul Eggert [this message]
2024-04-29  0:58       ` Collin Funk
2024-04-29 22:12         ` warnings " Bruno Haible
2024-04-30  0:31           ` Collin Funk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4565b0f-ed11-493d-8a64-de59419336d5@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=collin.funk1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).