Tag unavailable functions with macro.

Add an __UNAVAILABLE macro, and use it for several functions which lack
implementations, but need to have visible declarations to be reexported
in the C++ standard library.

Bug: http://b/28178111
Change-Id: Ia4ae0207bbfcb7baa61821f0ef946257b019c0db
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index d0fb0e8..2abaec3 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -163,7 +163,7 @@
 extern void setprogname(const char*);
 
 /* make STLPort happy */
-extern int      mblen(const char *, size_t);
+extern int      mblen(const char *, size_t) __UNAVAILABLE;
 extern size_t   mbstowcs(wchar_t *, const char *, size_t);
 extern int      mbtowc(wchar_t *, const char *, size_t);
 
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 2bd058e..b0e7b76 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -454,11 +454,13 @@
 #define __INTRODUCED_IN(api_level) __AVAILABILITY(introduced=api_level)
 #define __DEPRECATED_IN(api_level) __AVAILABILITY(deprecated=api_level)
 #define __REMOVED_IN(api_level) __AVAILABILITY(obsoleted=api_level)
+#define __UNAVAILABLE __attribute__((unavailable))
 #else
 #define __AVAILABILITY(...)
 #define __INTRODUCED_IN(api_level)
 #define __DEPRECATED_IN(api_level)
 #define __REMOVED_IN(api_level)
+#define __UNAVAILABLE __attribute__((__error__("unavailable")))
 #endif // __clang__
 
 #if __has_builtin(__builtin_umul_overflow) || __GNUC__ >= 5
diff --git a/libc/include/wchar.h b/libc/include/wchar.h
index fe068be..f65c988 100644
--- a/libc/include/wchar.h
+++ b/libc/include/wchar.h
@@ -169,8 +169,8 @@
 extern size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
 
 typedef void *wctrans_t;
-extern wint_t towctrans(wint_t, wctrans_t);
-extern wctrans_t wctrans(const char*);
+extern wint_t towctrans(wint_t, wctrans_t) __UNAVAILABLE;
+extern wctrans_t wctrans(const char*) __UNAVAILABLE;
 
 #if __POSIX_VISIBLE >= 200809
 FILE* open_wmemstream(wchar_t**, size_t*);