diff options
author | 2009-08-28 21:30:08 +0000 | |
---|---|---|
committer | 2009-10-16 20:27:58 +0000 | |
commit | 7fc4304ac3b0d7389eac368a044d7381eec6c197 (patch) | |
tree | 47cc913afe44a10533c81640efb05468ab8523c3 | |
parent | Sparse 0.4.2 (diff) | |
download | sparse-7fc4304ac3b0d7389eac368a044d7381eec6c197.tar.gz sparse-7fc4304ac3b0d7389eac368a044d7381eec6c197.tar.bz2 sparse-7fc4304ac3b0d7389eac368a044d7381eec6c197.zip |
do not ignore attribute 'noreturn'...
Hello,
enclosed is a simple patch adding support for attribute 'noreturn' to the
parser. The enhancement makes it possible to optimize walk through CFG and
thus help us to fight with the state explosion. The benefit is demonstrated
on a simple real-world example.
Generated CFG before patch:
http://dudka.cz/devel/html/slsparse-before/slplug.c-handle_stmt_assign.svg
Generated CFG after patch:
http://dudka.cz/devel/html/slsparse-after/slplug.c-handle_stmt_assign.svg
It's one of the key features I am currently missing in SPARSE in contrast
to gcc used as parser. Thanks in advance for considering it!
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r-- | parse.c | 4 | ||||
-rw-r--r-- | symbol.h | 4 |
2 files changed, 5 insertions, 3 deletions
@@ -489,8 +489,8 @@ static struct init_keyword { { "const", NS_KEYWORD, .op = &ignore_attr_op }, { "__const", NS_KEYWORD, .op = &ignore_attr_op }, { "__const__", NS_KEYWORD, .op = &ignore_attr_op }, - { "noreturn", NS_KEYWORD, .op = &ignore_attr_op }, - { "__noreturn__", NS_KEYWORD, .op = &ignore_attr_op }, + { "noreturn", NS_KEYWORD, MOD_NORETURN, .op = &attr_mod_op }, + { "__noreturn__", NS_KEYWORD, MOD_NORETURN, .op = &attr_mod_op }, { "no_instrument_function", NS_KEYWORD, .op = &ignore_attr_op }, { "__no_instrument_function__", NS_KEYWORD, .op = &ignore_attr_op }, { "sentinel", NS_KEYWORD, .op = &ignore_attr_op }, @@ -217,6 +217,8 @@ struct symbol { #define MOD_EXPLICITLY_SIGNED 0x40000000 #define MOD_BITWISE 0x80000000 +#define MOD_NORETURN 0x100000000 + #define MOD_NONLOCAL (MOD_EXTERN | MOD_TOPLEVEL) #define MOD_STORAGE (MOD_AUTO | MOD_REGISTER | MOD_STATIC | MOD_EXTERN | MOD_INLINE | MOD_TOPLEVEL) #define MOD_SIGNEDNESS (MOD_SIGNED | MOD_UNSIGNED | MOD_EXPLICITLY_SIGNED) @@ -225,7 +227,7 @@ struct symbol { #define MOD_SIZE (MOD_CHAR | MOD_SHORT | MOD_LONG_ALL) #define MOD_IGNORE (MOD_TOPLEVEL | MOD_STORAGE | MOD_ADDRESSABLE | \ MOD_ASSIGNED | MOD_USERTYPE | MOD_ACCESSED | MOD_EXPLICITLY_SIGNED) -#define MOD_PTRINHERIT (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_STORAGE) +#define MOD_PTRINHERIT (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_STORAGE | MOD_NORETURN) /* Current parsing/evaluation function */ |