aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/evaluate.c
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-08 06:25:40 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-08 15:36:51 +0200
commit446313222a0b47504d162a1e67527fb517275096 (patch)
treef329fccac9a70db8414a0ad0603253bebe105e57 /evaluate.c
parentce8785f0a92426cc2039a00e9fc8699b5e7d3ce1 (diff)
downloadsparse-446313222a0b47504d162a1e67527fb517275096.tar.gz
wstring: extend is_string_type() to also detect wide strings
When evaluating initializers, it must be known if it is for a string or not. But sparse doesn't known about wide strings. Fix this by modifying is_string_type() to use is_wchar_type() in addition of is_byte_type(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'evaluate.c')
-rw-r--r--evaluate.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/evaluate.c b/evaluate.c
index bbfa77c3..8d09c560 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -406,7 +406,10 @@ static inline int is_string_type(struct symbol *type)
{
if (type->type == SYM_NODE)
type = type->ctype.base_type;
- return type->type == SYM_ARRAY && is_byte_type(type->ctype.base_type);
+ if (type->type != SYM_ARRAY)
+ return 0;
+ type = type->ctype.base_type;
+ return is_byte_type(type) || is_wchar_type(type);
}
static struct symbol *bad_expr_type(struct expression *expr)