From patchwork Thu May 23 10:35:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1103970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-501524-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 458mBC0ZQBz9sNK for ; Thu, 23 May 2019 20:36:01 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=GjwNgx/SmHzfK/iI rHjEjbWc8F6zcnhKb7vOq6CsWl8zFxmvEGL7YJaeQaTrp3yh1Hap2orfzv7qhG9N CRbKVW4mhRoMAhv7f0V0sp9eifz6gtbe3MsP0DL/WCCrm00zOI/cR9swO37O16tV eY+2GtEzoQ13h5q0Z3ME6OJnZMs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=8rSdZEkhRjDrC/p/LY61tL RMvWI=; b=jSiQb1Sbm+oSNIJ6nVWVV0eas/714kPDTBLVhrrUf5obKF/UbMmlyx DlGDAi8WSW2uvnM80eCAvXeEYb6e2OgdCnqbEWWTKNtCmMKH8gWRBbvpJ8acMAsw ej/JTZwshokvXzvTxDphpve1vlguFi8iyGl5uqNj345Mvdkq5L0rs= Received: (qmail 45617 invoked by alias); 23 May 2019 10:35:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 45609 invoked by uid 89); 23 May 2019 10:35:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=UD:c-ada-spec.c, HX-Languages-Length:838, decl_uid, 6798 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 May 2019 10:35:52 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 9D23381391 for ; Thu, 23 May 2019 12:35:50 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lQAvi8EG3S2e for ; Thu, 23 May 2019 12:35:50 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 80FE68138B for ; Thu, 23 May 2019 12:35:50 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Stabilize sort for -fdump-ada-spec Date: Thu, 23 May 2019 12:35:48 +0200 Message-ID: <4443502.V1mhNqmMLq@polaris> MIME-Version: 1.0 Self-explanatory. Tested on x86-64/Lnux, applied on mainline and 9 branch. 2019-05-23 Eric Botcazou * c-ada-spec.c (compare_node): Compare the DECL_UIDs as a last resort. 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. */