From: Pedro Alves <pedro@codesourcery.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: Fix most -Wmissing-prototypes -Wmissing-declarations warnings
Date: Wed, 18 Feb 2009 17:34:00 -0000 [thread overview]
Message-ID: <200902181425.13598.pedro@codesourcery.com> (raw)
In-Reply-To: <200902181012.n1IAC3ow025364@brahms.sibelius.xs4all.nl>
On Wednesday 18 February 2009 10:12:03, Mark Kettenis wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > Date: Wed, 18 Feb 2009 02:01:04 +0000
> >
> > 3) several cases of _initialize_foo not being declared.
> >
> > +/* -Wmissing-prototypes */
> > +extern initialize_file_ftype _initialize_cli_logging;
> > +
>
> I absolutely detest using initialize_file_ftype for this, since my
> brain fails to parse this as a function prototype.
I'm guessing you detest all function pointer variable declarations
as well then. I'm quite sure you're capable of getting used to
it as well, as this is valid C syntax anyway. You probably have
already, since you hate it so much, but you're probably in
denial. :-)
I disagree with you here, and, I absolutelly love using
_initialize_file_ftype for this. The difference between:
extern initialize_file_ftype _initialize_foo;
void _initialize_foo (void)
{}
... and:
void _initialize_foo (void);
void _initialize_foo (void)
{}
Is that with the former, if the _initializer_BAR functions
prototype needs to change, we change initialize_file_ftype, and
all correctly declared and prototypes functions will fail to compile,
whereas with the latter form, you may miss the change. the compiler
will not help you. So, I claim that all those instance *not* using
initialize_file_ftype are wrong.
>
> And, the GNU coding standards still demand full sentences, so in the
> past I've written stuff like:
>
> /* Provide a prototype to silence -Wmissing-prototypes. */
> void _initialize_i386_tdep (void);
>
> I don't feel too strongly about the last point, but it'd be nice to
> see consistency here.
>
Well, I happened to copy paste from one of the instances that
does that already, vis (before my patch):
>grep missing-prototypes * -rn | grep -v "ChangeLog" | grep Provide | wc -l
74
>grep initialize_file_ftype * -rn| grep -v ChangeLog | wc -l
61
(after my patch, there are 84 instances of the _ftype form)
Most, if not all the initialize_file_ftype variants use shorter
description. It's a bit pedantic, but I'll adjust to use the
full sentence in the comment for the ones I'm adding.
--
Pedro Alves
next prev parent reply other threads:[~2009-02-18 14:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-18 4:11 Pedro Alves
2009-02-18 4:12 ` Pedro Alves
2009-02-18 14:27 ` Mark Kettenis
2009-02-18 17:34 ` Pedro Alves [this message]
2009-02-20 0:09 ` Mark Kettenis
2009-02-22 11:19 ` Pedro Alves
2009-02-18 22:54 ` Tom Tromey
2009-02-20 0:46 ` Joel Brobecker
2009-02-20 4:01 ` Tom Tromey
2009-02-20 5:43 ` Tom Tromey
2009-02-20 10:02 ` Joel Brobecker
2009-02-22 1:06 ` Pedro Alves
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200902181425.13598.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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