summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-01-05 20:37:51 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-01-05 20:37:51 +0000
commitd4f2818f0e08aed7ba626622e4fc01a27830cf8a (patch)
treefd9e6c73069447bcad4b4f296f458b72601f2b46
parentace26a24013809681583aaf897bb172458069528 (diff)
C99 says that both <wchar.h> and <stdint.h> should define WCHAR_MIN/MAX.
ok beck@, guenther@, millert@, miod@
-rw-r--r--include/wchar.h11
-rw-r--r--sys/sys/stdint.h6
2 files changed, 14 insertions, 3 deletions
diff --git a/include/wchar.h b/include/wchar.h
index a631fb0bd68..91b75336ed7 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wchar.h,v 1.21 2011/10/16 13:22:06 stsp Exp $ */
+/* $OpenBSD: wchar.h,v 1.22 2012/01/05 20:37:50 kettenis Exp $ */
/* $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $ */
/*-
@@ -94,10 +94,17 @@ typedef __wint_t wint_t;
typedef __size_t size_t;
#endif
-#ifndef WEOF
+#ifndef WEOF
#define WEOF ((wint_t)-1)
#endif
+#ifndef WCHAR_MIN
+#define WCHAR_MIN (-0x7fffffff - 1)
+#endif
+#ifndef WCHAR_MAX
+#define WCHAR_MAX 0x7fffffff
+#endif
+
__BEGIN_DECLS
wint_t btowc(int);
size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
diff --git a/sys/sys/stdint.h b/sys/sys/stdint.h
index 2e824add9ec..683d58e0246 100644
--- a/sys/sys/stdint.h
+++ b/sys/sys/stdint.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdint.h,v 1.6 2012/01/04 19:03:08 kettenis Exp $ */
+/* $OpenBSD: stdint.h,v 1.7 2012/01/05 20:37:50 kettenis Exp $ */
/*
* Copyright (c) 1997, 2005 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -189,8 +189,12 @@ typedef __uintmax_t uintmax_t;
#endif
/* Limits of wchar_t */
+#ifndef WCHAR_MIN
#define WCHAR_MIN INT32_MIN
+#endif
+#ifndef WCHAR_MAX
#define WCHAR_MAX INT32_MAX
+#endif
/* Limits of wint_t */
#define WINT_MIN INT32_MIN