[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/38] coroutine: annotate coroutine_fn for libclang
From: |
Kevin Wolf |
Subject: |
[PULL 04/38] coroutine: annotate coroutine_fn for libclang |
Date: |
Fri, 20 Jan 2023 13:25:59 +0100 |
From: Alberto Faria <afaria@redhat.com>
Clang has a generic __annotate__ attribute that can be used by
static analyzers to understand properties of functions and
analyze the control flow. Furthermore, unlike TSA annotations, the
__annotate__ attribute applies to function pointers as well.
As a first step towards static analysis of coroutine_fn markers,
attach the attribute to the marker when compiling with clang.
Signed-off-by: Alberto Faria <afaria@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20221216110758.559947-2-pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/qemu/coroutine.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h
index 89650a2d7f..b0c97f6fb7 100644
--- a/include/qemu/coroutine.h
+++ b/include/qemu/coroutine.h
@@ -42,7 +42,11 @@
* ....
* }
*/
+#ifdef __clang__
+#define coroutine_fn __attribute__((__annotate__("coroutine_fn")))
+#else
#define coroutine_fn
+#endif
typedef struct Coroutine Coroutine;
--
2.38.1
- [PULL 00/38] Block layer patches, Kevin Wolf, 2023/01/20
- [PULL 01/38] tests/qemu-iotests/312: Mark "quorum" as required driver, Kevin Wolf, 2023/01/20
- [PULL 04/38] coroutine: annotate coroutine_fn for libclang,
Kevin Wolf <=
- [PULL 03/38] pflash: Only read non-zero parts of backend image, Kevin Wolf, 2023/01/20
- [PULL 02/38] tests/qemu-iotests/262: Check for availability of "blkverify" first, Kevin Wolf, 2023/01/20
- [PULL 06/38] qemu-io: do not reinvent the blk_pwrite_zeroes wheel, Kevin Wolf, 2023/01/20
- [PULL 07/38] block: remove bdrv_coroutine_enter, Kevin Wolf, 2023/01/20
- [PULL 08/38] qcow2: Fix theoretical corruption in store_bitmap() error path, Kevin Wolf, 2023/01/20
- [PULL 05/38] block: Add no_coroutine_fn and coroutine_mixed_fn marker, Kevin Wolf, 2023/01/20
- [PULL 10/38] qemu-img bitmap: Report errors while closing the image, Kevin Wolf, 2023/01/20
- [PULL 11/38] qemu-iotests: Test qemu-img bitmap/commit exit code on error, Kevin Wolf, 2023/01/20
- [PULL 09/38] qemu-img commit: Report errors while closing the image, Kevin Wolf, 2023/01/20
- [PULL 13/38] block: Convert bdrv_io_plug() to co_wrapper, Kevin Wolf, 2023/01/20