Gentoo Archives: gentoo-dev

From: Ionen Wolkens <ionen@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Clang 16 is coming - and it'll break your packages!
Date: Tue, 11 Oct 2022 09:07:31
Message-Id: Y0UyTMwVIJqAmnYs@eversor
In Reply to: [gentoo-dev] Clang 16 is coming - and it'll break your packages! by Sam James
1 On Sun, Oct 09, 2022 at 10:25:47PM +0100, Sam James wrote:
2 > ## Bonus
3 >
4 > It also *warns* about K&R declarations and ill-defined, deprecated
5 > prototypes,
6 > so for bonus work, test with:
7 > * -Werror=strict-prototypes (C only)
8 > * -Werror=deprecated-non-prototype (C only)
9 >
10 > It's suggested that if you don't want to fix these errors, you try
11 > adding the -std=gnu89 flag instead.
13 Note that -Werror=strict-prototypes breaks /tons/ because it fails on
14 the following:
16 int myfunc() { return 0; }
18 But the above is fine with -std=c2x, and I don't think it's worth
19 starting to add (void) /everywhere/ downstream if it's going to be
20 okay'ish.
22 "Hopefully" clang won't try to do that check by default again, the
23 breakage would be on the next level... so I'd tentatively say, don't
24 worry about this and focus attention where it's more urgent (aka
25 implicits and incompatible pointer types, may even fix other bugs
26 at same time).
29 On the other hand, warnings from -Wdeprecated-non-prototype do
30 fail with `clang -std=c2x`. So if come across a K&R-style source
31 mostly beyond fixing, do consider `append-cflags -std=gnu89`.
33 An alternative way to test so don't need to add -Wno* everywhere on
34 top of -std=gnu* is to straight up test with `clang -std=c2x` rather
35 than the -Werror (not to say it's perfect given c2x makes assumptions,
36 but doing this can pick up more errors too).
38 (reminder that gcc/clang don't enable c2x by default and isn't urgent,
39 but this will happen sooner or later)
40 --
41 ionen


File name MIME type
signature.asc application/pgp-signature