qom: Don't keep error value between object_property_parse() calls
[qemu/ar7.git] / scripts / cocci-macro-file.h
blob7e200a1023d5e4c533853e4278ccd505c6154485
1 /* Macro file for Coccinelle
3 * Copyright (C) 2015 Red Hat, Inc.
5 * Authors:
6 * Paolo Bonzini <pbonzini@redhat.com>
8 * This work is licensed under the terms of the GNU GPL, version 2 or, at your
9 * option, any later version. See the COPYING file in the top-level directory.
12 /* Coccinelle only does limited parsing of headers, and chokes on some idioms
13 * defined in compiler.h and queue.h. Macros that Coccinelle must know about
14 * in order to parse .c files must be in a separate macro file---which is
15 * exactly what you're staring at now.
17 * To use this file, add the "--macro-file scripts/cocci-macro-file.h" to the
18 * Coccinelle command line.
21 /* From qemu/compiler.h */
22 #define QEMU_GNUC_PREREQ(maj, min) 1
23 #define QEMU_NORETURN __attribute__ ((__noreturn__))
24 #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
25 #define QEMU_SENTINEL __attribute__((sentinel))
26 #define QEMU_PACKED __attribute__((gcc_struct, packed))
28 #define cat(x,y) x ## y
29 #define cat2(x,y) cat(x,y)
30 #define QEMU_BUILD_BUG_ON(x) \
31 typedef char cat2(qemu_build_bug_on__,__LINE__)[(x)?-1:1] __attribute__((unused));
33 #define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
35 #define xglue(x, y) x ## y
36 #define glue(x, y) xglue(x, y)
37 #define stringify(s) tostring(s)
38 #define tostring(s) #s
40 #define typeof_field(type, field) typeof(((type *)0)->field)
41 #define type_check(t1,t2) ((t1*)0 - (t2*)0)
43 /* From qemu/queue.h */
45 #define QLIST_HEAD(name, type) \
46 struct name { \
47 struct type *lh_first; /* first element */ \
50 #define QLIST_HEAD_INITIALIZER(head) \
51 { NULL }
53 #define QLIST_ENTRY(type) \
54 struct { \
55 struct type *le_next; /* next element */ \
56 struct type **le_prev; /* address of previous next element */ \
60 * Singly-linked List definitions.
62 #define QSLIST_HEAD(name, type) \
63 struct name { \
64 struct type *slh_first; /* first element */ \
67 #define QSLIST_HEAD_INITIALIZER(head) \
68 { NULL }
70 #define QSLIST_ENTRY(type) \
71 struct { \
72 struct type *sle_next; /* next element */ \
76 * Simple queue definitions.
78 #define QSIMPLEQ_HEAD(name, type) \
79 struct name { \
80 struct type *sqh_first; /* first element */ \
81 struct type **sqh_last; /* addr of last next element */ \
84 #define QSIMPLEQ_HEAD_INITIALIZER(head) \
85 { NULL, &(head).sqh_first }
87 #define QSIMPLEQ_ENTRY(type) \
88 struct { \
89 struct type *sqe_next; /* next element */ \
93 * Tail queue definitions.
95 #define Q_TAILQ_HEAD(name, type, qual) \
96 struct name { \
97 qual type *tqh_first; /* first element */ \
98 qual type *qual *tqh_last; /* addr of last next element */ \
100 #define QTAILQ_HEAD(name, type) \
101 struct name { \
102 type *tqh_first; /* first element */ \
103 type **tqh_last; /* addr of last next element */ \
106 #define QTAILQ_HEAD_INITIALIZER(head) \
107 { NULL, &(head).tqh_first }
109 #define Q_TAILQ_ENTRY(type, qual) \
110 struct { \
111 qual type *tqe_next; /* next element */ \
112 qual type *qual *tqe_prev; /* address of previous next element */\
114 #define QTAILQ_ENTRY(type) \
115 struct { \
116 type *tqe_next; /* next element */ \
117 type **tqe_prev; /* address of previous next element */ \
120 /* From glib */
121 #define g_assert_cmpint(a, op, b) g_assert(a op b)
122 #define g_assert_cmpuint(a, op, b) g_assert(a op b)
123 #define g_assert_cmphex(a, op, b) g_assert(a op b)
124 #define g_assert_cmpstr(a, op, b) g_assert(strcmp(a, b) op 0)