]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Conf: Fixed symbol redefinition
authorMaria Matejka <mq@ucw.cz>
Tue, 30 Jul 2019 12:28:40 +0000 (14:28 +0200)
committerMaria Matejka <mq@ucw.cz>
Tue, 30 Jul 2019 12:28:40 +0000 (14:28 +0200)
conf/confbase.Y
filter/config.Y
nest/config.Y

index 775af22d7cdb5602b3054e32de2fa17f93ce0854..75158927673af1e7e66ad6f67f95ddafc4d8e600 100644 (file)
@@ -109,7 +109,6 @@ CF_DECLS
 %type <net> net_ip4_ net_ip6_ net_ip6 net_ip_ net_ip net_or_ipa
 %type <net_ptr> net_ net_any net_vpn4_ net_vpn6_ net_vpn_ net_roa4_ net_roa6_ net_roa_ net_ip6_sadr_ net_mpls_
 %type <mls> label_stack_start label_stack
-%type <s> CF_SYM_VOID
 
 %type <t> text opttext
 %type <s> symbol
@@ -147,7 +146,7 @@ conf: ';' ;
 conf: definition ;
 
 definition:
-   DEFINE CF_SYM_VOID '=' term ';' {
+   DEFINE symbol '=' term ';' {
      struct f_val *val = cfg_alloc(sizeof(struct f_val));
      if (f_eval(f_linearize($4), cfg_mem, val) > F_RETURN) cf_error("Runtime error");
      cf_define_symbol($2, SYM_CONSTANT | val->type, val, val);
@@ -168,9 +167,7 @@ expr_us:
  | expr US { $$ = $1 US_; }
  ;
 
-CF_SYM_VOID: CF_SYM_UNDEFINED ;
-
-symbol: CF_SYM_VOID | CF_SYM_KNOWN ;
+symbol: CF_SYM_UNDEFINED | CF_SYM_KNOWN ;
 
 /* Switches */
 
index 83319194c91b8ed910911af6ac87cf6f94e44a57..8171a7c20b6569afea605a0574ad1146e6a0ee9b 100644 (file)
@@ -467,7 +467,7 @@ CF_GRAMMAR
 
 conf: filter_def ;
 filter_def:
-   FILTER CF_SYM_VOID { $2 = cf_define_symbol($2, SYM_FILTER, filter, NULL); cf_push_scope( $2 ); }
+   FILTER symbol { $2 = cf_define_symbol($2, SYM_FILTER, filter, NULL); cf_push_scope( $2 ); }
      filter_body {
      struct filter *f = cfg_alloc(sizeof(struct filter));
      *f = (struct filter) { .sym = $2, .root = $4 };
@@ -483,7 +483,7 @@ filter_eval:
  ;
 
 conf: custom_attr ;
-custom_attr: ATTRIBUTE type CF_SYM_VOID ';' {
+custom_attr: ATTRIBUTE type symbol ';' {
   cf_define_symbol($3, SYM_ATTRIBUTE, attribute, ca_lookup(new_config->pool, $3->name, $2)->fda);
 };
 
@@ -555,7 +555,7 @@ type:
 
 function_argsn:
    /* EMPTY */
- | function_argsn type CF_SYM_VOID ';' {
+ | function_argsn type symbol ';' {
      if ($3->scope->slots >= 0xfe) cf_error("Too many declarations, at most 255 allowed");
      cf_define_symbol($3, SYM_VARIABLE | $2, offset, $3->scope->slots++);
    }
@@ -563,7 +563,7 @@ function_argsn:
 
 function_args:
    '(' ')' { $$ = 0; }
- | '(' function_argsn type CF_SYM_VOID ')' {
+ | '(' function_argsn type symbol ')' {
      cf_define_symbol($4, SYM_VARIABLE | $3, offset, $4->scope->slots++);
      $$ = $4->scope->slots;
    }
@@ -571,7 +571,7 @@ function_args:
 
 function_vars:
    /* EMPTY */ { $$ = 0; }
- | function_vars type CF_SYM_VOID ';' {
+ | function_vars type symbol ';' {
      cf_define_symbol($3, SYM_VARIABLE | $2, offset, $3->scope->slots++);
      $$ = $1 + 1;
    }
@@ -607,7 +607,7 @@ function_body:
 
 conf: function_def ;
 function_def:
-   FUNCTION CF_SYM_VOID { DBG( "Beginning of function %s\n", $2->name );
+   FUNCTION symbol { DBG( "Beginning of function %s\n", $2->name );
      $2 = cf_define_symbol($2, SYM_FUNCTION, function, NULL);
      cf_push_scope($2);
    } function_args function_body {
index 4c4b6c335c76ad2fa36afb5de1868b903843cf54..e1a932d461371000609889a5a781d5d4f5f7d4e5 100644 (file)
@@ -156,7 +156,7 @@ table_sorted:
  | SORTED { $$ = 1; }
  ;
 
-table: net_type TABLE CF_SYM_VOID table_sorted {
+table: net_type TABLE symbol table_sorted {
    struct rtable_config *cf;
    cf = rt_new_table($3, $1);
    cf->sorted = $4;
@@ -180,7 +180,7 @@ proto_name:
      s->proto = this_proto;
      this_proto->name = s->name;
      }
- | CF_SYM_VOID {
+ | symbol {
      cf_define_symbol($1, this_proto->class, proto, this_proto);
      this_proto->name = $1->name;
    }
@@ -194,7 +194,7 @@ proto_name:
 
      proto_copy_config(this_proto, $2->proto);
    }
- | CF_SYM_VOID FROM CF_SYM_KNOWN {
+ | symbol FROM CF_SYM_KNOWN {
      if (($3->class != SYM_TEMPLATE) && ($3->class != SYM_PROTO)) cf_error("Template or protocol name expected");
 
      cf_define_symbol($1, this_proto->class, proto, this_proto);