[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #13 from Nikita Kniazev --- (In reply to Andrew Pinski from comment #12) > The reality is ms_printf most likely should just include z and ll support > instead since they are supported now: > https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification- > syntax-printf-and-wprintf-functions?view=msvc-170 While it makes sense, if ms_printf and gnu_printf will behave the same - there is no point in having them then. (In reply to Andrew Pinski from comment #12) > As I mentioned GCC mingw support is out of date really and should be fixed > there . Fixed where? IIUC the machinery is in gcc/config/i386/msformat-c.cc
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #12 from Andrew Pinski --- (In reply to Nikita Kniazev from comment #11) > -mcrtdll=ucrt should make __printf__ be gnu_printf instead of ms_printf. > Should I file separate issue or this one can be reopened? The reality is ms_printf most likely should just include z and ll support instead since they are supported now: https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-170 They have been included since 2015. As I mentioned GCC mingw support is out of date really and should be fixed there .
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 Nikita Kniazev changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #11 from Nikita Kniazev --- -mcrtdll=ucrt should make __printf__ be gnu_printf instead of ms_printf. Should I file separate issue or this one can be reopened?
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #10 from Andrew Pinski --- (In reply to Nikita Kniazev from comment #9) > Ok, is there at least an option to build GCC so it defaults __printf__ to > gnu_printf? Defaulting __printf__ to ms_printf on UCRT is wrong (every OS > without UCRT is already EOL). There is none yet. But any fix won't happen until GCC 15 really ...
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #9 from Nikita Kniazev --- Ok, is there at least an option to build GCC so it defaults __printf__ to gnu_printf? Defaulting __printf__ to ms_printf on UCRT is wrong (every OS without UCRT is already EOL).
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #8 from Andrew Pinski --- (In reply to Nikita Kniazev from comment #7) > (In reply to Andrew Pinski from comment #6) > > (In reply to Nikita Kniazev from comment #5) > > > > So there is mingw_printf and gnu_printf attributes for mingw because at > > > > one point %ll didn't exist for mingw and nobody has updated it since > > > > then. > > > > > > Do you mean that binutils and [other code out > > > there](https://github.com/ > > > search?q=%2F__attribute__%5Cs*%5C%28%5Cs*%5C%28%5Cs*_*format_*%5Cs*%5C%28%5Cs > > > *_*printf%2F=code) should be updated to use gnu_printf in attributes? > > > That would be a lot of work, clang doesn't know gnu_printf, and is wrong > > > for > > > actual printf wrappers. > > > > This has been documented/implemented this way for ~16 years now (for GCC > > 4.4.0), r0-86297-g6590fc9fbd071d . > > > > https://inbox.sourceware.org/gcc-patches/OF604F1098.0E3FE32A-ONC1257408. > > 003bb78c-c1257408.003ce...@onevision.de/ > > Which attributes should use for > > void my_printf(const char *fmt, ...) > { > va_list ap; > > va_start(ap, fmt); > printf(fmt, ap); > va_end(ap); > } > > so it will behave correctly with any combination of -std=c89, -std=c99, > __USE_MINGW_ANSI_STDIO=0, __USE_MINGW_ANSI_STDIO=1, _UCRT that is a good question but that is a question for the mingw forums really rather than inside gcc bugzilla.
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #7 from Nikita Kniazev --- (In reply to Andrew Pinski from comment #6) > (In reply to Nikita Kniazev from comment #5) > > > So there is mingw_printf and gnu_printf attributes for mingw because at > > > one point %ll didn't exist for mingw and nobody has updated it since then. > > > > Do you mean that binutils and [other code out > > there](https://github.com/ > > search?q=%2F__attribute__%5Cs*%5C%28%5Cs*%5C%28%5Cs*_*format_*%5Cs*%5C%28%5Cs > > *_*printf%2F=code) should be updated to use gnu_printf in attributes? > > That would be a lot of work, clang doesn't know gnu_printf, and is wrong for > > actual printf wrappers. > > This has been documented/implemented this way for ~16 years now (for GCC > 4.4.0), r0-86297-g6590fc9fbd071d . > > https://inbox.sourceware.org/gcc-patches/OF604F1098.0E3FE32A-ONC1257408. > 003bb78c-c1257408.003ce...@onevision.de/ Which attributes should use for void my_printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); printf(fmt, ap); va_end(ap); } so it will behave correctly with any combination of -std=c89, -std=c99, __USE_MINGW_ANSI_STDIO=0, __USE_MINGW_ANSI_STDIO=1, _UCRT
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #6 from Andrew Pinski --- (In reply to Nikita Kniazev from comment #5) > > So there is mingw_printf and gnu_printf attributes for mingw because at one > > point %ll didn't exist for mingw and nobody has updated it since then. > > Do you mean that binutils and [other code out > there](https://github.com/ > search?q=%2F__attribute__%5Cs*%5C%28%5Cs*%5C%28%5Cs*_*format_*%5Cs*%5C%28%5Cs > *_*printf%2F=code) should be updated to use gnu_printf in attributes? > That would be a lot of work, clang doesn't know gnu_printf, and is wrong for > actual printf wrappers. This has been documented/implemented this way for ~16 years now (for GCC 4.4.0), r0-86297-g6590fc9fbd071d . https://inbox.sourceware.org/gcc-patches/of604f1098.0e3fe32a-onc1257408.003bb78c-c1257408.003ce...@onevision.de/
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #5 from Nikita Kniazev --- > So there is mingw_printf and gnu_printf attributes for mingw because at one > point %ll didn't exist for mingw and nobody has updated it since then. Do you mean that binutils and [other code out there](https://github.com/search?q=%2F__attribute__%5Cs*%5C%28%5Cs*%5C%28%5Cs*_*format_*%5Cs*%5C%28%5Cs*_*printf%2F=code) should be updated to use gnu_printf in attributes? That would be a lot of work, clang doesn't know gnu_printf, and is wrong for actual printf wrappers.
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #4 from Andrew Pinski --- This is documented this way. If you want to use C99 printf format, you need to use gnu_printf instead (note gnu_printf format is for all targets and not just mingw).
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #3 from Andrew Pinski --- If anything gnu_printf should be used instead for _bfd_error_handler and that would be a binutils issue and reported there ...
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 --- Comment #2 from Andrew Pinski --- (In reply to Andrew Pinski from comment #1) > So there is mingw_printf and gnu_printf attributes for mingw because at one > point %ll didn't exist for mingw and nobody has updated it since then. Sorry I mean ms_printf rather than mingw_printf. Anyways this is all documented: https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Common-Function-Attributes.html#index-format-function-attribute
[Bug target/114775] on mingw __attribute__ ((__format__ (__printf__, ...))) doesn't recognize C99 specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 Andrew Pinski changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=95130 --- Comment #1 from Andrew Pinski --- So there is mingw_printf and gnu_printf attributes for mingw because at one point %ll didn't exist for mingw and nobody has updated it since then.