Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-23 Thread Jeff King
On Tue, Sep 23, 2014 at 03:52:21AM -0400, Eric Sunshine wrote: > > That is my reading from the warning text, too, but I have to wonder: > > wouldn't that mean they should be warning about pointer + pointer, not > > pointer + int? > > 'pointer + pointer' is not legal C, is it? What would the resul

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-23 Thread Eric Sunshine
On Tue, Sep 23, 2014 at 3:51 AM, Jeff King wrote: > On Mon, Sep 22, 2014 at 11:26:14PM -0700, Junio C Hamano wrote: > >> On Mon, Sep 22, 2014 at 11:04 PM, Jeff King wrote: >> > >> > I don't mind silencing this one warning (even though I find it a little >> > ridiculous). I'm slightly concerned th

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-23 Thread Eric Sunshine
On Tue, Sep 23, 2014 at 2:26 AM, Junio C Hamano wrote: > On Mon, Sep 22, 2014 at 11:04 PM, Jeff King wrote: >> >> I don't mind silencing this one warning (even though I find it a little >> ridiculous). I'm slightly concerned that more brain-damage may be coming >> our way, but we can deal with th

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-23 Thread Eric Sunshine
On Tue, Sep 23, 2014 at 2:04 AM, Jeff King wrote: > On Mon, Sep 22, 2014 at 05:10:08PM -0400, Eric Sunshine wrote: > >> On Mon, Sep 22, 2014 at 1:41 PM, Junio C Hamano wrote: >> > Eric Sunshine writes: >> > >> >> The just-released Apple Xcode 6.0.1 has -Wstring-plus-int enabled by >> >> default

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-23 Thread Jeff King
On Mon, Sep 22, 2014 at 11:26:14PM -0700, Junio C Hamano wrote: > On Mon, Sep 22, 2014 at 11:04 PM, Jeff King wrote: > > > > I don't mind silencing this one warning (even though I find it a little > > ridiculous). I'm slightly concerned that more brain-damage may be coming > > our way, but we can

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-22 Thread Junio C Hamano
On Mon, Sep 22, 2014 at 11:04 PM, Jeff King wrote: > > I don't mind silencing this one warning (even though I find it a little > ridiculous). I'm slightly concerned that more brain-damage may be coming > our way, but we can deal with that if it ever does. > > Like Junio, I prefer keeping strlen()

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-22 Thread Jeff King
On Mon, Sep 22, 2014 at 05:10:08PM -0400, Eric Sunshine wrote: > On Mon, Sep 22, 2014 at 1:41 PM, Junio C Hamano wrote: > > Eric Sunshine writes: > > > >> The just-released Apple Xcode 6.0.1 has -Wstring-plus-int enabled by > >> default which complains about pointer arithmetic applied to a strin

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-22 Thread Eric Sunshine
On Mon, Sep 22, 2014 at 4:50 PM, Junio C Hamano wrote: > Eric Sunshine writes: > >> however, the solution in this patch allows us drop a couple strlen()s in >> favor of sizeof()s. > > It is actually not a very good justification when you know you care > about the length of the string. A decent c

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-22 Thread Eric Sunshine
On Mon, Sep 22, 2014 at 1:41 PM, Junio C Hamano wrote: > Eric Sunshine writes: > >> The just-released Apple Xcode 6.0.1 has -Wstring-plus-int enabled by >> default which complains about pointer arithmetic applied to a string >> literal: >> >> builtin/mailinfo.c:303:24: warning: >> add

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-22 Thread Junio C Hamano
Eric Sunshine writes: > however, the solution in this patch allows us drop a couple strlen()s in > favor of sizeof()s. It is actually not a very good justification when you know you care about the length of the string. A decent compiler ought to know the length of a constant string can be compu

Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-22 Thread Junio C Hamano
Eric Sunshine writes: > The just-released Apple Xcode 6.0.1 has -Wstring-plus-int enabled by > default which complains about pointer arithmetic applied to a string > literal: > > builtin/mailinfo.c:303:24: warning: > adding 'long' to a string does not append to the string >

[PATCH] mailinfo: resolve -Wstring-plus-int warning

2014-09-21 Thread Eric Sunshine
The just-released Apple Xcode 6.0.1 has -Wstring-plus-int enabled by default which complains about pointer arithmetic applied to a string literal: builtin/mailinfo.c:303:24: warning: adding 'long' to a string does not append to the string return !memcmp(SAMPLE + (cp - line)