mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
ccan: update to get RETURNS_NONNULL macro.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
2910bb0235
commit
38fad0f3e4
@ -1,3 +1,3 @@
|
||||
CCAN imported from http://ccodearchive.net.
|
||||
|
||||
CCAN version: init-2504-g48b4ffc3
|
||||
CCAN version: init-2506-gec95c3c5
|
||||
|
@ -271,6 +271,19 @@
|
||||
#define NON_NULL_ARGS(...)
|
||||
#endif
|
||||
|
||||
#if HAVE_ATTRIBUTE_RETURNS_NONNULL
|
||||
/**
|
||||
* RETURNS_NONNULL - specify that this function cannot return NULL.
|
||||
*
|
||||
* Mainly an optimization opportunity, but can also suppress warnings.
|
||||
*
|
||||
* Example:
|
||||
* RETURNS_NONNULL char *my_copy(char *buf);
|
||||
*/
|
||||
#define RETURNS_NONNULL __attribute__((__returns_nonnull__))
|
||||
#else
|
||||
#define RETURNS_NONNULL
|
||||
#endif
|
||||
|
||||
#if HAVE_ATTRIBUTE_SENTINEL
|
||||
/**
|
||||
|
@ -142,6 +142,9 @@ static const struct test base_tests[] = {
|
||||
{ "HAVE_ATTRIBUTE_NONNULL", "__attribute__((nonnull)) support",
|
||||
"DEFINES_FUNC", NULL, NULL,
|
||||
"static char *__attribute__((nonnull)) func(char *p) { return p; }" },
|
||||
{ "HAVE_ATTRIBUTE_RETURNS_NONNULL", "__attribute__((returns_nonnull)) support",
|
||||
"DEFINES_FUNC", NULL, NULL,
|
||||
"static const char *__attribute__((returns_nonnull)) func(void) { return \"hi\"; }" },
|
||||
{ "HAVE_ATTRIBUTE_SENTINEL", "__attribute__((sentinel)) support",
|
||||
"DEFINES_FUNC", NULL, NULL,
|
||||
"static int __attribute__((sentinel)) func(int i, ...) { return i; }" },
|
||||
|
@ -61,5 +61,5 @@ for SYMBOL; do
|
||||
|
||||
echo "/* Generated stub for $SYMBOL */"
|
||||
|
||||
tail -n "+${LINE}" < "$FILE" | head -n "$NUM" | sed 's/^extern *//' | sed 's/PRINTF_FMT([^)]*)//' | sed 's/NON_NULL_ARGS([^)]*)//' | sed 's/NO_NULL_ARGS//g' | sed 's/NORETURN//g' | sed 's/LAST_ARG_NULL//g' | sed 's/WARN_UNUSED_RESULT//g' | sed 's/,/ UNNEEDED,/g' | sed 's/\([a-z0-9A-Z*_]* [a-z0-9A-Z*_]*\));/\1 UNNEEDED);/' | sed "s/;\$/$STUB/" | sed 's/[[:space:]]*$//'
|
||||
tail -n "+${LINE}" < "$FILE" | head -n "$NUM" | sed 's/^extern *//' | sed 's/PRINTF_FMT([^)]*)//' | sed 's/NON_NULL_ARGS([^)]*)//' | sed 's/NO_NULL_ARGS//g' | sed 's/NORETURN//g' | sed 's/RETURNS_NONNULL//g' | sed 's/LAST_ARG_NULL//g' | sed 's/WARN_UNUSED_RESULT//g' | sed 's/,/ UNNEEDED,/g' | sed 's/\([a-z0-9A-Z*_]* [a-z0-9A-Z*_]*\));/\1 UNNEEDED);/' | sed "s/;\$/$STUB/" | sed 's/[[:space:]]*$//'
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user