[neomutt-devel] [PATCH] add -Werror and -pedantic build flag; fix warnings

toogley toogley at nixnet.email
Sat Mar 6 14:25:27 CET 2021


On Sat, Mar 06, 2021 at 12:23:09PM +0000, Richard Russon wrote:
> > I'm sorry for the additional work i'm creating here but i have trouble
> > configuring/authentificating my github so i can't send a pull request.
> 
> > -CFLAGS=		@CPPFLAGS@ @CFLAGS@ -I. -I at srcdir@ -Wall $(EXTRA_CFLAGS)
> > +CFLAGS=		@CPPFLAGS@ @CFLAGS@ -I. -I at srcdir@ -Werror -pedantic -Wall $(EXTRA_CFLAGS)
> 
> Locally, I always build with `-Werror -pedantic` enabled,
> but this is changing the build for everyone...
> 
> whatever their architecture, OS, compiler, compiler version.
> 
> I don't want to cause build failures that might only get discovered when
> packagers try to build NeoMutt after a release.

So basically the idea is to improve the continuous integration by
forcing errors to be fixed. So for instance, i was also thinking about
introducing in some months/years ASAN to neomutt's CI so memory bugs are
more exposed. For instance, i have been running locally with ASAN
enabled for some weeks and continuously receive many memory leaks.
However i wanted to look into fixing these memory leaks when i have time
in the next monhts/years before enabling it in CI.

I thought making CI stricter (for instance also enabling
-fsanitize=undefined, -fcf-protection=full -fstack-protector-strong
-fstack-clash-protection and such things (the above were only the
beginning of that), issues like these here could be easier to fix by
making neomutt more deterministic by hard-failing if something's wrong:

https://github.com/neomutt/neomutt/issues/2769
https://github.com/neomutt/neomutt/issues/2730

So i agree that packaging people should not get build failures and
stuff, but my impression was that a better solution is to improve the
variety of the continuous integration - however, i now realize that this
is probably impossible to do since it is too much.

So i am not sure how to proceeed here. Suggestions?

> 
> > -      snprintf(buf, sizeof(buf), "apple%ld", i);
> > +      snprintf(buf, sizeof(buf), "apple%d", i);
> 
> No.  `size_t` is a *long* type.
> Technically, we should use `%zu` for `size_t` -- see printf(3).

Oh yes, i am sorry. Will fix that when we decided what to do with the
warnings.


More information about the neomutt-devel mailing list