From cbd50549099fd3c84814e608025dcd2c3ccf0aaa Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" Date: Sun, 29 Jul 2007 01:17:40 +0000 Subject: [PATCH] * src/muscle_tab.c (muscle_percent_define_flag_if): In order to determine whether this function has already complained about an invalid value for a %define boolean variable, don't check whether Bison has ever examined the value. As written, the check was a tautology. Instead, record and check for this complaint using a separate muscle. --- ChangeLog | 8 ++++++++ src/muscle_tab.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a11ca86c..4573fc0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-07-28 Joel E. Denny + + * src/muscle_tab.c (muscle_percent_define_flag_if): In order to + determine whether this function has already complained about an invalid + value for a %define boolean variable, don't check whether Bison has + ever examined the value. As written, the check was a tautology. + Instead, record and check for this complaint using a separate muscle. + 2007-07-27 Joel E. Denny Fix push parsing memory leak reported by Brandon Lucia at diff --git a/src/muscle_tab.c b/src/muscle_tab.c index 732fc275..ad0951dd 100644 --- a/src/muscle_tab.c +++ b/src/muscle_tab.c @@ -460,12 +460,15 @@ muscle_percent_define_flag_if (char const *variable) char const *name; char const *loc_name; char const *usage_name; + char const *invalid_boolean_name; bool result = false; MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")"); MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")"); MUSCLE_USER_NAME_CONVERT (usage_name, "percent_define_bison_variables(", variable, ")"); + MUSCLE_USER_NAME_CONVERT (invalid_boolean_name, + "percent_define_invalid_boolean(", variable, ")"); if (muscle_percent_define_ifdef (variable)) { @@ -474,10 +477,13 @@ muscle_percent_define_flag_if (char const *variable) result = true; else if (0 == strcmp (value, "false")) result = false; - else if (!muscle_find_const (usage_name)) - complain_at(muscle_location_decode (loc_name), - _("invalid value for %%define boolean variable `%s'"), - variable); + else if (!muscle_find_const (invalid_boolean_name)) + { + muscle_insert (invalid_boolean_name, ""); + complain_at(muscle_location_decode (loc_name), + _("invalid value for %%define boolean variable `%s'"), + variable); + } free (value); } else -- 2.45.2