[master] b692155 Make cache.h include vrt.h and forbid including both.

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 23 10:06:08 UTC 2017


commit b6921558b9e5ecb431524f9d5dc9aea5af7bd24b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 23 10:04:41 2017 +0000

    Make cache.h include vrt.h and forbid including both.
    
    This is part of the $ABI reorg.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index e67f89f..2f5a379 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -28,6 +28,14 @@
  *
  */
 
+#ifdef VRT_H_INCLUDED
+#  error "vrt.h included before cache.h - they are exclusive"
+#endif
+
+#ifdef CACHE_H_INCLUDED
+#  error "cache.h included multiple times"
+#endif
+
 #include <math.h>
 #include <pthread.h>
 #include <stdarg.h>
@@ -36,6 +44,10 @@
 
 #include "vdef.h"
 
+#include "vrt.h"
+
+#define CACHE_H_INCLUDED
+
 #include "miniobj.h"
 #include "vas.h"
 #include "vqueue.h"
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index b344770..de03e88 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -36,7 +36,6 @@
 
 #include "cache_varnishd.h"
 
-#include "vrt.h"
 #include "vtcp.h"
 #include "vtim.h"
 #include "waiter/waiter.h"
diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c
index 5a30950..84a0cb1 100644
--- a/bin/varnishd/cache/cache_backend_cfg.c
+++ b/bin/varnishd/cache/cache_backend_cfg.c
@@ -39,7 +39,6 @@
 #include "cache_varnishd.h"
 
 #include "vcli_serve.h"
-#include "vrt.h"
 #include "vcl.h"
 #include "vtim.h"
 #include "waiter/waiter.h"
diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index e76468d..aa176c0 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -45,7 +45,6 @@
 
 #include "binary_heap.h"
 #include "vcli_serve.h"
-#include "vrt.h"
 #include "vsa.h"
 #include "vtcp.h"
 #include "vtim.h"
diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c
index d9bd52a..3fd9aec 100644
--- a/bin/varnishd/cache/cache_director.c
+++ b/bin/varnishd/cache/cache_director.c
@@ -39,8 +39,6 @@
 
 #include "cache_director.h"
 
-#include "vrt.h"
-
 /* Resolve director --------------------------------------------------*/
 
 static const struct director *
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index c6527e8..167c8a5 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -35,7 +35,6 @@
 #include "cache_objhead.h"
 #include "hash/hash_slinger.h"
 #include "storage/storage.h"
-#include "vrt.h"
 #include "vcl.h"
 #include "vtim.h"
 
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index c20fa63..869b2ad 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -45,8 +45,6 @@
 #include "common/heritage.h"
 #include "waiter/waiter.h"
 
-
-#include "vrt.h"
 #include "cache_director.h"
 #include "storage/storage.h"
 #include "vcli_serve.h"
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 693ac31..8ea3621 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -46,7 +46,6 @@
 
 #include "hash/hash_slinger.h"
 #include "storage/storage.h"
-#include "vrt.h"
 #include "vcl.h"
 #include "vsha256.h"
 #include "vtim.h"
diff --git a/bin/varnishd/cache/cache_tcp_pool.c b/bin/varnishd/cache/cache_tcp_pool.c
index 5c351a4..04ea7e2 100644
--- a/bin/varnishd/cache/cache_tcp_pool.c
+++ b/bin/varnishd/cache/cache_tcp_pool.c
@@ -35,7 +35,6 @@
 
 #include "cache_varnishd.h"
 
-#include "vrt.h"
 #include "vsa.h"
 #include "vtcp.h"
 #include "vtim.h"
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 547976e..e61fa76 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -38,7 +38,6 @@
 #include "cache_varnishd.h"
 #include "common/heritage.h"
 
-#include "vrt.h"
 #include "vcl.h"
 #include "waiter/waiter.h"
 
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index e1766c4..7f95ccb 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -36,7 +36,6 @@
 #include "cache_director.h"
 #include "cache_objhead.h"
 #include "vav.h"
-#include "vrt.h"
 #include "vcl.h"
 #include "vrt_obj.h"
 #include "vsa.h"
diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 8e65c8f..ffab825 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -36,8 +36,6 @@
 
 #include "cache_varnishd.h"
 
-#include "vrt.h"
-
 struct vrt_priv {
 	unsigned			magic;
 #define VRT_PRIV_MAGIC			0x24157a52
diff --git a/bin/varnishd/cache/cache_vrt_re.c b/bin/varnishd/cache/cache_vrt_re.c
index ed9d4fa..20a0cf6 100644
--- a/bin/varnishd/cache/cache_vrt_re.c
+++ b/bin/varnishd/cache/cache_vrt_re.c
@@ -35,8 +35,6 @@
 
 #include "cache_varnishd.h"
 
-#include "vrt.h"
-
 static void
 Tadd(char **b, char *e, const char *p, int l)
 {
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 9d4db8e..0f1d018 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -36,7 +36,6 @@
 #include "common/heritage.h"
 
 #include "cache_director.h"
-#include "vrt.h"
 #include "vrt_obj.h"
 
 static char vrt_hostname[255] = "";
diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index 04502db..f1c7a80 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -39,7 +39,6 @@
 
 #include "vcli_serve.h"
 #include "vmod_abi.h"
-#include "vrt.h"
 
 /*--------------------------------------------------------------------
  * Modules stuff
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index cab8ac1..393486d 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -39,7 +39,6 @@
 #include <stdlib.h>
 
 #include "storage/storage.h"
-#include "vrt.h"
 #include "vrt_obj.h"
 
 
diff --git a/bin/varnishd/storage/storage_malloc.c b/bin/varnishd/storage/storage_malloc.c
index 0468835..9fe13b5 100644
--- a/bin/varnishd/storage/storage_malloc.c
+++ b/bin/varnishd/storage/storage_malloc.c
@@ -40,7 +40,6 @@
 #include "storage/storage.h"
 #include "storage/storage_simple.h"
 
-#include "vrt.h"
 #include "vnum.h"
 
 #include "VSC_sma.h"
diff --git a/include/vrt.h b/include/vrt.h
index bb875e3..6a07e8c 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -31,6 +31,10 @@
  * NB: When this file is changed, lib/libvcc/generate.py *MUST* be rerun.
  */
 
+#ifdef CACHE_H_INCLUDED
+#  error "vrt.h included after cache.h - they are inclusive"
+#endif
+
 #ifdef VRT_H_INCLUDED
 #  error "vrt.h included multiple times"
 #endif
diff --git a/lib/libvmod_blob/vmod_blob.c b/lib/libvmod_blob/vmod_blob.c
index 73dd831..030140f 100644
--- a/lib/libvmod_blob/vmod_blob.c
+++ b/lib/libvmod_blob/vmod_blob.c
@@ -32,7 +32,7 @@
 #include <string.h>
 
 #include "vdef.h"
-#include "vrt.h"
+#include "cache/cache.h"
 
 #include "vcc_if.h"
 #include "vmod_blob.h"
diff --git a/lib/libvmod_blob/wb.c b/lib/libvmod_blob/wb.c
index 343ca59..e16c421 100644
--- a/lib/libvmod_blob/wb.c
+++ b/lib/libvmod_blob/wb.c
@@ -28,6 +28,8 @@
 
 #include <string.h>
 
+#include "vdef.h"
+#include "cache/cache.h"
 #include "wb.h"
 
 char *
diff --git a/lib/libvmod_blob/wb.h b/lib/libvmod_blob/wb.h
index ce11ba1..e2c820d 100644
--- a/lib/libvmod_blob/wb.h
+++ b/lib/libvmod_blob/wb.h
@@ -25,8 +25,6 @@
  *
  */
 
-#include "cache/cache.h"
-
 struct wb_s {
 	struct ws	*ws; // varnish workspace
 	char		*w;  // current write position
diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index e538543..5ed5cd0 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -37,7 +37,6 @@
 
 #include "cache/cache.h"
 
-#include "vrt.h"
 #include "vsa.h"
 #include "vsb.h"
 #include "vtcp.h"
diff --git a/lib/libvmod_debug/vmod_debug_dyn.c b/lib/libvmod_debug/vmod_debug_dyn.c
index af61742..8742ff9 100644
--- a/lib/libvmod_debug/vmod_debug_dyn.c
+++ b/lib/libvmod_debug/vmod_debug_dyn.c
@@ -34,9 +34,6 @@
 #include <sys/socket.h>
 
 #include "cache/cache.h"
-
-#include "vrt.h"
-
 #include "cache/cache_director.h"
 
 #include "vsa.h"
diff --git a/lib/libvmod_debug/vmod_debug_obj.c b/lib/libvmod_debug/vmod_debug_obj.c
index 9dfef9d..3364092 100644
--- a/lib/libvmod_debug/vmod_debug_obj.c
+++ b/lib/libvmod_debug/vmod_debug_obj.c
@@ -33,7 +33,6 @@
 
 #include "cache/cache.h"
 
-#include "vrt.h"
 #include "vcc_if.h"
 
 struct vmod_debug_obj {
diff --git a/lib/libvmod_directors/fall_back.c b/lib/libvmod_directors/fall_back.c
index 9a4d392..544c168 100644
--- a/lib/libvmod_directors/fall_back.c
+++ b/lib/libvmod_directors/fall_back.c
@@ -34,7 +34,6 @@
 #include "cache/cache.h"
 #include "cache/cache_director.h"
 
-#include "vrt.h"
 #include "vcc_if.h"
 
 #include "vdir.h"
diff --git a/lib/libvmod_directors/hash.c b/lib/libvmod_directors/hash.c
index 60fa834..14f36f5 100644
--- a/lib/libvmod_directors/hash.c
+++ b/lib/libvmod_directors/hash.c
@@ -34,7 +34,6 @@
 #include "cache/cache.h"
 #include "cache/cache_director.h"
 
-#include "vrt.h"
 #include "vend.h"
 #include "vsha256.h"
 
diff --git a/lib/libvmod_directors/random.c b/lib/libvmod_directors/random.c
index 10e6f53..0608021 100644
--- a/lib/libvmod_directors/random.c
+++ b/lib/libvmod_directors/random.c
@@ -35,7 +35,6 @@
 
 #include "vbm.h"
 #include "vrnd.h"
-#include "vrt.h"
 
 #include "vdir.h"
 
diff --git a/lib/libvmod_directors/round_robin.c b/lib/libvmod_directors/round_robin.c
index 8a867cc..64ed115 100644
--- a/lib/libvmod_directors/round_robin.c
+++ b/lib/libvmod_directors/round_robin.c
@@ -34,7 +34,6 @@
 #include "cache/cache.h"
 #include "cache/cache_director.h"
 
-#include "vrt.h"
 #include "vcc_if.h"
 
 #include "vdir.h"
diff --git a/lib/libvmod_directors/shard_cfg.c b/lib/libvmod_directors/shard_cfg.c
index 7fc5056..620126f 100644
--- a/lib/libvmod_directors/shard_cfg.c
+++ b/lib/libvmod_directors/shard_cfg.c
@@ -37,8 +37,6 @@
 #include "cache/cache.h"
 #include "cache/cache_director.h"
 
-#include "vrt.h"
-
 #include "shard_dir.h"
 #include "shard_cfg.h"
 #include "shard_hash.h"
diff --git a/lib/libvmod_directors/shard_dir.c b/lib/libvmod_directors/shard_dir.c
index aa56483..36c901b 100644
--- a/lib/libvmod_directors/shard_dir.c
+++ b/lib/libvmod_directors/shard_dir.c
@@ -39,7 +39,6 @@
 #include "cache/cache.h"
 #include "cache/cache_director.h"
 
-#include "vrt.h"
 #include "vbm.h"
 #include "vrnd.h"
 
diff --git a/lib/libvmod_directors/shard_hash.c b/lib/libvmod_directors/shard_hash.c
index 64e7e15..560ceb9 100644
--- a/lib/libvmod_directors/shard_hash.c
+++ b/lib/libvmod_directors/shard_hash.c
@@ -34,7 +34,6 @@
 
 #include "cache/cache.h"
 
-#include "vrt.h"
 #include "vsha256.h"
 #include "vend.h"
 
diff --git a/lib/libvmod_directors/vdir.c b/lib/libvmod_directors/vdir.c
index 1581346..c286497 100644
--- a/lib/libvmod_directors/vdir.c
+++ b/lib/libvmod_directors/vdir.c
@@ -33,7 +33,6 @@
 #include "cache/cache.h"
 #include "cache/cache_director.h"
 
-#include "vrt.h"
 #include "vbm.h"
 
 #include "vdir.h"
diff --git a/lib/libvmod_directors/vmod_shard.c b/lib/libvmod_directors/vmod_shard.c
index c85c9b4..984c3ed 100644
--- a/lib/libvmod_directors/vmod_shard.c
+++ b/lib/libvmod_directors/vmod_shard.c
@@ -34,7 +34,6 @@
 
 #include "cache/cache.h"
 
-#include "vrt.h"
 #include "vend.h"
 
 #include "vcc_if.h"
diff --git a/lib/libvmod_purge/vmod_purge.c b/lib/libvmod_purge/vmod_purge.c
index 4ba039b..0df0c45 100644
--- a/lib/libvmod_purge/vmod_purge.c
+++ b/lib/libvmod_purge/vmod_purge.c
@@ -28,10 +28,12 @@
 
 #include "config.h"
 
-#include "math.h"
-
-#include "cache/cache.h"
+#include <math.h>
+#include <stdio.h>
 
+#include "vdef.h"
+#include "vas.h"
+#include "miniobj.h"
 #include "vrt.h"
 
 #include "vcc_if.h"
diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c
index 91f29ca..2887beb 100644
--- a/lib/libvmod_std/vmod_std.c
+++ b/lib/libvmod_std/vmod_std.c
@@ -41,7 +41,6 @@
 #include "cache/cache.h"
 
 #include "vrnd.h"
-#include "vrt.h"
 #include "vtcp.h"
 #include "vsa.h"
 #include "vtim.h"
diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c
index 18ac13d..c71b771 100644
--- a/lib/libvmod_std/vmod_std_conversions.c
+++ b/lib/libvmod_std/vmod_std_conversions.c
@@ -40,7 +40,6 @@
 #include "cache/cache.h"
 
 #include "vnum.h"
-#include "vrt.h"
 #include "vsa.h"
 #include "vtim.h"
 #include "vcc_if.h"
diff --git a/lib/libvmod_std/vmod_std_fileread.c b/lib/libvmod_std/vmod_std_fileread.c
index 8a69921..2be46ff 100644
--- a/lib/libvmod_std/vmod_std_fileread.c
+++ b/lib/libvmod_std/vmod_std_fileread.c
@@ -44,7 +44,6 @@
 
 #include "cache/cache.h"
 
-#include "vrt.h"
 #include "vfil.h"
 
 #include "vcc_if.h"
diff --git a/lib/libvmod_std/vmod_std_querysort.c b/lib/libvmod_std/vmod_std_querysort.c
index 3efe155..52a95f9 100644
--- a/lib/libvmod_std/vmod_std_querysort.c
+++ b/lib/libvmod_std/vmod_std_querysort.c
@@ -33,8 +33,6 @@
 
 #include "cache/cache.h"
 
-#include "vrt.h"
-
 #include "vcc_if.h"
 
 static int
diff --git a/lib/libvmod_vtc/vmod_vtc.c b/lib/libvmod_vtc/vmod_vtc.c
index 840df35..9f8bbf9 100644
--- a/lib/libvmod_vtc/vmod_vtc.c
+++ b/lib/libvmod_vtc/vmod_vtc.c
@@ -36,7 +36,6 @@
 
 #include "cache/cache.h"
 
-#include "vrt.h"
 #include "vtcp.h"
 #include "vtim.h"
 


More information about the varnish-commit mailing list