From 28bbe2acbd0064769be2f8efc7f64f05ba1e321e Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 18 Sep 2018 14:41:06 +0100 Subject: Made it so duplicating a label is an error. --- src/casm.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/casm.c') diff --git a/src/casm.c b/src/casm.c index bec864b..f4b06e5 100644 --- a/src/casm.c +++ b/src/casm.c @@ -892,6 +892,28 @@ static void RunPass(const char *name, FILE *fp, int depth) goto error_handling; } + if (IsFirstPass()) + { + const Label *l; + + if ((l = LabelFind(label, type))) + { + if (l->type == GLOBAL_LABEL) + { + snprintf(err, sizeof err, "Global %s already defined", + label); + } + else + { + snprintf(err, sizeof err, "Local %s already defined", + label); + } + + cmdstat = CMD_FAILED; + goto error_handling; + } + } + /* This may well be updated by a command, but easier to set anyway */ if (options.address24) -- cgit v1.2.3