]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
scripts: Adapt mock-noinline.py to ATTRIBUTE_MOCKABLE
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 28 Apr 2025 11:56:09 +0000 (13:56 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 2 May 2025 12:31:19 +0000 (14:31 +0200)
The script is renamed to mockable-attribute.py and adjusted to
check for the new attribute.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
build-aux/syntax-check.mk
scripts/meson.build
scripts/mockable-attribute.py [moved from scripts/mock-noinline.py with 91% similarity]

index d414e033dfbeaa64f526c8410e7cb0b0bb67f5da..09d3a5620cdd25676d60ab3546744696e54273e4 100644 (file)
@@ -1326,9 +1326,9 @@ sc_spacing-check:
        $(PERL) $(top_srcdir)/build-aux/check-spacing.pl || \
          { echo 'incorrect formatting' 1>&2; exit 1; }
 
-sc_mock-noinline:
+sc_mockable-attribute:
        $(AM_V_GEN)$(VC_LIST_EXCEPT) | $(GREP) '\.[ch]$$' | $(RUNUTF8) \
-       $(PYTHON) $(top_srcdir)/scripts/mock-noinline.py
+       $(PYTHON) $(top_srcdir)/scripts/mockable-attribute.py
 
 sc_header-ifdef:
        $(AM_V_GEN)$(VC_LIST_EXCEPT) | $(GREP) '\.[h]$$' | $(RUNUTF8) xargs \
index 2798e302ab800e2fdf3d6f508b0ab7394a0af3df..15a23e8738196916c264ab7ff3baeab708d8af95 100644 (file)
@@ -29,7 +29,7 @@ scripts = [
   'meson-install-web.py',
   'meson-python.sh',
   'meson-timestamp.py',
-  'mock-noinline.py',
+  'mockable-attribute.py',
   'prohibit-duplicate-header.py',
   'qemu-replies-tool.py',
 ]
similarity index 91%
rename from scripts/mock-noinline.py
rename to scripts/mockable-attribute.py
index 77a5ca23e2b576a2069e5bf1b8fa9b735d65dacb..c6695773e73ff6e0a8fe8984a4f8c8e0d252422b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 #
-# Copyright (C) 2017-2019 Red Hat, Inc.
+# Copyright (C) 2017-2025 Red Hat, Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,7 @@ import sys
 noninlined = {}
 mocked = {}
 
-# Functions in public header don't get the noinline annotation
+# Functions in public header don't get the noipa annotation
 noninlined["virEventAddTimeout"] = True
 # This one confuses the script as its defined in the mock file
 # but is actually just a local helper
@@ -43,7 +43,7 @@ def scan_annotations(filename):
             elif line.isspace():
                 func = None
 
-            if "G_NO_INLINE" in line:
+            if "ATTRIBUTE_MOCKABLE" in line:
                 if func is not None:
                     noninlined[func] = True
 
@@ -74,7 +74,7 @@ warned = False
 for func in mocked.keys():
     if func not in noninlined:
         warned = True
-        print("%s is mocked at %s but missing 'G_NO_INLINE' annotation" %
+        print("%s is mocked at %s but missing 'ATTRIBUTE_MOCKABLE' annotation" %
               (func, mocked[func]), file=sys.stderr)
 
 if warned: