git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix a warning (on cygwin) to allow -Werror
@ 2008-08-26 17:50 Ramsay Jones
  2008-08-27  7:57 ` Johannes Sixt
  0 siblings, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2008-08-26 17:50 UTC (permalink / raw)
  To: GIT Mailing-list; +Cc: Junio C Hamano, Steffen Prohaska


Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Noticed while building 1.6.0 from the release tar-ball.

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)

ATB,

Ramsay Jones

 builtin-fast-export.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index 0709716..7c93eb8 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -417,7 +417,8 @@ static void export_marks(char *file)
 	for (i = 0; i < idnums.size; i++) {
 		if (deco->base && deco->base->type == 1) {
 			mark = ptr_to_mark(deco->decoration);
-			fprintf(f, ":%u %s\n", mark, sha1_to_hex(deco->base->sha1));
+			fprintf(f, ":%"PRIu32" %s\n", mark,
+				sha1_to_hex(deco->base->sha1));
 		}
 		deco++;
 	}
-- 
1.6.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix a warning (on cygwin) to allow -Werror
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Sixt @ 2008-08-27  7:57 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list, Junio C Hamano, Steffen Prohaska

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.

-- Hannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix a warning (on cygwin) to allow -Werror
  2008-08-27  7:57 ` Johannes Sixt
@ 2008-08-28 16:09   ` Ramsay Jones
  2008-08-29  6:23     ` Johannes Sixt
  0 siblings, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2008-08-28 16:09 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: GIT Mailing-list, Junio C Hamano, Steffen Prohaska

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix a warning (on cygwin) to allow -Werror
  2008-08-28 16:09   ` Ramsay Jones
@ 2008-08-29  6:23     ` Johannes Sixt
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2008-08-29  6:23 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list, Junio C Hamano, Steffen Prohaska

Ramsay Jones schrieb:
> (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)

We have to: MinGW include files are not C99.

-- Hannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-29  6:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-08-29  6:23     ` Johannes Sixt

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).