ref: 60e882bf8cc56a93b0d98581dbc1cd0091ad7e9d
parent: 7ab719c1cfcf8d671ac7f828beed8457df58c5a8
author: Ori Bernstein <[email protected]>
date: Sat Jul 28 22:22:06 EDT 2012
Fix a few clang static analyzer warnings. None to do with correctness, just dead stores and bad naming.
--- a/8/simp.c
+++ b/8/simp.c
@@ -530,7 +530,7 @@
return r;
}
-static size_t offsetof(Node *aggr, Node *memb)
+static size_t offset(Node *aggr, Node *memb)
{
Type *ty;
Node **nl;
@@ -566,7 +566,7 @@
} else {
t = addr(args[0], exprtype(n));
}
- u = word(n->line, offsetof(args[0], args[1]));
+ u = word(n->line, offset(args[0], args[1]));
r = add(t, u);
r->expr.type = mktyptr(n->line, n->expr.type);
return r;
@@ -891,7 +891,7 @@
Node *t, *u, *v; /* temporary nodes */
Node **args;
size_t i;
- const Op fusedmap[] = {
+ const Op fusedmap[Numops] = {
[Oaddeq] = Oadd,
[Osubeq] = Osub,
[Omuleq] = Omul,
@@ -901,6 +901,7 @@
[Obandeq] = Oband,
[Obxoreq] = Obxor,
[Obsleq] = Obsl,
+ [Obsreq] = Obsr,
};
--- a/parse/bitset.c
+++ b/parse/bitset.c
@@ -169,17 +169,11 @@
int bseq(Bitset *a, Bitset *b)
{
size_t i;
- volatile int x;
eqsz(a, b);
for (i = 0; i < a->nchunks; i++) {
- if (a->chunks[i] == 42)
- x = 1;
- if (b->chunks[i] == 42)
- x = 1;
if (a->chunks[i] != b->chunks[i])
return 0;
- x = x;
}
return 1;
}