[PATCH 6/6] git-compat-util.h: add __attribute__((printf)) to git_*printf*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add __attribute__((printf)) to the compatibility functions we use
under SNPRINTF_RETURNS_BOGUS=Y.

In practice this is redundant to the compiler's default printf format
checking, since we mostly (entirely?)  develop and test on platforms
where SNPRINTF_RETURNS_BOGUS is not set. I'm doing this mainly for
consistency with other code, now we don't need to think about why this
particular case is different.

See c4582f93a26 (Add compat/snprintf.c for systems that return bogus,
2008-03-05) for the commit that added these functions.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 git-compat-util.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/git-compat-util.h b/git-compat-util.h
index dca72cba294..af098d5c932 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -788,12 +788,14 @@ FILE *git_fopen(const char*, const char*);
 #undef snprintf
 #endif
 #define snprintf git_snprintf
+__attribute__((format (printf, 3, 4)))
 int git_snprintf(char *str, size_t maxsize,
 		 const char *format, ...);
 #ifdef vsnprintf
 #undef vsnprintf
 #endif
 #define vsnprintf git_vsnprintf
+__attribute__((format (printf, 3, 0)))
 int git_vsnprintf(char *str, size_t maxsize,
 		  const char *format, va_list ap);
 #endif
-- 
2.32.0.636.g43e71d69cff




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux