]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4502. [func] Report multiple and experimental options when printing
authorMark Andrews <marka@isc.org>
Tue, 1 Nov 2016 23:04:57 +0000 (10:04 +1100)
committerMark Andrews <marka@isc.org>
Tue, 1 Nov 2016 23:04:57 +0000 (10:04 +1100)
                        grammar. [RT #43134]

CHANGES
doc/misc/sort-options.pl
lib/isccfg/include/isccfg/grammar.h
lib/isccfg/namedconf.c
lib/isccfg/parser.c

diff --git a/CHANGES b/CHANGES
index 49f6e8301470f1daeca7ac65fdfeac11cba2f2c6..fc1d6b3b7e79a15bcecab2de0454049243428c97 100644 (file)
--- 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]
index 93933a01c493a802357ef0bac09341c56c3b9b96..88b6c6216dfe154f6b99f49c7b9741ae9e3a1619 100644 (file)
@@ -13,7 +13,7 @@ sub sortlevel() {
        my $fin = "";
        my $i = 0;
        while (<>) {
-               if (/^\s*};$/) {
+               if (/^\s*};$/ || /^\s*}; \/\/.*$/) {
                        $fin = $_;
                        # print 2, $_;
                        last;
index bce131d94a10df0d5cbe746aa264f88ecf031a1d..087db23a10dcad3f49c61a6205c9ed8ac4c8b62b 100644 (file)
@@ -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;
index 3e5c7934156aa184ec129aa755301a6d9c6e5c17..c79f08ed6287c5465e9b7da3fc19b0b08015515e 100644 (file)
@@ -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 },
index 05302d5fbc5edbafe4ddbe6df19bd4ecd0217aae..4181186d4b81ebbe6bca5029e5b352653e380227 100644 (file)
@@ -1113,7 +1113,7 @@ static void
 doc_btext(cfg_printer_t *pctx, const cfg_type_t *type) {
        UNUSED(type);
 
-       cfg_print_cstr(pctx, "{ <unspecified text> }");
+       cfg_print_cstr(pctx, "{ <unspecified-text> }");
 }
 
 
@@ -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;