[OpenWrt-Devel] -Werror=format-nonliteral and musl
W. Michael Petullo
mike at flyn.org
Sat Mar 16 17:51:22 EDT 2019
While trying to update the gst1-plugins-base package, I came across a
compiler error:
CC libgsttag_1.0_la-gstxmptag.lo
In file included from gstxmptag.c:42:0:
/home/mike/Source/openwrt-build-flyn.org/openwrt-herald/staging_dir/toolchain-x86_64_gcc-7.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/mike/Source/openwrt-build-flyn.org/openwrt-herald/staging_dir/toolchain-x86_64_gcc-7.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/mike/Source/openwrt-build-flyn.org/openwrt-herald/staging_dir/toolchain-x86_64_gcc-7.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/mike/Source/openwrt-build-flyn.org/openwrt-herald/staging_dir/toolchain-x86_64_gcc-7.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
__r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
^~~
/home/mike/Source/openwrt-build-flyn.org/openwrt-herald/staging_dir/toolchain-x86_64_gcc-7.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
__r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
^~~
cc1: all warnings being treated as errors
make[9]: *** [Makefile:856: libgsttag_1.0_la-gstxmptag.lo] Error 1
It seems this follows from the use of -Werror=format-nonliteral. The
definition in musl's stdio.h is as follows:
_FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, const char *__f, ...)
{
size_t __b = __builtin_object_size(__s, 0);
if (__n > __b)
__builtin_trap();
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
}
Other packages address this locally by setting TARGET_CFLAGS to include
-Wno-format-nonliteral. See for example the commit "package/elfutils:
add CFLAG -Wno-format-nonliteral."
Is there a more global way to address this?
--
Mike
:wq
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list