Christophe Leroy
2019-Jan-22 16:53 UTC
[klibc] usr/dash/eval.c:277:19: warning: logical not is only applied to the left hand side of comparison
? KLIBCCC usr/dash/eval.o usr/dash/eval.c: In function 'evaltree': usr/dash/eval.c:277:19: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] ?? if (!exitstatus == isor) ?????????????????? ^ Not sure what the fix should be: ?? if (!(exitstatus == isor)) Or ?? if ((!exitstatus) == isor) Any idea ? Christophe
eno
2019-Jan-22 17:38 UTC
[klibc] usr/dash/eval.c:277:19: warning: logical not is only applied to the left hand side of comparison
Hi!> Any idea ?I believe that: if (!exitstatus == isor) equals to, if ((!exitstatus) == isor) because the exclamation mark have bigger priority than "==". Nikita.
Christophe Leroy
2019-Jan-22 17:43 UTC
[klibc] usr/dash/eval.c:277:19: warning: logical not is only applied to the left hand side of comparison
Le 22/01/2019 ? 18:38, eno a ?crit?:> Hi! > >> Any idea ? > > I believe that: > if (!exitstatus == isor) > equals to, > if ((!exitstatus) == isor) > > because the exclamation mark have bigger priority than "==". >Yes but I'm not 100% sure that what is written is really what is expected. Can someone confirm ? I agree with you, if the current form corresponds to expectation, then we can shut up the warning that way. But I want to be should we won't just hide a real bug. Christophe
Sam Ravnborg
2019-Jan-22 19:23 UTC
[klibc] usr/dash/eval.c:277:19: warning: logical not is only applied to the left hand side of comparison
Hi Christophe. On Tue, Jan 22, 2019 at 04:53:05PM +0000, Christophe Leroy wrote:> ? KLIBCCC usr/dash/eval.o > usr/dash/eval.c: In function 'evaltree': > usr/dash/eval.c:277:19: warning: logical not is only applied to the > left hand side of comparison [-Wlogical-not-parentheses] > ?? if (!exitstatus == isor) > ?????????????????? ^ > > Not sure what the fix should be: > > ?? if (!(exitstatus == isor)) > > > Or > > > ?? if ((!exitstatus) == isor) > > > > Any idea ?Take a look at upstream dash where this is fixed https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/src/eval.c?id=f97aaf80dd44e92f2cabc7e6d92d461f4fe6eddd So one could backport this fix. But a better approach was maybe to upgrade to latest dash version. Sam
maximilian attems
2019-Jan-22 22:12 UTC
[klibc] usr/dash/eval.c:277:19: warning: logical not is only applied to the left hand side of comparison
On Tue, Jan 22, 2019 at 08:23:15PM +0100, Sam Ravnborg wrote:> So one could backport this fix. > But a better approach was maybe to upgrade to latest dash version. >yes, indeed upgrading dash is the best way. In the past, we imported latest dash from time to time. thanks to Ben for all of his work!
Seemingly Similar Threads
- usr/dash/eval.c:277:19: warning: logical not is only applied to the left hand side of comparison
- usr/dash/eval.c:277:19: warning: logical not is only applied to the left hand side of comparison
- [klibc:update-dash] dash: eval: Return status in eval functions
- [klibc:update-dash] eval: Return status in eval functions
- [klibc:update-dash] dash: eval: Silence compiler warning about missing parentheses