From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76275 invoked by alias); 16 Apr 2019 23:06:21 -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 76204 invoked by uid 89); 16 Apr 2019 23:06:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 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=HX-Languages-Length:2577 X-HELO: mail-wr1-f52.google.com Received: from mail-wr1-f52.google.com (HELO mail-wr1-f52.google.com) (209.85.221.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Apr 2019 23:06:19 +0000 Received: by mail-wr1-f52.google.com with SMTP id g3so29276915wrx.9 for ; Tue, 16 Apr 2019 16:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=jI41Xa6CovfpFl7+FvCeZKiZL9QY/idefOUXYIs8Ilc=; b=TefyCRGqVDbs7uLWTyxWaSqy4dsX8KObH1JELjfCHJLePWegN+cDZBLQ4wyTleOWyx G57BdBxo62FxO1IONCdTEOTy82/igCpwZ4XdzOU2MxK2+afdulJReLAQ+BiqOU3J2wSF Ty4nTxqrT9ztR7/r8esEzkvf9qiR9woh6rRNFNJTKIUXphiHosLME1ZS94/IqWhfoo6U AVzm2FGu/hOesBMWJCi6Ivneo3DJxGSX1MpOyzFO5fsY7AxUoFU7yhQZUdw6Fgqx+cup rJoRn43tlFRCA5Da6S4aKuSVQyMsN/4H57gvJuHdifL+ZJLzqlP/t5P5ynzRd3g8wPg6 mMWQ== Return-Path: Received: from localhost (host86-164-133-98.range86-164.btcentralplus.com. [86.164.133.98]) by smtp.gmail.com with ESMTPSA id y133sm1371259wmd.2.2019.04.16.16.06.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2019 16:06:16 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 1/5] gdb/ada: Update some predicate functions to return bool Date: Tue, 16 Apr 2019 23:06:00 -0000 Message-Id: <0ad8f4f39a6eaabe2e97467dc6f53aea89800d7e.1555455013.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00283.txt.bz2 A later commit would like to make use of a pointer to the function ada_is_string_type, however, this will require the function to return a bool (so the signature matches). As the ada_is_string_type is a predicate function, and its return value is only ever used as either true or false, then this commit updates the function to return a bool. As a consequence ada_is_character_type needs to change too. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_is_character_type): Change return type to bool. (ada_is_string_type): Likewise. * ada-lang.h (ada_is_character_type): Update declaration (ada_is_string_type): Likewise. --- gdb/ChangeLog | 7 +++++++ gdb/ada-lang.c | 8 ++++---- gdb/ada-lang.h | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index ccf8ed8039e..622cf59de68 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -9396,7 +9396,7 @@ value_val_atr (struct type *type, struct value *arg) [At the moment, this is true only for Character and Wide_Character; It is a heuristic test that could stand improvement]. */ -int +bool ada_is_character_type (struct type *type) { const char *name; @@ -9404,7 +9404,7 @@ ada_is_character_type (struct type *type) /* If the type code says it's a character, then assume it really is, and don't check any further. */ if (TYPE_CODE (type) == TYPE_CODE_CHAR) - return 1; + return true; /* Otherwise, assume it's a character type iff it is a discrete type with a known character type name. */ @@ -9420,7 +9420,7 @@ ada_is_character_type (struct type *type) /* True if TYPE appears to be an Ada string type. */ -int +bool ada_is_string_type (struct type *type) { type = ada_check_typedef (type); @@ -9435,7 +9435,7 @@ ada_is_string_type (struct type *type) return ada_is_character_type (elttype); } else - return 0; + return false; } /* The compiler sometimes provides a parallel XVS type for a given diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index ee03dbd2aad..8740916a193 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -268,9 +268,9 @@ extern struct value *ada_value_primitive_packed_val (struct value *, extern struct type *ada_coerce_to_simple_array_type (struct type *); -extern int ada_is_character_type (struct type *); +extern bool ada_is_character_type (struct type *); -extern int ada_is_string_type (struct type *); +extern bool ada_is_string_type (struct type *); extern int ada_is_tagged_type (struct type *, int); -- 2.14.5