From: Mark Andrews Date: Tue, 1 Nov 2016 23:04:57 +0000 (+1100) Subject: 4502. [func] Report multiple and experimental options when printing X-Git-Tag: v9.12.0a1~688 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=89286906dc8bbe058060ee1a51d2a89426d14e2f;p=thirdparty%2Fbind9.git 4502. [func] Report multiple and experimental options when printing grammar. [RT #43134] --- diff --git a/CHANGES b/CHANGES index 49f6e830147..fc1d6b3b7e7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4502. [func] Report multiple and experimental options when printing + grammar. [RT #43134] + 4501. [placeholder] 4500. [bug] Support modifier I64 in isc__print_printf. [RT #43526] diff --git a/doc/misc/sort-options.pl b/doc/misc/sort-options.pl index 93933a01c49..88b6c6216df 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 bce131d94a1..087db23a10d 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 3e5c7934156..c79f08ed628 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 05302d5fbc5..4181186d4b8 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,6 +1953,37 @@ cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) { } } +static struct flagtext { + unsigned int flag; + const char *text; +} flagtexts[] = { + { CFG_CLAUSEFLAG_NOTIMP, "not implemented" }, + { CFG_CLAUSEFLAG_NYI, "not yet implemented" }, + { CFG_CLAUSEFLAG_OBSOLETE, "obsolete" }, + { 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 } +}; + +static void +print_clause_flags(cfg_printer_t *pctx, unsigned int flags) { + struct flagtext *p; + isc_boolean_t first = ISC_TRUE; + for (p = flagtexts; p->flag != 0; p++) { + if ((flags & p->flag) != 0) { + if (first) + cfg_print_cstr(pctx, " // "); + else + cfg_print_cstr(pctx, ", "); + cfg_print_cstr(pctx, p->text); + first = ISC_FALSE; + } + } +} + void cfg_doc_mapbody(cfg_printer_t *pctx, const cfg_type_t *type) { const cfg_clausedef_t * const *clauseset; @@ -1968,25 +1999,13 @@ cfg_doc_mapbody(cfg_printer_t *pctx, const cfg_type_t *type) { 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"); + cfg_print_cstr(pctx, ";"); + print_clause_flags(pctx, clause->flags); + cfg_print_cstr(pctx, "\n\n"); } } } -static struct flagtext { - unsigned int flag; - const char *text; -} flagtexts[] = { - { CFG_CLAUSEFLAG_NOTIMP, "not implemented" }, - { CFG_CLAUSEFLAG_NYI, "not yet implemented" }, - { CFG_CLAUSEFLAG_OBSOLETE, "obsolete" }, - { CFG_CLAUSEFLAG_NEWDEFAULT, "default changed" }, - { CFG_CLAUSEFLAG_TESTONLY, "test only" }, - { CFG_CLAUSEFLAG_NOTCONFIGURED, "not configured" }, - { 0, NULL } -}; - void cfg_print_map(cfg_printer_t *pctx, const cfg_obj_t *obj) { REQUIRE(pctx != NULL); @@ -2001,22 +2020,6 @@ cfg_print_map(cfg_printer_t *pctx, const cfg_obj_t *obj) { print_close(pctx); } -static void -print_clause_flags(cfg_printer_t *pctx, unsigned int flags) { - struct flagtext *p; - isc_boolean_t first = ISC_TRUE; - for (p = flagtexts; p->flag != 0; p++) { - if ((flags & p->flag) != 0) { - if (first) - cfg_print_cstr(pctx, " // "); - else - cfg_print_cstr(pctx, ", "); - cfg_print_cstr(pctx, p->text); - first = ISC_FALSE; - } - } -} - void cfg_doc_map(cfg_printer_t *pctx, const cfg_type_t *type) { const cfg_clausedef_t * const *clauseset;