Message ID | 3f0e462e86625a3c253653e4a4eefabcd8590bf9.1651859773.git.git@grubix.eu (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | quell a few gcc warnings | expand |
Michael J Gruber <git@grubix.eu> writes: See previous discussion on the topic and help clarify it for me, thanks. https://lore.kernel.org/git/xmqqo8131tr8.fsf@gitster.g/ > Related to -Wdangling-pointer. > > In fact, this use of the pointer looks scary and has not created > problems so far only because the pointer in the struct is not used when > execution is out of the scope of the local function (and the pointer > invalid). > > Signed-off-by: Michael J Gruber <git@grubix.eu> > --- > http.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/http.c b/http.c > index 229da4d148..2f67fbb33c 100644 > --- a/http.c > +++ b/http.c > @@ -1367,6 +1367,7 @@ void run_active_slot(struct active_request_slot *slot) > select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout); > } > } > + slot->finished = NULL; > } > > static void release_active_slot(struct active_request_slot *slot)
On Fri, May 06, 2022 at 08:04:06PM +0200, Michael J Gruber wrote: > Related to -Wdangling-pointer. > > In fact, this use of the pointer looks scary and has not created > problems so far only because the pointer in the struct is not used when > execution is out of the scope of the local function (and the pointer > invalid). I think it might had been used by a different thread though and therefore it should be at least a thread local static to be safe (which should be possible to do now that we are supporting C99). If you are going that route, would be important to tell you that I tried and got in trouble because of Windows and the build environment in use there, but it didn't seem that difficult to fix, before I got sidetracked. Carlo
diff --git a/http.c b/http.c index 229da4d148..2f67fbb33c 100644 --- a/http.c +++ b/http.c @@ -1367,6 +1367,7 @@ void run_active_slot(struct active_request_slot *slot) select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout); } } + slot->finished = NULL; } static void release_active_slot(struct active_request_slot *slot)
Related to -Wdangling-pointer. In fact, this use of the pointer looks scary and has not created problems so far only because the pointer in the struct is not used when execution is out of the scope of the local function (and the pointer invalid). Signed-off-by: Michael J Gruber <git@grubix.eu> --- http.c | 1 + 1 file changed, 1 insertion(+)