Skip to contentSkip to conversation

integer_promotions() can't get SYM_NODE

PATCH In review Al Viro 2 participants 2 messages Jul 13, 2007 Sparse checker

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 3/8 integer_promotions() can't get SYM_NODE

---
 evaluate.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
evaluate.c +2 -7
index 7669c9a..88435da 100644
@@ -98,17 +98,12 @@ static struct symbol *evaluate_string(struct expression *expr)
 	return sym;
 }
 
+/* type has come from classify_type and is an integer type */
 static inline struct symbol *integer_promotion(struct symbol *type)
 {
 	struct symbol *orig_type = type;
 	unsigned long mod =  type->ctype.modifiers;
-	int width;
-
-	if (type->type == SYM_NODE)
-		type = type->ctype.base_type;
-	if (type->type == SYM_ENUM)
-		type = type->ctype.base_type;
-	width = type->bit_size;
+	int width = type->bit_size;
 
 	/*
 	 * Bitfields always promote to the base type,
Signature · 1 line
1.5.0-rc2.GIT
#1 lore raw
Quoted 19 lines · Al Viro
---
 evaluate.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
evaluate.c +1 -1
index 7669c9a..88435da 100644
@@ -98,17 +98,12 @@ static struct symbol *evaluate_string(struct expression *expr)
 	return sym;
 }
 
+/* type has come from classify_type and is an integer type */
 static inline struct symbol *integer_promotion(struct symbol *type)
 {
 	struct symbol *orig_type = type;
 	unsigned long mod =  type->ctype.modifiers;
-	int width;

evaluate.c static struct symbol *evaluate_string(struct expression *expr) · line 109

Quoted 10 lines
evaluate.c +1 -6
-
-	if (type->type == SYM_NODE)
-		type = type->ctype.base_type;
-	if (type->type == SYM_ENUM)
-		type = type->ctype.base_type;
-	width = type->bit_size;
+	int width = type->bit_size;
 
 	/*
 	 * Bitfields always promote to the base type,

In addition to SYM_NODE as mentioned in the commit message, this also removes SYM_ENUM as classify_type handles that too. I'll append that to the commit message.

- Josh Triplett