This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=44db684c1621f8728f97ffbaadb236b2c9a83944

commit 44db684c1621f8728f97ffbaadb236b2c9a83944
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Dec 23 22:56:51 2022 +0100

    lib: Refactor format attributes into a common *_ATTR_FMT
    
    This should reduce the duplication and horizontal space usage somewhat.
---
 lib/compat/compat.h | 6 ++++--
 lib/dpkg/macros.h   | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/compat/compat.h b/lib/compat/compat.h
index 8a96fcf12..cad295ca7 100644
--- a/lib/compat/compat.h
+++ b/lib/compat/compat.h
@@ -48,9 +48,11 @@
 #endif
 
 #if LIBCOMPAT_GCC_VERSION >= 0x0300
-#define LIBCOMPAT_ATTR_PRINTF(n)       __attribute__((format(printf, n, n + 
1)))
-#define LIBCOMPAT_ATTR_VPRINTF(n)      __attribute__((format(printf, n, 0)))
+#define LIBCOMPAT_ATTR_FMT(t, f, a)    __attribute__((format(t, f, a)))
+#define LIBCOMPAT_ATTR_PRINTF(n)       LIBCOMPAT_ATTR_FMT(printf, n, n + 1)
+#define LIBCOMPAT_ATTR_VPRINTF(n)      LIBCOMPAT_ATTR_FMT(printf, n, 0)
 #else
+#define LIBCOMPAT_ATTR_FMT(t, f, a)
 #define LIBCOMPAT_ATTR_PRINTF(n)
 #define LIBCOMPAT_ATTR_VPRINTF(n)
 #endif
diff --git a/lib/dpkg/macros.h b/lib/dpkg/macros.h
index bf48c15c5..c85885440 100644
--- a/lib/dpkg/macros.h
+++ b/lib/dpkg/macros.h
@@ -70,9 +70,11 @@
 #endif
 
 #if DPKG_GCC_VERSION >= 0x0300
-#define DPKG_ATTR_PRINTF(n)    __attribute__((format(printf, n, n + 1)))
-#define DPKG_ATTR_VPRINTF(n)   __attribute__((format(printf, n, 0)))
+#define DPKG_ATTR_FMT(t, f, a) __attribute__((format(t, f, a)))
+#define DPKG_ATTR_PRINTF(n)    DPKG_ATTR_FMT(printf, n, n + 1)
+#define DPKG_ATTR_VPRINTF(n)   DPKG_ATTR_FMT(printf, n, 0)
 #else
+#define DPKG_ATTR_FMT(t, f, a)
 #define DPKG_ATTR_PRINTF(n)
 #define DPKG_ATTR_VPRINTF(n)
 #endif

-- 
Dpkg.Org's dpkg

Reply via email to