From: Sam James <sam@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] Clang 16 is coming - and it'll break your packages!
Date: Sun, 09 Oct 2022 22:25:47 +0100 [thread overview]
Message-ID: <87tu4c8z49.fsf@mop.mail-host-address-is-not-set> (raw)
Hi all,
Clang 16 is going to break a lot of packages. We need your help to fix
the huge number of bugs [0] already reported - and there's more coming.
These fixes are almost always trivial, the issue is the _volume_ of
bugs. The compiler even
tells you how to fix them most of the time.
I absolutely cannot do any of this by myself, and nor can the small
number of people who have been helping: ionen has done the biggest
number of bugs, and soap is helping out too.
Developers, contributors, and users alike are encouraged to help! This
task is massive.
They originally made this change for Clang 15 but reverted it until
Clang 16 [1].
## The problem
There are *two* classes of bug caused by these changes:
1. Obvious build failures. They're just normal errors and it's clear
when you see it;
2. `./configure` tests getting the wrong result but silently
miscompiling. You need to grep `config.log` for `error:` to spot these.
I have a cheesy hook at https://gist.github.com/thesamesam/4ddaa95f3f42c2be312b676476cbf505
which I use to run configure commands twice (old/new Clang options) and then
diff them.
I don't mind which people help with. Ideally both, but if you only want
to do 1., at least until we have bugs filed for 2. (it's harder to detect,
so no bugs filed for it yet), that's fine.
## The actual changes
It enables the following by default:
* -Werror=implicit-function-declaration (C only)
* -Werror=implict-int (C only)
* -Werror=incompatible-function-pointer-types (affects both C and C++)
Note that for implicit-function-declaration (and obviously
incompatible-function-pointer-types), a new revision is needed as it
affects code generation - think of this like the 32-bit -> 64-bit days when
pointers got truncated. It's also useful for finding out quickly if
there's an issue with your fix.
GCC will end up following at least some of these changes in time [2][3].
## Bonus
It also *warns* about K&R declarations and ill-defined, deprecated
prototypes,
so for bonus work, test with:
* -Werror=strict-prototypes (C only)
* -Werror=deprecated-non-prototype (C only)
It's suggested that if you don't want to fix these errors, you try
adding the -std=gnu89 flag instead.
## Helping out
* Please feel free to ask me, soap, ionen, or generally in #gentoo-dev /
#gentoo-toolchain
if you need help fixing a bug.
* To reproduce these bugs, we recommend you use the new improved Clang
config file support [4]:
1. Upgrade to >=sys-devel/clang-15.0.2 and make sure you have
>=sys-devel/clang-common-15.0.2-r1[stricter].
This creates `/etc/clang/clang-stricter.cfg` where you can adjust
the flags manually if desired (like commenting out strict prototypes etc).
This does not copy Clang 16 behaviour 100%, but it's close enough
for the purposes of these bugs.
2. Build packages with `CC=clang CXX=clang++ emerge -v1 ...` or
`CC=clang CXX=clang++ ebuild ...`
3. Enjoy!
* Some bugs simply need an `eautoreconf` because older
autoconf-generated configure files had issues.
* It is *critical* that you send fixes upstream where upstream is still
active or we're going to have a huge amount of duplicate work across distros.
[0] https://bugs.gentoo.org/870412 (tracker bug)
[1] https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
(upstream Clang discussion)
[2] https://www.youtube.com/watch?v=q5itHU2T5xU&t=2862s
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91092
[4] https://blogs.gentoo.org/mgorny/2022/10/07/clang-in-gentoo-now-sets-default-runtimes-via-config-file/
next reply other threads:[~2022-10-09 21:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-09 21:25 Sam James [this message]
2022-10-09 22:00 ` [gentoo-dev] Clang 16 is coming - and it'll break your packages! Sam James
2022-10-10 2:05 ` Michael Orlitzky
2022-10-11 9:07 ` Ionen Wolkens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tu4c8z49.fsf@mop.mail-host-address-is-not-set \
--to=sam@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox