]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add access attribute
authorAydın Mercan <aydin@isc.org>
Thu, 26 Feb 2026 06:07:52 +0000 (09:07 +0300)
committerAydın Mercan <aydin@isc.org>
Thu, 12 Mar 2026 11:34:46 +0000 (14:34 +0300)
The `access` attribute annotates functions if it will read from or write
to pointers with an optional byte size specifier if applicable. [1]

This attribute can prove useful to catch uninitialized reads or suppress
false warnings.

[1]: https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-access

lib/isc/include/isc/attributes.h

index 03c84ae4979cbe24c8483cf6da4025b75739f3bb..2cffeb0374ac0ba5025a5f4551a46a67f1a9cc2f 100644 (file)
 #else
 #define ISC_ATTR_NONNULL(...)
 #endif
+
+#if __has_attribute(__access__)
+#if __STDC_VERSION__ >= 202311L
+#define ISC_ATTR_ACCESS(...) [[gnu::access(__VA_ARGS__)]]
+#else /* __STDC_VERSION__ >= 202311L */
+#define ISC_ATTR_ACCESS(...) __attribute__((__access__(__VA_ARGS__)))
+#endif /* __STDC_VERSION__ >= 202311L */
+#else  /* __has_attribute(__access__) */
+#define ISC_ATTR_ACCESS(...)
+#endif /* __has_attribute(__access__) */