Re: [patch rfc] -Wmissing-prototypes round #3

Kevin Buettner
2003-06-11T23:47:33Z

On Jun 11, 3:24pm, Andrew Cagney wrote:

> > Andrew Cagney <ac131313@redhat.com> writes:
> >
> >
> >> - move function declarations to CPU-tdep.h, from config/CPU/tm-CPU.h
> >> Ex, m68k's delta68 functions previously in tm-delta.h.
> >> This ensures that the function declaration is always visible, and that a
> >> global function in CPU-tdep.c has its declaration in the corresponding
> >> CPU-tdep.h file. The config/CPU/tm-CPU.h files were also updated to
> >> include the corresponding "CPU-tdep.h".
> >
> >
> > I'm not sure whether this part of your patch is a good idea. Quite a
> > number of function declarations in config/CPU/tm-CPU.h are for things
> > that haven't been multi-arched yet. Keeping the function declaration
> > next to the #define that uses them, makes it easier to remove them
> > once they're no longer needed.
>
> I thought someone might comment, that's why I tried to make what was
> happening very clear :-)
>
> It's a real trade off.
>
> -- delay -Wmissing-prototypes until multi-arch is finished
>
> -- move the declarations so that they are always visible
>
> -- drop -Werror for certain architectures
>
> Given the problems that -Wmissing-prototypes has thrown up (extern in
> .c, forgetting to include .h), I'd prefer to see it enabled.
>
> Also note the number of *-tdep.c functions I make static. It's pretty
> clear that people deleting the #define/declaration consistently forget
> to update the corresponding function definition.
>
> I think a better way of handling these stray global declarations would
> be to use some sort of real code analysis tool (which the ari isn't :-).

I happen to agree with Mark on this, but I'm also sympathetic to Andrew's
desire to get -Wmissing-prototypes going.

As a compromise, I suggest moving the function declarations as Andrew
proposes, but also putting a pointer (comment) to the (new) location
of the declaration along with a reminder to remove it and make it
static when the function is question is finally multiarched.

Kevin