coccinelle: add g_assert_cmp* to macro file
PATCH 1/1 coccinelle: add g_assert_cmp* to macro file
This helps applying semantic patches to unit tests.
Signed-off-by Paolo Bonzini <[email protected]>
--- scripts/cocci-macro-file.h | 6 ++++++ 1 file changed, 6 insertions(+)
scripts/cocci-macro-file.h +6 -0
@@ -117,3 +117,9 @@ struct { \type *tqe_next;/* next element */ \type **tqe_prev;/* address of previous next element */ \ } + +/* From glib */ +#define g_assert_cmpint (a, op, b) g_assert(a op b) +#define g_assert_cmpuint (a, op, b) g_assert(a op b) +#define g_assert_cmphex (a, op, b) g_assert(a op b) +#define g_assert_cmpstr (a, op, b) g_assert(strcmp(a, b) op 0)
Signature · 1 line
2.5.5
Quoted 6 lines · Paolo Bonzini
This helps applying semantic patches to unit tests.
Signed-off-by Paolo Bonzini <[email protected]>--- scripts/cocci-macro-file.h | 6 ++++++ 1 file changed, 6 insertions(+)
Reviewed-by Eric Blake <[email protected]>
scripts/cocci-macro-file.h struct { \ · line 123
Quoted 13 lines
scripts/cocci-macro-file.h +4
-0@@ -117,3 +117,9 @@ struct { \type *tqe_next;/* next element */ \type **tqe_prev;/* address of previous next element */ \ } + +/* From glib */ +#define g_assert_cmpint (a, op, b) g_assert(a op b) +#define g_assert_cmpuint (a, op, b) g_assert(a op b)
Odd indentation, compared to the other lines.
Quoted 3 lines
scripts/cocci-macro-file.h +2
-0+#define g_assert_cmphex (a, op, b) g_assert(a op b) +#define g_assert_cmpstr (a, op, b) g_assert(strcmp(a, b) op 0)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org