aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-02-24 00:58:22 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-03-22 14:40:51 +0400
commitc08401793a1f298b4d52410835b01ca9b64c313a (patch)
treedc6e619b3732ab994e9597f26bb8a98b7cdf8430
parent9edc6313da34699ebd2bae4573ea22339b26450a (diff)
downloadqemu-c08401793a1f298b4d52410835b01ca9b64c313a.zip
qemu-c08401793a1f298b4d52410835b01ca9b64c313a.tar.gz
qemu-c08401793a1f298b4d52410835b01ca9b64c313a.tar.bz2
compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
-rw-r--r--block/qcow2-refcount.c20
-rw-r--r--include/qemu-common.h2
-rw-r--r--include/qemu/compiler.h2
-rw-r--r--include/qemu/range.h4
-rwxr-xr-xscripts/checkpatch.pl2
-rw-r--r--scripts/cocci-macro-file.h2
6 files changed, 16 insertions, 16 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 9403397..b914994 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -33,9 +33,11 @@
static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size,
uint64_t max);
-static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
- int64_t offset, int64_t length, uint64_t addend,
- bool decrease, enum qcow2_discard_type type);
+
+G_GNUC_WARN_UNUSED_RESULT
+static int update_refcount(BlockDriverState *bs,
+ int64_t offset, int64_t length, uint64_t addend,
+ bool decrease, enum qcow2_discard_type type);
static uint64_t get_refcount_ro0(const void *refcount_array, uint64_t index);
static uint64_t get_refcount_ro1(const void *refcount_array, uint64_t index);
@@ -803,12 +805,12 @@ found:
/* XXX: cache several refcount block clusters ? */
/* @addend is the absolute value of the addend; if @decrease is set, @addend
* will be subtracted from the current refcount, otherwise it will be added */
-static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
- int64_t offset,
- int64_t length,
- uint64_t addend,
- bool decrease,
- enum qcow2_discard_type type)
+static int update_refcount(BlockDriverState *bs,
+ int64_t offset,
+ int64_t length,
+ uint64_t addend,
+ bool decrease,
+ enum qcow2_discard_type type)
{
BDRVQcow2State *s = bs->opaque;
int64_t start, last, cluster_offset;
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 9c04fa9..19e254d 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -27,7 +27,7 @@ int qemu_main(int argc, char **argv, char **envp);
#endif
ssize_t qemu_write_full(int fd, const void *buf, size_t count)
- QEMU_WARN_UNUSED_RESULT;
+ G_GNUC_WARN_UNUSED_RESULT;
#ifndef _WIN32
int qemu_pipe(int pipefd[2]);
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index f2bd050..8385e47 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -19,8 +19,6 @@
#define QEMU_NORETURN __attribute__ ((__noreturn__))
-#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-
#define QEMU_SENTINEL __attribute__((sentinel))
#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
diff --git a/include/qemu/range.h b/include/qemu/range.h
index f62b363..7e2b1cc 100644
--- a/include/qemu/range.h
+++ b/include/qemu/range.h
@@ -114,8 +114,8 @@ static inline uint64_t range_upb(Range *range)
* @size may be 0. If the range would overflow, returns -ERANGE, otherwise
* 0.
*/
-static inline int QEMU_WARN_UNUSED_RESULT range_init(Range *range, uint64_t lob,
- uint64_t size)
+G_GNUC_WARN_UNUSED_RESULT
+static inline int range_init(Range *range, uint64_t lob, uint64_t size)
{
if (lob + size < lob) {
return -ERANGE;
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a07f0ef..797738a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -224,7 +224,7 @@ our $Attribute = qr{
const|
volatile|
QEMU_NORETURN|
- QEMU_WARN_UNUSED_RESULT|
+ G_GNUC_WARN_UNUSED_RESULT|
QEMU_SENTINEL|
QEMU_PACKED|
G_GNUC_PRINTF
diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h
index c2fcea8..9daec24 100644
--- a/scripts/cocci-macro-file.h
+++ b/scripts/cocci-macro-file.h
@@ -20,7 +20,7 @@
/* From qemu/compiler.h */
#define QEMU_NORETURN __attribute__ ((__noreturn__))
-#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#define QEMU_SENTINEL __attribute__((sentinel))
#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))