On Tue, 11 Aug 2009 04:26:51 +0800, Chow wrote:
Hey,
attached is a little patch which cleans up the includes and improves ordering of the included header files. The main change is to include "geany.h" very early, this header will implicitly include most of the GLib and GTK headers you need. So, there is no need to explicitly include something like <glib/gmacros.h> which is deprecated due to GTK's single header policy anyway. I don't want to bore you with details, just make "geany.h" your first include in general should do the trick.
In the future, i.e. once Geany 0.18 is released, things will get a lot easier, then you only need to include "geanyplugin.h" which includes most other necessary Geany and GTK headers. The API docs, especially the howto describe this issue as well, IIRC.
As for the issue with the for loop, the reason for that happening is because gcc defaults to -std=gnu89, which is based on the C90 standard, whereas declarations within the for loop only work with -std=c99 and above. I think it's best to stick to this standard (C90) for portability reasons.
While there are probably not many people out there (anymore) who use a C89/C90 compiler, there are at least a few of them. And so we try to keep the Geany code compiling with gcc -ansi, i.e. compatible with C89. Nobody is forced to do the same with plugins, but it just makes it easier for users. The current code still doesn't compile with a pure C89 compiler because C89 doesn't allow to mix code and variable declarations. Cédric, it's completely up to you whether you want to "fix" this or just keep it as it is.
If you want to see the warnings I'm talking about, just check http://nightly.geany.org/misc/build_gtk28_plugins_stderr.log tomorrow (after August 11, 04:00 UTC). There should appear a few warnings. But again, it's completely up to you whether to remove them or to keep them.
Regards, Enrico