All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 4/9] MOD_ACCESSED is not a type modifier ...
Date: Wed,  5 Apr 2017 23:09:22 +0200	[thread overview]
Message-ID: <20170405210927.27948-5-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170405210927.27948-1-luc.vanoostenryck@gmail.com>

but is used to track which inline functions are
effectively used. So better remove it from the MOD_...
and implement the same functionality via a flag
in struct symbol.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 gdbhelpers   | 3 ---
 parse.c      | 2 +-
 show-parse.c | 1 -
 symbol.c     | 4 ++--
 symbol.h     | 4 ++--
 5 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/gdbhelpers b/gdbhelpers
index 87ab5b8e9..3d1148a87 100644
--- a/gdbhelpers
+++ b/gdbhelpers
@@ -140,9 +140,6 @@ define gdb_show_ctype
 	if ($arg0->modifiers & MOD_NODEREF)
 		printf "MOD_NODEREF "
 	end
-	if ($arg0->modifiers & MOD_ACCESSED)
-		printf "MOD_ACCESSED "
-	end
 	if ($arg0->modifiers & MOD_TOPLEVEL)
 		printf "MOD_TOPLEVEL "
 	end
diff --git a/parse.c b/parse.c
index 80f0337cc..4c3ebbaac 100644
--- a/parse.c
+++ b/parse.c
@@ -2144,7 +2144,7 @@ static struct statement *start_function(struct symbol *sym)
 	start_function_scope();
 	ret = alloc_symbol(sym->pos, SYM_NODE);
 	ret->ctype = sym->ctype.base_type->ctype;
-	ret->ctype.modifiers &= ~(MOD_STORAGE | MOD_CONST | MOD_VOLATILE | MOD_TLS | MOD_INLINE | MOD_ADDRESSABLE | MOD_NOCAST | MOD_NODEREF | MOD_ACCESSED | MOD_TOPLEVEL);
+	ret->ctype.modifiers &= ~(MOD_STORAGE | MOD_CONST | MOD_VOLATILE | MOD_TLS | MOD_INLINE | MOD_ADDRESSABLE | MOD_NOCAST | MOD_NODEREF | MOD_TOPLEVEL);
 	ret->ctype.modifiers |= (MOD_AUTO | MOD_REGISTER);
 	bind_symbol(ret, &return_ident, NS_ITERATOR);
 	stmt->ret = ret;
diff --git a/show-parse.c b/show-parse.c
index 2adeae961..3364aec5e 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -137,7 +137,6 @@ const char *modifier_string(unsigned long mod)
 		{MOD_ADDRESSABLE,	"[addressable]"},
 		{MOD_NOCAST,		"[nocast]"},
 		{MOD_NODEREF,		"[noderef]"},
-		{MOD_ACCESSED,		"[accessed]"},
 		{MOD_TOPLEVEL,		"[toplevel]"},
 		{MOD_ASSIGNED,		"[assigned]"},
 		{MOD_TYPE,		"[type]"},
diff --git a/symbol.c b/symbol.c
index 08c85f40e..2e7fcf16e 100644
--- a/symbol.c
+++ b/symbol.c
@@ -48,9 +48,9 @@ struct symbol_list *translation_unit_used_list = NULL;
 void access_symbol(struct symbol *sym)
 {
 	if (sym->ctype.modifiers & MOD_INLINE) {
-		if (!(sym->ctype.modifiers & MOD_ACCESSED)) {
+		if (!sym->accessed) {
 			add_symbol(&translation_unit_used_list, sym);
-			sym->ctype.modifiers |= MOD_ACCESSED;
+			sym->accessed = 1;
 		}
 	}
 }
diff --git a/symbol.h b/symbol.h
index b8b81fdeb..5192cacd9 100644
--- a/symbol.h
+++ b/symbol.h
@@ -173,6 +173,7 @@ struct symbol {
 					string:1,
 					designated_init:1,
 					forced_arg:1,
+					accessed:1,
 					transparent_union:1;
 			struct expression *array_size;
 			struct ctype ctype;
@@ -222,7 +223,6 @@ struct symbol {
 
 #define MOD_NOCAST	0x100000
 #define MOD_NODEREF	0x200000
-#define MOD_ACCESSED	0x400000
 #define MOD_TOPLEVEL	0x800000	// scoping..
 
 #define MOD_ASSIGNED	0x2000000
@@ -242,7 +242,7 @@ struct symbol {
 #define MOD_SPECIFIER	(MOD_CHAR | MOD_SHORT | MOD_LONG_ALL | MOD_SIGNEDNESS)
 #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)
+	MOD_ASSIGNED | MOD_USERTYPE | MOD_EXPLICITLY_SIGNED)
 #define MOD_PTRINHERIT (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_NORETURN | MOD_NOCAST)
 /* modifiers preserved by typeof() operator */
 #define MOD_TYPEOF	(MOD_VOLATILE | MOD_CONST | MOD_NOCAST | MOD_SPECIFIER)
-- 
2.12.0


  parent reply	other threads:[~2017-04-05 21:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 21:09 [PATCH 0/9] restricted pointers Luc Van Oostenryck
2017-04-05 21:09 ` [PATCH 1/9] remove never-used MOD_TYPEDEF Luc Van Oostenryck
2017-04-05 21:09 ` [PATCH 2/9] avoid warnings about using 0 instead of NULL Luc Van Oostenryck
2017-04-05 21:09 ` [PATCH 3/9] finer control over error vs. warnings Luc Van Oostenryck
2017-04-05 21:09 ` Luc Van Oostenryck [this message]
2017-04-05 21:09 ` [PATCH 5/9] reorganize the definition of the modifiers Luc Van Oostenryck
2017-04-05 21:09 ` [PATCH 6/9] MOD_STORAGE redundancy Luc Van Oostenryck
2017-04-05 21:09 ` [PATCH 7/9] MOD_QUALIFIER Luc Van Oostenryck
2017-04-05 21:09 ` [PATCH 8/9] associate MOD_RESTRICT with restrict-qualified variables Luc Van Oostenryck
2017-04-05 21:09 ` [PATCH 9/9] add support for C11's _Atomic as type qualifier Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170405210927.27948-5-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.