Open Kojoley opened 6 months ago
Try __attribute__((__format__ (gnu_printf, ..., ...)))
Try
__attribute__((__format__ (gnu_printf, ..., ...)))
Thanks, I know that gnu_printf
works (I've checked why regular printf
doesn't produce a warning), I will definitely have an infinity amount of time and luck trying to submit mingw workaround to binutils and every other project.
File upstream bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775.
I use gcc 11.5.0 with MinGW-w64 12.0.0 and have strange messages https://github.com/brechtsanders/winlibs_mingw/releases/download/11.5.0posix-12.0.0-msvcrt-r1/winlibs-x86_64-posix-seh-gcc-11.5.0-mingw-w64msvcrt-12.0.0-r1.zip
common.c: In function 'xavs2_malloc':
common.c:255:42: warning: unknown conversion type character 'z' in format [-Wformat=]
255 | fprintf(stderr, "malloc of size %zu failed\n", i_size);
| ^
common.c:255:25: warning: too many arguments for format [-Wformat-extra-args]
255 | fprintf(stderr, "malloc of size %zu failed\n", i_size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parameters.c: In function 'xavs2_encoder_opt_set':
parameters.c:404:23: warning: '%d' directive writing between 1 and 10 bytes into a region of size 4 [-Wformat-overflow=]
404 | sprintf(str, "%d", ++i);
| ^~
parameters.c:404:22: note: directive argument in the range [2, 2147483647]
404 | sprintf(str, "%d", ++i);
| ^~~~
parameters.c:404:9: note: 'sprintf' output between 2 and 11 bytes into a destination of size 4
404 | sprintf(str, "%d", ++i);
| ^~~~~~~~~~~~~~~~~~~~~~~
In version 11.3.1 these errors were not present http://msystem.waw.pl/x265/mingw-gcc1131-20221227.7z
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114775 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
Andrew Pinski that is a good question but that is a question for the mingw forums really rather than inside gcc bugzilla.
What version of gcc/mingw should I use on Windows10? Why is winlibs gcc 11.5.0 working slowly? What it depends on?
Description / Steps to reproduce the issue
gcc -Wall -c bug.c -std=c99
Expected behavior
No warnings
Actual behavior
Verification
Windows Version
MINGW64_NT-10.0-19045
MINGW environments affected
Are you willing to submit a PR?
No response