Home | History | Annotate | Download | only in patches.android
      1 From 848c37e08f93ea14fbc430d5e85517da8a6589ac Mon Sep 17 00:00:00 2001
      2 From: Andrew Hsieh <andrewhsieh (a] google.com>
      3 Date: Sun, 27 Apr 2014 22:22:32 -0700
      4 Subject: [PATCH 08/12] Remove gcc warning about redefinition of putchar with
      5  different visibility
      6 
      7 In NDK bionic's stdio.h, putchar appears as both a function prototype and a macro
      8 (later in the same header).  Because it's defined as a macro, libc++ replaces
      9 it with a function but with *different* visibility.  GCC 4.x complains [-Wattributes]
     10 
     11    include/stdio.h:236:5: warning: conflicts with previous declaration here [-Wattributes]
     12    int  putchar(int);
     13 
     14 Undefine putchar to avoid redefinition, and putchar does exist in libc.so
     15 ---
     16  include/cstdio | 13 +++++++++++++
     17  1 file changed, 13 insertions(+)
     18 
     19 diff --git a/include/cstdio b/include/cstdio
     20 index 7787fad..8f2a7b0 100644
     21 --- a/include/cstdio
     22 +++ b/include/cstdio
     23 @@ -126,6 +126,19 @@ inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {ret
     24  inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
     25  #endif  // putc
     26  
     27 +#ifdef __ANDROID__
     28 +// In bionic's stdio.h, putchar appears as both a function prototype and a macro (later
     29 +// in the same header).  Because it's defined as a macro, the following code snippet replaces
     30 +// it with a function but with *different* visibility.  GCC 4.x complains [-Wattributes]
     31 +//
     32 +//   include/stdio.h:236:5: warning: conflicts with previous declaration here [-Wattributes]
     33 +//     int  putchar(int);
     34 +//
     35 +// Undefine putchar to avoid redefinition, and putchar does exist in libc.so
     36 +//
     37 +#undef putchar
     38 +#endif
     39 +
     40  #ifdef putchar
     41  inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putchar(int __c) {return putchar(__c);}
     42  #undef putchar
     43 -- 
     44 1.9.1.423.g4596e3a
     45 
     46