[9/9] wrc: Consider duplicate dialog ids as an error.
Dmitry Timoshkov
dmitry at codeweavers.com
Mon Jan 12 04:40:47 CST 2009
Duplicate dialog ids often lead to misbehaving and hard to debug dialogs.
MS' resource compiler allows only -1 as a "don't care" value, and nothing
else, it issues a warning in that case, it. If yyerror() seems inappropriate
to you please feel free to replace it by parser_warning().
---
tools/wrc/parser.y | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y
index c0cc2ba..5968bc1 100644
--- a/tools/wrc/parser.y
+++ b/tools/wrc/parser.y
@@ -1966,6 +1966,15 @@ static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control
if(prev)
prev->next = ctrl;
+ /* Check for duplicate identifiers */
+ while (prev)
+ {
+ if (ctrl->id != -1 && ctrl->id == prev->id)
+ yyerror("Duplicate dialog control id %d\n", ctrl->id);
+
+ prev = prev->prev;
+ }
+
if(type != -1)
{
ctrl->ctlclass = new_name_id();
--
1.6.1
More information about the wine-patches
mailing list