]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: cache: avoid a build warning with some compilers/linkers
authorWilly Tarreau <w@1wt.eu>
Fri, 29 Mar 2019 17:26:52 +0000 (18:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 29 Mar 2019 20:03:24 +0000 (21:03 +0100)
The struct http_cache_applet was fully declared at the beginning
instead of just doing a forward declaration using an extern modifier.
Some linkers report warnings about a redefined symbol since these
really are two complete declarations.

The proper way to do this is to use extern on the first one and to
have a full declaration later. However it's not permitted to have
both static and extern so the change done in commit 0f2229943
("CLEANUP: cache: don't export http_cache_applet anymore") has to
be partially undone.

This should be backported to 1.9 for sanity but has no effet on
most platforms. However on 1.9 the extern keyword must also be
added to include/types/cache.h.

src/cache.c

index 879e068c54c24ba41deaf01d2d742b95f1e39a97..44355cd8650566b737ad56f613c36cf942ec9c41 100644 (file)
@@ -48,7 +48,7 @@
 
 const char *cache_store_flt_id = "cache store filter";
 
-static struct applet http_cache_applet;
+extern struct applet http_cache_applet;
 
 struct flt_ops cache_ops;
 
@@ -1839,7 +1839,7 @@ static struct action_kw_list http_req_actions = {
 
 INITCALL1(STG_REGISTER, http_req_keywords_register, &http_req_actions);
 
-static struct applet http_cache_applet = {
+struct applet http_cache_applet = {
        .obj_type = OBJ_TYPE_APPLET,
        .name = "<CACHE>", /* used for logging */
        .fct = http_cache_io_handler,