diff mbox series

[2/3] remove useless optimization in cast_enum_list()

Message ID 20190925220340.5128-3-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series fix sign extension in casting enums | expand

Commit Message

Luc Van Oostenryck Sept. 25, 2019, 10:03 p.m. UTC
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>
---
 parse.c | 2 --
 1 file changed, 2 deletions(-)
diff mbox series

Patch

diff --git a/parse.c b/parse.c
index f291e2474..005eb1608 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);
 }