blob: 6d77a0bb809d4b0fc4f81285c2684985f4d5d607 [file] [log] [blame]
From 848c37e08f93ea14fbc430d5e85517da8a6589ac Mon Sep 17 00:00:00 2001
From: Andrew Hsieh <andrewhsieh@google.com>
Date: Sun, 27 Apr 2014 22:22:32 -0700
Subject: [PATCH 08/12] Remove gcc warning about redefinition of putchar with
different visibility
In NDK bionic's stdio.h, putchar appears as both a function prototype and a macro
(later in the same header). Because it's defined as a macro, libc++ replaces
it with a function but with *different* visibility. GCC 4.x complains [-Wattributes]
include/stdio.h:236:5: warning: conflicts with previous declaration here [-Wattributes]
int putchar(int);
Undefine putchar to avoid redefinition, and putchar does exist in libc.so
---
include/cstdio | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/include/cstdio b/include/cstdio
index 7787fad..8f2a7b0 100644
--- a/include/cstdio
+++ b/include/cstdio
@@ -126,6 +126,19 @@ inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {ret
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
#endif // putc
+#ifdef __ANDROID__
+// In bionic's stdio.h, putchar appears as both a function prototype and a macro (later
+// in the same header). Because it's defined as a macro, the following code snippet replaces
+// it with a function but with *different* visibility. GCC 4.x complains [-Wattributes]
+//
+// include/stdio.h:236:5: warning: conflicts with previous declaration here [-Wattributes]
+// int putchar(int);
+//
+// Undefine putchar to avoid redefinition, and putchar does exist in libc.so
+//
+#undef putchar
+#endif
+
#ifdef putchar
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putchar(int __c) {return putchar(__c);}
#undef putchar
--
1.9.1.423.g4596e3a