[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Warning in spawn-pipe.c (create_pipe)
From: |
Tim Rühsen |
Subject: |
Warning in spawn-pipe.c (create_pipe) |
Date: |
Wed, 13 Dec 2017 11:01:58 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
This seems to be a false positive from clang - but how does a compiler
know for sure that a function (posix_spawnp) always initializes a
pointer argument when returning 0 ? Ok, it's written in the docs and we
know it but there is no syntax to tell the compiler exactly that.
That's why I vote for initializing 'child' to 0 as suggested below. It
seems to be good programming practice.
clang's warning:
spawn-pipe.c:364:34: warning: variable 'child' may be uninitialized when
used here [-Wconditional-uninitialized]
register_slave_subprocess (child);
^~~~~
spawn-pipe.c:257:14: note: initialize the variable 'child' to silence
this warning
pid_t child;
^
= 0
With Best Regards, Tim
signature.asc
Description: OpenPGP digital signature
- Warning in spawn-pipe.c (create_pipe),
Tim Rühsen <=
- Re: Warning in spawn-pipe.c (create_pipe), Bruno Haible, 2017/12/13
- Re: Warning in spawn-pipe.c (create_pipe), Eric Blake, 2017/12/13
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/14
- Re: Warning in spawn-pipe.c (create_pipe), Bruno Haible, 2017/12/14
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Bruno Haible, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Gisle Vanem, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/15