[PATCH 4/4] remove unneeded MOD_TYPE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MOD_TYPE is used for the sparse extension which allow
to directly compare types with each others.

Expressions for direct type are EXPR_TYPE with the type in
expr->symbol and the expression itself having it's type
(expr->ctype) set to &type_ctype. This is one of the few
base/builtin types and is the only one which van have MOD_TYPE.

Howver, the MOD_TYPE is not needed (like bad_ctype doesn't need
a MOD_BAD, or incomplete_ctype ....). There is also a single
place where MOD_TYPE is tested: is_type_ctype(), itself used
a single time.

So:
* rewrite the unique test using is_type_ctype() by directly
  comparing with &type_ctype instead.
* remove now unused is_type_ctype()
* remove MOD_TYPE from type_ctype's definition
* remove MOD_TYPE's definition.

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

diff --git a/gdbhelpers b/gdbhelpers
index 2fe9336dd..8d186cee7 100644
--- a/gdbhelpers
+++ b/gdbhelpers
@@ -152,9 +152,6 @@ define gdb_show_ctype
 	if ($arg0->modifiers & MOD_ASSIGNED)
 		printf "MOD_ASSIGNED "
 	end
-	if ($arg0->modifiers & MOD_TYPE)
-		printf "MOD_TYPE "
-	end
 	if ($arg0->modifiers & MOD_SAFE)
 		printf "MOD_SAFE "
 	end
diff --git a/show-parse.c b/show-parse.c
index 7b65ba679..68b3e7186 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -140,7 +140,6 @@ const char *modifier_string(unsigned long mod)
 		{MOD_NODEREF,		"[noderef]"},
 		{MOD_TOPLEVEL,		"[toplevel]"},
 		{MOD_ASSIGNED,		"[assigned]"},
-		{MOD_TYPE,		"[type]"},
 		{MOD_SAFE,		"[safe]"},
 		{MOD_USERTYPE,		"[usertype]"},
 		{MOD_NORETURN,		"[noreturn]"},
diff --git a/symbol.c b/symbol.c
index a410af43a..116b1040f 100644
--- a/symbol.c
+++ b/symbol.c
@@ -742,7 +742,7 @@ static const struct ctype_declare {
 } ctype_declaration[] = {
 	{ &bool_ctype,	    SYM_BASETYPE, MOD_UNSIGNED,		    &bits_in_bool,	     &max_int_alignment, &int_type },
 	{ &void_ctype,	    SYM_BASETYPE, 0,			    NULL,	     NULL,		 NULL },
-	{ &type_ctype,	    SYM_BASETYPE, MOD_TYPE,		    NULL,		     NULL,		 NULL },
+	{ &type_ctype,	    SYM_BASETYPE, 0,			    NULL,	     NULL,		 NULL },
 	{ &incomplete_ctype,SYM_BASETYPE, 0,			    NULL,		     NULL,		 NULL },
 	{ &bad_ctype,	    SYM_BASETYPE, 0,			    NULL,		     NULL,		 NULL },
 
diff --git a/symbol.h b/symbol.h
index ee7088718..fd536ed6e 100644
--- a/symbol.h
+++ b/symbol.h
@@ -222,7 +222,7 @@ struct symbol {
 #define MOD_UNSIGNED		0x00004000
 #define MOD_EXPLICITLY_SIGNED	0x00008000
 
-#define MOD_TYPE		0x00010000
+//      UNUSED			0x00010000
 #define MOD_USERTYPE		0x00020000
 #define MOD_CHAR		0x00040000
 #define MOD_SHORT		0x00080000
@@ -373,7 +373,7 @@ static inline int is_signed_type(struct symbol *sym)
 
 static inline int is_type_type(struct symbol *type)
 {
-	return (type->ctype.modifiers & MOD_TYPE) != 0;
+	return type == &type_ctype;
 }
 
 static inline int is_ptr_type(struct symbol *type)
-- 
2.23.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux