]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gas: correctly deal with line comments when not preprocessing
authorJan Beulich <jbeulich@suse.com>
Fri, 2 Aug 2024 07:43:58 +0000 (09:43 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 2 Aug 2024 07:43:58 +0000 (09:43 +0200)
commit3615e5db8d07da71110143ee37f604235dd088a6
tree9a1444dd570a58a17f39030bca2d2e72fe2c5780
parentb6e1210536c585be025218687a5c6911ceb1e1e8
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.
gas/read.c
gas/read.h
gas/testsuite/gas/all/gas.exp
gas/testsuite/gas/all/line-comment.d [new file with mode: 0644]
gas/testsuite/gas/all/line-comment.s [new file with mode: 0644]
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/line-comment.d [new file with mode: 0644]
gas/testsuite/gas/i386/line-comment.s [new file with mode: 0644]