[PATCH v2 08/12] arch: add predefines for INT128 only on supported archs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The predefines for INT128 were added unconditionally for
all archs but only the 64-bit ones support them.

Fix this by issuing the the predefines only on 64-bit archs.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 lib.c                            | 13 +++++++++++--
 validation/preprocessor/predef.c |  2 ++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib.c b/lib.c
index f9e7caf4a..602960a08 100644
--- a/lib.c
+++ b/lib.c
@@ -1433,8 +1433,6 @@ static void predefined_macros(void)
 	predefined_ctype("INT64",      int64_ctype, PTYPE_MAX|PTYPE_TYPE);
 	predefined_ctype("UINT64",    uint64_ctype, PTYPE_MAX|PTYPE_TYPE);
 
-	predefined_sizeof("INT128", "", 128);
-
 	predefined_ctype("INTMAX",    intmax_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
 	predefined_ctype("UINTMAX",  uintmax_ctype, PTYPE_MAX|PTYPE_TYPE);
 	predefined_ctype("INTPTR",   ssize_t_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
@@ -1447,6 +1445,17 @@ static void predefined_macros(void)
 	predefined_sizeof("DOUBLE", "", bits_in_double);
 	predefined_sizeof("LONG_DOUBLE", "", bits_in_longdouble);
 
+	switch (arch_mach) {
+	case MACH_ARM64:
+	case MACH_MIPS64:
+	case MACH_PPC64:
+	case MACH_RISCV64:
+	case MACH_S390X:
+	case MACH_SPARC64:
+	case MACH_X86_64:
+		predefined_sizeof("INT128", "", 128);
+	}
+
 	predefine("__ORDER_LITTLE_ENDIAN__", 1, "1234");
 	predefine("__ORDER_BIG_ENDIAN__", 1, "4321");
 	predefine("__ORDER_PDP_ENDIAN__", 1, "3412");
diff --git a/validation/preprocessor/predef.c b/validation/preprocessor/predef.c
index 5678acedf..90f9fb9c8 100644
--- a/validation/preprocessor/predef.c
+++ b/validation/preprocessor/predef.c
@@ -37,7 +37,9 @@ int test(void)
 	TEST_SIZEOF(INT, int);
 	TEST_SIZEOF(LONG, long);
 	TEST_SIZEOF(LONG_LONG, long long);
+#ifdef __SIZEOF_INT128__
 	TEST_SIZEOF(INT128, __int128);
+#endif
 	TEST_SIZEOF(PTRDIFF_T, __PTRDIFF_TYPE__);
 	TEST_SIZEOF(SIZE_T, __SIZE_TYPE__);
 	TEST_SIZEOF(POINTER, void*);
-- 
2.24.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux