9.41 __attribute__((nonnull)) function attribute

This function attribute specifies function parameters that are not supposed to be null pointers. This enables the compiler to generate a warning on encountering such a parameter.

Note

This function attribute is a GNU compiler extension that the ARM compiler supports.

Syntax

__attribute__((nonnull(arg-index, ...)))
Where arg-index, ... denotes the argument index list.
If no argument index list is specified, all pointer arguments are marked as nonnull.

Examples

The following declarations are equivalent:
void * my_memcpy (void *dest, const void *src, size_t len) __attribute__((nonnull (1, 2)));
void * my_memcpy (void *dest, const void *src, size_t len) __attribute__((nonnull));
Non-ConfidentialPDF file icon PDF versionARM DUI0375E
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.