[PATCH 2/5] bitfield: don't warn twice on invalid width

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

 



At parsing time, bitfields with invalid width have their size
set to -1 but at examination time this size is interpreted as
an unsigned value, causing a second warning.

Fix this by avoiding to cast the size to an unsigned variable.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 symbol.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/symbol.c b/symbol.c
index fb14b624574a..6c1fb2a5195f 100644
--- a/symbol.c
+++ b/symbol.c
@@ -254,12 +254,11 @@ static struct symbol * examine_array_type(struct symbol *sym)
 static struct symbol *examine_bitfield_type(struct symbol *sym)
 {
 	struct symbol *base_type = examine_base_type(sym);
-	unsigned long bit_size, alignment, modifiers;
+	unsigned long alignment, modifiers;
 
 	if (!base_type)
 		return sym;
-	bit_size = base_type->bit_size;
-	if (sym->bit_size > bit_size)
+	if (sym->bit_size > base_type->bit_size)
 		warning(sym->pos, "impossible field-width, %d, for this type",  sym->bit_size);
 
 	alignment = base_type->ctype.alignment;
-- 
2.24.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