scanner: Generate all SINCE_VERSION macros for everyone
authorQuentin Glidic <sardemff7+git@sardemff7.net>
Tue, 5 Jul 2016 18:41:50 +0000 (20:41 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 11 Aug 2016 10:49:50 +0000 (13:49 +0300)
commit5636cb2f056d813b464c451754908e17de838e3a
tree444327c4094369a8b12bd4dff11d14a0b10e6a30
parentbad9dc5186e46ab92e1680d1f0ea4a4d4f0f7211
scanner: Generate all SINCE_VERSION macros for everyone

Practical example: a client supporting version 2 of wl_output will wait
for the wl_output.done event before starting wl_output-related
operations. However, if the server only supports version 1, no event
will ever come, and it must fallback to use the wl_output.geometry event
alone.
Without this macro, it cannot check for that in a nice way.

This patch introduces the same #defines in both server and client
headers. We rely on both being generated from the same XML file and
https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html
to not cause compiler errors or warning due to redefinitions. We also
assume that no-one uses the same name in the same interface for both a
request and an event.

If this patch does cause grief due to identical redefinitions, the
contingency plan is to change the generator to produce
 #ifndef/#define/#endif instead of just #define.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: add paragraphs to commit message.]
src/scanner.c