git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 08/22] cache.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Feb 11, 2016, 12:38 UTC
Message-ID
<1455194339-859-9-git-send-email-gitter.spiros@gmail.com>
In-Reply-To
<1455194339-859-1-git-send-email-gitter.spiros@gmail.com>

Use the new FORMATPRINTF macro (in git-compat-util.h) to declare the gcc function attribute 'format printf'

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 cache.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/cache.h b/cache.h
index 553b04b..fb29154 100644
--- a/cache.h
+++ b/cache.h
@@ -763,24 +763,24 @@ extern int check_repository_format(void);
  * using the safer "dup" or "strbuf" formats below (in some cases, the
  * unsafe versions have already been removed).
  */
-extern const char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
-extern const char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
+extern const char *mkpath(const char *fmt, ...) FORMATPRINTF(1,2);
+extern const char *git_path(const char *fmt, ...) FORMATPRINTF(1,2);
 
 extern char *mksnpath(char *buf, size_t n, const char *fmt, ...)
-	__attribute__((format (printf, 3, 4)));
+	FORMATPRINTF(3,4);
 extern void strbuf_git_path(struct strbuf *sb, const char *fmt, ...)
-	__attribute__((format (printf, 2, 3)));
+	FORMATPRINTF(2,3);
 extern char *git_path_buf(struct strbuf *buf, const char *fmt, ...)
-	__attribute__((format (printf, 2, 3)));
+	FORMATPRINTF(2,3);
 extern void strbuf_git_path_submodule(struct strbuf *sb, const char *path,
 				      const char *fmt, ...)
-	__attribute__((format (printf, 3, 4)));
+	FORMATPRINTF(3,4);
 extern char *git_pathdup(const char *fmt, ...)
-	__attribute__((format (printf, 1, 2)));
+	FORMATPRINTF(1,2);
 extern char *mkpathdup(const char *fmt, ...)
-	__attribute__((format (printf, 1, 2)));
+	FORMATPRINTF(1,2);
 extern char *git_pathdup_submodule(const char *path, const char *fmt, ...)
-	__attribute__((format (printf, 2, 3)));
+	FORMATPRINTF(2,3);
 
 extern void report_linked_checkout_garbage(void);
 
@@ -1630,7 +1630,7 @@ struct key_value_info {
 	int linenr;
 };
 
-extern NORETURN void git_die_config(const char *key, const char *err, ...) __attribute__((format(printf, 2, 3)));
+extern NORETURN void git_die_config(const char *key, const char *err, ...) FORMATPRINTF(2,3);
 extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);
 
 extern int committer_ident_sufficiently_given(void);
@@ -1643,7 +1643,7 @@ extern const char *git_mailmap_blob;
 
 /* IO helper functions */
 extern void maybe_flush_or_die(FILE *, const char *);
-__attribute__((format (printf, 2, 3)))
+FORMATPRINTF(2,3)
 extern void fprintf_or_die(FILE *, const char *fmt, ...);
 
 #define COPY_READ_ERROR (-2)
-- 
2.5.0
Previous: Elia PintoNext: Elia Pinto
Message 11 of 28 in “add the FORMATPRINTF macro to declare the gcc function”
  1. 00/22 add the FORMATPRINTF macro to declare the gcc functionElia Pinto, Feb 11, 2016
  2. 01/22 git-compat-util.h: add the FORMATPRINTF macroElia Pinto, Feb 11, 2016
  3. 02/22 advice.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  4. 03/22 argv-array.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  5. Junio C HamanoFeb 11, 2016
  6. Junio C HamanoFeb 11, 2016
  7. 04/22 builtin/index-pack.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  8. 05/22 builtin/receive-pack.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  9. 06/22 builtin/update-index.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  10. 07/22 builtin/upload-archive.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  11. 08/22 cache.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  12. 09/22 color.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  13. 10/22 config.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  14. 11/22 daemon.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  15. 12/22 fsck.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  16. 13/22 http-backend.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  17. 14/22 imap-send.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  18. 15/22 merge-recursive.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  19. 16/22 pkt-line.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  20. 17/22 remote.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  21. 18/22 strbuf.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  22. 19/22 trace.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  23. 20/22 transport-helper.c: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  24. 21/22 utf8.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  25. 22/22 wt-status.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'Elia Pinto, Feb 11, 2016
  26. Junio C HamanoFeb 11, 2016
  27. Jeff KingFeb 11, 2016
  28. Junio C HamanoFeb 18, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.