aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2018-09-18 14:41:06 +0100
committerIan C <ianc@noddybox.co.uk>2018-09-18 14:41:06 +0100
commit28bbe2acbd0064769be2f8efc7f64f05ba1e321e (patch)
treeb0241903303b01b4ccba7fa582c9ffc4679842a4 /src
parentb442eb4bbab3820ce6bc0b2551c1c560c2911c43 (diff)
Made it so duplicating a label is an error.
Diffstat (limited to 'src')
-rw-r--r--src/casm.c22
1 files changed, 22 insertions, 0 deletions
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)