From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCHv2 1/5] gdb/ada: Update some predicate functions to return bool
Date: Tue, 16 Apr 2019 23:06:00 -0000 [thread overview]
Message-ID: <0ad8f4f39a6eaabe2e97467dc6f53aea89800d7e.1555455013.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1555455013.git.andrew.burgess@embecosm.com>
In-Reply-To: <cover.1555455013.git.andrew.burgess@embecosm.com>
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
next prev parent reply other threads:[~2019-04-16 23:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 23:06 [PATCHv2 0/5] Add new 'print max-depth' feature Andrew Burgess
2019-03-27 21:53 ` [PATCH 0/2] " Andrew Burgess
2019-03-27 21:53 ` [PATCH 1/2] gdb: Introduce new language field la_struct_too_deep_ellipsis Andrew Burgess
2019-03-28 12:43 ` Pedro Alves
2019-03-27 21:53 ` [PATCH 2/2] gdb: Introduce 'print max-depth' feature Andrew Burgess
2019-03-28 16:08 ` Eli Zaretskii
2019-03-28 12:47 ` [PATCH 0/2] Add new " Pedro Alves
2019-03-28 22:48 ` Andrew Burgess
2019-03-28 23:47 ` Marco Barisione
2019-04-16 23:06 ` Andrew Burgess [this message]
2019-04-18 0:03 ` [PATCHv2 1/5] gdb/ada: Update some predicate functions to return bool Joel Brobecker
2019-04-16 23:06 ` [PATCHv2 2/5] gdb/testsuite: Don't add gcc flags when compiling rust tests Andrew Burgess
2019-04-19 14:31 ` Tom Tromey
2019-04-16 23:06 ` [PATCHv2 3/5] gdb: Introduce new language field la_struct_too_deep_ellipsis Andrew Burgess
2019-04-19 14:37 ` Tom Tromey
2019-04-16 23:06 ` [PATCHv2 5/5] gdb: Introduce 'print max-depth' feature Andrew Burgess
2019-04-17 7:42 ` Philippe Waroquiers
2019-04-17 14:35 ` Eli Zaretskii
2019-04-18 1:07 ` Andrew Burgess
2019-04-18 2:38 ` Eli Zaretskii
2019-04-18 21:52 ` Andrew Burgess
2019-04-19 6:50 ` Eli Zaretskii
2019-04-18 17:08 ` Pedro Alves
2019-04-16 23:06 ` [PATCHv2 4/5] gdb: Introduce new language field la_is_string_type_p Andrew Burgess
2019-04-18 17:08 ` Pedro Alves
2019-04-19 21:00 ` Andrew Burgess
2019-04-19 14:45 ` Tom Tromey
2019-04-19 22:22 ` Andrew Burgess
2019-04-24 19:32 ` Tom Tromey
2019-04-19 22:45 ` Andrew Burgess
2019-04-24 19:33 ` Tom Tromey
2019-04-29 21:14 ` [PATCHv2 0/5] Add new 'print max-depth' feature Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0ad8f4f39a6eaabe2e97467dc6f53aea89800d7e.1555455013.git.andrew.burgess@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox