From bd19cef22382906a11fb6f1ffdef11038e432bca Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 2 Nov 2016 10:04:57 +1100 Subject: [PATCH] 4502. [func] Report multiple and experimental options when printing grammar. [RT #43134] (cherry picked from commit 89286906dc8bbe058060ee1a51d2a89426d14e2f) --- CHANGES | 3 ++ doc/misc/sort-options.pl | 2 +- lib/isccfg/include/isccfg/grammar.h | 2 + lib/isccfg/namedconf.c | 2 +- lib/isccfg/parser.c | 75 +++++++++++++++-------------- 5 files changed, 46 insertions(+), 38 deletions(-) diff --git a/CHANGES b/CHANGES index 1f7cbf6e59..dcf711826a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4502. [func] Report multiple and experimental options when printing + grammar. [RT #43134] + 4500. [bug] Support modifier I64 in isc__print_printf. [RT #43526] 4499. [port] MacOSX: silence deprecated function warning diff --git a/doc/misc/sort-options.pl b/doc/misc/sort-options.pl index 93933a01c4..88b6c6216d 100644 --- a/doc/misc/sort-options.pl +++ b/doc/misc/sort-options.pl @@ -13,7 +13,7 @@ sub sortlevel() { my $fin = ""; my $i = 0; while (<>) { - if (/^\s*};$/) { + if (/^\s*};$/ || /^\s*}; \/\/.*$/) { $fin = $_; # print 2, $_; last; diff --git a/lib/isccfg/include/isccfg/grammar.h b/lib/isccfg/include/isccfg/grammar.h index bce131d94a..087db23a10 100644 --- a/lib/isccfg/include/isccfg/grammar.h +++ b/lib/isccfg/include/isccfg/grammar.h @@ -46,6 +46,8 @@ #define CFG_CLAUSEFLAG_TESTONLY 0x00000040 /*% A configuration option that was not configured at compile time. */ #define CFG_CLAUSEFLAG_NOTCONFIGURED 0x00000080 +/*% A option for a experimental feature. */ +#define CFG_CLAUSEFLAG_EXPERIMENTAL 0x00000100 typedef struct cfg_clausedef cfg_clausedef_t; typedef struct cfg_tuplefielddef cfg_tuplefielddef_t; diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 3e5c793415..c79f08ed62 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -1776,7 +1776,7 @@ view_clauses[] = { { "suppress-initial-notify", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI }, { "topology", &cfg_type_bracketed_aml, CFG_CLAUSEFLAG_NOTIMP }, { "transfer-format", &cfg_type_transferformat, 0 }, - { "trust-anchor-telemetry", &cfg_type_boolean, 0 }, + { "trust-anchor-telemetry", &cfg_type_boolean, CFG_CLAUSEFLAG_EXPERIMENTAL }, { "use-queryport-pool", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, { "v6-bias", &cfg_type_uint32, 0 }, { "zero-no-soa-ttl-cache", &cfg_type_boolean, 0 }, diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 05302d5fbc..4181186d4b 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -1113,7 +1113,7 @@ static void doc_btext(cfg_printer_t *pctx, const cfg_type_t *type) { UNUSED(type); - cfg_print_cstr(pctx, "{ }"); + cfg_print_cstr(pctx, "{ }"); } @@ -1953,27 +1953,6 @@ cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) { } } -void -cfg_doc_mapbody(cfg_printer_t *pctx, const cfg_type_t *type) { - const cfg_clausedef_t * const *clauseset; - const cfg_clausedef_t *clause; - - REQUIRE(pctx != NULL); - REQUIRE(type != NULL); - - for (clauseset = type->of; *clauseset != NULL; clauseset++) { - for (clause = *clauseset; - clause->name != NULL; - clause++) { - cfg_print_cstr(pctx, clause->name); - cfg_print_cstr(pctx, " "); - cfg_doc_obj(pctx, clause->type); - /* XXX print flags here? */ - cfg_print_cstr(pctx, ";\n\n"); - } - } -} - static struct flagtext { unsigned int flag; const char *text; @@ -1984,23 +1963,11 @@ static struct flagtext { { CFG_CLAUSEFLAG_NEWDEFAULT, "default changed" }, { CFG_CLAUSEFLAG_TESTONLY, "test only" }, { CFG_CLAUSEFLAG_NOTCONFIGURED, "not configured" }, + { CFG_CLAUSEFLAG_MULTI, "may occur multiple times" }, + { CFG_CLAUSEFLAG_EXPERIMENTAL, "experimental" }, { 0, NULL } }; -void -cfg_print_map(cfg_printer_t *pctx, const cfg_obj_t *obj) { - REQUIRE(pctx != NULL); - REQUIRE(obj != NULL); - - if (obj->value.map.id != NULL) { - cfg_print_obj(pctx, obj->value.map.id); - cfg_print_cstr(pctx, " "); - } - print_open(pctx); - cfg_print_mapbody(pctx, obj); - print_close(pctx); -} - static void print_clause_flags(cfg_printer_t *pctx, unsigned int flags) { struct flagtext *p; @@ -2017,6 +1984,42 @@ print_clause_flags(cfg_printer_t *pctx, unsigned int flags) { } } +void +cfg_doc_mapbody(cfg_printer_t *pctx, const cfg_type_t *type) { + const cfg_clausedef_t * const *clauseset; + const cfg_clausedef_t *clause; + + REQUIRE(pctx != NULL); + REQUIRE(type != NULL); + + for (clauseset = type->of; *clauseset != NULL; clauseset++) { + for (clause = *clauseset; + clause->name != NULL; + clause++) { + cfg_print_cstr(pctx, clause->name); + cfg_print_cstr(pctx, " "); + cfg_doc_obj(pctx, clause->type); + cfg_print_cstr(pctx, ";"); + print_clause_flags(pctx, clause->flags); + cfg_print_cstr(pctx, "\n\n"); + } + } +} + +void +cfg_print_map(cfg_printer_t *pctx, const cfg_obj_t *obj) { + REQUIRE(pctx != NULL); + REQUIRE(obj != NULL); + + if (obj->value.map.id != NULL) { + cfg_print_obj(pctx, obj->value.map.id); + cfg_print_cstr(pctx, " "); + } + print_open(pctx); + cfg_print_mapbody(pctx, obj); + print_close(pctx); +} + void cfg_doc_map(cfg_printer_t *pctx, const cfg_type_t *type) { const cfg_clausedef_t * const *clauseset;