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

Lex Trotman elextr at xxxxx
Thu Jun 10 23:27:41 UTC 2010


On 10 June 2010 23:51, Nick Treleaven <nick.treleaven at btinternet.com> wrote:
> 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?

Yes, that would let the compiler check both sides of the plugin interface.

Cheers
Lex

>
> Regards,
> Nick
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>



More information about the Devel mailing list