GNOME Bugzilla – Bug 696718
Cleanup unused and redundant #include directives
Last modified: 2013-03-28 09:21:02 UTC
While I was trying to move the account configuration widgets in a submodule to be shared with g-o-a I noticed that some #include could be dropped. With the help of the script posted at http://stackoverflow.com/a/7135530 and some manual fixes I got a somewhat giant patch (135 files changed, 5 insertions, 731 deletions), but Empathy still compiles fine here. :) While I was at it I also cooked a patch to standardise on #include "config.h" instead of #include <config.h>. Once (and if) these patches have been accepted I'd also like to reorder the #include directives a bit (if time allows), taking inspiration from the WebKit coding style guidelines: http://www.webkit.org/coding/coding-style.html#include e.g. in empathy-foo.c:
Created attachment 239970 [details] [review] Consistently use `#include "config.h"` everywhere
Created attachment 239971 [details] [review] Drop unused/redundant header inclusions With the help of the script posted at http://stackoverflow.com/a/7135530 and some manual fixes, drop the unused or redundant #include directives.
(Ouch, git-bz trimmed my example since the lines started with #...) e.g. in empathy-foo.c: #include "config.h" // only in .c files #include "empathy-foo.h" // the matching header first, to make sure it works standalone #include "libempathy/empathy-bar.h" // other internal headers #include <gcr/gcr.h> // external headers
Review of attachment 239970 [details] [review]: ++ :)
Review of attachment 239971 [details] [review]: As long as "make check" passes that's fine with me. :)
(In reply to comment #0) > While I was trying to move the account configuration widgets in a submodule to > be shared with g-o-a I noticed that some #include could be dropped. > > With the help of the script posted at http://stackoverflow.com/a/7135530 and > some manual fixes I got a somewhat giant patch (135 files changed, > 5 insertions, 731 deletions), but Empathy still compiles fine here. :) > > While I was at it I also cooked a patch to standardise on #include "config.h" > instead of #include <config.h>. > > Once (and if) these patches have been accepted I'd also like to reorder > the #include directives a bit (if time allows), taking inspiration from the > WebKit coding style guidelines: > http://www.webkit.org/coding/coding-style.html#include I'd prefer to keep following Telepathy's coding style : http://telepathy.freedesktop.org/wiki/Style
(In reply to comment #6) > > Once (and if) these patches have been accepted I'd also like to reorder > > the #include directives a bit (if time allows), taking inspiration from the > > WebKit coding style guidelines: > > http://www.webkit.org/coding/coding-style.html#include > > I'd prefer to keep following Telepathy's coding style : > http://telepathy.freedesktop.org/wiki/Style ... which are mostly the same, except that in the Telepathy one public headers precede the non-installed private one. :D Thanks for the pointer, I'll give it a shot (if time allows).
The following fixes have been pushed: 66e393b Drop unused/redundant header inclusions 4aa8651 Consistently use `#include "config.h"` everywhere
Created attachment 240014 [details] [review] Drop unused/redundant header inclusions With the help of the script posted at http://stackoverflow.com/a/7135530 and some manual fixes, drop the unused or redundant #include directives.
Created attachment 240015 [details] [review] Consistently use `#include "config.h"` everywhere