[OpenWrt-Devel] -Werror=format-nonliteral and musl
Rosen Penev
rosenp at gmail.com
Sun Mar 17 18:37:42 EDT 2019
On Sun, Mar 17, 2019 at 10:21 AM W. Michael Petullo <mike at flyn.org> wrote:
>
> >> 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?
>
> > The issue is probably missing __attribute__((format(printf, x, x))) in
> > function declarations in fortify-headers. I can whip up a patch if
> > you'd like.
>
> Do you mean a patch for musl?
I tested my patch. It did nothing. Looking at the error again, I think
it's an issue with gstreamer. The warning warns about stuff like
printf(foo) vs.
printf("%s", foo)
The latter is what should be used.
>
> I also came across some trouble when updating the gst1-plugins-good
> package. Gst-plugins-good captures ioctl with a function pointer,
> but musl declares ioctl's second argument as an int whereas glibc and
> gst1-plugins-good expect it to be a long. This causes a "incompatible
> pointer type" warning, which OpenWrt treats as an error.
This may or may not cause issues with 64-bit targets. I don't have any
and thus have not tested.
>
> I again address this by using CFLAGS to turn off a warning.
>
> Musl does not provide a __MUSL__-like symbol for cpp to use, so the
> gst1-plugins-good folks are not likely to fix this with a simple #ifdef
> as they do with Android. I read musl's position on this in their FAQ, and
> I do not disagree. I do wonder about the right way to handle this, though.
Apparently POSIX says it should be int. PulseAudio fixes this issue by using
#ifndef __GLIBC_
>
> There is some discussion about the ioctl function pointer issue at:
>
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/576
I would point them here: https://bugs.freedesktop.org/show_bug.cgi?id=85319
>
> --
> 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