From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Philip Oakley <philipoakley@iee.org>,
Duy Nguyen <pclouds@gmail.com>, Git List <git@vger.kernel.org>
Subject: Re: /* compiler workaround */ - what was the issue?
Date: Fri, 6 May 2016 22:17:09 +0100 [thread overview]
Message-ID: <572D09D5.4060600@ramsayjones.plus.com> (raw)
In-Reply-To: <572CFCBC.3020103@ramsayjones.plus.com>
On 06/05/16 21:21, Ramsay Jones wrote:
> On 06/05/16 19:54, Junio C Hamano wrote:
>> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>>
[snip]
> I still can't get gcc to complain, e.g. (on top of above):
>
> $ git diff
> diff --git a/builtin/rev-list.c b/builtin/rev-list.c
> index deae1f3..845fcdc 100644
> --- a/builtin/rev-list.c
> +++ b/builtin/rev-list.c
> @@ -377,7 +377,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
> mark_edges_uninteresting(&revs, show_edge);
>
> if (bisect_list) {
> - int reaches = 0, all = 0;
> + int reaches, all;
>
> revs.commits = find_bisection(revs.commits, &reaches, &all,
> bisect_find_all);
> $ rm builtin/rev-list.o
> $ make V=1 CFLAGS='-g -O3 -Wall -Wextra -Wuninitialized -Wno-unused-parameter' builtin/rev-list.o
> cc -o builtin/rev-list.o -c -MF builtin/.depend/rev-list.o.d -MQ builtin/rev-list.o -MMD -MP -g -O3 -Wall -Wextra -Wuninitialized -Wno-unused-parameter -I. -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -DHAVE_PATHS_H -DHAVE_DEV_TTY -DXDL_FAST_HASH -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY -DNO_MKSTEMPS -DSHELL_PATH='"/bin/sh"' builtin/rev-list.c
> In file included from ./cache.h:4:0,
> from builtin/rev-list.c:1:
> ./git-compat-util.h: In function ‘xsize_t’:
> ./git-compat-util.h:838:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
> if (len > (size_t) len)
> ^
> $
BTW, another patch that I have hanging around ... this time the
patch below was built on master from a couple of years ago (so,
I haven't bothered to rebase it, but you should get the idea):
ATB,
Ramsay Jones
-- >8 --
Subject: [PATCH] git-compat-util.h: xsize_t(): avoid signed comparison warnings
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
git-compat-util.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index c07e0c1..3a9cf6c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -838,9 +838,10 @@ static inline char *xstrdup_or_null(const char *str)
static inline size_t xsize_t(off_t len)
{
- if (len > (size_t) len)
+ size_t r = (size_t)len;
+ if (len != (off_t)r)
die("Cannot handle files this big");
- return (size_t)len;
+ return r;
}
__attribute__((format (printf, 3, 4)))
--
2.8.0
prev parent reply other threads:[~2016-05-06 21:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AA5B2B1715BAF7438221293187A417A7BDE9D11D@desmdswms002.des.grplnk.net>
2016-05-05 20:48 ` /* compiler workaround */ - what was the issue? Philip Oakley
2016-05-05 21:41 ` Junio C Hamano
2016-05-06 10:17 ` Duy Nguyen
2016-05-06 13:15 ` Philip Oakley
2016-05-06 18:05 ` Ramsay Jones
2016-05-06 18:33 ` Philip Oakley
2016-05-06 18:54 ` Junio C Hamano
2016-05-06 19:30 ` Marc Branchaud
2016-05-06 19:57 ` Junio C Hamano
2016-05-06 20:01 ` Stefan Beller
2016-05-09 19:40 ` Philip Oakley
2016-05-09 19:49 ` Randall S. Becker
2016-05-06 20:28 ` Marc Branchaud
2016-05-06 20:21 ` Ramsay Jones
2016-05-06 21:17 ` Ramsay Jones [this message]
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=572D09D5.4060600@ramsayjones.plus.com \
--to=ramsay@ramsayjones.plus.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=philipoakley@iee.org \
/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).