[Ada] Stabilize sort for -fdump-ada-spec

Message ID 4443502.V1mhNqmMLq@polaris
State New
Headers show
Series
  • [Ada] Stabilize sort for -fdump-ada-spec
Related show

Commit Message

Eric Botcazou May 23, 2019, 10:35 a.m.
Self-explanatory.  Tested on x86-64/Lnux, applied on mainline and 9 branch.


2019-05-23  Eric Botcazou  <ebotcazou@adacore.com>

	* c-ada-spec.c (compare_node): Compare the DECL_UIDs as a last resort.

-- 
Eric Botcazou

Patch

Index: c-ada-spec.c
===================================================================
--- c-ada-spec.c	(revision 271457)
+++ c-ada-spec.c	(working copy)
@@ -679,8 +679,10 @@  compare_node (const void *lp, const void
 {
   const_tree lhs = *((const tree *) lp);
   const_tree rhs = *((const tree *) rp);
+  const int ret
+    = compare_location (decl_sloc (lhs, true), decl_sloc (rhs, true));
 
-  return compare_location (decl_sloc (lhs, true), decl_sloc (rhs, true));
+  return ret ? ret : DECL_UID (lhs) - DECL_UID (rhs);
 }
 
 /* Compare two comments (LP and RP) by their source location.  */