diff options
author | Alexey Zaytsev <alexey.zaytsev@gmail.com> | 2008-12-25 23:10:58 +0300 |
---|---|---|
committer | Christopher Li <sparse@chrisli.org> | 2008-12-28 20:11:12 -0800 |
commit | 521bacf04c705259c942ce4093627bd1640252e8 (patch) | |
tree | cca30377d172fe9e79c46efea247c51d9373d165 | |
parent | 405cd6edfe2e88c808f0a45f0c2ef92a854dbe67 (diff) | |
download | sparse-521bacf04c705259c942ce4093627bd1640252e8.tar.gz |
Also warn about sizeof(function)
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
-rw-r--r-- | evaluate.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -2061,6 +2061,12 @@ static struct symbol *evaluate_sizeof(struct expression *expr) warning(expr->pos, "expression using sizeof(void)"); size = bits_in_char; } + + if (is_function(type->ctype.base_type)) { + warning(expr->pos, "expression using sizeof on a function"); + size = bits_in_char; + } + if ((size < 0) || (size & (bits_in_char - 1))) expression_error(expr, "cannot size expression"); |