correct sparcv9 defines
PATCH 1/1 correct sparcv9 defines
From: Toomas Soome <[email protected]>
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(-)
lib.c +8 -5
@@ -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 ) {
machine.h +1 -1
@@ -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
Signature · 1 line
2.23.0
Quoted 4 lines · On Mon, Jan 20, 2020 at 02:38:24AM -0800, [email protected] wrote:
From: Toomas Soome <[email protected]>
The SPARCV9 compile check needs to look for
__sparcv9on 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.
lib.c static void predefined_macros(void) · line 1601
Quoted 4 lines
lib.c +1
-0case 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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 24 lines · Toomas Soome
Quoted 6 lines · Luc Van Oostenryck
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.OK by me:)
Quoted 13 lines
lib.c static void predefined_macros(void) · line 1601
Quoted 5 lines
case MACH_SPARC32: predefine("__sparc__", 1, "1"); predefine("__sparc", 1, "1");lib.c +1
-0+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, ...)).
Quoted 1 line
The problem is that gcc does define those symbols and the code is using them, hence smatch should behave the same:
OK, fine for me if the symbol is effectively used.
This patch and John's are applied and pushed with some adaptations for a related pending branch I merged first.
Thanks,
-- Luc