2 * smatch/check_array_condition.c
4 * Copyright (C) 2013 Oracle.
6 * Licensed under the Open Software License version 1.1
11 * struct foo { char buf[10]; };
13 * struct foo *p = something();
22 static void match_condition(struct expression
*expr
)
27 if (expr
->type
!= EXPR_DEREF
)
29 type
= get_type(expr
);
30 if (!type
|| type
->type
!= SYM_ARRAY
)
32 if (get_macro_name(expr
->pos
))
35 str
= expr_to_str(expr
);
36 sm_msg("warn: this array is probably non-NULL. '%s'", str
);
40 void check_array_condition(int id
)
43 add_hook(&match_condition
, CONDITION_HOOK
);