aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/read.c13
-rw-r--r--gas/read.h8
-rw-r--r--gas/testsuite/gas/all/gas.exp4
-rw-r--r--gas/testsuite/gas/all/line-comment.d12
-rw-r--r--gas/testsuite/gas/all/line-comment.s4
-rw-r--r--gas/testsuite/gas/i386/i386.exp1
-rw-r--r--gas/testsuite/gas/i386/line-comment.d13
-rw-r--r--gas/testsuite/gas/i386/line-comment.s6
8 files changed, 56 insertions, 5 deletions
diff --git a/gas/read.c b/gas/read.c
index 9a26a9a..adb4759 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1324,8 +1324,11 @@ read_a_source_file (const char *name)
s = input_line_pointer;
if (!startswith (s, "APP\n"))
{
- /* We ignore it. */
- ignore_rest_of_line ();
+ /* We ignore it. Note: Not ignore_rest_of_line ()! */
+ while (s <= buffer_limit)
+ if (is_end_of_line (*s++))
+ break;
+ input_line_pointer = s;
continue;
}
bump_line_counters ();
@@ -3974,7 +3977,7 @@ demand_empty_rest_of_line (void)
/* Return pointing just after end-of-line. */
}
-/* Silently advance to the end of line. Use this after already having
+/* Silently advance to the end of a statement. Use this after already having
issued an error about something bad. Like demand_empty_rest_of_line,
this function may leave input_line_pointer one after buffer_limit;
Don't call it from within expression parsing code in an attempt to
@@ -3984,9 +3987,9 @@ void
ignore_rest_of_line (void)
{
while (input_line_pointer <= buffer_limit)
- if (is_end_of_line[(unsigned char) *input_line_pointer++])
+ if (is_end_of_stmt (*input_line_pointer++))
break;
- /* Return pointing just after end-of-line. */
+ /* Return pointing just after end-of-statement. */
}
/* Sets frag for given symbol to zero_address_frag, except when the
diff --git a/gas/read.h b/gas/read.h
index 2441d56..3cdd408 100644
--- a/gas/read.h
+++ b/gas/read.h
@@ -58,6 +58,14 @@ extern bool input_from_string;
#define is_name_ender(c) \
( lex_type[(unsigned char) (c)] & LEX_END_NAME )
+/* The distinction of "line" and "statement" sadly is blurred by unhelpful
+ naming of e.g. the underlying array. Most users really mean "end of
+ statement". Going forward only these wrappers are supposed to be used. */
+#define is_end_of_stmt(c) \
+ (is_end_of_line[(unsigned char) (c)])
+#define is_end_of_line(c) \
+ (is_end_of_line[(unsigned char) (c)] == 1)
+
#ifndef is_a_char
#define CHAR_MASK (0xff)
#define NOT_A_CHAR (CHAR_MASK+1)
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index 24376a7..d42d8df 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -490,6 +490,10 @@ if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } {
run_list_test const-1 "-alm"
}
+if { ![istarget "tic30-*-*"] } {
+ run_dump_test "line-comment"
+}
+
run_list_test macro "-alm"
run_list_test pr20312
diff --git a/gas/testsuite/gas/all/line-comment.d b/gas/testsuite/gas/all/line-comment.d
new file mode 100644
index 0000000..9531ba8
--- /dev/null
+++ b/gas/testsuite/gas/all/line-comment.d
@@ -0,0 +1,12 @@
+#as:
+#as: -f
+#objdump: -dw --disassemble-zeroes
+#name: generic line comment
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <(line_comment|\.text)>:
+ +0+: .*
+#pass
diff --git a/gas/testsuite/gas/all/line-comment.s b/gas/testsuite/gas/all/line-comment.s
new file mode 100644
index 0000000..6f74bde
--- /dev/null
+++ b/gas/testsuite/gas/all/line-comment.s
@@ -0,0 +1,4 @@
+ .text
+line_comment:
+ #.warning;$@!|.error
+ .nop
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 590a55d..3e707b3 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -106,6 +106,7 @@ if [gas_32_check] then {
run_list_test "equ-2" "-al"
run_list_test "equ-bad"
run_list_test "comments" "-almn"
+ run_dump_test "line-comment"
run_dump_test "curly"
run_dump_test "separator"
run_dump_test "divide"
diff --git a/gas/testsuite/gas/i386/line-comment.d b/gas/testsuite/gas/i386/line-comment.d
new file mode 100644
index 0000000..4d989a4
--- /dev/null
+++ b/gas/testsuite/gas/i386/line-comment.d
@@ -0,0 +1,13 @@
+#as:
+#as: -f
+#objdump: -dw
+#name: i386 line comment
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <line_comment>:
+ +[a-f0-9]+: 90[ ]+nop
+ +[a-f0-9]+: c3[ ]+ret
+#pass
diff --git a/gas/testsuite/gas/i386/line-comment.s b/gas/testsuite/gas/i386/line-comment.s
new file mode 100644
index 0000000..e0d6e9a
--- /dev/null
+++ b/gas/testsuite/gas/i386/line-comment.s
@@ -0,0 +1,6 @@
+ .text
+line_comment:
+ nop
+ #aaa;aas
+ /aad;aam
+ ret