public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] bpf: accept # as an inline comment char
@ 2023-07-26 15:23 David Faust
  0 siblings, 0 replies; only message in thread
From: David Faust @ 2023-07-26 15:23 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9d1e07bd19fb126edf5ac8bb098777bee9364ca5

commit 9d1e07bd19fb126edf5ac8bb098777bee9364ca5
Author: David Faust <david.faust@oracle.com>
Date:   Mon Jul 24 14:57:35 2023 -0700

    bpf: accept # as an inline comment char
    
    This little patch makes the BPF assembler accept '#' as an inline
    comment character, which clang -S seems to use.
    
    gas/
            * config/tc-bpf.c (comment_chars): Add '#'.
            * doc/c-bpf.texi (BPF Special Characters): Add note that '#' may
            be used for inline comments.

Diff:
---
 gas/config/tc-bpf.c | 2 +-
 gas/doc/c-bpf.texi  | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
index 095b05ac7af..faa809c05a2 100644
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -53,7 +53,7 @@ struct bpf_insn
   unsigned int has_imm64 : 1;
 };
 
-const char comment_chars[]        = ";";
+const char comment_chars[]        = ";#";
 const char line_comment_chars[]   = "#";
 const char line_separator_chars[] = "`";
 const char EXP_CHARS[]            = "eE";
diff --git a/gas/doc/c-bpf.texi b/gas/doc/c-bpf.texi
index 6683ff98105..868a358cf54 100644
--- a/gas/doc/c-bpf.texi
+++ b/gas/doc/c-bpf.texi
@@ -64,9 +64,8 @@ the host endianness is used.
 
 @cindex line comment character, BPF
 @cindex BPF line comment character
-The presence of a @samp{;} on a line indicates the start of a comment
-that extends to the end of the current line.  If a @samp{#} appears as
-the first character of a line, the whole line is treated as a comment.
+The presence of a @samp{;} or a @samp{#} on a line indicates the start
+of a comment that extends to the end of the current line.
 
 @cindex statement separator, BPF
 Statements and assembly directives are separated by newlines.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-26 15:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26 15:23 [binutils-gdb] bpf: accept # as an inline comment char David Faust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).