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=720d30be859814bdb5ee22564b09481952303dfc

commit 720d30be859814bdb5ee22564b09481952303dfc
Author: Guillem Jover <[email protected]>
AuthorDate: Sun Nov 16 19:10:47 2025 +0100

    libcompat: Add support for __format_arg__ attribute
    
    We need this to mark functions that take a format argument that they
    will end up returning, so that the compiler knows that it can check its
    arguments as part of the outer function call that makes use of the
    format string.
---
 lib/compat/compat.h  | 2 ++
 lib/compat/gettext.h | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/lib/compat/compat.h b/lib/compat/compat.h
index 87821e3ed..0e5c842c5 100644
--- a/lib/compat/compat.h
+++ b/lib/compat/compat.h
@@ -71,10 +71,12 @@
 
 #if LIBCOMPAT_GCC_VERSION >= 0x0300 || __has_attribute(__format__)
 #define LIBCOMPAT_ATTR_FMT(t, f, a)    __attribute__((__format__(t, f, a)))
+#define LIBCOMPAT_ATTR_FMT_ARG(n)      __attribute__((__format_arg__(n)))
 #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_FMT_ARG(n)
 #define LIBCOMPAT_ATTR_PRINTF(n)
 #define LIBCOMPAT_ATTR_VPRINTF(n)
 #endif
diff --git a/lib/compat/gettext.h b/lib/compat/gettext.h
index 69cb4483a..080ddbe14 100644
--- a/lib/compat/gettext.h
+++ b/lib/compat/gettext.h
@@ -22,6 +22,12 @@
 /* NLS can be disabled through the configure --disable-nls option.  */
 #if ENABLE_NLS
 
+# if __has_attribute(__format_arg__)
+#   define GETTEXT_ATTR_FMT_ARG(n) __attribute__((__format_arg__(n)))
+# else
+#   define GETTEXT_ATTR_FMT_ARG(n)
+# endif
+
 /* Get declarations of GNU message catalog functions.  */
 # include <libintl.h>
 

-- 
Dpkg.Org's dpkg

Reply via email to