diff options
author | Jan Beulich <jbeulich@suse.com> | 2024-08-02 09:43:58 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2024-08-02 09:43:58 +0200 |
commit | 3615e5db8d07da71110143ee37f604235dd088a6 (patch) | |
tree | 9a1444dd570a58a17f39030bca2d2e72fe2c5780 /gas/read.h | |
parent | b6e1210536c585be025218687a5c6911ceb1e1e8 (diff) | |
download | gdb-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.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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) |