Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: john.levon@joyent.com
To: linux-sparse@vger.kernel.org
Cc: Toomas Soome <tsoome@me.com>
Subject: [PATCH] correct sparcv9 defines
Date: Mon, 20 Jan 2020 02:38:24 -0800	[thread overview]
Message-ID: <20200120103824.20746-1-john.levon@joyent.com> (raw)

From: Toomas Soome <tsoome@me.com>

The SPARCV9 compile check needs to look for __sparcv9 on some systems,
and should also define "sparc".
---
 lib.c     | 13 ++++++++-----
 machine.h |  2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib.c b/lib.c
index 711e8fbe..14e51979 100644
--- a/lib.c
+++ b/lib.c
@@ -1587,15 +1587,18 @@ static void predefined_macros(void)
 		predefine("__s390__", 1, "1");
 		break;
 	case MACH_SPARC64:
-		predefine("__sparc_v9__", 1, "1");
-		predefine("__sparcv9__", 1, "1");
-		predefine("__sparcv9", 1, "1");
-		predefine("__sparc64__", 1, "1");
-		predefine("__arch64__", 1, "1");
+		if (arch_m64 != ARCH_LP32) {
+			predefine("__sparc_v9__", 1, "1");
+			predefine("__sparcv9__", 1, "1");
+			predefine("__sparcv9", 1, "1");
+			predefine("__sparc64__", 1, "1");
+			predefine("__arch64__", 1, "1");
+		}
 		/* fall-through */
 	case MACH_SPARC32:
 		predefine("__sparc__", 1, "1");
 		predefine("__sparc", 1, "1");
+		predefine("sparc", 1, "1");
 		break;
 	case MACH_X86_64:
 		if (arch_m64 != ARCH_LP32) {
diff --git a/machine.h b/machine.h
index 6eba448c..3389579c 100644
--- a/machine.h
+++ b/machine.h
@@ -56,7 +56,7 @@ enum machine {
 #define	MACH_NATIVE	MACH_RISCV64
 #elif defined(__riscv) && (__riscv_xlen == 32)
 #define	MACH_NATIVE	MACH_RISCV32
-#elif defined(__sparc_v9__)
+#elif defined(__sparc_v9__) || defined(__sparcv9)
 #define	MACH_NATIVE	MACH_SPARC64
 #elif defined(__sparc__) || defined(__sparc)
 #define	MACH_NATIVE	MACH_SPARC32
-- 
2.23.0

             reply	other threads:[~2020-01-20 10:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 10:38 john.levon [this message]
2020-01-21  0:13 ` [PATCH] correct sparcv9 defines Luc Van Oostenryck
     [not found]   ` <BFD5AC88-E262-4579-BBD4-3C2BBBEAEBF9@me.com>
2020-01-22 22:48     ` Luc Van Oostenryck

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=20200120103824.20746-1-john.levon@joyent.com \
    --to=john.levon@joyent.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=tsoome@me.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