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

Re: [PATCH 03/22] argv-array.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 11, 2016, 20:53 UTC
Message-ID
<xmqqd1s3vuhy.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1455194339-859-4-git-send-email-gitter.spiros@gmail.com>
Elia Pinto <gitter.spiros@gmail.com> writes:
Show 21 quoted lines
> 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>
> ---
>  argv-array.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/argv-array.h b/argv-array.h
> index a2fa0aa..e303dfd 100644
> --- a/argv-array.h
> +++ b/argv-array.h
> @@ -13,7 +13,7 @@ struct argv_array {
>  
>  void argv_array_init(struct argv_array *);
>  void argv_array_push(struct argv_array *, const char *);
> -__attribute__((format (printf,2,3)))
> +FORMATPRINTF(2,3)
>  void argv_array_pushf(struct argv_array *, const char *fmt, ...);
>  LAST_ARG_MUST_BE_NULL
>  void argv_array_pushl(struct argv_array *, ...);
OK, this may answer my previous question.

It might be pleasing to the eyes when these two macros appearing together in all CAPS, making them look similar and consistent, perhaps with two more tweaks:

 - Imitate LAST_ARG_MUST_BE_NULL and spell it FORMAT_PRINTF;
 - Consistently have SP after comma, i.e. FORMAT_PRINTF(2, 3),
   or to make it obvious that this thing is a special magic, drop SP
   (i.e. this patch would stay the same but some other patches left
   a space after comma, which made them look more inconsistent).
Thanks.  I am not 100% sold on this yet, though.
 
Previous: Elia PintoNext: Junio C Hamano
Message 5 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.