Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GNU C's "format" function attribute where appropriate
Which allows correct type-checking during compilation and avoids errors when building with clang + -Werror: [58/71] Compiling C object src/programs/pkexec.p/pkexec.c.o FAILED: src/programs/pkexec.p/pkexec.c.o clang -Isrc/programs/pkexec.p -Isrc/programs -I../src/programs -I. -I.. -Isrc/polkitagent -I../src/polkitagent -Isrc -I../src -Isrc/polkit -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/gio-unix-2.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -std=c99 -O2 -g -D_GNU_SOURCE -include config.h -Waggregate-return -Wdeclaration-after-statement -Wformat=2 -Wimplicit-function-declaration -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wstrict-prototypes -Wno-format-y2k -Wno-declaration-after-statement -Wno-deprecated-declarations -pthread -DWITH_GZFILEOP -MD -MQ src/programs/pkexec.p/pkexec.c.o -MF src/programs/pkexec.p/pkexec.c.o.d -o src/programs/pkexec.p/pkexec.c.o -c ../src/programs/pkexec.c ../src/programs/pkexec.c:109:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral] 109 | s = g_strdup_vprintf (format, var_args); | ^~~~~~ 1 error generated. [59/71] Compiling C object src/polkitbackend/libpolkit-backend-1.a.p/polkitbackendauthority.c.o FAILED: src/polkitbackend/libpolkit-backend-1.a.p/polkitbackendauthority.c.o clang -Isrc/polkitbackend/libpolkit-backend-1.a.p -Isrc/polkitbackend -I../src/polkitbackend -I. -I.. -Isrc -I../src -Isrc/polkit -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/gio-unix-2.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -std=c99 -O2 -g -D_GNU_SOURCE -include config.h -Waggregate-return -Wdeclaration-after-statement -Wformat=2 -Wimplicit-function-declaration -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wstrict-prototypes -Wno-format-y2k -Wno-declaration-after-statement -Wno-deprecated-declarations -fPIC -pthread -DWITH_GZFILEOP -D_POLKIT_COMPILATION -D_POLKIT_BACKEND_COMPILATION '-DPACKAGE_DATA_DIR="/usr/share"' '-DPACKAGE_SYSCONF_DIR="/etc"' -MD -MQ src/polkitbackend/libpolkit-backend-1.a.p/polkitbackendauthority.c.o -MF src/polkitbackend/libpolkit-backend-1.a.p/polkitbackendauthority.c.o.d -o src/polkitbackend/libpolkit-backend-1.a.p/polkitbackendauthority.c.o -c ../src/polkitbackend/polkitbackendauthority.c ../src/polkitbackend/polkitbackendauthority.c:1721:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral] 1721 | message = g_strdup_vprintf (format, var_args); | ^~~~~~ 1 error generated.
- Loading branch information