[master] 7687c20 Forward declaration of initialized static variables is not possible in C. (One of the thing you'd think ISO-C had solved long time ago...)

Poul-Henning Kamp phk at FreeBSD.org
Fri May 5 23:35:05 CEST 2017


commit 7687c2029716d17c9984d1c182b9e4d43a947fb8
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri May 5 21:19:50 2017 +0000

    Forward declaration of initialized static variables is not possible in C.
    (One of the thing you'd think ISO-C had solved long time ago...)

diff --git a/bin/varnishtest/flint.lnt b/bin/varnishtest/flint.lnt
index 65c57c0..b6b36df 100644
--- a/bin/varnishtest/flint.lnt
+++ b/bin/varnishtest/flint.lnt
@@ -9,6 +9,8 @@
 
 -esym(534, snprintf)		// Only for varnishtest, and not really nice
 
+-esym(765, http_cmds)		// No, cannot be made static
+
 -e712	// 14      Info    712     Loss of precision (___) (___ to ___)
 -e747	// 16      Info    747     Significant prototype coercion (___) ___ to ___
 
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 044581e..22c00bd 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -49,7 +49,7 @@
 #include "vtcp.h"
 #include "hpack.h"
 
-static const struct cmds http_cmds[];
+extern const struct cmds http_cmds[];
 
 /* SECTION: client-server client/server
  *
@@ -1780,7 +1780,7 @@ cmd_http_write_body(CMD_ARGS)
  * Execute HTTP specifications
  */
 
-static const struct cmds http_cmds[] = {
+const struct cmds http_cmds[] = {
 #define CMD(n) { #n, cmd_##n },
 #define CMD_HTTP(n) { #n, cmd_http_##n },
 	/* session */



More information about the varnish-commit mailing list