From: Ján Tomko
Date: Fri, 18 Oct 2019 21:12:19 +0000 (+0200)
Subject: docs: hacking: mention compiler annotations
X-Git-Tag: v5.9.0-rc1~74
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e30c787a0cef6cc7dccb4da730b6163e1d1c485b;p=thirdparty%2Flibvirt.git
docs: hacking: mention compiler annotations
Mention all the __attribute__ annotations we use to make the compiler
and/or the static analysis tools understand the code better.
Signed-off-by: Ján Tomko
Reviewed-by: Daniel P. Berrangé
Reviewed-by: Andrea Bolognani
---
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index ae4d14e7b7..f3ad43eee7 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -985,6 +985,25 @@ BAD:
it points to, or it is aliased to another pointer that is.
+
+
+ Use the following annotations to help the compiler and/or static
+ analysis tools understand the code better:
+
+
+
+ Macro | Meaning |
+ ATTRIBUTE_NONNULL | passing NULL for this parameter is not allowed |
+ ATTRIBUTE_PACKED | force a structure to be packed |
+ G_GNUC_FALLTHROUGH | allow code reuse by multiple switch cases |
+ G_GNUC_NO_INLINE | the function is mocked in the test suite |
+ G_GNUC_NORETURN | the function never returns |
+ G_GNUC_NULL_TERMINATED | last parameter must be NULL |
+ G_GNUC_PRINTF | validate that the formatting string matches parameters |
+ G_GNUC_UNUSED | parameter is unused in this implementation of the function |
+ G_GNUC_WARN_UNUSED_RESULT | the return value must be checked |
+
+