[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gettext] libintl.h redirection of stdio printf functions
From: |
Eli Zaretskii |
Subject: |
[bug-gettext] libintl.h redirection of stdio printf functions |
Date: |
Sat, 12 May 2018 12:04:20 +0300 |
I bumped into this problem while building and testing the latest alpha
of wget2. Some of the wget2 unit tests in unit-tests/test.c fail due
to unsupported printf specifiers, such as %hhd and %zd. To solve
this, I've rebuilt wget2 and the test suite with
"-D__USE_MINGW_ANSI_STDIO=1", but to my surprise this didn't help at
all.
It turned out the root cause was that libintl.h, included by
gettext.h, redirects the *printf functions to its own implementations,
for example:
#if !(defined sprintf && defined _GL_STDIO_H) /* don't override gnulib */
#undef sprintf
#define sprintf libintl_sprintf
extern int sprintf (char *, const char *, ...);
#endif
This interferes with MinGW-supplied replacements for sprintf etc.
Every program that includes gettext.h "gains" these redirections, and
there doesn't seem to be a way of avoiding that, except when building
Gnulib itself, unless I missed something. The only "solution" I could
see is to #undef all those definitions after including gettext.h, in
source files that don't use the _ macro, but that sounds fragile, and
doesn't work when both _() and C99 printf format specifiers are used.
What is the recommended solution for this issue?
- [bug-gettext] libintl.h redirection of stdio printf functions,
Eli Zaretskii <=
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Bruno Haible, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Eli Zaretskii, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Bruno Haible, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Eli Zaretskii, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Bruno Haible, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Eli Zaretskii, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Bruno Haible, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Eli Zaretskii, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Bruno Haible, 2018/05/12
- Re: [bug-gettext] libintl.h redirection of stdio printf functions, Eli Zaretskii, 2018/05/12