git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: GIT Mailing-list <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Steffen Prohaska <prohaska@zib.de>
Subject: Re: [PATCH] Fix a warning (on cygwin) to allow -Werror
Date: Thu, 28 Aug 2008 17:09:03 +0100	[thread overview]
Message-ID: <48B6CD9F.6020302@ramsay1.demon.co.uk> (raw)
In-Reply-To: <48B508F0.70402@viscovery.net>

Johannes Sixt wrote:
> Ramsay Jones schrieb:
>> Also, I noticed that git_ntohl() is still defined in compat/mingw.h; is this
>> still required?  It's not a problem, just curious! (I don't have mingw
>> installed, so I can't test myself)
> 
> Yes, it's still needed. The reason is that on Windows ntohl() returns
> 'unsigned long', and then gcc warns about
> 
> sha1_file.c:700: warning: unsigned int format, u_long arg (arg 3)
> 
> git_ntohl() is the workaround.

OK, Thanks.

Ah, yes, everything works on cygwin and Linux because:

                             Linux           Cygwin
    ntohl() returns:         uint32_t        uint32_t
    uint32_t typedef-ed as:  unsigned int    unsigned long
    PRIu32 #define-d as:     "u"             "lu"

So, I suspect (IOW I am guessing that) mingw must have:

    ntohl() returns:         unsigned long (well u_long anyway)
    uint32_t typedef-ed as:  unsigned int
    PRIu32 #define-d ad:     "u"

(I've just noticed that you are not #include-ing inttypes.h, so you are
relying on the PRIu32 defined in git-compat-util.h)

If the above is true, then well, ... Bummer ;-)

I suppose a (very) slight improvement would be to change the return type
of your git_ntohl() wrapper to uint32_t. (But we are talking very slight ;-)

ATB,

Ramsay Jones

  reply	other threads:[~2008-08-28 17:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26 17:50 [PATCH] Fix a warning (on cygwin) to allow -Werror Ramsay Jones
2008-08-27  7:57 ` Johannes Sixt
2008-08-28 16:09   ` Ramsay Jones [this message]
2008-08-29  6:23     ` Johannes Sixt

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

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

  git send-email \
    --in-reply-to=48B6CD9F.6020302@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=prohaska@zib.de \
    /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.
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 NNTP newsgroup(s).