* [PATCH] correct sparcv9 defines
@ 2020-01-20 10:38 john.levon
2020-01-21 0:13 ` Luc Van Oostenryck
0 siblings, 1 reply; 3+ messages in thread
From: john.levon @ 2020-01-20 10:38 UTC (permalink / raw)
To: linux-sparse; +Cc: Toomas Soome
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] correct sparcv9 defines
2020-01-20 10:38 [PATCH] correct sparcv9 defines john.levon
@ 2020-01-21 0:13 ` Luc Van Oostenryck
[not found] ` <BFD5AC88-E262-4579-BBD4-3C2BBBEAEBF9@me.com>
0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-01-21 0:13 UTC (permalink / raw)
To: john.levon; +Cc: linux-sparse, Toomas Soome
On Mon, Jan 20, 2020 at 02:38:24AM -0800, john.levon@joyent.com wrote:
> From: Toomas Soome <tsoome@me.com>
>
> The SPARCV9 compile check needs to look for __sparcv9 on some systems,
> and should also define "sparc".
Hi.
Thanks for the patch.
Is it possible to have Toomas' Signed-off-by for this patch?
No need to resend the patch, just a reply to this email
saying it's OK is enough.
> case MACH_SPARC32:
> predefine("__sparc__", 1, "1");
> predefine("__sparc", 1, "1");
> + predefine("sparc", 1, "1");
I'm wondering if there is a real need for this one or if
it's just to reflect what GCC do? I'm a bit reluctant to
add it since it lies in the user's namespace. But I'm fine
to add it if there is a real use case for it (in which case
I'll just slightly change the patch to not predefine it if
one of the ISO dialect is selected (via --std=c99, ...)).
-- Luc
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-22 22:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-20 10:38 [PATCH] correct sparcv9 defines john.levon
2020-01-21 0:13 ` Luc Van Oostenryck
[not found] ` <BFD5AC88-E262-4579-BBD4-3C2BBBEAEBF9@me.com>
2020-01-22 22:48 ` Luc Van Oostenryck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox