[Geany-devel] [PATCH 2/3] Prevent -Wmissing-prototypes report warning when compiling a plugin

Nick Treleaven nick.treleaven at xxxxx
Thu Jun 10 13:51:23 UTC 2010


On Thu, 10 Jun 2010 14:21:27 +0200
Jiří Techet <techet at gmail.com> wrote:

> Imagine you have:
> 
> foo.h:
> void foo(void);
> 
> foo.c:
> #include "foo.h"
> 
> void foo(void)
> {
>   printf("foo");
> }
> 
> main.c:
> #include "foo.h"
> 
> int main(int argc, char **argv)
> {
>   foo();
>   return 0;
> }
> 
> This is OK. Now you rename foo(void) in foo.c to foobar(void) but
> forget to update the header. It compiles just fine because main.c
> finds the declaration of foo(void) in foo.h, but its implementation is
> missing (so the compiler thinks it's an extern symbol, but it's not
> actually defined anywhere).

OK, thanks for explaining. It sounds like a good warning flag.

Your patch only provides prototypes for the 2 macro-defined functions,
but we would need prototypes for all plugin functions geany calls to
satisfy the flag.

One way we might do that is to turn doc/pluginsymbols.c into a header
file and include that in geanyplugin.h. What do you think?

Regards,
Nick



More information about the Devel mailing list