git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff Hostetler <git@jeffhostetler.com>
To: Wink Saville <wink@saville.com>, git@vger.kernel.org
Cc: gitster@pobox.com, jeffhost@microsoft.com
Subject: Re: [RFC PATCH 1/1] json-writer: incorrect format specifier
Date: Sat, 24 Mar 2018 07:11:59 -0400	[thread overview]
Message-ID: <d6af477d-6865-9580-0389-182a5c19d935@jeffhostetler.com> (raw)
In-Reply-To: <140b7646e7efa4175f9d82e6eb2909f2f94771fe.1521868951.git.wink@saville.com>



On 3/24/2018 1:37 AM, Wink Saville wrote:
> In routines jw_object_uint64 and jw_object_double strbuf_addf is
> invoked with strbuf_addf(&jw->json, ":%"PRIuMAX, value) where value
> is a uint64_t. This causes a compile error on OSX.
> 
> The correct format specifier is PRIu64 instead of PRIuMax.
> 
> Signed-off-by: Wink Saville <wink@saville.com>

That's odd.

A grep on the Git source tree did not find a "PRIu64" symbol.
Searching public-inbox only found one message [1] talking about it
(other than the ones associated with your messages here).

I have to wonder if that is defined in a OSX header file and
you're getting it from there [2].  (I don't have a MAC in front of
me, so I can't verify what's in that header.)  But [2] defines
PRIuMAX as PRIu64, so we shouldn't need to make that change in
json-writer -- unless something is getting lost in the #ifdefs.

Could you double check this in the header files on your system?
Any chance you are doing a 32-bit build?

Thanks
Jeff

[1] 
https://public-inbox.org/git/MWHPR21MB0478181AE0B64901DA2C07CDF4600@MWHPR21MB0478.namprd21.prod.outlook.com/raw

[2] https://opensource.apple.com/source/gcc/gcc-926/inttypes.h.auto.html


> ---
>   json-writer.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/json-writer.c b/json-writer.c
> index 89a6abb57..04045448a 100644
> --- a/json-writer.c
> +++ b/json-writer.c
> @@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)
>   	maybe_add_comma(jw);
>   
>   	append_quoted_string(&jw->json, key);
> -	strbuf_addf(&jw->json, ":%"PRIuMAX, value);
> +	strbuf_addf(&jw->json, ":%"PRIu64, value);
>   }
>   
>   void jw_object_double(struct json_writer *jw, const char *fmt,
> @@ -225,7 +225,7 @@ void jw_array_uint64(struct json_writer *jw, uint64_t value)
>   	assert_in_array(jw);
>   	maybe_add_comma(jw);
>   
> -	strbuf_addf(&jw->json, "%"PRIuMAX, value);
> +	strbuf_addf(&jw->json, "%"PRIu64, value);
>   }
>   
>   void jw_array_double(struct json_writer *jw, const char *fmt, double value)
> 

  reply	other threads:[~2018-03-24 11:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24  5:37 [RFC PATCH 0/1] json-writer: incorrect format specifier Wink Saville
2018-03-24  5:37 ` [RFC PATCH 1/1] " Wink Saville
2018-03-24 11:11   ` Jeff Hostetler [this message]
2018-03-24 15:14   ` Ramsay Jones
2018-03-24 16:07     ` Ramsay Jones
2018-03-26 17:04       ` Junio C Hamano
2018-03-26 17:39         ` Jeff Hostetler
2018-03-27  3:26         ` Ramsay Jones
2018-03-27 10:24           ` Jeff Hostetler
2018-03-24 18:38 ` [RFC PATCH 0/1] json-writer: add cast to uintmax_t Wink Saville
2018-03-24 18:38 ` [RFC PATCH v2 1/1] " Wink Saville
2018-03-26 17:36   ` Jeff Hostetler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6af477d-6865-9580-0389-182a5c19d935@jeffhostetler.com \
    --to=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=wink@saville.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).