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

Anton Rieger rieger at jikken.de
Sat Mar 6 15:04:39 CET 2021


On Sat, Mar 06, 2021 at 02:25:27PM +0100, toogley wrote:
>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:
Maybe as a compromise introduce these stricter options to the CI itself.
SED script comes to mind.

>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.
Can confirm this. The Makefile uses "std=c99" so assuming that size_t exists is
reasonable. But it's AFAIK possible to check in the configure stage.
``-Wall'' is used, so I'm wondering why ``-Wformat'' didn't catch this?

Greetings
     Anton


More information about the neomutt-devel mailing list