public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@axis.com>
To: <gcc-patches@gcc.gnu.org>
Subject: [COMMITTED] testsuite: Fix gcc.dg/attr-copy-6.c for user-label-prefixed targets
Date: Thu, 2 Mar 2023 02:20:03 +0100	[thread overview]
Message-ID: <20230302012003.6A0D52040C@pchp3.se.axis.com> (raw)

Trivia: I copied that ASMNAME construct from the
18-year-minus-a-month old commit of r0-66993-gc5221531453e02,
where it fixed a similar testsuite error.  Committed as obvious.

-- >8 --
This fixes:
 Running /x/gcc/testsuite/gcc.dg/dg.exp ...
 ...
 FAIL: gcc.dg/attr-copy-6.c (test for excess errors)
for cris-elf, where gcc.log has:
Excess errors:
/x/gcc/testsuite/gcc.dg/attr-copy-6.c:91:3: error: 'fnoreturn_alias' aliased to undefined symbol 'fnoreturn_name'

Asm-declared identifiers need to prepend __USER_LABEL_PREFIX__
to the asm-name, something which is often overlooked because
it's empty for most targets.  N.B: attribute-alias does not need
the same treatment.  The identical construct added here, is in
several tests.

	* gcc.dg/attr-copy-6.c: Prefix asm-declared name with
	__USER_LABEL_PREFIX__.
---
 gcc/testsuite/gcc.dg/attr-copy-6.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/attr-copy-6.c b/gcc/testsuite/gcc.dg/attr-copy-6.c
index cf578bddb1b0..30a1317bf928 100644
--- a/gcc/testsuite/gcc.dg/attr-copy-6.c
+++ b/gcc/testsuite/gcc.dg/attr-copy-6.c
@@ -9,6 +9,10 @@
 #define ATTR(...)   __attribute__ ((__VA_ARGS__))
 #define ASRT(expr)   _Static_assert (expr, #expr)
 
+#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) STRING (prefix) cname
+#define STRING(x)    #x
+
 /* Variable that is local to this translation unit but that can
    be modified from other units by calling reset_unit_local().  */
 static int unit_local;
@@ -79,7 +83,7 @@ extern _Noreturn void fnoreturn (void);
 
 extern __typeof (fnoreturn)
   ATTR (visibility ("hidden"))
-  fnoreturn __asm__ ("fnoreturn_name");
+  fnoreturn __asm__ (ASMNAME ("fnoreturn_name"));
 
 void fnoreturn (void)
 {
-- 
2.30.2


                 reply	other threads:[~2023-03-02  1:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230302012003.6A0D52040C@pchp3.se.axis.com \
    --to=hp@axis.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).