[Varnish] #1567: error: unused variable ‘tv’ at cache_acceptor.c at compilation time (Solaris and Cygwin)
Varnish
varnish-bugs at varnish-cache.org
Thu Aug 7 02:58:15 CEST 2014
#1567: error: unused variable ‘tv’ at cache_acceptor.c at compilation time
(Solaris and Cygwin)
-------------------+--------------------
Reporter: jdzst | Type: defect
Status: new | Priority: normal
Milestone: | Component: build
Version: 4.0.1 | Severity: normal
Keywords: |
-------------------+--------------------
If SO_SNDTIMEO_WORKS or SO_RCVTIMEO_WORKS is not defined the following
error is thrown at compilation time:
{{{
make[3]: Entering directory
'/usr/src/varnish-4.0.1-1.i686/build/bin/varnishd'
CC varnishd-cache_acceptor.o
/usr/src/varnish-4.0.1-1.i686/src/varnish-4.0.1/bin/varnishd/cache/cache_acceptor.c:
In function ‘vca_tcp_opt_init’:
/usr/src/varnish-4.0.1-1.i686/src/varnish-4.0.1/bin/varnishd/cache/cache_acceptor.c:131:17:
error: unused variable ‘tv’ [-Werror=unused-variable]
struct timeval tv;
^
cc1: all warnings being treated as errors
Makefile:775: recipe for target 'varnishd-cache_acceptor.o' failed
make[3]: *** [varnishd-cache_acceptor.o] Error 1
make[3]: Leaving directory
'/usr/src/varnish-4.0.1-1.i686/build/bin/varnishd'
Makefile:392: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/usr/src/varnish-4.0.1-1.i686/build/bin'
Makefile:524: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/src/varnish-4.0.1-1.i686/build'
Makefile:409: recipe for target 'all' failed
make: *** [all] Error 2
}}}
This issue is only reproduced at Solaris and Cygwin platforms, where
SO_SNDTIMEO_WORKS and SO_RCVTIMEO_WORKS are not defined.
The solution is trivial, adding a #if defined, solves the issue:
{{{
--- origsrc/varnish-4.0.0/bin/varnishd/cache/cache_acceptor.c 2014-04-10
11:19:18.000000000 +0200
+++ src/varnish-4.0.0/bin/varnishd/cache/cache_acceptor.c 2014-05-09
02:46:49.537264500 +0200
@@ -128,7 +128,9 @@ vca_tcp_opt_init(void)
int one = 1;
// int zero = 0;
struct tcp_opt *to;
+#if defined(SO_SNDTIMEO_WORKS) || defined(SO_RCVTIMEO_WORKS)
struct timeval tv;
+#endif
int chg = 0;
#ifdef HAVE_TCP_KEEP
int x;
}}}
--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1567>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list