public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Don't use C++ comments in assembly
@ 2022-01-13  3:38 Alan Modra
  2022-01-13  7:58 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2022-01-13  3:38 UTC (permalink / raw)
  To: binutils

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.
 	.dc.a __ehdr_start + 10
diff --git a/ld/testsuite/ld-elf/dt-relr-2.s b/ld/testsuite/ld-elf/dt-relr-2.s
index bd1f3dfa16f..1fcee6c6fce 100644
--- a/ld/testsuite/ld-elf/dt-relr-2.s
+++ b/ld/testsuite/ld-elf/dt-relr-2.s
@@ -16,5 +16,5 @@ data:
 	.dc.a __ehdr_start + 9
 
 	.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.
 	.dc.a __ehdr_start + 10
diff --git a/ld/testsuite/ld-elf/dt-relr-3.s b/ld/testsuite/ld-elf/dt-relr-3.s
index d020132466f..41ea08ec28c 100644
--- a/ld/testsuite/ld-elf/dt-relr-3.s
+++ b/ld/testsuite/ld-elf/dt-relr-3.s
@@ -4,7 +4,7 @@
 _start:
 	.byte 0
 
-	// Section alignment is not a multiple of 2.  Don't use DT_RELR.
+# Section alignment is not a multiple of 2.  Don't use DT_RELR.
 	.data
 	.p2align 0
 	.globl data

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Don't use C++ comments in assembly
  2022-01-13  3:38 Don't use C++ comments in assembly Alan Modra
@ 2022-01-13  7:58 ` Jan Beulich
  2022-01-13  8:32   ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2022-01-13  7:58 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

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
gas/testsuite/gas/all/quoted-sym-names.s I did use /**/ which looks to
have worked quite well ... Elsewhere I find ";#" in use.

Jan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Don't use C++ comments in assembly
  2022-01-13  7:58 ` Jan Beulich
@ 2022-01-13  8:32   ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2022-01-13  8:32 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-13  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13  3:38 Don't use C++ comments in assembly Alan Modra
2022-01-13  7:58 ` Jan Beulich
2022-01-13  8:32   ` Alan Modra

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).