Don't use C++ comments in assembly
Alan Modra
amodra@gmail.com
Thu Jan 13 08:32:01 GMT 2022
On Thu, Jan 13, 2022 at 08:58:25AM +0100, Jan Beulich wrote:
> On 13.01.2022 04:38, Alan Modra via Binutils wrote:
> > It might seem to work, but only if '/' is a start of comment char.
> >
> > * testsuite/ld-elf/dt-relr-1.s: Use # for comment.
> > * testsuite/ld-elf/dt-relr-2.s: Likewise.
> > * testsuite/ld-elf/dt-relr-3.s: Likewise.
> >
> > diff --git a/ld/testsuite/ld-elf/dt-relr-1.s b/ld/testsuite/ld-elf/dt-relr-1.s
> > index 1eb34588160..ce1a876b1e8 100644
> > --- a/ld/testsuite/ld-elf/dt-relr-1.s
> > +++ b/ld/testsuite/ld-elf/dt-relr-1.s
> > @@ -9,5 +9,5 @@ _start:
> > .globl data
> > data:
> > .byte 0
> > - // Offset is not a multiple of 2. Don't use DT_RELR.
> > +# Offset is not a multiple of 2. Don't use DT_RELR.
>
> Just for my own education, since I've been wondering how to write comments
> in tests suitable for all (or at least most) targets: # isn't a universal
> comment char either (having a different meaning e.g. on Arm). In
No, it isn't, but it almost universally begins a comment line when
at the start of the line. grep line_comment_chars.
> gas/testsuite/gas/all/quoted-sym-names.s I did use /**/ which looks to
> have worked quite well
Yes, that style should also be universally accepted.
... Elsewhere I find ";#" in use.
For most targets this is a logical line break, followed by start of
line comment. For ns32k, the one target that doesn't use '#' as a
start of line comment, ';' happens to be the start of line comment.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list