Move initialization of variables after data definitions. This silence
warnings treated as error with W=1:
arch/powerpc/xmon/xmon.c:3389:14: error: variable ‘name’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
arch/powerpc/xmon/xmon.c:3100:22: error: variable ‘tsk’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
Signed-off-by: Mathieu Malaterre <redacted>
---
arch/powerpc/xmon/xmon.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Le 22/06/2018 à 21:27, Mathieu Malaterre a écrit :
Move initialization of variables after data definitions. This silence
warnings treated as error with W=1:
arch/powerpc/xmon/xmon.c:3389:14: error: variable ‘name’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
arch/powerpc/xmon/xmon.c:3100:22: error: variable ‘tsk’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
Is that an invalid warning ?
If so, please explain in the commit log.
Otherwise, I'd expect one to fix the warning, not just cheat on GCC.
Christophe
On Sat, Jun 23, 2018 at 06:59:27PM +0200, christophe leroy wrote:
Le 22/06/2018 à 21:27, Mathieu Malaterre a écrit :
quoted
Move initialization of variables after data definitions. This silence
warnings treated as error with W=1:
arch/powerpc/xmon/xmon.c:3389:14: error: variable ‘name’ might be
clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
arch/powerpc/xmon/xmon.c:3100:22: error: variable ‘tsk’ might be
clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
Is that an invalid warning ?
No, both are correct warnings. GCC can not see which functions it only
has a declaration of can call longjmp.
Otherwise, I'd expect one to fix the warning, not just cheat on GCC.
Yes, the patch seems to change the code in such a way that some versions
of GCC will no longer warn. Which does not make to code any more correct.
Either restructure the code, or make the var non-automatic, or make it
volatile.
Segher
On Sat, Jun 23, 2018 at 9:47 PM Segher Boessenkool
[off-list ref] wrote:
On Sat, Jun 23, 2018 at 06:59:27PM +0200, christophe leroy wrote:
quoted
Le 22/06/2018 =C3=A0 21:27, Mathieu Malaterre a =C3=A9crit :
quoted
Move initialization of variables after data definitions. This silence
warnings treated as error with W=3D1:
arch/powerpc/xmon/xmon.c:3389:14: error: variable =E2=80=98name=E2=
=80=99 might be
quoted
quoted
clobbered by =E2=80=98longjmp=E2=80=99 or =E2=80=98vfork=E2=80=99 [=