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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 parse.c | 2 --
 1 file changed, 2 deletions(-)

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);
 }
-- 
2.23.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux