Bug 49384 - [next] force single-include header
Summary: [next] force single-include header
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Xavier Claessens
QA Contact: Telepathy bugs list
URL: http://cgit.collabora.com/git/user/xc...
Whiteboard: r+
Keywords: patch
Depends on:
Blocks: 17112 tp-glib-1.0
  Show dependency treegraph
 
Reported: 2012-05-02 07:26 UTC by Xavier Claessens
Modified: 2012-06-05 03:13 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
[master, 1/7] Add multiple-inclusion guards to generated client-side code (2.48 KB, patch)
2012-05-04 07:03 UTC, Simon McVittie
Details | Splinter Review
[master, 2/7] Mark all -internal headers as /*<private_header>*/ (15.62 KB, patch)
2012-05-04 07:04 UTC, Simon McVittie
Details | Splinter Review
[master, 3/7] Define _TP_COMPILATION when compiling library and tests (but not examples) (2.24 KB, patch)
2012-05-04 07:05 UTC, Simon McVittie
Details | Splinter Review
[master, 4/7] Include nearly all headers in telepathy-glib.h (6.00 KB, patch)
2012-05-04 07:05 UTC, Simon McVittie
Details | Splinter Review
[master, 5/7] Add <telepathy-glib/telepathy-glib-dbus.h> meta-header (4.05 KB, patch)
2012-05-04 07:06 UTC, Simon McVittie
Details | Splinter Review
[master, 6/7] All examples: follow the meta-header policy (21.63 KB, patch)
2012-05-04 07:06 UTC, Simon McVittie
Details | Splinter Review
[master, 7/7] Documentation: recommend including meta-headers (39.28 KB, patch)
2012-05-04 07:06 UTC, Simon McVittie
Details | Splinter Review
[Gabble, 1/2] Stop using deprecated debug-ansi.h (1.85 KB, patch)
2012-05-04 07:07 UTC, Simon McVittie
Details | Splinter Review
[Gabble, 2/2] Use meta-headers for everything (58.82 KB, patch)
2012-05-04 07:08 UTC, Simon McVittie
Details | Splinter Review
meta-headers: #define _TP_IN_META_HEADER for future single-include guards (1.78 KB, patch)
2012-05-30 04:41 UTC, Xavier Claessens
Details | Splinter Review
define _TP_COMPILATION in gir scanner (957 bytes, patch)
2012-05-30 04:41 UTC, Xavier Claessens
Details | Splinter Review
Examples: do no use message-internal.h (1.59 KB, patch)
2012-05-30 04:41 UTC, Xavier Claessens
Details | Splinter Review
Example extensions: include global header (976 bytes, patch)
2012-05-30 04:42 UTC, Xavier Claessens
Details | Splinter Review
Consider proxy-subclass.h as a meta header (943 bytes, patch)
2012-05-30 04:42 UTC, Xavier Claessens
Details | Splinter Review
Add single-include #error in all headers included from telepathy-glib(-dbus).h (63.13 KB, patch)
2012-05-30 04:42 UTC, Xavier Claessens
Details | Splinter Review
Add single-include #error in generated headers (5.20 KB, patch)
2012-05-30 04:42 UTC, Xavier Claessens
Details | Splinter Review
meta-headers: #define _TP_IN_META_HEADER for future single-include guards (1.78 KB, patch)
2012-06-04 10:35 UTC, Xavier Claessens
Details | Splinter Review
define _TP_COMPILATION in gir scanner (957 bytes, patch)
2012-06-04 10:35 UTC, Xavier Claessens
Details | Splinter Review
Examples: do no use message-internal.h (1.59 KB, patch)
2012-06-04 10:35 UTC, Xavier Claessens
Details | Splinter Review
Example extensions: include global header (976 bytes, patch)
2012-06-04 10:35 UTC, Xavier Claessens
Details | Splinter Review
Consider proxy-subclass.h as a meta header (943 bytes, patch)
2012-06-04 10:35 UTC, Xavier Claessens
Details | Splinter Review
Add single-include #error in all headers included from telepathy-glib(-dbus).h (67.24 KB, patch)
2012-06-04 10:35 UTC, Xavier Claessens
Details | Splinter Review
Examples: disable single include (4.59 KB, patch)
2012-06-04 10:35 UTC, Xavier Claessens
Details | Splinter Review

Description Xavier Claessens 2012-05-02 07:26:46 UTC
like glib/gtk, we should warn if app includes individual headers instead of telepathy-glib.h or telepathy-glib-dbus.h. Could have some exceptions though.
Comment 1 Simon McVittie 2012-05-04 06:58:22 UTC
I think before we do this, we should include <telepathy-glib/telepathy-glib-dbus.h> in master, and make telepathy-glib.h complete - so, I've done that.

I was going to make exceptions for some of the larger cli- and svc- headers, but it turns out that using complete meta-headers, exclusively, slows down a complete Gabble compilation by less than 6 seconds - so, life's too short.

Proposed structure:

<telepathy-glib/debug-ansi.h>
<telepathy-glib/properties-mixin.h>
<telepathy-glib/text-mixin.h>
  Are included directly, or preferably not included.
  (Rationale: they are all deprecated.)

<telepathy-glib/proxy-subclass.h>
  Is included directly. (Rationale: it's low-level.)

<telepathy-glib/telepathy-glib.h>
  Includes all non-generated headers except those above,
  plus enums and errors from the spec (which I consider to be still
  part of our stable ABI).

  In master, also includes generated code for svc-generic, svc-client,
  interfaces, gtypes, and all cli- code. In next, these will go away.
  I might introduce a #define that makes these go away from master too.

<telepathy-glib/telepathy-glib-dbus.h>
  Includes telepathy-glib.h and all generated code, including cli- and svc-.
Comment 2 Simon McVittie 2012-05-04 07:02:39 UTC
(In reply to comment #1)
> I was going to make exceptions for some of the larger cli- and svc- headers,
> but it turns out that using complete meta-headers, exclusively, slows down a
> complete Gabble compilation by less than 6 seconds - so, life's too short.

Method: build Gabble (to warm up cache), then repeat 3 times:
  * make -C src clean
  * time CCACHE_DISABLE=1 make CPPFLAGS=-D_TP_IGNORE_DEPRECATIONS

With individual headers (current master):

80.91s user 9.95s system 93% cpu 1:37.38 total
81.62s user 10.01s system 94% cpu 1:36.83 total
80.69s user 9.93s system 94% cpu 1:35.77 total

With single headers (the tp-glib and Gabble patches I'll attach):

86.25s user 11.30s system 95% cpu 1:42.64 total
86.55s user 11.22s system 94% cpu 1:42.97 total
88.77s user 11.20s system 94% cpu 1:46.21 total

The complete builds (including Wocky etc., and from a semi-cold start) took around 2:50.
Comment 3 Simon McVittie 2012-05-04 07:03:37 UTC
Created attachment 61027 [details] [review]
[master, 1/7] Add multiple-inclusion guards to generated client-side  code

---
This is necessary to be able to include them in more than one place.
Comment 4 Simon McVittie 2012-05-04 07:04:24 UTC
Created attachment 61028 [details] [review]
[master, 2/7] Mark all -internal headers as /*<private_header>*/

This is a nicer way to get them out of the gtk-doc than listing them all
in docs/reference/Makefile.am. (We still need to mention
proxy-introspectable.h there, though - it's private from gtk-doc's
point of view, but not gobject-introspection's.)

---

I already did this on next, but the set of headers is different, so I can't just cherry-pick.
Comment 5 Simon McVittie 2012-05-04 07:05:30 UTC
Created attachment 61030 [details] [review]
[master, 3/7] Define _TP_COMPILATION when compiling library and tests  (but not examples)

This will switch off single-inclusion checks. We don't want to use
telepathy-glib/telepathy-glib.h within the library since it'll trigger
mass recompilation whenever any header changes.

For the examples, it seems acceptable to use the meta-header so that
the examples will be exemplary.

---

I haven't actually *done* single-inclusion checks; that'll come later.
Comment 6 Simon McVittie 2012-05-04 07:05:49 UTC
Created attachment 61031 [details] [review]
[master, 4/7] Include nearly all headers in telepathy-glib.h

Exceptions:

* dbus-daemon.h is included via dbus.h 
* debug-ansi.h is deprecated
* extra-gtkdoc.h is not really a header
* properties-mixin.h is deprecated
* proxy-subclass.h is sufficiently low-level that API users should
  "opt in"
* svc-*.h wil be in telepathy-glib-dbus.h
* text-mixin.h is deprecated
* verify.h is included via util.h
Comment 7 Simon McVittie 2012-05-04 07:06:09 UTC
Created attachment 61032 [details] [review]
[master, 5/7] Add <telepathy-glib/telepathy-glib-dbus.h> meta-header

This includes all generated code, including the things that will be a
separate library in 1.0.
Comment 8 Simon McVittie 2012-05-04 07:06:26 UTC
Created attachment 61033 [details] [review]
[master, 6/7] All examples: follow the meta-header policy
Comment 9 Simon McVittie 2012-05-04 07:06:42 UTC
Created attachment 61034 [details] [review]
[master, 7/7] Documentation: recommend including meta-headers
Comment 10 Simon McVittie 2012-05-04 07:07:10 UTC
Created attachment 61035 [details] [review]
[Gabble, 1/2] Stop using deprecated debug-ansi.h
Comment 11 Simon McVittie 2012-05-04 07:08:08 UTC
Created attachment 61036 [details] [review]
[Gabble, 2/2] Use meta-headers for everything

---

This can't be merged until the tp-glib patches attached above have been released. For the configure check, I assumed that that would happen in 0.19.0.
Comment 12 Simon McVittie 2012-05-04 07:19:54 UTC
I think we should land these telepathy-glib patches, and release them in 0.19.0. After that, we can start making "single include" mandatory - perhaps using the new versioned deprecations stuff, so that it's mandatory if you target 0.20 as your minimum version.
Comment 13 Xavier Claessens 2012-05-07 02:08:53 UTC
+1 for all of this, nice work :)

I agree it's better to give a bit more time to apps to be ported to single-include before forcing it.
Comment 14 Xavier Claessens 2012-05-30 04:41:49 UTC
Created attachment 62274 [details] [review]
meta-headers: #define _TP_IN_META_HEADER for future single-include guards
Comment 15 Xavier Claessens 2012-05-30 04:41:52 UTC
Created attachment 62275 [details] [review]
define _TP_COMPILATION in gir scanner

Otherwise upcoming single-include #error will break the scanner
Comment 16 Xavier Claessens 2012-05-30 04:41:56 UTC
Created attachment 62276 [details] [review]
Examples: do no use message-internal.h
Comment 17 Xavier Claessens 2012-05-30 04:42:00 UTC
Created attachment 62277 [details] [review]
Example extensions: include global header
Comment 18 Xavier Claessens 2012-05-30 04:42:04 UTC
Created attachment 62278 [details] [review]
Consider proxy-subclass.h as a meta header

That header can be included directly, so proxy.h would #error.
Comment 19 Xavier Claessens 2012-05-30 04:42:07 UTC
Created attachment 62279 [details] [review]
Add single-include #error in all headers included from telepathy-glib(-dbus).h
Comment 20 Xavier Claessens 2012-05-30 04:42:11 UTC
Created attachment 62280 [details] [review]
Add single-include #error in generated headers
Comment 21 Xavier Claessens 2012-05-30 04:43:24 UTC
Attached patches to make single-include mandatory.

Simon: you merged your tp-glib patches but not yet gabble's ?
Comment 22 Simon McVittie 2012-05-30 05:40:41 UTC
(In reply to comment #21)
> Simon: you merged your tp-glib patches but not yet gabble's ?

1/2 was superseded by a similar patch for another bug, and is no longer needed.

Feel free to apply 2/2 if you can make it compile. In my build setup, Gabble currently doesn't build because tp_channel_manager_emit_new_channels is deprecated, despite Jonny adding a patch specifically to avoid that deprecation warning; that yak is too hairy for me to shave right now, since I'm meant to be doing something else.
Comment 23 Simon McVittie 2012-05-30 05:57:29 UTC
(In reply to comment #22)
> Feel free to apply 2/2 if you can make it compile. In my build setup, Gabble
> currently doesn't build because tp_channel_manager_emit_new_channels is
> deprecated

I found the right runes to force config.h to be regenerated, so I've applied that now. Fixed in (Gabble) git for 0.17.0
Comment 24 Simon McVittie 2012-05-30 06:00:38 UTC
Comment on attachment 62280 [details] [review]
Add single-include #error in generated headers

Review of attachment 62280 [details] [review]:
-----------------------------------------------------------------

Including _gen headers was never meant to be API, FWIW.
Comment 25 Xavier Claessens 2012-06-04 10:32:30 UTC
Ok, I droped the patch for single include in _gen, since it was a bit ugly IMO. I've also added TP_DISABLE_SINGLE_INCLUDE that apps need to define to make it #error.
Comment 26 Xavier Claessens 2012-06-04 10:35:23 UTC
Created attachment 62525 [details] [review]
meta-headers: #define _TP_IN_META_HEADER for future single-include guards
Comment 27 Xavier Claessens 2012-06-04 10:35:27 UTC
Created attachment 62526 [details] [review]
define _TP_COMPILATION in gir scanner

Otherwise upcoming single-include #error will break the scanner
Comment 28 Xavier Claessens 2012-06-04 10:35:31 UTC
Created attachment 62527 [details] [review]
Examples: do no use message-internal.h
Comment 29 Xavier Claessens 2012-06-04 10:35:35 UTC
Created attachment 62528 [details] [review]
Example extensions: include global header
Comment 30 Xavier Claessens 2012-06-04 10:35:39 UTC
Created attachment 62529 [details] [review]
Consider proxy-subclass.h as a meta header

That header can be included directly, so proxy.h would #error.
Comment 31 Xavier Claessens 2012-06-04 10:35:43 UTC
Created attachment 62530 [details] [review]
Add single-include #error in all headers included from telepathy-glib(-dbus).h
Comment 32 Xavier Claessens 2012-06-04 10:35:47 UTC
Created attachment 62531 [details] [review]
Examples: disable single include
Comment 33 Simon McVittie 2012-06-05 02:56:51 UTC
Comment on attachment 62525 [details] [review]
meta-headers: #define _TP_IN_META_HEADER for future single-include guards

Review of attachment 62525 [details] [review]:
-----------------------------------------------------------------

++
Comment 34 Simon McVittie 2012-06-05 02:57:16 UTC
Comment on attachment 62526 [details] [review]
define _TP_COMPILATION in gir scanner

Review of attachment 62526 [details] [review]:
-----------------------------------------------------------------

++
Comment 35 Simon McVittie 2012-06-05 02:57:26 UTC
Comment on attachment 62527 [details] [review]
Examples: do no use message-internal.h

Review of attachment 62527 [details] [review]:
-----------------------------------------------------------------

++
Comment 36 Simon McVittie 2012-06-05 02:57:35 UTC
Comment on attachment 62528 [details] [review]
Example extensions: include global header

Review of attachment 62528 [details] [review]:
-----------------------------------------------------------------

++
Comment 37 Simon McVittie 2012-06-05 02:57:43 UTC
Comment on attachment 62529 [details] [review]
Consider proxy-subclass.h as a meta header

Review of attachment 62529 [details] [review]:
-----------------------------------------------------------------

++
Comment 38 Simon McVittie 2012-06-05 02:58:22 UTC
Comment on attachment 62530 [details] [review]
Add single-include #error in all headers included from telepathy-glib(-dbus).h

Review of attachment 62530 [details] [review]:
-----------------------------------------------------------------

++
Comment 39 Simon McVittie 2012-06-05 02:58:59 UTC
Comment on attachment 62531 [details] [review]
Examples: disable single include

Review of attachment 62531 [details] [review]:
-----------------------------------------------------------------

++
Comment 40 Simon McVittie 2012-06-05 02:59:39 UTC
Yes, ship it.
Comment 41 Xavier Claessens 2012-06-05 03:13:50 UTC
Thanks, merged :)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.