]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
scripts: Properly declare g_auto() stub for cocci
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Nov 2021 16:32:54 +0000 (17:32 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 3 Nov 2021 13:46:54 +0000 (14:46 +0100)
While being great semantic patching tool, coccinelle fails to
understand some of macros we use (including those provided by
glib). What they have in common is use of __attribute__ under the
hood. We store a list of such macros in a file. But in there,
g_auto() macro is not defined properly. Indeed, g_auto(type)
declares a local variable of given type, for instance from
cocci's POV:

  g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
  virBuffer buf = VIR_BUFFER_INITIALIZER;

are both the same declaration. Fix declaration of g_auto() stub.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
scripts/cocci-macro-file.h

index a76ba533b45dfc95ede737272cb1e84e02779cca..4e6d218a97e7ffc5136ffb7fd3173bad8f8053bb 100644 (file)
@@ -34,6 +34,6 @@
 
 #define g_autoptr(x) x##_autoptr
 #define g_autofree
-#define g_auto
+#define g_auto(x) x
 
 #define BAD_CAST