]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Drop format attribute from snprintf wrapper [PR116969]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 4 Oct 2024 11:08:12 +0000 (12:08 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 9 Oct 2024 13:05:49 +0000 (14:05 +0100)
commit5247ee086f7fff5c6e7cd837478974dbfc2782db
tree35822468138779c5879bf92432497b3d183819b8
parentc0bc9a153ae6ab649e2fcc3af53ebcd37df0a871
libstdc++: Drop format attribute from snprintf wrapper [PR116969]

When __LONG_DOUBLE_IEEE128__ is defined we need to declare a wrapper for
Glibc's 'snprintf' symbol, so we can call the original definition that
works with the IBM128 format of long double. Because we were declaring
the wrapper using __typeof__(__builtin_snprintf) it inherited the
__attribute__((format(printf, 3, 4))) decoration, and then we got a
warning for calling that wrapper with an __ibm128 argument for a %Lf
conversion specifier. The warning is bogus, because the function we're
calling really does want __ibm128 for %Lf, but there's no "printf but
with a different long double format" archetype for the attribute.

In r15-4039-g28911f626864e7 I added a diagnostic pragma to suppress the
warning, but it would be better to just declare the wrapper without the
attribute, and not have to suppress a warning for code that we know is
actually correct.

libstdc++-v3/ChangeLog:

PR libstdc++/116969
* include/bits/locale_facets_nonio.tcc (money_put::__do_put):
Remove diagnostic pragmas.
(__glibcxx_snprintfibm128): Declare type manually, instead of
using __typeof__(__builtin_snprintf).
libstdc++-v3/include/bits/locale_facets_nonio.tcc