libc: Introduce __errordecl()
Define __errordecl and replace __attribute__((__error__("foo")))
with __errordecl. Make sure __errordecl is a no-op on clang, as it
generates a compile time warning.
Change-Id: Ifa1a2d3afd6881de9d479fc2adac6737871a2949
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index c710356..78513e3 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -330,6 +330,12 @@
#define __wur
#endif
+#if __GNUC_PREREQ__(4, 3)
+#define __errordecl(name, msg) extern void name(void) __attribute__((__error__(msg)))
+#else
+#define __errordecl(name, msg) extern void name(void)
+#endif
+
/*
* Macros for manipulating "link sets". Link sets are arrays of pointers
* to objects, which are gathered up by the linker.
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 4e8beb6..da49e1a 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -134,8 +134,7 @@
extern mode_t __umask_chk(mode_t);
extern mode_t __umask_real(mode_t)
__asm__(__USER_LABEL_PREFIX__ "umask");
-extern void __umask_error()
- __attribute__((__error__("umask called with invalid mode")));
+__errordecl(__umask_error, "umask called with invalid mode");
__BIONIC_FORTIFY_INLINE
mode_t umask(mode_t mode) {