summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-09-24 21:52:39 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-10-01 00:44:54 +0200
commit58721d6e25e1845ce147150755e61401fcbc1a32 (patch)
treeece4a0dbb21a3a5e98087b7034200dc0221a3a35
parentbf3144077b3d4284d9ba3cbb62e22e23fb1d0a51 (diff)
downloadsparse-58721d6e25e1845ce147150755e61401fcbc1a32.tar.gz
flex-array: add helper has_flexible_array()
This will make later checks easier & clearer. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--symbol.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/symbol.h b/symbol.h
index 287df0a3..c9e6c7fe 100644
--- a/symbol.h
+++ b/symbol.h
@@ -507,6 +507,13 @@ static inline int is_extern_inline(struct symbol *sym)
is_function(sym->ctype.base_type);
}
+static inline int has_flexible_array(struct symbol *type)
+{
+ if (type->type == SYM_NODE)
+ type = type->ctype.base_type;
+ return type->has_flex_array;
+}
+
static inline int get_sym_type(struct symbol *type)
{
if (type->type == SYM_NODE)