public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: David Macek <david.macek.0@gmail.com>
To: cygwin-patches@cygwin.com, newlib@sourceware.org
Subject: [PATCH] Rename __in and __out in headers to avoid collision with Windows APIs
Date: Fri, 07 Jul 2017 08:47:00 -0000	[thread overview]
Message-ID: <20170707104702.00003877@gmail.com> (raw)
In-Reply-To: <20170707002450.00007720@gmail.com>

* string.h: Local variables in expansion of strdupa and strndupa
* sys/wait.h: Fields in anonymous union in expansion of __wait_status_to_int
---
Reposting to the newlib ML.

There should be no API nor ABI changes, as the changed names are private to the macros.

The new "s" in string.h comes from the __s parameter. The new "s" in wait.h comes from "status".  I'm not sure what the naming conventions are, so I'm open to corrections.

 newlib/libc/include/string.h     | 18 +++++++++---------
 winsup/cygwin/include/sys/wait.h |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 29e0d44766..7833aa1561 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -141,16 +141,16 @@ int	 _EXFUN(strverscmp,(const char *, const char *));
 
 #if __GNU_VISIBLE && defined(__GNUC__)
 #define strdupa(__s) \
-	(__extension__ ({const char *__in = (__s); \
-			 size_t __len = strlen (__in) + 1; \
-			 char * __out = (char *) __builtin_alloca (__len); \
-			 (char *) memcpy (__out, __in, __len);}))
+	(__extension__ ({const char *__sin = (__s); \
+			 size_t __len = strlen (__sin) + 1; \
+			 char * __sout = (char *) __builtin_alloca (__len); \
+			 (char *) memcpy (__sout, __sin, __len);}))
 #define strndupa(__s, __n) \
-	(__extension__ ({const char *__in = (__s); \
-			 size_t __len = strnlen (__in, (__n)) + 1; \
-			 char *__out = (char *) __builtin_alloca (__len); \
-			 __out[__len-1] = '\0'; \
-			 (char *) memcpy (__out, __in, __len-1);}))
+	(__extension__ ({const char *__sin = (__s); \
+			 size_t __len = strnlen (__sin, (__n)) + 1; \
+			 char *__sout = (char *) __builtin_alloca (__len); \
+			 __sout[__len-1] = '\0'; \
+			 (char *) memcpy (__sout, __sin, __len-1);}))
 #endif /* __GNU_VISIBLE && __GNUC__ */
 
 /* There are two common basename variants.  If you do NOT #include <libgen.h>
diff --git a/winsup/cygwin/include/sys/wait.h b/winsup/cygwin/include/sys/wait.h
index 69e1b9d9bf..dc89458437 100644
--- a/winsup/cygwin/include/sys/wait.h
+++ b/winsup/cygwin/include/sys/wait.h
@@ -88,7 +88,7 @@ inline int __wait_status_to_int (const union wait & __status)
 #else /* !__cplusplus */
 
 #define __wait_status_to_int(__status)  (__extension__ \
-  (((union { __typeof(__status) __in; int __out; }) { .__in = (__status) }).__out))
+  (((union { __typeof(__status) __sin; int __sout; }) { .__sin = (__status) }).__sout))
 
 #endif /* __cplusplus */
 
-- 
2.13.2.windows.1

--
David Macek

       reply	other threads:[~2017-07-07  8:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170707002450.00007720@gmail.com>
2017-07-07  8:47 ` David Macek [this message]
2017-07-07 14:46   ` Corinna Vinschen

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=20170707104702.00003877@gmail.com \
    --to=david.macek.0@gmail.com \
    --cc=cygwin-patches@cygwin.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).