aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-07-14 19:22:57 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-07-14 19:22:57 -0400
commitc3fac8665131c5b8736a4432889040d868da8174 (patch)
tree67c547ad40b03a37f7b66a4a897e2d0e99b2f59e /gcc/c-decl.c
parentfc91b0d0aafa30db416b1b14f94bde05ccadcdff (diff)
downloadgcc-c3fac8665131c5b8736a4432889040d868da8174.zip
gcc-c3fac8665131c5b8736a4432889040d868da8174.tar.gz
gcc-c3fac8665131c5b8736a4432889040d868da8174.tar.bz2
(field_decl_cmp): Rewritten to make sure that a null name always sorts
low against other names. From-SVN: r10137
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 4d4e466..c90e11b 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -5383,7 +5383,15 @@ static int
field_decl_cmp (x, y)
tree *x, *y;
{
- return (long)DECL_NAME (*x) - (long)DECL_NAME (*y);
+ if (DECL_NAME (*x) == DECL_NAME (*y))
+ return 0;
+ if (DECL_NAME (*x) == NULL)
+ return -1;
+ if (DECL_NAME (*y) == NULL)
+ return 1;
+ if (DECL_NAME (*x) < DECL_NAME (*y))
+ return -1;
+ return 1;
}
/* Fill in the fields of a RECORD_TYPE or UNION_TYPE node, T.