mirror of
https://github.com/opnsense/src.git
synced 2026-02-19 02:30:08 -05:00
cdefs: Add __writeonly to mark write only vars
When a variable in write only and can't be removed, e.g. for API reasons, it is useful to document this fact similar to __diagused and __witness_used. Add __writeonly to tell the compiler and anyone looking at the code that this variable is expected to only be written to, and to not raise and error. Reviewed by: imp, kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45561 (cherry picked from commit a7ae78caaa17ff840da844c1dcaa780d194c9e20)
This commit is contained in:
parent
258672fe62
commit
833ccd66da
1 changed files with 1 additions and 0 deletions
|
|
@ -218,6 +218,7 @@
|
|||
#define __aligned(x) __attribute__((__aligned__(x)))
|
||||
#define __section(x) __attribute__((__section__(x)))
|
||||
#endif
|
||||
#define __writeonly __unused
|
||||
#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
|
||||
#define __alloc_size(x) __attribute__((__alloc_size__(x)))
|
||||
#define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue