integer overflow checking in the kernel

Mark Johnston <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <anpM6wwp1PMS0zF-@nuc>
In the kernel we don't have any dedicated macros or functions for
checking for overflow in integer operations.  We have many open-coded
checks, but it can be tricky to get those right in the face of integer
promotion rules.

I propose that we simply adopt the macros from C23's stdckdint.h.  These
are just thin wrappers around __builtin_*_overflow.  I posted a patch
which implements this at https://reviews.freebsd.org/D58773 and I also
converted a couple of existing checks.

Any reviews/thoughts/objections?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.