eliminate bits/wchar.h
authorRich Felker <dalias@aerifal.cx>
Thu, 4 Apr 2013 23:57:23 +0000 (19:57 -0400)
committerRich Felker <dalias@aerifal.cx>
Thu, 4 Apr 2013 23:57:23 +0000 (19:57 -0400)
the preprocessor can reliably determine the signedness of wchar_t.
L'\0' is used for 0 in the expressions so that, if the underlying type
of wchar_t is long rather than int, the promoted type of the
expression will match the type of wchar_t.

arch/arm/bits/wchar.h [deleted file]
arch/i386/bits/wchar.h [deleted file]
arch/microblaze/bits/wchar.h [deleted file]
arch/mips/bits/wchar.h [deleted file]
arch/powerpc/bits/wchar.h [deleted file]
arch/x86_64/bits/wchar.h [deleted file]
include/stdint.h
include/wchar.h

diff --git a/arch/arm/bits/wchar.h b/arch/arm/bits/wchar.h
deleted file mode 100644 (file)
index ffb2691..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WCHAR_MIN
-#define WCHAR_MIN 0U
-#define WCHAR_MAX 0xffffffffU
-#endif
diff --git a/arch/i386/bits/wchar.h b/arch/i386/bits/wchar.h
deleted file mode 100644 (file)
index c969c5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WCHAR_MIN
-#define WCHAR_MIN (-1-0x7fffffff)
-#define WCHAR_MAX (0x7fffffff)
-#endif
diff --git a/arch/microblaze/bits/wchar.h b/arch/microblaze/bits/wchar.h
deleted file mode 100644 (file)
index c969c5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WCHAR_MIN
-#define WCHAR_MIN (-1-0x7fffffff)
-#define WCHAR_MAX (0x7fffffff)
-#endif
diff --git a/arch/mips/bits/wchar.h b/arch/mips/bits/wchar.h
deleted file mode 100644 (file)
index ffb2691..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WCHAR_MIN
-#define WCHAR_MIN 0U
-#define WCHAR_MAX 0xffffffffU
-#endif
diff --git a/arch/powerpc/bits/wchar.h b/arch/powerpc/bits/wchar.h
deleted file mode 100644 (file)
index c969c5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WCHAR_MIN
-#define WCHAR_MIN (-1-0x7fffffff)
-#define WCHAR_MAX (0x7fffffff)
-#endif
diff --git a/arch/x86_64/bits/wchar.h b/arch/x86_64/bits/wchar.h
deleted file mode 100644 (file)
index c969c5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WCHAR_MIN
-#define WCHAR_MIN (-1-0x7fffffff)
-#define WCHAR_MAX (0x7fffffff)
-#endif
index 7ca9d76bcf92f72d2694a9e49d49ec830a7d9b66..486d1ac2f75120df2726eb9e2d73c88bcc77d4a6 100644 (file)
@@ -78,7 +78,14 @@ typedef unsigned long long uintmax_t;
 #define WINT_MIN INT32_MIN
 #define WINT_MAX INT32_MAX
 
-#include <bits/wchar.h>
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
 #include <bits/stdint.h>
 
 #endif
index 9ceddd57550fc60c386cd3f68c438f4271256fd6..d8738818c77ffe1e0672ffe9bf49535e63bae06a 100644 (file)
@@ -24,7 +24,13 @@ extern "C" {
 
 #include <bits/alltypes.h>
 
-#include <bits/wchar.h>
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
 
 #define NULL 0L