This is the mail archive of the
newlib-cvs@sourceware.org
mailing list for the newlib project.
[newlib-cygwin] stdio.h: Don't define unlocked macros using static inline on C++
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: newlib-cvs at sourceware dot org
- Date: 4 Sep 2017 08:54:10 -0000
- Subject: [newlib-cygwin] stdio.h: Don't define unlocked macros using static inline on C++
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e18b7ffa4893aa1011bae52e6e7a8f1bfcc336d5
commit e18b7ffa4893aa1011bae52e6e7a8f1bfcc336d5
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Mon Sep 4 10:52:33 2017 +0200
stdio.h: Don't define unlocked macros using static inline on C++
In C++, the usage of static inline functions for getchar_unlocked and
putchar_unlocked may result in error messages like
error: â??_putchar_unlockedâ?? was not declared in this scope
Fix this by not using the _getchar_unlocked and _putchar_unlocked
macros in C++.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
newlib/libc/include/stdio.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 331a1cf..ee0f612 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -762,12 +762,12 @@ _putchar_unlocked(int _c)
#define getchar() _getchar_unlocked()
#define putchar(_c) _putchar_unlocked(_c)
#endif /* __SINGLE_THREAD__ */
-#endif /* __cplusplus */
#if __MISC_VISIBLE || __POSIX_VISIBLE
#define getchar_unlocked() _getchar_unlocked()
#define putchar_unlocked(_c) _putchar_unlocked(_c)
#endif
+#endif /* __cplusplus */
#if __MISC_VISIBLE
/* fast always-buffered version, true iff error */