[PATCH v4 3/4] add predefine for __CHAR_UNSIGNED__

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

 



This macro is needed by <limits.h> to get, among others things,
CHAR_MAX from __SCHAR_MAX__.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 lib.c     | 4 +++-
 machine.h | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib.c b/lib.c
index 592fc414e..ed2f5e3dd 100644
--- a/lib.c
+++ b/lib.c
@@ -302,7 +302,7 @@ unsigned long fdump_ir;
 int fmem_report = 0;
 unsigned long long fmemcpy_max_count = 100000;
 unsigned long fpasses = ~0UL;
-int funsigned_char = 0;
+int funsigned_char = UNSIGNED_CHAR;
 
 int preprocess_only;
 
@@ -1236,6 +1236,8 @@ static void predefined_macros(void)
 	}
 
 	predefine("__CHAR_BIT__", 1, "%d", bits_in_char);
+	if (funsigned_char)
+		predefine("__CHAR_UNSIGNED__", 1, "1");
 
 	predefined_ctype("SHORT",     &short_ctype, PTYPE_SIZEOF);
 	predefined_ctype("SHRT",      &short_ctype, PTYPE_MAX|PTYPE_WIDTH);
diff --git a/machine.h b/machine.h
index 522f9ba08..09c1f513c 100644
--- a/machine.h
+++ b/machine.h
@@ -74,4 +74,10 @@ enum machine {
 #define MACH_NATIVE	MACH_UNKNOWN
 #endif
 
+#if defined(__CHAR_UNSIGNED__)
+#define	UNSIGNED_CHAR	1
+#else
+#define UNSIGNED_CHAR	0
+#endif
+
 #endif
-- 
2.20.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