Browse Source

add a wchar.h stub

The basic C standard requires a few wchar types, so provide those even when
wchar support is disabled.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Mike Frysinger 14 years ago
parent
commit
fa2ba2e3c3
2 changed files with 19 additions and 0 deletions
  1. 5 0
      Makefile.in
  2. 14 0
      include/wchar-stub.h

+ 5 - 0
Makefile.in

@@ -283,6 +283,11 @@ install_headers: headers $(top_builddir)extra/scripts/unifdef
 	echo '/* Dont use _syscall#() macros; use the syscall() function */' > \
 		$(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h
 	cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -r $(HEADERS_RM-)
+ifeq ($(UCLIBC_HAS_WCHAR),)
+	cd $(PREFIX)$(DEVEL_PREFIX)include && mv -f wchar-stub.h wchar.h
+else
+	cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -f wchar-stub.h
+endif
 
 # Installs development library links.
 install_dev: install_headers all

+ 14 - 0
include/wchar-stub.h

@@ -0,0 +1,14 @@
+/* This wchar.h is used if wchar support is disabled in uClibc.
+ * We still want to provide a few basic definitions as the basic
+ * C standard requires them.  And it makes our lives easier with
+ * no additional overhead.
+ */
+
+#ifndef _WCHAR_H
+#define _WCHAR_H
+
+#define MB_CUR_MAX 1
+typedef unsigned int wint_t;
+#define WEOF (0xffffffffu)
+
+#endif