Commit 67252219 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Flag unused VSL tags in the definition table.

Add a flags field to the VSL tag definition table, and use this to
flag unused records.
parent ee1b415f
......@@ -100,7 +100,7 @@ mgt_DumpRstVsl(void)
"\n.. The following is autogenerated output from "
"varnishd -x dumprstvsl\n\n");
#define SLTM(tag, sdesc, ldesc) mgt_sltm(#tag, sdesc, ldesc);
#define SLTM(tag, flags, sdesc, ldesc) mgt_sltm(#tag, sdesc, ldesc);
#include "tbl/vsl_tags.h"
#undef SLTM
}
......
......@@ -115,7 +115,7 @@ bit_tweak(struct cli *cli, uint8_t *p, unsigned l, const char *arg,
*/
static const char * const VSL_tags[256] = {
# define SLTM(foo,sdesc,ldesc) [SLT_##foo] = #foo,
# define SLTM(foo,flags,sdesc,ldesc) [SLT_##foo] = #foo,
# include "tbl/vsl_tags.h"
# undef SLTM
NULL
......
This diff is collapsed.
......@@ -64,6 +64,6 @@ SLTH(Header, HTTP_HDR_FIRST, 1, 1, "header",
"\t+----- Header name\n"
"\n"
)
SLTH(Lost, HTTP_HDR_LOST, 1, 1, "(unused)",
SLTH(Lost, HTTP_HDR_LOST, 0, 0, "lost header",
""
)
......@@ -107,11 +107,15 @@ struct VSL_head {
#define SLT__MAX 256
enum VSL_tag_e {
SLT__Bogus = 0,
#define SLTM(foo,sdesc,ldesc) SLT_##foo,
#define SLTM(foo,flags,sdesc,ldesc) SLT_##foo,
#include "tbl/vsl_tags.h"
#undef SLTM
SLT__Reserved = 254,
SLT__Batch = 255
};
/* VSL tag flags */
#define SLT_F_UNUSED (1 << 0)
#define SLT_F_BINARY (1 << 1)
#endif /* VAPI_VSL_FMT_H_INCLUDED */
......@@ -58,7 +58,7 @@
/*--------------------------------------------------------------------*/
const char *VSL_tags[SLT__MAX] = {
# define SLTM(foo,sdesc,ldesc) [SLT_##foo] = #foo,
# define SLTM(foo,flags,sdesc,ldesc) [SLT_##foo] = #foo,
# include "tbl/vsl_tags.h"
# undef SLTM
};
......
......@@ -39,14 +39,15 @@
struct SLT {
unsigned tag;
unsigned flags;
const char *name;
const char *sdesc;
const char *ldesc;
};
static struct SLT tags[SLT__MAX] = {
#define SLTM(name, sdesc, ldesc) \
[SLT_##name] = { SLT_##name, #name, sdesc, ldesc },
#define SLTM(name, flags, sdesc, ldesc) \
[SLT_##name] = { SLT_##name, flags, #name, sdesc, ldesc },
#include "tbl/vsl_tags.h"
#undef SLTM
};
......@@ -98,10 +99,7 @@ main(int argc, char *argv[])
for (i = 0; i < SLT__MAX; i++) {
if (ptags[i]->name == NULL || !strcmp(ptags[i]->name, ""))
continue;
if (ptags[i]->sdesc != NULL &&
strstr(ptags[i]->sdesc, "(unused)"))
/* Don't list tags where the short description
contains the string "(unused)" */
if (ptags[i]->flags & SLT_F_UNUSED)
continue;
printf("%s", ptags[i]->name);
if (ptags[i]->sdesc != NULL && strcmp(ptags[i]->sdesc, ""))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment