From 0be93f8e860bbaa7216de8e5ebe25529f099dd39 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 12 Jul 2014 05:29:54 +0200 Subject: [PATCH] gtkx: Warn if we include gtkx.h during GTK compilation --- gtk/Makefile.am | 2 +- gtk/gtktestutils.c | 9 ++++++++- gtk/gtkx.h | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gtk/Makefile.am b/gtk/Makefile.am index f974723550..531b315504 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -1450,7 +1450,7 @@ gtkprivatetypebuiltins.c: $(gtk_private_type_h_sources) gtkprivatetypebuiltins. gtktypefuncs.c: stamp-gtktypebuiltins.h stamp-gtkprivatetypebuiltins.h $(top_srcdir)/gtk/*.h $(top_srcdir)/gtk/a11y/*.h $(top_srcdir)/gtk/deprecated/*.h $(top_srcdir)/gdk/*.h Makefile - $(AM_V_GEN) echo '#include ' > xgen-gtfsrc.c && \ + $(AM_V_GEN) (echo '#undef GTK_COMPILATION' && echo '#include ') > xgen-gtfsrc.c && \ echo 'G_GNUC_BEGIN_IGNORE_DEPRECATIONS' > xgen-gtf && \ ${CPP} $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \ $(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \ diff --git a/gtk/gtktestutils.c b/gtk/gtktestutils.c index fa0067802d..b96a828f1b 100644 --- a/gtk/gtktestutils.c +++ b/gtk/gtktestutils.c @@ -19,7 +19,6 @@ #include "config.h" -#include #include "gtkspinbutton.h" #include "gtkmain.h" #include "gtkbox.h" @@ -32,6 +31,14 @@ #include #include +/* This is a hack. + * We want to include the same headers as gtktypefuncs.c but we are not + * allowed to include gtkx.h directly during GTK compilation. + * So.... + */ +#undef GTK_COMPILATION +#include +#define GTK_COMPILATION /** * SECTION:gtktesting diff --git a/gtk/gtkx.h b/gtk/gtkx.h index 10f3dfaedc..e5d2531823 100644 --- a/gtk/gtkx.h +++ b/gtk/gtkx.h @@ -18,6 +18,10 @@ #ifndef __GTK_X_H__ #define __GTK_X_H__ +#if defined (GTK_COMPILATION) +#error " must not be included by GTK+ headers." +#endif + #define __GTKX_H_INSIDE__ #include