Recent versions of CLANG emit warnings like:
- variable 'i' set but not used [-Wunused-but-set-variable]
- warning: variable 'tries' set but not used [-Wunused-but-set-variable]
Silence them by removing those unnecessary variables and related code
incrementing them.
Signed-off-by: Akira Yokosawa <[email protected]>
---
CodeSamples/datastruct/Issaquah/existence_test.c | 3 ---
CodeSamples/datastruct/Issaquah/tree.c | 6 ------
2 files changed, 9 deletions(-)
diff --git a/CodeSamples/datastruct/Issaquah/existence_test.c
b/CodeSamples/datastruct/Issaquah/existence_test.c
index 5f31d09e..b55a7fd0 100644
--- a/CodeSamples/datastruct/Issaquah/existence_test.c
+++ b/CodeSamples/datastruct/Issaquah/existence_test.c
@@ -36,8 +36,6 @@ struct existence_group *egp;
static void *scan_existence(void *arg)
{
- int i = 0;
-
for (;;) {
if (!existence_exists(&outgoing)) {
BUG_ON(!existence_exists(&incoming));
@@ -47,7 +45,6 @@ static void *scan_existence(void *arg)
BUG_ON(existence_exists(&outgoing));
break;
}
- i++;
}
/* printf("scan_existence(): %d loops\n", i); */
return NULL;
diff --git a/CodeSamples/datastruct/Issaquah/tree.c
b/CodeSamples/datastruct/Issaquah/tree.c
index 26600118..6627e460 100644
--- a/CodeSamples/datastruct/Issaquah/tree.c
+++ b/CodeSamples/datastruct/Issaquah/tree.c
@@ -504,10 +504,8 @@ void *tree_lookup(struct treeroot *trp, int key, void
(*func)(void *data))
struct treenode *par;
spinlock_t *lockp = NULL;
int wantdelay = 0;
- int tries = 0;
retry:
- tries++;
rcu_read_lock();
cur = _tree_lookup(trp, key, &par);
TREE_BUG_ON(cur == NULL);
@@ -580,7 +578,6 @@ int tree_insert_existence(struct treeroot *trp, int key,
void *data,
struct treenode *par;
int ret = 0;
spinlock_t *lockp[2];
- int tries = 0;
int wantdelay = 0;
TREE_BUG_ON(data == NULL);
@@ -588,7 +585,6 @@ int tree_insert_existence(struct treeroot *trp, int key,
void *data,
if (!new)
return -ENOMEM;
retry:
- tries++;
rcu_read_lock();
cur = _tree_lookup(trp, key, &par);
TREE_BUG_ON(cur == NULL || par == NULL);
@@ -660,11 +656,9 @@ static int tree_delete_existence(struct treeroot *trp, int
key,
struct treenode *par;
spinlock_t *lockp[2];
int ret = -ENOENT;
- int tries = 0;
int wantdelay = 0;
retry:
- tries++;
rcu_read_lock();
cur = _tree_lookup(trp, key, &par);
TREE_BUG_ON(cur == NULL || par == NULL);
--
2.34.1