From patchwork Thu Feb 27 16:46:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 38339 Received: (qmail 128766 invoked by alias); 27 Feb 2020 16:46:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 128757 invoked by uid 89); 27 Feb 2020 16:46:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*MI:andrew, touching X-HELO: mail-wm1-f54.google.com Received: from mail-wm1-f54.google.com (HELO mail-wm1-f54.google.com) (209.85.128.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Feb 2020 16:46:58 +0000 Received: by mail-wm1-f54.google.com with SMTP id q9so19416wmj.5 for ; Thu, 27 Feb 2020 08:46:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id; bh=GBobIXVS4TF+gwZ2B8Ae1yGFxvxTI4m+2gA6Ti65Otc=; b=W98oWa5A7Jva3VvLREBbGVEvIovN36VY3s/xmPWH2rpyWJpArKtjnMeI32JAqhHU2Y 70j7iaTjbZLmQPlk8cHpf5W10ENCkSrH31CuE0Rzc818YVAmyWPLdFMtU/DM0G0xtfaY Hl2raWaSMCFPJL21Y/XD4InmlVLUpDdMm/fO+g1RkRGnGRiI/sC1nSY0A6qzidS/3Q2V SKUUhxrLO1mxovbr+kZv48WSIMvN04eRo2orAFoSSgP4DPFTr/psHxjl8I2DvlxCtRfE SZJN+IElmKFCHPSZ+/b8+d6YdPzmxv9E8jUBl7f3mwAjSvCvqgSRb0J6Pl+WoXDl9wwY aOrQ== Return-Path: Received: from localhost (host86-186-80-160.range86-186.btcentralplus.com. [86.186.80.160]) by smtp.gmail.com with ESMTPSA id c141sm8017549wme.41.2020.02.27.08.46.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Feb 2020 08:46:54 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PUSHED] gdb: Use std::abs instead of abs on LONGEST types Date: Thu, 27 Feb 2020 16:46:51 +0000 Message-Id: <20200227164651.13723-1-andrew.burgess@embecosm.com> X-IsSubscribed: yes Use std::abs so that we get the C++ overloaded version that matches the argument type instead of the C abs function which is only for int arguments. There should be no user visible change after this commit. gdb/ChangeLog: * gdbtypes.c (create_array_type_with_stride): Use std::abs not abs. --- gdb/ChangeLog | 5 +++++ gdb/gdbtypes.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index ef110b30445..d89df9f7409 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1249,9 +1249,9 @@ create_array_type_with_stride (struct type *result_type, negative stride in Fortran (this doesn't mean anything special, it's still just a single element array) so do consider that case when touching this code. */ - LONGEST element_count = abs (high_bound - low_bound + 1); + LONGEST element_count = std::abs (high_bound - low_bound + 1); TYPE_LENGTH (result_type) - = ((abs (stride) * element_count) + 7) / 8; + = ((std::abs (stride) * element_count) + 7) / 8; } else TYPE_LENGTH (result_type) =