From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112871 invoked by alias); 18 Oct 2019 13:47:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 112731 invoked by uid 89); 18 Oct 2019 13:47:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2476, U*breakpoint.c X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Oct 2019 13:47:08 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id CF6C620940; Fri, 18 Oct 2019 09:47:05 -0400 (EDT) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 8686C206FC; Fri, 18 Oct 2019 09:47:04 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 5F06F20AF6; Fri, 18 Oct 2019 09:47:04 -0400 (EDT) X-Gerrit-PatchSet: 1 Date: Fri, 18 Oct 2019 13:47:00 -0000 From: "Tom Tromey (Code Review)" To: Christian Biesinger , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review] Replace some more qsort calls with std::sort X-Gerrit-Change-Id: Ibcddce12a3d07448701e731b7150fa23611d86de X-Gerrit-Change-Number: 131 X-Gerrit-ChangeURL: X-Gerrit-Commit: 3c939b2a7dd96566c8189bb17c63a1f25bd01ef2 In-Reply-To: References: X-Gerrit-Comment-Date: Fri, 18 Oct 2019 09:47:04 -0400 Reply-To: tromey@sourceware.org, cbiesinger@google.com, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191018134704.5F06F20AF6@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-10/txt/msg00624.txt.bz2 Tom Tromey has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131 ...................................................................... Patch Set 1: (8 comments) Thank you for the patch. This is a nice improvement. I found a few nits, but nothing serious. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/breakpoint.c File gdb/breakpoint.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/breakpoint.c@522 PS1, Line 522: /* Array is sorted by bp_location_is_less_than - primarily by the ADDRESS. */ In gerrit I can't tell if this line is overlong. If it is, it should wrap. It would be nice if we could add column guides to gerrit. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/breakpoint.c@11440 PS1, Line 11440: return (a->address > b->address) < (a->address < b->address); I think this can just be a->address < b->address ? https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/breakpoint.c@11448 PS1, Line 11448: < (a->pspace->num < b->pspace->num)); Likewise this can be simplified. BTW gerrit doesn't seem to allow multi-line selections... bummer. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/breakpoint.c@11452 PS1, Line 11452: return (a->permanent < b->permanent) < (a->permanent > b->permanent); Ditto. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/breakpoint.c@11460 PS1, Line 11460: < (a->owner->number < b->owner->number)); Ditto. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/breakpoint.c@11462 PS1, Line 11462: return (a > b) < (a < b); Even here. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/disasm.c File gdb/disasm.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/disasm.c@184 PS1, Line 184: val = mle1.start_pc - mle2.start_pc; This code is a bit weird. It only works because "val" has signed type, as start_pc is unsigned. I think it would be a lot clearer to just change this to use plain < instead of subtraction. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/mdebugread.c File gdb/mdebugread.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131/1/gdb/mdebugread.c@4570 PS1, Line 4570: addr_diff = (BLOCK_START (b1)) - (BLOCK_START (b2)); This has the same oddity involving signs. I think just using the obvious comparisons would be better.