Index: i/include/_bits/WCHAR_MAX.h
===================================================================
--- abi/include/_bits/WCHAR_MAX.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_WCHAR_MAX_H_
-#define _BITS_WCHAR_MAX_H_
-
-#include <_bits/macros.h>
-
-#define WCHAR_MAX  __WCHAR_MAX__
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/WCHAR_MIN.h
===================================================================
--- abi/include/_bits/WCHAR_MIN.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_WCHAR_MIN_H_
-#define _BITS_WCHAR_MIN_H_
-
-#include <_bits/macros.h>
-
-#define WCHAR_MIN  __WCHAR_MIN__
-
-#endif
-
-/** @}
- */
Index: abi/include/_bits/WEOF.h
===================================================================
--- abi/include/_bits/WEOF.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ abi/include/_bits/WEOF.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -41,7 +41,7 @@
 #define _BITS_WEOF_H_
 
-#include <_bits/macros.h>
+/* wint_t is always int */
 
-#define WEOF  __WINT_EOF__
+#define WEOF  (-1)
 
 #endif
Index: abi/include/_bits/native.h
===================================================================
--- abi/include/_bits/native.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ abi/include/_bits/native.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -46,17 +46,14 @@
 #define _BITS_NATIVE_H_
 
-#include <_bits/macros.h>
+#include <inttypes.h>
 
-#define ATOMIC_COUNT_MIN  __UINTPTR_MIN__
-#define ATOMIC_COUNT_MAX  __UINTPTR_MAX__
+typedef uintptr_t pfn_t;
+typedef uintptr_t ipl_t;
+typedef uintptr_t sysarg_t;
+typedef intptr_t  native_t;
 
-typedef __UINTPTR_TYPE__ pfn_t;
-typedef __UINTPTR_TYPE__ ipl_t;
-typedef __UINTPTR_TYPE__ sysarg_t;
-typedef __INTPTR_TYPE__  native_t;
-
-#define PRIdn  __PRIdPTR__  /**< Format for native_t. */
-#define PRIun  __PRIuPTR__  /**< Format for sysarg_t. */
-#define PRIxn  __PRIxPTR__  /**< Format for hexadecimal sysarg_t. */
+#define PRIdn  PRIdPTR  /**< Format for native_t. */
+#define PRIun  PRIuPTR  /**< Format for sysarg_t. */
+#define PRIxn  PRIxPTR  /**< Format for hexadecimal sysarg_t. */
 
 #endif
Index: abi/include/_bits/ptrdiff_t.h
===================================================================
--- abi/include/_bits/ptrdiff_t.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ abi/include/_bits/ptrdiff_t.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -41,7 +41,6 @@
 #define _BITS_PTRDIFF_T_H_
 
-#include <_bits/macros.h>
-
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
+#define __need_ptrdiff_t
+#include <stddef.h>
 
 #endif
Index: abi/include/_bits/size_t.h
===================================================================
--- abi/include/_bits/size_t.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ abi/include/_bits/size_t.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -41,7 +41,6 @@
 #define _BITS_SIZE_T_H_
 
-#include <_bits/macros.h>
-
-typedef __SIZE_TYPE__ size_t;
+#define __need_size_t
+#include <stddef.h>
 
 #endif
Index: abi/include/_bits/ssize_t.h
===================================================================
--- abi/include/_bits/ssize_t.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ abi/include/_bits/ssize_t.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -41,10 +41,10 @@
 #define _BITS_SSIZE_T_H_
 
-#include <_bits/macros.h>
+#include <stdint.h>
 
-typedef __PTRDIFF_TYPE__ ssize_t;
+typedef intptr_t ssize_t;
 
-#define SSIZE_MIN  __PTRDIFF_MIN__
-#define SSIZE_MAX  __PTRDIFF_MAX__
+#define SSIZE_MIN  INTPTR_MIN
+#define SSIZE_MAX  INTPTR_MAX
 
 #endif
Index: abi/include/_bits/stdint.h
===================================================================
--- abi/include/_bits/stdint.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ abi/include/_bits/stdint.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -180,6 +180,5 @@
 #define WINT_MAX  __WINT_MAX__
 
-#include <_bits/WCHAR_MIN.h>
-#include <_bits/WCHAR_MAX.h>
+#include <_bits/wchar_limits.h>
 
 /* Use nonstandard 128-bit types if they are supported by the compiler. */
Index: abi/include/_bits/wchar_limits.h
===================================================================
--- abi/include/_bits/wchar_limits.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
+++ abi/include/_bits/wchar_limits.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_WCHAR_MIN_H_
+#define _BITS_WCHAR_MIN_H_
+
+/* wchar_t should always be signed int in HelenOS. */
+
+#include <_bits/wchar_t.h>
+
+#ifndef __cplusplus
+_Static_assert(((wchar_t)-1) < 0, "wchar_t is not int");
+_Static_assert(sizeof(wchar_t) == 4, "wchar_t is not int");
+#endif
+
+#ifndef WCHAR_MAX
+#define WCHAR_MAX  0x7fffffff
+#endif
+#ifndef WCHAR_MIN
+#define WCHAR_MIN  (-WCHAR_MIN - 1)
+#endif
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/wchar_t.h
===================================================================
--- abi/include/_bits/wchar_t.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ abi/include/_bits/wchar_t.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -41,9 +41,6 @@
 #define _BITS_WCHAR_T_H_
 
-#include <_bits/macros.h>
-
-#ifndef __cplusplus
-typedef __WCHAR_TYPE__ wchar_t;
-#endif
+#define __need_wchar_t
+#include <stddef.h>
 
 #endif
Index: abi/include/_bits/wint_t.h
===================================================================
--- abi/include/_bits/wint_t.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ abi/include/_bits/wint_t.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -41,7 +41,6 @@
 #define _BITS_WINT_T_H_
 
-#include <_bits/macros.h>
-
-typedef __WINT_TYPE__ wint_t;
+#define __need_wint_t
+#include <stddef.h>
 
 #endif
Index: abi/include/inttypes.h
===================================================================
--- abi/include/inttypes.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
+++ abi/include/inttypes.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_INTTYPES_H_
+#define LIBC_INTTYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <_bits/inttypes.h>
+
+#ifndef __HELENOS_DISABLE_INTMAX__
+intmax_t imaxabs(intmax_t);
+imaxdiv_t imaxdiv(intmax_t, intmax_t);
+intmax_t strtoimax(const char *__restrict__ nptr,
+    char **__restrict__ endptr, int base);
+uintmax_t strtoumax(const char *__restrict__ nptr,
+    char **__restrict__ endptr, int base);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/** @}
+ */
Index: pace/lib/c/include/inttypes.h
===================================================================
--- uspace/lib/c/include/inttypes.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_INTTYPES_H_
-#define LIBC_INTTYPES_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <_bits/inttypes.h>
-
-#ifndef __HELENOS_DISABLE_INTMAX__
-intmax_t imaxabs(intmax_t);
-imaxdiv_t imaxdiv(intmax_t, intmax_t);
-intmax_t strtoimax(const char *__restrict__ nptr,
-    char **__restrict__ endptr, int base);
-uintmax_t strtoumax(const char *__restrict__ nptr,
-    char **__restrict__ endptr, int base);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/wchar.h
===================================================================
--- uspace/lib/c/include/wchar.h	(revision 10d65d70906a865fb116576edc88e47ab61a5fb4)
+++ uspace/lib/c/include/wchar.h	(revision 99170e0c792be530b42ffa128310bac51739233c)
@@ -43,10 +43,7 @@
 #include <_bits/size_t.h>
 #include <_bits/wchar_t.h>
+#include <_bits/wchar_limits.h>
 #include <_bits/wint_t.h>
-#include <_bits/WEOF.h>
-
 #include <_bits/NULL.h>
-#include <_bits/WCHAR_MIN.h>
-#include <_bits/WCHAR_MAX.h>
 #include <_bits/WEOF.h>
 
