public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: rename __sFILE to __sFILE64 for backward compatibility
Date: Thu,  8 Dec 2022 13:17:50 +0000 (GMT)	[thread overview]
Message-ID: <20221208131750.7B85E388A76A@sourceware.org> (raw)

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

commit 0f376ae22036bac2fbc7863264909b599e42616c
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Thu Dec 8 13:58:37 2022 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Thu Dec 8 13:58:37 2022 +0100

    Cygwin: rename __sFILE to __sFILE64 for backward compatibility
    
    Until Cygwin 3.3.6, we define __LARGE64_FILES unconditionally, so we
    were using the type __sFILE64 even for 64 bit.  That was lazy and wrong.
    so commit 2902b3a09e0a ("Cygwin: drop requirement to build newlib's
    stdio64") tried to fix that.
    
    Unfortunately this patch forgot to take the exposure of the typename
    __sFILE64 in userspace into account.  This leads to trouble in C++ due
    to name mangling.
    
    Fix this by redefining __sFILE to __sFILE64.  The type name is very much
    internal, so it doesn't really matter, except for the fact that it needs
    to stay backward compatible so as not to break building against C++ libs
    built under older versions of Cygwin.
    
    Fixes: 2902b3a09e0a ("Cygwin: drop requirement to build newlib's stdio64")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/include/cygwin/config.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
index 2a708327890b..c9c3565c63a3 100644
--- a/winsup/cygwin/include/cygwin/config.h
+++ b/winsup/cygwin/include/cygwin/config.h
@@ -49,6 +49,12 @@ extern inline struct _reent *__getreent (void)
 
 #define __FILENAME_MAX__ 4096	/* Keep in sync with PATH_MAX in limits.h. */
 
+/* Unfortunately we defined __LARGE64_FILES until Cygwin 3.3.6, so
+   FILE was based on `struct __sFILE64'.  The name is exposed into
+   userspace and consequentially used in C++ name mangling.  We must
+   redefine __sFILE as __sFILE64 to stay backward compatible. */
+#define __sFILE	__sFILE64
+
 /* The following block of macros is required to build newlib correctly for
    Cygwin.  Changing them in applications has no or not the desired effect.
    Just leave them alone. */

                 reply	other threads:[~2022-12-08 13:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221208131750.7B85E388A76A@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@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).