[master] 7537590f7 Avoid our boolean parameter clashing with stdbool.h

Nils Goroll nils.goroll at uplex.de
Thu Jan 28 15:35:08 UTC 2021


commit 7537590f710b4663356fffefd4e3267a6954a3ba
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Jan 28 16:30:26 2021 +0100

    Avoid our boolean parameter clashing with stdbool.h
    
    We have now seen a second case after
    184736fad473070da79b77a16eab38faf393516e, and a simple internal rename
    from bool to boolean does the job.
    
    Should have no user-visible impact.

diff --git a/bin/varnishd/common/common_param.h b/bin/varnishd/common/common_param.h
index b7f07ace3..785e20579 100644
--- a/bin/varnishd/common/common_param.h
+++ b/bin/varnishd/common/common_param.h
@@ -40,10 +40,6 @@
 
 #define VSM_CLASS_PARAM		"Params"
 
-#ifdef __MACH__
-#undef bool
-#endif
-
 enum debug_bits {
 #define DEBUG_BIT(U, l, d) DBG_##U,
 #include "tbl/debug_bits.h"
@@ -82,7 +78,7 @@ typedef uint8_t feature_t[(FEATURE_Reserved+7)>>3];
 
 struct params {
 
-#define ptyp_bool		unsigned
+#define ptyp_boolean		unsigned
 #define ptyp_bytes		ssize_t
 #define ptyp_bytes_u		unsigned
 #define ptyp_double		double
@@ -96,7 +92,7 @@ struct params {
 #define PARAM(typ, fld, nm, ...)		\
 	ptyp_##typ		fld;
 #include <tbl/params.h>
-#undef ptyp_bool
+#undef ptyp_boolean
 #undef ptyp_bytes
 #undef ptyp_bytes_u
 #undef ptyp_double
diff --git a/bin/varnishd/mgt/mgt_param.h b/bin/varnishd/mgt/mgt_param.h
index fd884fd02..20d82641f 100644
--- a/bin/varnishd/mgt/mgt_param.h
+++ b/bin/varnishd/mgt/mgt_param.h
@@ -66,7 +66,7 @@ struct parspec {
 	char		*dyn_def;
 };
 
-tweak_t tweak_bool;
+tweak_t tweak_boolean;
 tweak_t tweak_bytes;
 tweak_t tweak_bytes_u;
 tweak_t tweak_double;
diff --git a/bin/varnishd/mgt/mgt_param_tweak.c b/bin/varnishd/mgt/mgt_param_tweak.c
index fe06f1ce5..8e378df04 100644
--- a/bin/varnishd/mgt/mgt_param_tweak.c
+++ b/bin/varnishd/mgt/mgt_param_tweak.c
@@ -122,7 +122,7 @@ tweak_double(struct vsb *vsb, const struct parspec *par, const char *arg)
 /*--------------------------------------------------------------------*/
 
 int
-tweak_bool(struct vsb *vsb, const struct parspec *par, const char *arg)
+tweak_boolean(struct vsb *vsb, const struct parspec *par, const char *arg)
 {
 	volatile unsigned *dest;
 
diff --git a/include/tbl/params.h b/include/tbl/params.h
index af751fdf2..6f4b6ad8b 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -54,7 +54,7 @@
 #endif
 PARAM_SIMPLE(
 	/* name */	accept_filter,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"on",	/* default adjusted in mgt_param.c */
@@ -120,7 +120,7 @@ PARAM_SIMPLE(
 
 PARAM_SIMPLE(
 	/* name */	auto_restart,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"on",
@@ -131,7 +131,7 @@ PARAM_SIMPLE(
 
 PARAM_SIMPLE(
 	/* name */	ban_dups,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"on",
@@ -505,7 +505,7 @@ PARAM_SIMPLE(
 
 PARAM_SIMPLE(
 	/* name */	http_gzip_support,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"on",
@@ -544,7 +544,7 @@ PARAM_SIMPLE(
 
 PARAM_SIMPLE(
 	/* name */	http_range_support,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"on",
@@ -745,7 +745,7 @@ PARAM_SIMPLE(
 
 PARAM_SIMPLE(
 	/* name */	prefer_ipv6,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"off",
@@ -807,7 +807,7 @@ PARAM_SIMPLE(
 
 PARAM_SIMPLE(
 	/* name */	sigsegv_handler,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"on",
@@ -820,7 +820,7 @@ PARAM_SIMPLE(
 
 PARAM_SIMPLE(
 	/* name */	syslog_cli_traffic,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"on",
@@ -836,7 +836,7 @@ PARAM_SIMPLE(
 #endif
 PARAM_SIMPLE(
 	/* name */	tcp_fastopen,
-	/* type */	bool,
+	/* type */	boolean,
 	/* min */	NULL,
 	/* max */	NULL,
 	/* def */	"off",
@@ -1567,7 +1567,7 @@ PARAM_STRING(
  */
 
 #  define PARAM_VCC(nm, def, descr) \
-	PARAM(, , nm, tweak_bool, &mgt_ ## nm, NULL, NULL, def, "bool", descr)
+	PARAM(, , nm, tweak_boolean, &mgt_ ## nm, NULL, NULL, def, "bool", descr)
 
 PARAM_VCC(
 	/* name */	vcc_err_unref,


More information about the varnish-commit mailing list