[Libguestfs] [PATCH nbdkit 0/2] common: Add checked-overflow macros

Richard W.M. Jones
2021-11-09T17:49:16Z

In common/vector/vector.c use GCC/Clang built-in overflow operators.

The first patch is a neutral change which adds comments.  The second
patch is the actual change.

Add a new header "checked-overflow.h" which has the purpose of
isolating the use of the built-ins to one file (in case we need to add
a new compiler later).  Then use this in generic_vector_reserve.

I tested this with GCC 11 and Clang 13.

I verified by disassembly that "jo" (jump overflow) / "jno"
is used
where it was not used previously, by both compilers.

Rich.