Hi Bruno and Holger,
Bruno Haible via Gnulib discussion list <[email protected]> writes:
> Thanks. Yes, it is useful:
> - The size of your patch makes it clear that this is not the way to go.
> - The mention that it is specific to --disable-nls makes it clear that
> we need to look for a workaround in gettext.h. I'll do some
> experiments with various gcc versions and compiler options...
The issue is that __attribute__ ((__format (...))) adds a check to make
the format string is actually a string. When it sees a call to 'gettext'
it assumes that it can return NULL which will cause issues as a format
string.
This assumption is bad, per the description of gettext in POSIX 2024
[1]:
The gettext(), gettext_l(), dgettext(), dgettext_l(), dcgettext(),
and dcgettext_l() functions shall return the message string
described in DESCRIPTION if successful. Otherwise, they shall return
msgid.
In other words, when gettext fails it should just return the string
passed to it.
I would have to test it, but I wonder if adding
'__attribute__ ((__returns_nonnull__))' will fix this.
Collin
[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/dngettext.html