summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2010-01-03 21:59:28 +0000
committerPeter Johnson <peter@tortall.net>2010-01-03 21:59:28 +0000
commit6ede18e881c81f0f5779c9daf67b0b1db4411905 (patch)
tree44bc30ebd9e51c729a582e45d0c482996b832f04
parent737c225a5081207542398a89950c17b326bd5d30 (diff)
downloadyasm-6ede18e881c81f0f5779c9daf67b0b1db4411905.tar.gz
GAS preproc: Fix line number for .rept without matching .endr error.
The line number reported for the error is that of the .rept directive. Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com> svn path=/trunk/yasm/; revision=2265
-rw-r--r--modules/parsers/gas/tests/bin/rept-err.asm2
-rw-r--r--modules/parsers/gas/tests/bin/rept-err.errwarn2
-rw-r--r--modules/preprocs/gas/gas-preproc.c5
3 files changed, 7 insertions, 2 deletions
diff --git a/modules/parsers/gas/tests/bin/rept-err.asm b/modules/parsers/gas/tests/bin/rept-err.asm
index 143e9041..88582f93 100644
--- a/modules/parsers/gas/tests/bin/rept-err.asm
+++ b/modules/parsers/gas/tests/bin/rept-err.asm
@@ -1,2 +1,4 @@
.rept 6
+.endr
+.rept 3
.byte 0
diff --git a/modules/parsers/gas/tests/bin/rept-err.errwarn b/modules/parsers/gas/tests/bin/rept-err.errwarn
index 3f64c8eb..5682b14a 100644
--- a/modules/parsers/gas/tests/bin/rept-err.errwarn
+++ b/modules/parsers/gas/tests/bin/rept-err.errwarn
@@ -1 +1 @@
--:1: error: rept without matching endr
+-:3: error: rept without matching endr
diff --git a/modules/preprocs/gas/gas-preproc.c b/modules/preprocs/gas/gas-preproc.c
index e81bb897..998070bb 100644
--- a/modules/preprocs/gas/gas-preproc.c
+++ b/modules/preprocs/gas/gas-preproc.c
@@ -644,6 +644,8 @@ static int eval_rept(yasm_preproc_gas *pp, int unused, const char *arg1)
char *line = read_line(pp);
buffered_line *prev_bline = NULL;
SLIST_HEAD(buffered_lines_head, buffered_line) lines;
+ int rept_start_file_line_number = pp->next_line_number - 1;
+ int rept_start_output_line_number = pp->current_line_number;
SLIST_INIT(&lines);
@@ -696,8 +698,9 @@ static int eval_rept(yasm_preproc_gas *pp, int unused, const char *arg1)
line = read_line(pp);
num_lines++;
}
+ yasm_linemap_set(pp->cur_lm, pp->in_filename, rept_start_output_line_number, rept_start_file_line_number, 0);
yasm_error_set(YASM_ERROR_SYNTAX, N_("rept without matching endr"));
- yasm_errwarn_propagate(pp->errwarns, pp->current_line_number);
+ yasm_errwarn_propagate(pp->errwarns, rept_start_output_line_number);
return 0;
}