From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Subject: Re: [PATCH] stdio.h: guard function macros with !__cplusplus
Date: Wed, 14 Jun 2017 08:48:00 -0000 [thread overview]
Message-ID: <20170614084842.GQ13513@calimero.vinschen.de> (raw)
In-Reply-To: <20170613200022.5056-1-yselkowi@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]
On Jun 13 15:00, Yaakov Selkowitz wrote:
> 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>
> ---
> 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 097b0f665..1c32423d3 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 */
> --
> 2.12.3
ACK to both patches.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2017-06-14 8:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-13 20:00 Yaakov Selkowitz
2017-06-13 20:01 ` [PATCH] Feature test macros overhaul: signal.h (part 3) Yaakov Selkowitz
2017-06-15 9:48 ` Thomas Preudhomme
2017-06-15 12:52 ` Thomas Preudhomme
2017-06-15 14:20 ` Thomas Preudhomme
2017-06-19 8:29 ` Thomas Preudhomme
2017-06-19 11:02 ` Corinna Vinschen
2017-06-14 8:48 ` Corinna Vinschen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170614084842.GQ13513@calimero.vinschen.de \
--to=vinschen@redhat.com \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).