After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 696718 - Cleanup unused and redundant #include directives
Cleanup unused and redundant #include directives
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2013-03-27 16:38 UTC by Emanuele Aina
Modified: 2013-03-28 09:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Consistently use `#include "config.h"` everywhere (25.88 KB, patch)
2013-03-27 16:38 UTC, Emanuele Aina
committed Details | Review
Drop unused/redundant header inclusions (82.66 KB, patch)
2013-03-27 16:38 UTC, Emanuele Aina
committed Details | Review
Drop unused/redundant header inclusions (82.66 KB, patch)
2013-03-28 09:20 UTC, Emanuele Aina
committed Details | Review
Consistently use `#include "config.h"` everywhere (25.88 KB, patch)
2013-03-28 09:21 UTC, Emanuele Aina
committed Details | Review

Description Emanuele Aina 2013-03-27 16:38:35 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:
Comment 1 Emanuele Aina 2013-03-27 16:38:40 UTC
Created attachment 239970 [details] [review]
Consistently use `#include "config.h"` everywhere
Comment 2 Emanuele Aina 2013-03-27 16:38:48 UTC
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.
Comment 3 Emanuele Aina 2013-03-27 16:42:27 UTC
(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
Comment 4 Guillaume Desmottes 2013-03-28 08:56:12 UTC
Review of attachment 239970 [details] [review]:

++ :)
Comment 5 Guillaume Desmottes 2013-03-28 08:56:56 UTC
Review of attachment 239971 [details] [review]:

As long as "make check" passes that's fine with me. :)
Comment 6 Guillaume Desmottes 2013-03-28 09:04:33 UTC
(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
Comment 7 Emanuele Aina 2013-03-28 09:19:05 UTC
(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).
Comment 8 Emanuele Aina 2013-03-28 09:20:20 UTC
The following fixes have been pushed:
66e393b Drop unused/redundant header inclusions
4aa8651 Consistently use `#include "config.h"` everywhere
Comment 9 Emanuele Aina 2013-03-28 09:20:45 UTC
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.
Comment 10 Emanuele Aina 2013-03-28 09:21:02 UTC
Created attachment 240015 [details] [review]
Consistently use `#include "config.h"` everywhere