[master] 5d3099e Arcanæ of the C-preprocessor (#436), brought to you by FlexeLint:
Poul-Henning Kamp
phk at FreeBSD.org
Thu Dec 8 22:12:05 CET 2016
commit 5d3099e21bfc38d39ae58394515464dbbbcc619e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Dec 8 21:03:22 2016 +0000
Arcanæ of the C-preprocessor (#436), brought to you by FlexeLint:
Don't:
MACRO(
a,
#if FOO
b,
#else
c,
#endif
d
)
A function like macro was invoked whose arguments extended for
multiple lines, which included preprocessor statements. This is
almost certainly an error brought about by a missing right parenthesis.
By the rules of Standard C the preprocessing directive is absorbed
into the macro argument but then will not subsequently get executed.
For this reason some compilers treat the apparent preprocessor
directive as a directive. This is logical but not portable.
It is therefore best to avoid this construct.
diff --git a/include/tbl/params.h b/include/tbl/params.h
index 1cdecbb..0dd1d62 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -28,8 +28,17 @@
* PARAM(nm, ty, mi, ma, de, un, fl, st, lt, fn)
*/
+#if defined(XYZZY)
+ #error "Temporary macro XYZZY already defined"
+#endif
+
/*lint -save -e525 -e539 */
+#if defined(HAVE_ACCEPT_FILTERS)
+ #define XYZZY MUST_RESTART
+#else
+ #define XYZZY NOT_IMPLEMENTED
+#endif
PARAM(
/* name */ accept_filter,
/* typ */ bool,
@@ -37,16 +46,13 @@ PARAM(
/* max */ NULL,
/* default */ "on",
/* units */ "bool",
-#if defined(HAVE_ACCEPT_FILTERS)
- /* flags */ MUST_RESTART,
-#else
- /* flags */ NOT_IMPLEMENTED,
-#endif
+ /* flags */ XYZZY,
/* s-text */
"Enable kernel accept-filters.",
/* l-text */ NULL,
/* func */ NULL
)
+#undef XYZZY
PARAM(
/* name */ acceptor_sleep_decay,
@@ -997,6 +1003,11 @@ PARAM(
/* func */ NULL
)
+#if defined(HAVE_TCP_FASTOPEN)
+ #define XYZZY MUST_RESTART
+#else
+ #define XYZZY NOT_IMPLEMENTED
+#endif
PARAM(
/* name */ tcp_fastopen,
/* typ */ bool,
@@ -1004,23 +1015,19 @@ PARAM(
/* max */ NULL,
/* default */ "off",
/* units */ "bool",
-#if defined(HAVE_TCP_FASTOPEN)
- /* flags */ MUST_RESTART,
-#else
- /* flags */ NOT_IMPLEMENTED,
-#endif
+ /* flags */ XYZZY,
/* s-text */
"Enable TCP Fast Open extension.",
/* l-text */ NULL,
/* func */ NULL
)
+#undef XYZZY
#if defined(HAVE_TCP_KEEP)
-#define TCP_KEEP_FLAGS EXPERIMENTAL
+ #define XYZZY EXPERIMENTAL
#else
-#define TCP_KEEP_FLAGS NOT_IMPLEMENTED
+ #define XYZZY NOT_IMPLEMENTED
#endif
-
PARAM(
/* name */ tcp_keepalive_intvl,
/* typ */ timeout,
@@ -1028,7 +1035,7 @@ PARAM(
/* max */ "100",
/* default */ "",
/* units */ "seconds",
- /* flags */ TCP_KEEP_FLAGS,
+ /* flags */ XYZZY,
/* s-text */
"The number of seconds between TCP keep-alive probes.",
/* l-text */ "",
@@ -1042,7 +1049,7 @@ PARAM(
/* max */ "100",
/* default */ "",
/* units */ "probes",
- /* flags */ TCP_KEEP_FLAGS,
+ /* flags */ XYZZY,
/* s-text */
"The maximum number of TCP keep-alive probes to send before giving "
"up and killing the connection if no response is obtained from the "
@@ -1058,13 +1065,14 @@ PARAM(
/* max */ "7200",
/* default */ "",
/* units */ "seconds",
- /* flags */ TCP_KEEP_FLAGS,
+ /* flags */ XYZZY,
/* s-text */
"The number of seconds a connection needs to be idle before TCP "
"begins sending out keep-alive probes.",
/* l-text */ "",
/* func */ NULL
)
+#undef XYZZY
#if 0
/* actual location mgt_pool.c */
More information about the varnish-commit
mailing list