[PATCH 1/2] flex: Avoid REJECT name conflict.
Ondrej Filip
feela at network.cz
Tue Apr 27 11:34:18 CEST 2010
On 27.4.2010 11:21, Joakim Tjernlund wrote:
> REJECT is a reserved word in flex and REJECT is also used
> as %token in bison grammar. Rename REJECT to Reject in bison
> grammar to avoid name conflict. Same thing for ECHO but
> that does not seem to cause any conflicts ATM so leave as is.
Hmm, interesting. What king of problems does it cause to you?
Ondrej
>
> Also delete some dead code in flex output by using the
> apropiate %option statements.
>
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
> ---
> conf/cf-lex.l | 5 +++--
> filter/config.Y | 4 ++--
> proto/static/config.Y | 4 ++--
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/conf/cf-lex.l b/conf/cf-lex.l
> index 3fe3c2e..6612d3c 100644
> --- a/conf/cf-lex.l
> +++ b/conf/cf-lex.l
> @@ -25,7 +25,6 @@
> */
>
> %{
> -#undef REJECT /* Avoid name clashes */
>
> #include <errno.h>
> #include <stdlib.h>
> @@ -71,12 +70,14 @@ linpool *cfg_mem;
> int (*cf_read_hook)(byte *buf, unsigned int max);
>
> #define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max);
> -#define YY_NO_UNPUT
> +
> #define YY_FATAL_ERROR(msg) cf_error(msg)
>
> %}
>
> %option noyywrap
> +%option nounput
> +%option noinput
>
> %x COMMENT CCOMM CLI
>
> diff --git a/filter/config.Y b/filter/config.Y
> index 7723658..cab5dbe 100644
> --- a/filter/config.Y
> +++ b/filter/config.Y
> @@ -28,7 +28,7 @@ static int make_pair(int i1, int i2)
> CF_DECLS
>
> CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
> - ACCEPT, REJECT, ERROR, QUITBIRD,
> + ACCEPT, Reject, ERROR, QUITBIRD,
> INT, BOOL, IP, PREFIX, PAIR, QUAD, SET, STRING, BGPMASK, BGPPATH, CLIST,
> IF, THEN, ELSE, CASE,
> TRUE, FALSE,
> @@ -506,7 +506,7 @@ term:
> break_command:
> QUITBIRD { $$ = F_QUITBIRD; }
> | ACCEPT { $$ = F_ACCEPT; }
> - | REJECT { $$ = F_REJECT; }
> + | Reject { $$ = F_REJECT; }
> | ERROR { $$ = F_ERROR; }
> | PRINT { $$ = F_NOP; }
> | PRINTN { $$ = F_NONL; }
> diff --git a/proto/static/config.Y b/proto/static/config.Y
> index a7e5016..20f07ed 100644
> --- a/proto/static/config.Y
> +++ b/proto/static/config.Y
> @@ -16,7 +16,7 @@ static struct static_route *this_srt;
>
> CF_DECLS
>
> -CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE)
> +CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, Reject, PROHIBIT, PREFERENCE)
>
> CF_GRAMMAR
>
> @@ -54,7 +54,7 @@ stat_route:
> add_tail(&((struct static_config *) this_proto)->iface_routes, &this_srt->n);
> }
> | stat_route0 DROP { this_srt->dest = RTD_BLACKHOLE; }
> - | stat_route0 REJECT { this_srt->dest = RTD_UNREACHABLE; }
> + | stat_route0 Reject { this_srt->dest = RTD_UNREACHABLE; }
> | stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; }
> ;
>
More information about the Bird-users
mailing list