From de6cab6e6eb44df4660a3d4df171f87ef8e8ee41 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 11 Feb 2009 14:12:11 +0300 Subject: [PATCH] Create a state &merged. When we merge stuff it isn't the same as being &undefined because we store all the possible states and the pools which it came from. Signed-off-by: Dan Carpenter --- smatch.h | 1 + smatch_extra.c | 8 -------- smatch_slist.c | 2 +- smatch_states.c | 1 + 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/smatch.h b/smatch.h index 73c186c8..cfa21596 100644 --- a/smatch.h +++ b/smatch.h @@ -25,6 +25,7 @@ struct smatch_state { }; #define STATE(_x) static struct smatch_state _x = { .name = #_x } extern struct smatch_state undefined; +extern struct smatch_state merged; extern struct smatch_state true_state; extern struct smatch_state false_state; diff --git a/smatch_extra.c b/smatch_extra.c index 1d9e232a..37b9c415 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -44,13 +44,6 @@ static struct smatch_state *alloc_state(int val) return state; } -static struct smatch_state *merge_func(const char *name, struct symbol *sym, - struct smatch_state *s1, - struct smatch_state *s2) -{ - return &undefined; -} - static void match_function_call_after(struct expression *expr) { struct expression *tmp; @@ -128,7 +121,6 @@ static void match_unop(struct expression *expr) void register_smatch_extra(int id) { my_id = id; - add_merge_hook(my_id, &merge_func); add_hook(&undef_expr, OP_HOOK); add_hook(&match_function_call_after, FUNCTION_CALL_AFTER_HOOK); add_hook(&match_assign, ASSIGNMENT_AFTER_HOOK); diff --git a/smatch_slist.c b/smatch_slist.c index 78d13fba..6c844e16 100644 --- a/smatch_slist.c +++ b/smatch_slist.c @@ -190,7 +190,7 @@ struct smatch_state *merge_states(const char *name, int owner, else if (__has_merge_function(owner)) ret = __client_merge_function(owner, name, sym, state1, state2); else - ret = &undefined; + ret = &merged; SM_DEBUG("%d merge name='%s' owner=%d: %s + %s => %s\n", get_lineno(), name, owner, show_state(state1), diff --git a/smatch_states.c b/smatch_states.c index f08b979d..0784aba4 100644 --- a/smatch_states.c +++ b/smatch_states.c @@ -30,6 +30,7 @@ #include "smatch_slist.h" struct smatch_state undefined = { .name = "undefined" }; +struct smatch_state merged = { .name = "merged" }; struct smatch_state true_state = { .name = "true" }; struct smatch_state false_state = { .name = "false" }; -- 2.11.4.GIT