[libsoup] Require single includes for new headers



commit 4b69d63fbd80e13a703e2dc1896ce6a9ba861bb2
Author: Kalev Lember <klember redhat com>
Date:   Tue Sep 15 13:20:03 2015 +0200

    Require single includes for new headers
    
    For new headers added this cycle, enforce single includes by only
    allowing directly including <libsoup/soup.h>.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754721

 libsoup/Makefile.am         |    1 +
 libsoup/soup-autocleanups.h |   23 ++++-------------------
 libsoup/soup.h              |    7 ++++++-
 3 files changed, 11 insertions(+), 20 deletions(-)
---
diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am
index df25985..a7dd7b2 100644
--- a/libsoup/Makefile.am
+++ b/libsoup/Makefile.am
@@ -12,6 +12,7 @@ endif
 
 AM_CPPFLAGS =                          \
        -DG_LOG_DOMAIN=\"libsoup\"      \
+       -DLIBSOUP_COMPILATION           \
        -DLOCALEDIR=\"$(localedir)\"    \
        -I$(top_srcdir)                 \
        -I$(top_builddir)               \
diff --git a/libsoup/soup-autocleanups.h b/libsoup/soup-autocleanups.h
index 3c992dd..910abe7 100644
--- a/libsoup/soup-autocleanups.h
+++ b/libsoup/soup-autocleanups.h
@@ -15,28 +15,13 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#if !defined (__SOUP_H_INSIDE__) && !defined (LIBSOUP_COMPILATION)
+#error "Only <libsoup/soup.h> can be included directly."
+#endif
+
 #ifndef SOUP_AUTOCLEANUPS_H
 #define SOUP_AUTOCLEANUPS_H
 
-#include <libsoup/soup-auth-domain-basic.h>
-#include <libsoup/soup-auth-domain-digest.h>
-#include <libsoup/soup-auth-manager.h>
-#include <libsoup/soup-cache.h>
-#include <libsoup/soup-content-decoder.h>
-#include <libsoup/soup-content-sniffer.h>
-#include <libsoup/soup-cookie.h>
-#include <libsoup/soup-cookie-jar-db.h>
-#include <libsoup/soup-cookie-jar-text.h>
-#include <libsoup/soup-date.h>
-#include <libsoup/soup-logger.h>
-#include <libsoup/soup-multipart.h>
-#include <libsoup/soup-multipart-input-stream.h>
-#include <libsoup/soup-request-data.h>
-#include <libsoup/soup-request-file.h>
-#include <libsoup/soup-types.h>
-#include <libsoup/soup-uri.h>
-#include <libsoup/soup-xmlrpc.h>
-
 #if SOUP_VERSION_MAX_ALLOWED >= SOUP_VERSION_2_52
 #ifndef __GI_SCANNER__
 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
diff --git a/libsoup/soup.h b/libsoup/soup.h
index 9cc191a..6bedb62 100644
--- a/libsoup/soup.h
+++ b/libsoup/soup.h
@@ -10,13 +10,14 @@
 extern "C" {
 #endif
 
+#define __SOUP_H_INSIDE__
+
 #include <libsoup/soup-address.h>
 #include <libsoup/soup-auth.h>
 #include <libsoup/soup-auth-domain.h>
 #include <libsoup/soup-auth-domain-basic.h>
 #include <libsoup/soup-auth-domain-digest.h>
 #include <libsoup/soup-auth-manager.h>
-#include <libsoup/soup-autocleanups.h>
 #include <libsoup/soup-cache.h>
 #include <libsoup/soup-content-decoder.h>
 #include <libsoup/soup-content-sniffer.h>
@@ -56,6 +57,10 @@ extern "C" {
 #include <libsoup/soup-xmlrpc.h>
 #include <libsoup/soup-xmlrpc-old.h>
 
+#include <libsoup/soup-autocleanups.h>
+
+#undef __SOUP_H_INSIDE__
+
 #ifdef __cplusplus
 }
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]