[libc-commits] [libc] [libc] Add `__builtin_expect` tag on assert conditions; NFC (PR #99498)

via libc-commits libc-commits at lists.llvm.org
Thu Jul 18 08:48:15 PDT 2024


goldsteinn wrote:

> I remember discussing something similar with @AaronBallman about adding `__builtin_assume` to the assert macros. I think the answer then was that the C standard specifies exactly what `assert` should look like so we can't change it? I think `LIBC_ASSERT` probably should though.

`__builtin_assume` is a bit different, no? This is properly `NFC`, it just has an off chance of helping codegen.
I don't think any standard says much about how `assert` is implemented other than it will `abort` and maybe write something to `stderr` (and I guess the linux reference saying `__assert_fail` is defined) but this doesn't change any of those things.

https://github.com/llvm/llvm-project/pull/99498


More information about the libc-commits mailing list