summaryrefslogtreecommitdiff
path: root/src/read.c
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2021-12-19 16:09:07 -0500
committerPaul Smith <psmith@gnu.org>2021-12-19 16:55:50 -0500
commitf440c3ebe2601b48893cd510335818a8bcfdf342 (patch)
tree60bcb89c2d6cc007976ce7ffeb56b4dd66da7aa2 /src/read.c
parent3efba8a1452c92ac474f3c08ac40ed45af4c67f9 (diff)
downloadmake-git-f440c3ebe2601b48893cd510335818a8bcfdf342.tar.gz
[SV 60798] Silence bogus GCC10 and GCC11 warnings
* src/main.c (main): Use a separate variable to track final character. * src/read.c (eval): Track the semicolon position not one beyond it. * src/variable.c (do_variable_definition): Include a default switch case to ease the work of the exhaustiveness prover.
Diffstat (limited to 'src/read.c')
-rw-r--r--src/read.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/read.c b/src/read.c
index 77bbdb5e..ae1ddabc 100644
--- a/src/read.c
+++ b/src/read.c
@@ -1000,7 +1000,7 @@ eval (struct ebuffer *ebuf, int set_default)
{
enum make_word_type wtype;
- char *cmdleft, *semip, *lb_next;
+ char *cmdleft, *semip = 0, *lb_next;
size_t plen = 0;
char *colonp;
const char *end, *beg; /* Helpers for whitespace stripping. */
@@ -1020,9 +1020,11 @@ eval (struct ebuffer *ebuf, int set_default)
cmdleft = 0;
}
else if (cmdleft != 0)
- /* Found one. Cut the line short there before expanding it. */
- *(cmdleft++) = '\0';
- semip = cmdleft;
+ {
+ /* Found one. Cut the line short there before expanding it. */
+ semip = cmdleft++;
+ *semip = '\0';
+ }
collapse_continuations (line);
@@ -1193,7 +1195,7 @@ eval (struct ebuffer *ebuf, int set_default)
if (semip)
{
size_t l = p2 - variable_buffer;
- *(--semip) = ';';
+ *semip = ';';
collapse_continuations (semip);
variable_buffer_output (p2 + strlen (p2),
semip, strlen (semip)+1);