[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 05/18] qom: Make type checker functions accept const pointers
From: |
Eduardo Habkost |
Subject: |
[PATCH v4 05/18] qom: Make type checker functions accept const pointers |
Date: |
Mon, 31 Aug 2020 17:07:27 -0400 |
The existing type check macros all unconditionally drop const
qualifiers from their arguments. Keep this behavior in the
macros generated by DECLARE_*CHECKER* by now.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v3 -> v4: none
Changes v2 -> v3:
* Removed reference to _Generic on comment
Changes v1 -> v2:
* Removed note about _Generic from commit message, because it
won't be possible to do what I was planning without manual
#defines
---
include/qom/object.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 4cd84998c2..3626ae3c65 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -567,7 +567,7 @@ struct Object
*/
#define DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \
static inline G_GNUC_UNUSED InstanceType * \
- OBJ_NAME(void *obj) \
+ OBJ_NAME(const void *obj) \
{ return OBJECT_CHECK(InstanceType, obj, TYPENAME); }
/**
@@ -584,11 +584,11 @@ struct Object
*/
#define DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME) \
static inline G_GNUC_UNUSED ClassType * \
- OBJ_NAME##_GET_CLASS(void *obj) \
+ OBJ_NAME##_GET_CLASS(const void *obj) \
{ return OBJECT_GET_CLASS(ClassType, obj, TYPENAME); } \
\
static inline G_GNUC_UNUSED ClassType * \
- OBJ_NAME##_CLASS(void *klass) \
+ OBJ_NAME##_CLASS(const void *klass) \
{ return OBJECT_CLASS_CHECK(ClassType, klass, TYPENAME); }
/**
--
2.26.2
- [PATCH v4 00/18] qom: Automated conversion of type checking boilerplate, Eduardo Habkost, 2020/08/31
- [PATCH v4 03/18] qom: Allow class type name to be specified in OBJECT_DECLARE*, Eduardo Habkost, 2020/08/31
- [PATCH v4 01/18] qom: make object_ref/unref use a void * instead of Object *., Eduardo Habkost, 2020/08/31
- [PATCH v4 07/18] [automated] Delete duplicate QOM typedefs, Eduardo Habkost, 2020/08/31
- [PATCH v4 04/18] qom: DECLARE_*_CHECKERS macros, Eduardo Habkost, 2020/08/31
- [PATCH v4 05/18] qom: Make type checker functions accept const pointers,
Eduardo Habkost <=
- [PATCH v4 02/18] qom: provide convenient macros for declaring and defining types, Eduardo Habkost, 2020/08/31
- [PATCH v4 06/18] codeconverter: script for automating QOM code cleanups, Eduardo Habkost, 2020/08/31
- [PATCH v4 09/18] [automated] Move QOM typedefs and add missing includes (pass 2), Eduardo Habkost, 2020/08/31
- [PATCH v4 10/18] [automated] Move QOM typedefs and add missing includes (pass 3), Eduardo Habkost, 2020/08/31
- [PATCH v4 08/18] [automated] Move QOM typedefs and add missing includes, Eduardo Habkost, 2020/08/31
- [PATCH v4 12/18] [automated] Use DECLARE_*CHECKER* macros (pass 2), Eduardo Habkost, 2020/08/31
- [PATCH v4 14/18] [semi-automated] Use DECLARE_*CHECKER* when possible (--force mode), Eduardo Habkost, 2020/08/31
- [PATCH v4 13/18] [automated] Use DECLARE_*CHECKER* macros (pass 3), Eduardo Habkost, 2020/08/31
- [PATCH v4 17/18] [automated] Use OBJECT_DECLARE_TYPE where possible (pass 3), Eduardo Habkost, 2020/08/31
- [PATCH v4 11/18] [automated] Use DECLARE_*CHECKER* macros, Eduardo Habkost, 2020/08/31