public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Provide __intmax_t and __uintmax_t
@ 2016-10-25 15:05 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2016-10-25 15:05 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b1f321538097ee4fac334acf7794d502d6d371fa
commit b1f321538097ee4fac334acf7794d502d6d371fa
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Tue Oct 25 07:13:49 2016 +0200
Provide __intmax_t and __uintmax_t
Provide __intmax_t and __uintmax_t via <machine/_default_types.h> and
define intmax_t and uintmax_t in <sys/_stdint.h> for FreeBSD
compatibility.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Diff:
---
newlib/libc/include/machine/_default_types.h | 30 ++++++++++++++++++++++++++++
newlib/libc/include/stdint.h | 19 ------------------
newlib/libc/include/sys/_intsup.h | 14 -------------
newlib/libc/include/sys/_stdint.h | 10 ++++++++++
4 files changed, 40 insertions(+), 33 deletions(-)
diff --git a/newlib/libc/include/machine/_default_types.h b/newlib/libc/include/machine/_default_types.h
index ffc646d..6137493 100644
--- a/newlib/libc/include/machine/_default_types.h
+++ b/newlib/libc/include/machine/_default_types.h
@@ -19,6 +19,20 @@
#include <limits.h>
#endif
+/* Check if "long long" is 64bit wide */
+/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */
+#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \
+ || ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
+#define __have_longlong64 1
+#endif
+
+/* Check if "long" is 64bit or 32bit wide */
+#if __EXP(LONG_MAX) > 0x7fffffff
+#define __have_long64 1
+#elif __EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
+#define __have_long32 1
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -196,6 +210,22 @@ typedef __uint64_t __uint_least64_t;
#define ___int_least64_t_defined 1
#endif
+#if defined(__INTMAX_TYPE__)
+typedef __INTMAX_TYPE__ __intmax_t;
+#elif __have_longlong64
+typedef signed long long __intmax_t;
+#else
+typedef signed long __intmax_t;
+#endif
+
+#if defined(__UINTMAX_TYPE__)
+typedef __UINTMAX_TYPE__ __uintmax_t;
+#elif __have_longlong64
+typedef unsigned long long __uintmax_t;
+#else
+typedef unsigned long __uintmax_t;
+#endif
+
#ifdef __INTPTR_TYPE__
typedef __INTPTR_TYPE__ __intptr_t;
#ifdef __UINTPTR_TYPE__
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h
index bd65cd0..4abdacb 100644
--- a/newlib/libc/include/stdint.h
+++ b/newlib/libc/include/stdint.h
@@ -124,25 +124,6 @@ typedef __uint_least64_t uint_least64_t;
#endif
#endif
-/* Greatest-width integer types */
-/* Modern GCCs provide __INTMAX_TYPE__ */
-#if defined(__INTMAX_TYPE__)
- typedef __INTMAX_TYPE__ intmax_t;
-#elif __have_longlong64
- typedef signed long long intmax_t;
-#else
- typedef signed long intmax_t;
-#endif
-
-/* Modern GCCs provide __UINTMAX_TYPE__ */
-#if defined(__UINTMAX_TYPE__)
- typedef __UINTMAX_TYPE__ uintmax_t;
-#elif __have_longlong64
- typedef unsigned long long uintmax_t;
-#else
- typedef unsigned long uintmax_t;
-#endif
-
#ifdef __INTPTR_TYPE__
#define INTPTR_MIN (-__INTPTR_MAX__ - 1)
#define INTPTR_MAX (__INTPTR_MAX__)
diff --git a/newlib/libc/include/sys/_intsup.h b/newlib/libc/include/sys/_intsup.h
index b979d5c..88d7400 100644
--- a/newlib/libc/include/sys/_intsup.h
+++ b/newlib/libc/include/sys/_intsup.h
@@ -19,20 +19,6 @@
#include <limits.h>
#endif
-/* Check if "long long" is 64bit wide */
-/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */
-#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \
- || ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
-#define __have_longlong64 1
-#endif
-
-/* Check if "long" is 64bit or 32bit wide */
-#if __STDINT_EXP(LONG_MAX) > 0x7fffffff
-#define __have_long64 1
-#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
-#define __have_long32 1
-#endif
-
/* Determine how intptr_t and intN_t fastN_t and leastN_t are defined by gcc
for this target. This is used to determine the correct printf() constant in
inttypes.h and other constants in stdint.h.
diff --git a/newlib/libc/include/sys/_stdint.h b/newlib/libc/include/sys/_stdint.h
index 93746b8..21a14d3 100644
--- a/newlib/libc/include/sys/_stdint.h
+++ b/newlib/libc/include/sys/_stdint.h
@@ -63,6 +63,16 @@ typedef __uint64_t uint64_t ;
#define __int64_t_defined 1
#endif /* ___int64_t_defined */
+#ifndef _INTMAX_T_DECLARED
+typedef __intmax_t intmax_t;
+#define _INTMAX_T_DECLARED
+#endif
+
+#ifndef _UINTMAX_T_DECLARED
+typedef __uintmax_t uintmax_t;
+#define _UINTMAX_T_DECLARED
+#endif
+
#ifndef _INTPTR_T_DECLARED
typedef __intptr_t intptr_t;
#define _INTPTR_T_DECLARED
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-10-25 15:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 15:05 [newlib-cygwin] Provide __intmax_t and __uintmax_t Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).