[PATCH wayland v4] scanner: add a new --include-core-only option

Bill Spitzak spitzak at gmail.com
Thu Apr 30 11:45:14 PDT 2015

On 04/30/2015 11:08 AM, Giulio Camuffo wrote:

> I think you're just not getting the goal of the patches here. The goal
> is basically to be able to *not include* indirectly
> wayland-client-protocol.h, not to clean up the circular includes or
> whatever. Whoever includes directly wayland-client-protocol.h won't
> and shouldn't be affected by this patchset, and no change is needed.

Of course I know what the purpose of the patch is. However there were 
several comments suggesting that deprecated api be moved to 
wayland-client.h out of wayland-client-core.h, so it seems some are 
under the delusion that it is serving this purpose, and it could with a 
trivial fix.

For the original purpose this is pretty ugly. The programmer has to 
include the alternative wayland.xml header file first or it will not 
work. In addition the --include-core-only switch is not actually needed.

This can be clearly seen with a little thought, if you assume you want 
to use more than one protocol at the same time but use the distributed 
version of one of them:

  #include "my/wayland-client-protocol.h" // must be first!
  #include <foo-client-protocol.h> // this magically works

For the above to work my/wayland-client-protocol.h has to somehow stop 
the wayland-client.h included by foo-client-protocol.h from including 
the conflicting wayland-client-protocol.h. This can be accomplished by 
using the same include guard for both, or other hacks. But if that is 
done, it is harmless if the local wayland-client-protocol.h includes 
wayland-client.h, because the same fix will apply there!

I also hope everybody knows that header files that are order-dependent 
are bad news.

More information about the wayland-devel mailing list