Re: [ob/6.0] Fix a new sparc build failure

Daniel Jacobowitz
2003-07-03T14:00:39Z

On Sun, Jun 29, 2003 at 06:14:50PM -0400, Andrew Cagney wrote:
> >On Sun, Jun 29, 2003 at 05:27:52PM -0400, Andrew Cagney wrote:
> >
> >>>sparc_y_regnum is mentioned in the tm header, so sparc-nat.c actually
> >>>references it. Fixes another sparc-native build failure; checked in.
> >
> >>
> >>Missing an extern declaration? The nat file would be getting -Wimplict.
> >
> >
> >No, the extern declaration is there too. There was an extern followed
> >by a static, which some future version of GCC (probably 3.4) will warn
> >about.
>
> Huh?
>
> cagney@nettle$ gcc --version
> 2.95.3
> cagney@nettle$ gcc -c foo.c
> foo.c:2: warning: static declaration for `foo' follows non-static
> cagney@nettle$ cat foo.c
> extern void foo (void);
> static void foo (void) { };
>
> Notice where it occures:
>
> #if defined (GDB_MULTI_ARCH) && (GDB_MULTI_ARCH > 0)
> [...]
> /* Multi-arch the nPC and Y registers. */
> #define Y_REGNUM (sparc_y_regnum ())
> extern int sparc_npc_regnum (void);
> extern int sparc_y_regnum (void);
>
> And the sparc-elf cross target, it turns out, isn't multi-arch so
> wouldn' get the warning :-/
>
> Can you please move the extern declaration to "sparc-tdep.h"? Without
> it, there's yet another -Wmissing-prototypes to fix.

Would you prefer creating a sparc-tdep.h for this, or just moving the
prototype out of the #if? There's no sparc-tdep.h yet and I don't want
to do surgery on the sparc port to populate it properly.