[gtksourceview/wip/warning-headers] Warn when a secondary public header is #included in external code
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/warning-headers] Warn when a secondary public header is #included in external code
- Date: Fri, 24 Jun 2016 20:15:47 +0000 (UTC)
commit b77abeb97b7b13ab91836d4947dece78dbb99e19
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jun 24 22:00:56 2016 +0200
Warn when a secondary public header is #included in external code
https://bugzilla.gnome.org/show_bug.cgi?id=755700
gtksourceview/Makefile.am | 1 +
.../completion-providers/words/Makefile.am | 1 +
.../words/gtksourcecompletionwords.h | 4 ++++
gtksourceview/gtksource.h | 4 ++++
gtksourceview/gtksourcetypes.h | 4 ++++
5 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index 90f6b0a..eb59658 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -7,6 +7,7 @@ endif
AM_CPPFLAGS = \
-DDATADIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"GtkSourceView\"\
+ -DGTK_SOURCE_COMPILATION \
-I$(top_builddir) \
-I$(top_srcdir) -I$(srcdir) \
$(DISABLE_DEPRECATED_CFLAGS) \
diff --git a/gtksourceview/completion-providers/words/Makefile.am
b/gtksourceview/completion-providers/words/Makefile.am
index f0b23b1..97bf31e 100644
--- a/gtksourceview/completion-providers/words/Makefile.am
+++ b/gtksourceview/completion-providers/words/Makefile.am
@@ -3,6 +3,7 @@
AM_CPPFLAGS = \
-DDATADIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"GtkSourceView\"\
+ -DGTK_SOURCE_COMPILATION \
-I$(top_srcdir) -I$(srcdir) \
$(DISABLE_DEPRECATED_CFLAGS) \
$(WARN_CFLAGS) \
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwords.h
b/gtksourceview/completion-providers/words/gtksourcecompletionwords.h
index e803099..f28fd6a 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwords.h
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwords.h
@@ -22,9 +22,13 @@
#ifndef GTK_SOURCE_COMPLETION_WORDS_H
#define GTK_SOURCE_COMPLETION_WORDS_H
+#define GTK_SOURCE_H_INSIDE
+
#include <gtksourceview/gtksourcecompletionprovider.h>
#include <gtk/gtk.h>
+#undef GTK_SOURCE_H_INSIDE
+
G_BEGIN_DECLS
#define GTK_SOURCE_TYPE_COMPLETION_WORDS (gtk_source_completion_words_get_type ())
diff --git a/gtksourceview/gtksource.h b/gtksourceview/gtksource.h
index 7d4fffe..3d330d6 100644
--- a/gtksourceview/gtksource.h
+++ b/gtksourceview/gtksource.h
@@ -20,6 +20,8 @@
#ifndef GTK_SOURCE_H
#define GTK_SOURCE_H
+#define GTK_SOURCE_H_INSIDE
+
#include <gtksourceview/gtksourcetypes.h>
#include <gtksourceview/gtksourcebuffer.h>
#include <gtksourceview/gtksourcecompletioncontext.h>
@@ -59,4 +61,6 @@
#include <gtksourceview/gtksourceview-enumtypes.h>
#include <gtksourceview/gtksourceautocleanups.h>
+#undef GTK_SOURCE_H_INSIDE
+
#endif /* GTK_SOURCE_H */
diff --git a/gtksourceview/gtksourcetypes.h b/gtksourceview/gtksourcetypes.h
index 3038900..7c1ff8d 100644
--- a/gtksourceview/gtksourcetypes.h
+++ b/gtksourceview/gtksourcetypes.h
@@ -22,6 +22,10 @@
#ifndef GTK_SOURCE_TYPES_H
#define GTK_SOURCE_TYPES_H
+#if !defined (GTK_SOURCE_H_INSIDE) && !defined (GTK_SOURCE_COMPILATION)
+#warning "Only <gtksourceview/gtksource.h> can be included directly."
+#endif
+
#include <gio/gio.h>
#include <gtksourceview/gtksourceversion.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]