From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Alexey Gladkov <gladkov.alexey@gmail.com>
Cc: linux-sparse@vger.kernel.org,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH] sindex: avoid a warning with 'case -1:'
Date: Sun, 5 Jul 2020 01:54:53 +0200 [thread overview]
Message-ID: <20200704235453.7756-1-luc.vanoostenryck@gmail.com> (raw)
When parsing the format, there is a 'case -1:' which:
* seems to be there only for the following label (but mixing
labels with cases, like here, is OK).
* on architectures where chars are unsigned, the compiler complains:
warning: case label value is less than minimum value for type
So, remove the unneeded 'case -1:' and use an explicit 'default:'
to catch invalid formats. Also, align the label with the cases,
it looks nicer so.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
sindex.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sindex.c b/sindex.c
index ea092a4a434b..22836a957213 100644
--- a/sindex.c
+++ b/sindex.c
@@ -970,8 +970,8 @@ static int search_query_callback(void *data, int argc, char **argv, char **colna
print_file_line(argv[0], atoi(argv[1]));
fmt++;
break;
- case -1:
-print_string:
+
+ print_string:
if (n) {
printf("%.*s", n, buf);
n = 0;
@@ -979,6 +979,9 @@ print_string:
printf("%s", argv[colnum]);
fmt++;
break;
+ default:
+ break;
+
}
if (pos == fmt)
--
2.27.0
next reply other threads:[~2020-07-04 23:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 23:54 Luc Van Oostenryck [this message]
2020-07-05 11:12 ` [PATCH] sindex: avoid a warning with 'case -1:' Alexey Gladkov
2020-07-05 11:45 ` Luc Van Oostenryck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200704235453.7756-1-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=gladkov.alexey@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox