aboutsummaryrefslogtreecommitdiff
path: root/gas/read.h
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-08-02 09:43:58 +0200
committerJan Beulich <jbeulich@suse.com>2024-08-02 09:43:58 +0200
commit3615e5db8d07da71110143ee37f604235dd088a6 (patch)
tree9a1444dd570a58a17f39030bca2d2e72fe2c5780 /gas/read.h
parentb6e1210536c585be025218687a5c6911ceb1e1e8 (diff)
downloadgdb-3615e5db8d07da71110143ee37f604235dd088a6.zip
gdb-3615e5db8d07da71110143ee37f604235dd088a6.tar.gz
gdb-3615e5db8d07da71110143ee37f604235dd088a6.tar.bz2
gas: correctly deal with line comments when not preprocessing
Internal naming of functions / data as well as commentary mixes lines and statements. It is presumably this confusion which has led to the wrong use of ignore_rest_of_line() when dealing with line comments in read_a_source_file(). We shall not (silently) produce different output depending on whether -f is passed (for suitable input). Introduce two new helper macros, intended to be used in favor of open- coded accesses to is_end_of_line[]. To emphasize the difference, convert ignore_rest_of_line() right away, including adjustments to its comments. Since most targets have # in line_comment_chars[], add a target- independent test for that, plus an x86-only one also checking for non-# to work as intended.
Diffstat (limited to 'gas/read.h')
-rw-r--r--gas/read.h8
1 files changed, 8 insertions, 0 deletions
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)