Closed jvoisin closed 2 years ago
@jvoisin I would prefer just adding the attribute directly rather than defining these 3 macros.
If there was a need for portability, I think a single variadic macro would work. Could define an ALLOC_SIZE
macro in util.h for that but it's not really worth it since there's no need for the portability.
The existing macros there are for readability rather than portability. The only one where portability was needed was the OPTNONE one used for the tests to make them less likely to break due to testing things that are undefined behavior.
Sure, done.
This should help a bit the compiler to emit better diagnostics and to improve the correctness of
__builtin_object_size
.See https://clang.llvm.org/docs/AttributeReference.html#alloc-size