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

Enrico Tröger enrico.troeger at xxxxx
Sun Jun 13 10:40:10 UTC 2010


On Sat, 12 Jun 2010 19:46:00 +0200, Jiří wrote:

> 2010/6/12 Enrico Tröger <enrico.troeger at uvena.de>:
> > On Thu, 10 Jun 2010 13:33:44 +0200, Jiří wrote:
> >
> >> On Thu, Jun 10, 2010 at 13:05, Nick Treleaven
> >> <nick.treleaven at btinternet.com> wrote:
> >> > On Wed,  9 Jun 2010 21:40:58 +0200
> >> > Jiří Techet <techet at gmail.com> wrote:
> >> >
> >> >> Signed-off-by: Jiří Techet <techet at gmail.com>
> >> >> ---
> >> >>  src/plugindata.h |    2 ++
> >> >
> >> >> +     gint plugin_version_check(gint abi_ver);\
> >> >>       gint plugin_version_check(gint abi_ver) \
> >> >>       { \
> >> >
> >> > Why is this necessary?
> >> >
> >>
> >> If you don't compile the plugins with -Wmissing-prototypes then you
> >> don't get any warnings if you use a function that hasn't been
> >> declared (imagine you make a typo in a call of an API function or
> >> any of your internal functions). The plugin compiles just fine,
> >> but then it doesn't get loaded by geany on runtime and you have to
> >> start searching for what symbol is missing (using LD_DEBUG).
> >>
> >> -Wmissing-prototypes requires that for every non-static function
> >> there is a previous declaration before it is defined/used. This is
> >> normally satisfied because these are in the header files - this
> >> macro is just an exceptional case.
> >>
> >> In general, I would recommend that geany uses a slightly more
> >> strict set of warning options. I find the options used by
> >> gnome-common as a reasonable set:
> >>
> >> -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith
> >> -Wno-sign-compare
> >>
> >> You might consider using them for the whole geany.
> >
> > Just as an additional note:
> > compiler flags should always be used by individual developers/users,
> > not by the used build system directly.
> 
> Why? If you want to ensure that the sources satisfy some standards,
> then it's alright. You use -Wall after all.

Really?
I had a quick look and didn't find any reference. Did I miss anything?


> > -Wmissing-prototypes and friends are gcc specific and would break
> > building with other compilers.
> >
> > I guess you didn't mean to add them to the build system directly :).
> 
> You can use gnome-compiler-flags.m4 from the gnome-common package that
> checks whether you use gcc for compilation and only in this case the
> above flags are added (it adds a configure parameter where the set of
> flags can be configured).

Ok. But IMO this is overhead we don't need. Specific compiler flags
(more specific than -c, -o and -g), should be in the responsibility of
each individual developer.
But of course, we could add the mentioned flag as hint in the HACKING
file.


Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100613/94c90572/attachment.pgp>


More information about the Devel mailing list