From: David Faust <david.faust@oracle.com>
To: binutils@sourceware.org
Cc: jose.marchesi@oracle.com
Subject: [PATCH] bpf: accept # as an inline comment char
Date: Tue, 25 Jul 2023 13:44:35 -0700 [thread overview]
Message-ID: <20230725204435.9560-1-david.faust@oracle.com> (raw)
This little patch makes the BPF assembler accept '#' as an inline
comment character, which clang -S seems to use.
Tested on bpf-unknown-none.
OK?
gas/
* config/tc-bpf.c (comment_chars): Add '#'.
* doc/c-bpf.texi (BPF Special Characters): Add note that '#' may
be used for inline comments.
---
gas/config/tc-bpf.c | 2 +-
gas/doc/c-bpf.texi | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
index c56b8fe984f..56c434c223d 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 8f39ab314a7..597b3b30b30 100644
--- a/gas/doc/c-bpf.texi
+++ b/gas/doc/c-bpf.texi
@@ -64,9 +64,10 @@ 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. If a
+@samp{#} appears as the first character of a line, the whole line is
+treated as a comment.
@cindex statement separator, BPF
Statements and assembly directives are separated by newlines.
--
2.40.1
next reply other threads:[~2023-07-25 20:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 20:44 David Faust [this message]
2023-07-25 20:56 ` Jose E. Marchesi
2023-07-25 22:54 ` David Faust
2023-07-25 22:58 ` Jose E. Marchesi
2023-07-25 23:13 ` David Faust
2023-07-25 23:36 ` Jose E. Marchesi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230725204435.9560-1-david.faust@oracle.com \
--to=david.faust@oracle.com \
--cc=binutils@sourceware.org \
--cc=jose.marchesi@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).