This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 13/13] Remove unnecessary cases from rank_one_type's switch
- From: Simon Marchi <simon dot marchi at efficios dot com>
- To: gdb-patches at sourceware dot org
- Cc: Simon Marchi <simon dot marchi at efficios dot com>
- Date: Wed, 27 Feb 2019 15:00:28 -0500
- Subject: [PATCH 13/13] Remove unnecessary cases from rank_one_type's switch
- Dkim-filter: OpenDKIM Filter v2.10.3 mail.efficios.com E8A3B8086D
- References: <20190227200028.27360-1-simon.marchi@efficios.com>
We return INCOMPATIBLE_TYPE_BADNESS for all these type codes, so we might as
well just let them go to the default case.
Incidentally, this patch also makes this false positive error go away when
compiling with gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0, default compiler on
Ubuntu 18.04.
CXX gdbtypes.o
/home/smarchi/src/binutils-gdb/gdb/gdbtypes.c: In function ‘rank rank_one_type(type*, type*, value*)’:
/home/smarchi/src/binutils-gdb/gdb/gdbtypes.c:4259:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
gdb/ChangeLog:
* gdbtypes.c (rank_one_type): Remove unnecessary cases from switch.
---
gdb/gdbtypes.c | 33 ---------------------------------
1 file changed, 33 deletions(-)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index dc054b9272..f4ca025b63 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4309,41 +4309,8 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
return rank_one_type_parm_complex (parm, arg, value);
case TYPE_CODE_STRUCT:
return rank_one_type_parm_struct (parm, arg, value);
- case TYPE_CODE_UNION:
- switch (TYPE_CODE (arg))
- {
- case TYPE_CODE_UNION:
- default:
- return INCOMPATIBLE_TYPE_BADNESS;
- }
- break;
- case TYPE_CODE_MEMBERPTR:
- switch (TYPE_CODE (arg))
- {
- default:
- return INCOMPATIBLE_TYPE_BADNESS;
- }
- break;
- case TYPE_CODE_METHOD:
- switch (TYPE_CODE (arg))
- {
-
- default:
- return INCOMPATIBLE_TYPE_BADNESS;
- }
- break;
- case TYPE_CODE_REF:
- switch (TYPE_CODE (arg))
- {
-
- default:
- return INCOMPATIBLE_TYPE_BADNESS;
- }
-
- break;
case TYPE_CODE_SET:
return rank_one_type_parm_set (parm, arg, value);
- case TYPE_CODE_VOID:
default:
return INCOMPATIBLE_TYPE_BADNESS;
} /* switch (TYPE_CODE (arg)) */
--
2.21.0