Open
Description
__attribute__((sentinel))
or __attribute__((sentinel(N)))
is a GNU C extension (also supported by clang) that marks variadic functions as requiring a sentinel NULL
value in the last (or (N+1)th-to-last) argument slot. The compiler checks uses of this function and emits a warning (-Wformat
) if the NULL
sentinel value is not present in the expected location in the parameter list.
It would be nice to be able to mark foreign variadic functions in Rust the same way, such that the compiler checks that a sentinel NULL
appears in the proper position at call sites for these functions. GCC considers any 0-initialized pointer type to be NULL in this context.