On 2026-02-11T18:21:12+0100, Rene Kita wrote:
> Inspired by commit 8b10799c (Fix iswblank() compilation error when
> configured --without-wc-funcs., 2026-01-26) I decided to take a look at
> the CI builds run on sr.ht.
> 
> My two main ideas were to use different build configurations and to
> compile with -Werror to make any warning abort the CI. I dropped the
> configure and build stage and added stages for each configuration which
> contain the configure and the build step. The inlined patches below are
> merely meant to get some feedback or start a discussion.
> 
> I tried having a better way to add -Werror to CFLAGS, but failed.
> 
> Some thoughts:
> - I don't think having a built run on Debian Stable is really
>   meaningful. Debian stable is most of the time quite old and only
>   selected patches will be backported. I would suggest to pick something
>   more bleeding edge like Arch.

Building on a stable system is also useful.  Otherwise, you may write
code that works on new systems, but fails on ond ones.  I personally use
Devuan unstable on my computer, and having an oldstable CI to test old
systems has caught a few things that I wouldn't have caught on my
computer.

> - I like having Alpine Linux because of musl.

+1

> - I've tested a build for NetBSD which uses signed char which can give
>   warnings with some functions, but mutt seems to be OK. I will keep
>   NetBSD enabled in my sr.ht repo.
> - I also added OpenBSD with their configure options used in ports.
> - sr.ht only allows four build manifests to run for each push. If more
>   than four are present a random pick will run. I don't like this idea,
>   because it makes the CI somewhat non-deterministic.
> - I don't think -pedantic is really helpful, but creates some PITA when
>   used with -Werror. I had to add some workarounds to get a non-failing
>   build.

Yeah, -pedantic (and in general standard ISO C) is a dialect of C that
nobody should be using.  It's just too terrible.  Some extensions are
just essential for any decent programmer.


Have a lovely night!
Alex

> 
> If someone has good ideas what other build configurations to add, I will
> test them.
> 
> Below are the patches I ended up with. I omitted the changed manifests
> and only inserted the newly added OpenBSD one. The 'original' stage is
> what was used before. If there is some consensus here I will send proper
> patches.
> 
> Ideas?
> 
> Kevin, feel free to reject, a simple 'no' is enough. :-)
> 
> commit b317691396a4f5a2505ccc095e17135f2bbd9081
> Author: Rene Kita <[email protected]>
> Date:   2026-02-04T09:12:18+01:00
> 
>     Remove unused variable
> 
> diff --git a/mbyte.c b/mbyte.c
> index f7c29662..762e7f25 100644
> --- a/mbyte.c
> +++ b/mbyte.c
> @@ -107,7 +107,7 @@ static size_t wcrtomb_iconv (char *s, wchar_t wc, iconv_t 
> cd)
>    char buf[MB_LEN_MAX+1];
>    ICONV_CONST char *ib;
>    char *ob;
> -  size_t ibl, obl, r;
> +  size_t ibl, obl;
>  
>    if (s)
>    {
> @@ -117,7 +117,7 @@ static size_t wcrtomb_iconv (char *s, wchar_t wc, iconv_t 
> cd)
>      ib = buf;
>      ob = s;
>      obl = MB_LEN_MAX;
> -    r = iconv (cd, &ib, &ibl, &ob, &obl);
> +    iconv (cd, &ib, &ibl, &ob, &obl);
>    }
>    else
>    {
> @@ -125,7 +125,7 @@ static size_t wcrtomb_iconv (char *s, wchar_t wc, iconv_t 
> cd)
>      ibl = 1;
>      ob = buf;
>      obl = sizeof (buf);
> -    r = iconv (cd, &ib, &ibl, &ob, &obl);
> +    iconv (cd, &ib, &ibl, &ob, &obl);
>    }
>    return ob - s;
>  }
> 
> commit 31f3299b356e4bdbfad2d9f2eb447c908c2869d9
> Author: Rene Kita <[email protected]>
> Date:   2026-02-04T07:07:34+01:00
> 
>     Silence warning
> 
> diff --git a/mutt_ssl.c b/mutt_ssl.c
> index ee08f943..762377e1 100644
> --- a/mutt_ssl.c
> +++ b/mutt_ssl.c
> @@ -708,6 +708,7 @@ static void ssl_err (sslsockdata *data, int err)
>        errmsg = "unknown error";
>    }
>  
> +  (void)errmsg;  /* Silence warning when configured with --disable-debug */
>    muttdbg(1, "SSL error: %s", errmsg);
>  }
>  
> 
> commit 9b4284ade52b786e665c2daf8a784588a580a127
> Author: Rene Kita <[email protected]>
> Date:   2026-02-04T10:02:29+01:00
> 
>     Fix build error for --without-wc-funcs on FreeBSD
>     
>     mbyte.c:417:5: error: redefinition of '__wcwidth'
>     417 | int wcwidth (wchar_t wc)
> 
> diff --git a/mbyte.c b/mbyte.c
> index 762e7f25..7a9de4c9 100644
> --- a/mbyte.c
> +++ b/mbyte.c
> @@ -414,6 +414,7 @@ int wcwidth_ja (wchar_t ucs)
>  
>  int wcwidth_ucs(wchar_t ucs);
>  
> +#ifndef HAVE_WCHAR_H
>  int wcwidth (wchar_t wc)
>  {
>    if (!Charset_is_utf8)
> @@ -438,6 +439,7 @@ int wcwidth (wchar_t wc)
>    }
>    return wcwidth_ucs (wc);
>  }
> +#endif /* HAVE_WCHAR_H */
>  
>  size_t utf8rtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *_ps)
>  {
> 
> commit 3a9124ac97f3f74d66c25be77f86d662854b6f76
> Author: Rene Kita <[email protected]>
> Date:   2026-02-06T11:39:11+01:00
> 
>     Add sr.ht build manifest for OpenBSD
> 
> diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml
> new file mode 100644
> index 00000000..e82180b5
> --- /dev/null
> +++ b/.builds/openbsd.yml
> @@ -0,0 +1,85 @@
> +image: openbsd/latest
> +packages:
> +- autoconf-2.72p0
> +- automake-1.18
> +- gettext-runtime
> +- gettext-tools
> +- gpgme
> +- indexinfo
> +- kyotocabinet
> +- libassuan
> +- libgpg-error
> +- libiconv
> +- libidn2
> +- libunistring
> +- qdbm
> +sources:
> +- https://git.sr.ht/~mutt/mutt
> +environment:
> +  AUTOCONF_VERSION: 2.72
> +  AUTOMAKE_VERSION: 1.18
> +  LDFLAGS: -L/usr/local/lib
> +tasks:
> +- default: |
> +    cd mutt
> +    autoreconf -if
> +    ./configure
> +    # Work around warning from -pedantic
> +    make 'CFLAGS=-Wall -pedantic -Werror -Wno-c23-extensions' md5.o
> +    make -j4 CFLAGS='-Wall -pedantic -Werror'
> +- without-wc-funcs: |
> +    cd mutt
> +    autoreconf -if
> +    ./configure \
> +        --without-wc-funcs
> +    # Work around warning from -pedantic
> +    make 'CFLAGS=-Wall -pedantic -Werror -Wno-c23-extensions' md5.o
> +    make -j4 CFLAGS='-Wall -pedantic -Werror'
> +- original: |
> +    cd mutt
> +    autoreconf -if
> +    ./configure \
> +        --enable-gpgme \
> +        --enable-pop \
> +        --enable-imap \
> +        --enable-smtp \
> +        --enable-hcache \
> +        --enable-sidebar \
> +        --with-kyotocabinet=/usr/local \
> +        --with-mailpath=/var/spool/mail \
> +        --with-curses \
> +        --with-ssl \
> +        --without-sasl \
> +        --with-libiconv-prefix=/usr/local \
> +        --with-libintl-prefix=/usr/local
> +      # Work around warning in /usr/local/include/kclangc.h
> +      make hcversion.h
> +      make 'CFLAGS=-Wall -pedantic -Werror -Wno-strict-prototypes' hcache.o
> +      # Work around warning from -pedantic
> +      make 'CFLAGS=-Wall -pedantic -Werror -Wno-c23-extensions' md5.o
> +      make -j4 CFLAGS='-Wall -pedantic -Werror'
> +- openbsd: |
> +    cd mutt
> +    autoreconf -if
> +    ./configure \
> +      --enable-compressed \
> +      --enable-debug \
> +      --enable-external_dotlock \
> +      --disable-fcntl \
> +      --enable-flock \
> +      --with-idn2 \
> +      --enable-imap \
> +      --enable-pop \
> +      --enable-sidebar \
> +      --enable-smtp \
> +      --mandir=${PREFIX}/man \
> +      --with-docdir="${PREFIX}/share/doc/mutt" \
> +      --with-ssl \
> +      --enable-hcache \
> +      --with-qdbm
> +      # Work around warning in /usr/local/include/kclangc.h
> +      make hcversion.h
> +      make 'CFLAGS=-Wall -pedantic -Werror -Wno-strict-prototypes' hcache.o
> +      # Work around warning from -pedantic
> +      make 'CFLAGS=-Wall -pedantic -Werror -Wno-c23-extensions' md5.o
> +      make -j4 CFLAGS='-Wall -pedantic -Werror'
> 
> commit 02cdc4d6c1e3786bd28a5a0245fe9772d4de31f7
> Author: Rene Kita <[email protected]>
> Date:   2026-02-03T18:11:43+01:00
> 
>     Drop -Wno-long-long from CFLAGS
>     
>     We already require C99.
> 
> diff --git a/configure.ac b/configure.ac
> index a58b152b..bc7d7137 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -956,7 +956,7 @@ AC_ARG_ENABLE(warnings, 
> AS_HELP_STRING([--disable-warnings],[Turn off compiler w
>  fi])
>  
>  if test x$GCC = xyes && test $mutt_cv_warnings = yes; then
> -  CFLAGS="-Wall -pedantic -Wno-long-long $CFLAGS"
> +  CFLAGS="-Wall -pedantic $CFLAGS"
>  fi
>  
>  AC_ARG_ENABLE(nfs-fix, AS_HELP_STRING([--enable-nfs-fix],[Work around an NFS 
> with broken attributes caching]),
> 
> commit 8385ea5af95a2bf165147f8c459c3a8d7d90e0a7
> Author: Rene Kita <[email protected]>
> Date:   2026-02-03T18:15:22+01:00
> 
>     Do not limit use of warnings to GCC
>     
>     These are not compiler specific warnings, use them everywhere.
> 
> diff --git a/configure.ac b/configure.ac
> index bc7d7137..33d483d2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -955,7 +955,7 @@ AC_ARG_ENABLE(warnings, 
> AS_HELP_STRING([--disable-warnings],[Turn off compiler w
>          mutt_cv_warnings=no
>  fi])
>  
> -if test x$GCC = xyes && test $mutt_cv_warnings = yes; then
> +if test $mutt_cv_warnings = yes; then
>    CFLAGS="-Wall -pedantic $CFLAGS"
>  fi
>  

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to