[klibc] [klibc:master] dash: shell: Fix clang warnings

klibc-bot for Bill Wendling morbo at google.com
Sat Dec 12 15:27:07 PST 2020


Commit-ID:  815b8ef2a741108c5f7a81c83beef3645b82beec
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=815b8ef2a741108c5f7a81c83beef3645b82beec
Author:     Bill Wendling <morbo at google.com>
AuthorDate: Mon, 9 Nov 2020 14:13:34 -0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 12 Dec 2020 22:46:19 +0100

[klibc] dash: shell: Fix clang warnings

A couple of warnings from clang about old-style field designators and a
logical "not" used in an unconventional way and needs parentheses.

-----------------------------------------------------------------------
usr/dash/eval.c:106:2: warning: use of GNU old-style field designator extension [-Wgnu-designator]
        name: nullstr,
        ^~~~~
        .name =
usr/dash/eval.c:107:2: warning: use of GNU old-style field designator extension [-Wgnu-designator]
        builtin: bltincmd
        ^~~~~~~~
        .builtin =
usr/dash/eval.c:277:7: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
                if (!exitstatus == isor)
                    ^           ~~
usr/dash/eval.c:277:7: note: add parentheses after the '!' to evaluate the comparison first
                if (!exitstatus == isor)
                    ^
                     (                 )
usr/dash/eval.c:277:7: note: add parentheses around left hand side expression to silence this warning
                if (!exitstatus == isor)
                    ^
                    (          )
-----------------------------------------------------------------------

Signed-off-by: Bill Wendling <morbo at google.com>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/eval.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index dd144948..145e0b46 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -103,8 +103,8 @@ STATIC int bltincmd(int, char **);
 
 
 STATIC const struct builtincmd bltin = {
-	name: nullstr,
-	builtin: bltincmd
+	.name = nullstr,
+	.builtin = bltincmd
 };
 
 
@@ -274,7 +274,7 @@ checkexit:
 			n->nbinary.ch1,
 			(flags | ((isor >> 1) - 1)) & EV_TESTED
 		);
-		if (!exitstatus == isor)
+		if ((!exitstatus) == isor)
 			break;
 		if (!evalskip) {
 			n = n->nbinary.ch2;


More information about the klibc mailing list