[vlc-devel] [PATCH 1/2] configure: add an option to turn some dangerous warnings into errors
Rémi Denis-Courmont
remi at remlab.net
Fri Mar 20 11:30:17 CET 2020
Le perjantaina 20. maaliskuuta 2020, 11.59.12 EET Steve Lhomme a écrit :
> On 2020-03-20 10:29, Rémi Denis-Courmont wrote:
> > Le perjantaina 20. maaliskuuta 2020, 11.20.49 EET Steve Lhomme a écrit :
> >> Mismatching pointers are usually a result of using the incorrect pointer
> >> and might trigger crashes.
> >>
> >> Missing initializers are useful for structures of callbacks, to make sure
> >> a
> >> new callback is not missing by accident. It's always possible to put
> >> NULL,
> >> on purpose, knowingly.
> >>
> >> Both flags produce no error on win32/win64 with clang or gcc. But they
> >> cannot be set globally outside of the build script as many contribs will
> >> likely fail these tests and we shouldn't refuse/patch a contrib just for
> >> that.
> >>
> >> I have been compiling with these flags for weeks without issues. It
> >> helped
> >> find some issue (48442d3536edae578f1a384e73346d1e2a4c0061) that were
> >> pushed
> >> unnoticed without these checks.
> >> ---
> >>
> >> configure.ac | 6 ++++++
> >> 1 file changed, 6 insertions(+)
> >>
> >> diff --git a/configure.ac b/configure.ac
> >> index bc1874cb97c..c96b3fe6fac 100644
> >> --- a/configure.ac
> >> +++ b/configure.ac
> >> @@ -4480,6 +4480,12 @@ AS_VAR_IF(with_libfuzzer, no, [], [
> >>
> >> ])
> >>
> >> ])
> >>
> >> +AC_ARG_ENABLE([extra-checks],
> >> + AS_HELP_STRING([--enable-extra-checks],
> >> + [Turn some compilation warnings into errors]), [
> >> + AX_APPEND_COMPILE_FLAGS([-Werror=incompatible-pointer-types
> >> -Werror=missing-field-initializers], [CFLAGS]) +])
> >
> > I don't see what justifies adding yet another option here. In this case,
> > you can just as well pass them with CFLAGS/CXXFLAGS like everybody and
> > everything else does.
>
> No you can't.
Yes you can. I've been doing it for more than a decade, including for Windows.
Limitations of your build scripts are not a design criteria for configure.
--
Реми Дёни-Курмон
http://www.remlab.net/
More information about the vlc-devel
mailing list