Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-06 Thread Johannes Schindelin
Hi Junio, On Fri, 5 Aug 2016, Junio C Hamano wrote: > Johannes Schindelin writes: > > > This setup will from now on test next & pu in the Git for Windows SDK, and > > rebase Git for Windows' current master to git.git's maint, master, next & > > pu, every morning

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-06 Thread René Scharfe
Am 05.08.2016 um 23:57 schrieb Junio C Hamano: Johannes Schindelin writes: Hi Junio & René, On Thu, 4 Aug 2016, Junio C Hamano wrote: Let's try it this way. How about this as a replacement? I like it (with the if (s2) test intead of if (s1), of course). But

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-05 Thread Junio C Hamano
Johannes Schindelin writes: > Hi Junio & René, > > On Thu, 4 Aug 2016, Junio C Hamano wrote: > >> Let's try it this way. How about this as a replacement? > > I like it (with the if (s2) test intead of if (s1), of course). But please > record René as author, maybe

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-05 Thread Junio C Hamano
Johannes Schindelin writes: > This setup will from now on test next & pu in the Git for Windows SDK, and > rebase Git for Windows' current master to git.git's maint, master, next & > pu, every morning after a weekday (unless I forget to turn on my laptop, > that is).

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-05 Thread Johannes Schindelin
Hi Junio, On Thu, 4 Aug 2016, Junio C Hamano wrote: > Johannes Schindelin writes: > > > With GCC 6, the strdup() function is declared with the "nonnull" > > attribute, stating that it is not allowed to pass a NULL value as > > parameter. > > > > In nedmalloc()'s

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-05 Thread Johannes Schindelin
Hi Junio & René, On Thu, 4 Aug 2016, Junio C Hamano wrote: > Let's try it this way. How about this as a replacement? I like it (with the if (s2) test intead of if (s1), of course). But please record René as author, maybe mentioning myself with a "Diagnosed-by:" line. FWIW today's `pu` does

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-05 Thread Jeff King
On Thu, Aug 04, 2016 at 11:24:32PM -0700, Junio C Hamano wrote: > I do not know if we want to worry about st_add(1, strlen(s1)) > overflow around here, though. > [...] > + size_t len = strlen(s1) + 1; I wondered that, too, but I don't think it's possible. To overflow the size_t with "+1",

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-05 Thread Junio C Hamano
Johannes Sixt writes: > Oh! This is a typo. You meant to check s2 for NULL. > > And the declaration for s2 should remain, of course. Yeah, the moral of the story is don't try to do something you do not usually do X-<. The second try (the log message is the same). I do not know

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-04 Thread Johannes Sixt
Am 05.08.2016 um 07:36 schrieb Johannes Sixt: Am 05.08.2016 um 00:39 schrieb Junio C Hamano: @@ -955,12 +955,10 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void ** */ char *strdup(const char *s1) { -char *s2 = 0; -if (s1) { -size_t len =

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-04 Thread Johannes Sixt
Am 05.08.2016 um 00:39 schrieb Junio C Hamano: @@ -955,12 +955,10 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void ** */ char *strdup(const char *s1) { - char *s2 = 0; - if (s1) { - size_t len = strlen(s1) + 1; - s2 =

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-04 Thread Junio C Hamano
Let's try it this way. How about this as a replacement? -- >8 -- From: Johannes Schindelin Date: Thu, 4 Aug 2016 18:07:08 +0200 Subject: [PATCH] nedmalloc: work around overzealous GCC 6 warning With GCC 6, the strdup() function is declared with the "nonnull"

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-04 Thread Junio C Hamano
René Scharfe writes: > This version of strdup() is only compiled if nedmalloc is used instead > of the system allocator. That means we can't rely on strdup() being > able to take NULL -- some (most?) platforms won't like it. Removing > the NULL check would be a more general and

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-04 Thread René Scharfe
Am 04.08.2016 um 18:07 schrieb Johannes Schindelin: With GCC 6, the strdup() function is declared with the "nonnull" attribute, stating that it is not allowed to pass a NULL value as parameter. In nedmalloc()'s reimplementation of strdup(), Postel's Law is heeded and NULL parameters are handled

Re: [PATCH 2/2] nedmalloc: work around overzealous GCC 6 warning

2016-08-04 Thread Junio C Hamano
Johannes Schindelin writes: > With GCC 6, the strdup() function is declared with the "nonnull" > attribute, stating that it is not allowed to pass a NULL value as > parameter. > > In nedmalloc()'s reimplementation of strdup(), Postel's Law is heeded > and NULL