about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-20 21:10:06 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-20 21:10:06 -0400
commit80949ccdc6656c51292b4260b6e8d7b493ca6c45 (patch)
tree1053c415cafe8c21023902bb5a0c0e2952d344dd
parent58bf74850f5f7286dc290aa22ad982f50620a1c8 (diff)
downloadmusl-80949ccdc6656c51292b4260b6e8d7b493ca6c45.tar.gz
musl-80949ccdc6656c51292b4260b6e8d7b493ca6c45.tar.xz
musl-80949ccdc6656c51292b4260b6e8d7b493ca6c45.zip
limits.h: support gcc's -funsigned-char
some software apparently uses this and breaks with musl due to
mismatching definitions...
-rw-r--r--include/limits.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/limits.h b/include/limits.h
index 56f7a12f..25773ee4 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -5,14 +5,22 @@
 
 #include <bits/limits.h>
 
+/* Support signed or unsigned plain-char */
+
+#ifdef __CHAR_UNSIGNED__
+#define CHAR_MIN 0
+#define CHAR_MAX 255
+#else
+#define CHAR_MIN (-128)
+#define CHAR_MAX 127
+#endif
+
 /* Some universal constants... */
 
 #define CHAR_BIT 8
 #define SCHAR_MIN (-128)
 #define SCHAR_MAX 127
 #define UCHAR_MAX 255
-#define CHAR_MIN (-128)
-#define CHAR_MAX 127
 #define SHRT_MIN  (-1-0x7fff)
 #define SHRT_MAX  0x7fff
 #define USHRT_MAX 0xffff