aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-09-25 20:49:22 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-09-30 03:38:50 +0200
commit959e165a34d52778ca96bb062dc9c30063e8ccdf (patch)
treeec2e0440b7d0fcca137ea9e33bcf36730cf6b141
parent6d37de7ad9804f1a606839346101f2425ed86a13 (diff)
downloadsparse-959e165a34d52778ca96bb062dc9c30063e8ccdf.tar.gz
remove useless optimization in cast_enum_list()
The function cast_enum_list() is used to give the same type to all elements of an enum declaration. The base case for doing this is to call cast_value() on the element, but this call is not done is the size of the element already match the size of the common type. This special case is an optimization but not an interesting one since cast_value() is not a costly function. OTOH, it somehow complicates the flow inside cast_enum_list(). So, remove the optimisation by letting cast_value() to handle all cases. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--parse.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index f291e247..005eb160 100644
--- a/parse.c
+++ b/parse.c
@@ -898,8 +898,6 @@ static void cast_enum_list(struct symbol_list *list, struct symbol *base_type)
continue;
}
expr->ctype = base_type;
- if (ctype->bit_size == base_type->bit_size)
- continue;
cast_value(expr, base_type, expr, ctype);
} END_FOR_EACH_PTR(sym);
}