Parcourir la source

libdpkg: Add and use new DPKG_ATTR_VPRINTF

This new attribute marks a function that uses format strings with a
va_list argument.
Guillem Jover il y a 16 ans
Parent
commit
812115a0f5
3 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 1 1
      lib/dpkg/dpkg.h
  2. 1 0
      lib/dpkg/macros.h
  3. 2 1
      lib/dpkg/varbuf.h

+ 1 - 1
lib/dpkg/dpkg.h

@@ -153,7 +153,7 @@ void do_internerr(const char *file, int line, const char *fmt, ...)
 #endif
 
 void ohshit(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
-void ohshitv(const char *fmt, va_list al) DPKG_ATTR_NORET;
+void ohshitv(const char *fmt, va_list al) DPKG_ATTR_NORET DPKG_ATTR_VPRINTF(1);
 void ohshite(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
 void werr(const char *what) DPKG_ATTR_NORET;
 void warning(const char *fmt, ...) DPKG_ATTR_PRINTF(1);

+ 1 - 0
lib/dpkg/macros.h

@@ -28,6 +28,7 @@
 #define DPKG_ATTR_CONST		__attribute__((const))
 #define DPKG_ATTR_NORET		__attribute__((noreturn))
 #define DPKG_ATTR_PRINTF(n)	__attribute__((format(printf, n, n + 1)))
+#define DPKG_ATTR_VPRINTF(n)	__attribute__((format(printf, n, 0)))
 #define DPKG_ATTR_SENTINEL	__attribute__((sentinel))
 #else
 #define DPKG_ATTR_UNUSED

+ 2 - 1
lib/dpkg/varbuf.h

@@ -77,7 +77,8 @@ void varbufsubstc(struct varbuf *v, int c_src, int c_dst);
 void varbufaddbuf(struct varbuf *v, const void *s, size_t size);
 
 int varbufprintf(struct varbuf *v, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
-int varbufvprintf(struct varbuf *v, const char *fmt, va_list va);
+int varbufvprintf(struct varbuf *v, const char *fmt, va_list va)
+	DPKG_ATTR_VPRINTF(2);
 
 DPKG_END_DECLS