Skip to content

error: function 'die' might be a candidate for 'ms_printf' format attribute [-Werror=suggest-attribute=format] #175

@rhabacker

Description

@rhabacker

When building dtc version 1.7.2 with MinGW and the UCRT runtime environment, the following error occurs:

[   25s] FAILED: fdtdump.exe.p/fdtdump.c.obj 
[   25s] /usr/bin/x86_64-w64-mingw32-gcc -Ifdtdump.exe.p -I. -I.. -Ilibfdt -I../libfdt -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -Wpointer-arith -Wcast-qual -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow -Wsuggest-attribute=format -Wwrite-strings -DFDT_ASSUME_MASK=0 -DNO_VALGRIND -O2 -g -pipe -Wall -fexceptions --param=ssp-buffer-size=4 -mms-bitfields -MD -MQ fdtdump.exe.p/fdtdump.c.obj -MF fdtdump.exe.p/fdtdump.c.obj.d -o fdtdump.exe.p/fdtdump.c.obj -c ../fdtdump.c
[   25s] In file included from ../fdtdump.c:18:
[   25s] ../util.h: In function 'die':
[   25s] ../util.h:40:9: error: function 'die' might be a candidate for 'ms_printf' format attribute [-Werror=suggest-attribute=format]
[   25s]    40 |         vfprintf(stderr, str, ap);
[   25s]       |         ^~~~~~~~
[   25s] ../fdtdump.c: In function 'main':
[   25s] ../fdtdump.c:233:84: error: unknown conversion type character 't' in format [-Werror=format=]
[   25s]   233 |                                         printf("%s: skipping fdt magic at offset %#tx\n",
[   25s]       |                                                                                    ^
[   25s] ../fdtdump.c:233:48: error: too many arguments for format [-Werror=format-extra-args]
[   25s]   233 |                                         printf("%s: skipping fdt magic at offset %#tx\n",
[   25s]       |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   25s] ../fdtdump.c:240:51: error: unknown conversion type character 't' in format [-Werror=format=]
[   25s]   240 |                 printf("%s: found fdt at offset %#tx\n", file, p - buf);
[   25s]       |                                                   ^
[   25s] ../fdtdump.c:240:24: error: too many arguments for format [-Werror=format-extra-args]
[   25s]   240 |                 printf("%s: found fdt at offset %#tx\n", file, p - buf);
[   25s]       |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   25s] cc1: all warnings being treated as errors
[   25s] /usr/bin/x86_64-w64-mingw32-gcc -Ifdtdump.exe.p -I. -I.. -Ilibfdt -I../libfdt -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -Wpointer-arith -Wcast-qual -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow -Wsuggest-attribute=format -Wwrite-strings -DFDT_ASSUME_MASK=0 -DNO_VALGRIND -O2 -g -pipe -Wall -fexceptions --param=ssp-buffer-size=4 -mms-bitfields -MD -MQ fdtdump.exe.p/util.c.obj -MF fdtdump.exe.p/util.c.obj.d -o fdtdump.exe.p/util.c.obj -c ../util.c
[   25s] In file included from ../util.c:23:
[   25s] ../util.h: In function 'die':
[   25s] ../util.h:40:9: error: function 'die' might be a candidate for 'ms_printf' format attribute [-Werror=suggest-attribute=format]
[   25s]    40 |         vfprintf(stderr, str, ap);
[   25s]       |         ^~~~~~~~
[   25s] ../util.c: In function 'xavsprintf_append':
[   25s] ../util.c:74:9: error: function 'xavsprintf_append' might be a candidate for 'ms_printf' format attribute [-Werror=suggest-attribute=format]
[   25s]    74 |         n = vsnprintf(NULL, 0, fmt, ap_copy) + 1;
[   25s]       |         ^
[   25s] ../util.c:79:9: error: function 'xavsprintf_append' might be a candidate for 'ms_printf' format attribute [-Werror=suggest-attribute=format]
[   25s]    79 |         n = vsnprintf(p + size, n, fmt, ap);
[   25s]       |         ^
[   25s] cc1: all warnings being treated as errors
[   26s] FAILED: dtc.exe.p/meson-generated_dtc-lexer.l.lex.c.obj 
[   26s] /usr/bin/x86_64-w64-mingw32-gcc -Idtc.exe.p -I. -I.. -Ilibfdt -I../libfdt -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -Wpointer-arith -Wcast-qual -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow -Wsuggest-attribute=format -Wwrite-strings -DFDT_ASSUME_MASK=0 -DNO_VALGRIND -O2 -g -pipe -Wall -fexceptions --param=ssp-buffer-size=4 -mms-bitfields -MD -MQ dtc.exe.p/meson-generated_dtc-lexer.l.lex.c.obj -MF dtc.exe.p/meson-generated_dtc-lexer.l.lex.c.obj.d -o dtc.exe.p/meson-generated_dtc-lexer.l.lex.c.obj -c dtc.exe.p/dtc-lexer.l.lex.c
[   26s] In file included from ../dtc.h:24,
[   26s]                  from ../dtc-lexer.l:22:
[   26s] ../util.h: In function 'die':
[   26s] ../util.h:40:9: error: function 'die' might be a candidate for 'ms_printf' format attribute [-Werror=suggest-attribute=format]
[   26s]    40 |         vfprintf(stderr, str, ap);
[   26s]       |         ^~~~~~~~
[   26s] cc1: all warnings being treated as errors

log.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions