public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] stdio.h: guard function macros with !__cplusplus
@ 2017-06-14 15:18 Yaakov Selkowitz
  0 siblings, 0 replies; only message in thread
From: Yaakov Selkowitz @ 2017-06-14 15:18 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c347bb64697a380b749ff073dfa25e35c73c19e7

commit c347bb64697a380b749ff073dfa25e35c73c19e7
Author: Yaakov Selkowitz <yselkowi@redhat.com>
Date:   Tue Jun 13 14:51:18 2017 -0500

    stdio.h: guard function macros with !__cplusplus
    
    While POSIX allows these functions to also be defined as macros in C, in
    C++ this is not allowed, and prevents these names (particularly feof) from
    being used in a custom namespace.
    
    Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

Diff:
---
 newlib/libc/include/stdio.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 097b0f6..1c32423 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -718,6 +718,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
 #define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
 #define	__sfileno(p)	((p)->_file)
 
+#ifndef __cplusplus
 #ifndef _REENT_SMALL
 #define	feof(p)		__sfeof(p)
 #define	ferror(p)	__sferror(p)
@@ -740,6 +741,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
 #define putc(x, fp)	__sputc_r(_REENT, x, fp)
 #endif /* lint */
 #endif /* __CYGWIN__ */
+#endif /* __cplusplus */
 
 #if __MISC_VISIBLE
 /* fast always-buffered version, true iff error */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-14 15:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-14 15:18 [newlib-cygwin] stdio.h: guard function macros with !__cplusplus Yaakov Selkowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).