aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-08-25 12:27:48 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-08-25 12:27:48 +0000
commitbb5d50b59947bc193c859c26eb982d04cee301ab (patch)
tree8d34bb3f4a9876aed7c7a79be34ee73935a72f27 /gcc
parente2da9ffe3c90b3a460b5fbbea7ee3aa7941882d1 (diff)
downloadgcc-bb5d50b59947bc193c859c26eb982d04cee301ab.zip
gcc-bb5d50b59947bc193c859c26eb982d04cee301ab.tar.gz
gcc-bb5d50b59947bc193c859c26eb982d04cee301ab.tar.bz2
class.c (method_name_cmp, [...]): Method names can never be NULL.
* class.c (method_name_cmp, resort_method_name_cmp): Method names can never be NULL. From-SVN: r251350
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/class.c25
2 files changed, 9 insertions, 19 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3557e48..b9e6441 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2017-08-25 Nathan Sidwell <nathan@acm.org>
+ * class.c (method_name_cmp, resort_method_name_cmp): Method names
+ can never be NULL.
+
Conversion operators have a special name
* cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
(conv_op_marker, conv_op_identifier): New.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index fc37bd8..4d7c76b 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2263,12 +2263,6 @@ method_name_cmp (const void* m1_p, const void* m2_p)
const tree *const m1 = (const tree *) m1_p;
const tree *const m2 = (const tree *) m2_p;
- if (*m1 == NULL_TREE && *m2 == NULL_TREE)
- return 0;
- if (*m1 == NULL_TREE)
- return -1;
- if (*m2 == NULL_TREE)
- return 1;
if (OVL_NAME (*m1) < OVL_NAME (*m2))
return -1;
return 1;
@@ -2282,20 +2276,13 @@ resort_method_name_cmp (const void* m1_p, const void* m2_p)
{
const tree *const m1 = (const tree *) m1_p;
const tree *const m2 = (const tree *) m2_p;
- if (*m1 == NULL_TREE && *m2 == NULL_TREE)
- return 0;
- if (*m1 == NULL_TREE)
+
+ tree n1 = OVL_NAME (*m1);
+ tree n2 = OVL_NAME (*m2);
+ resort_data.new_value (&n1, resort_data.cookie);
+ resort_data.new_value (&n2, resort_data.cookie);
+ if (n1 < n2)
return -1;
- if (*m2 == NULL_TREE)
- return 1;
- {
- tree d1 = OVL_NAME (*m1);
- tree d2 = OVL_NAME (*m2);
- resort_data.new_value (&d1, resort_data.cookie);
- resort_data.new_value (&d2, resort_data.cookie);
- if (d1 < d2)
- return -1;
- }
return 1;
}