bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #61794] mingw: fix bug where libintl_swprintf() is not defined, but


From: Johannes Schindelin
Subject: [bug #61794] mingw: fix bug where libintl_swprintf() is not defined, but declared
Date: Tue, 11 Jan 2022 05:39:08 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0

URL:
  <https://savannah.gnu.org/bugs/?61794>

                 Summary: mingw: fix bug where libintl_swprintf() is not
defined, but declared
                 Project: GNU gettext
            Submitted by: dscho
            Submitted on: Tue 11 Jan 2022 10:39:06 AM UTC
                Category: Build
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I just provided a fix for a gettext bug to the MSYS2 project, but the fix
actually applies to gettext directly. Here is the patch, with an extensive
commit message to explain the problem and its resolution:

>From b7b09177379f2ee8a56bcd9c98635d4f513d9807 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Mon, 10 Jan 2022 23:18:34 +0100
Subject: [PATCH] printf.c: guard the *wprintf() functions by the correct
constant

In dcaf8c4d7 (Cygwin portability., 2003-09-17), the *wprintf() family of
functions in `gettext-runtime/intl/printf.c` were no longer guarded by
the constant `HAVE_WPRINTF`, but instead by `HAVE_FWPRINTF`.

This apparently worked even if the corresponding part in
`gettext-runtime/intl/libgnuintl.h.in` uses `HAVE_WPRINTF` to guard the
_declarations_ of those functions.

However, in d84f20745 (Make sure that libintl.h declares the *wprintf
overrides on Windows., 2019-04-08), gettext introduced a change where it
would look for `wprintf()` instead of `fwprintf()`. As a consequence it
would no longer define the `HAVE_FWPRINTF` constant at all.

GCC apparently interprets `#if HAVE_FWPRINTF` as `#if 0` if the constant
has not even been defined.

This leads to the funny situation that previously, the *wprintf()
functions would be defined, but not be declared. Whereas now the
functions are not defined, but declared.

Also funny: Cygwin did not even export the `fwprintf()` function until
2009, as per Cygwin's 45e20e47ba (cygwin.din: Export wprintf,
fwprintf, swprintf, vwprintf, vfwprintf, vswprintf. [...] , 2009-03-06),
while the `wprintf()` function was exported already in 2003. So the
Cygwin portability patch from 2003 seems to have turned off _all_ of the
*wprintf() functions in gettext.

Let's revert that "portability" patch, as it now only does harm and has
no benefit anymore.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 gettext-runtime/intl/printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gettext-runtime/intl/printf.c b/gettext-runtime/intl/printf.c
index d327c5ebc..651b3aba0 100644
--- a/gettext-runtime/intl/printf.c
+++ b/gettext-runtime/intl/printf.c
@@ -310,7 +310,7 @@ libintl_asprintf (char **resultp, const char *format,
...)
 
 #endif
 
-#if HAVE_FWPRINTF
+#if HAVE_WPRINTF
 
 #include <wchar.h>
 
-- 
2.34.1.windows.1






    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61794>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]