Compiling with modern Clang

FireTurtle <[email protected]> Sun, 5 Apr 2026 16:44:11 -0700
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <CAAc3VoMiXzcOR-z4ti6N7-nTU=xJTNm09fv4teMy+y-mgLBdow@mail.gmail.com>
--000000000000fbbe65064ebf20b1
Content-Type: text/plain; charset="UTF-8"

Hi,

I've been building the NetBSD-current tree with a recent Clang (22+) for a
project and there are quite a few -Werror failures from warnings that GCC
doesn't emit.

My thought is to suppress the high-volume warnings globally and submit
code fixes for the rest.

For the high-volume suppressions, I'd like to propose adding these three to
bsd.sys.mk under CWARNFLAGS.clang:

 *  -Wno-error=deprecated-non-prototype    (~100+ instances,  distributed.)
 *  -Wno-error=strict-prototypes           (~50+ instances, same packages)
  * -Wno-error=unused-but-set-variable     (~50+ instances)

These are all C23 intolerance or Clang-vs-GCC divergences that fire across
multiple architectures (amd64, i386,  ...).   At this volume, per-file
suppression is impractical.

I'd also include -Wno-unknown-warning-option as a safety net so the same
bsd.sys.mk works with both the in-tree Clang 13 and newer versions.

Thoughts?

Also is there any thought to upgrading the Clang version -- Clang 13 is 4.5
years old.?

thanks,
FireTurtle

--000000000000fbbe65064ebf20b1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<br><br>I&#39;ve been building the NetBSD-current tree =
with a recent Clang (22+) for a<br>project and there are quite a few -Werro=
r failures from warnings that GCC<br>doesn&#39;t emit.<br><br>My thought is=
 to suppress the high-volume warnings globally and submit<br>code fixes for=
 the rest.<br><br>For the high-volume suppressions, I&#39;d like to propose=
 adding these three to<br><a href=3D"http://bsd.sys.mk">bsd.sys.mk</a> unde=
r CWARNFLAGS.clang:<br><br>=C2=A0*=C2=A0 -Wno-error=3Ddeprecated-non-protot=
ype =C2=A0 =C2=A0(~100+ instances,=C2=A0 distributed.)<br>=C2=A0*=C2=A0 -Wn=
o-error=3Dstrict-prototypes =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (~50+ instan=
ces, same packages)<br>=C2=A0 * -Wno-error=3Dunused-but-set-variable =C2=A0=
 =C2=A0 (~50+ instances)<br><br>These are all C23 intolerance or Clang-vs-G=
CC divergences that fire across<br>multiple architectures (amd64, i386,=C2=
=A0 ...). =C2=A0 At this volume, per-file<br>suppression is impractical.<br=
><br>I&#39;d also include -Wno-unknown-warning-option as a safety net so th=
e same<br><a href=3D"http://bsd.sys.mk">bsd.sys.mk</a> works with both the =
in-tree Clang 13 and newer versions.<br><br>Thoughts?<br><br>Also is there =
any thought to upgrading the Clang version -- Clang 13 is 4.5 years old.?<b=
r><br>thanks,<br>FireTurtle</div>

--000000000000fbbe65064ebf20b1--