public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/ada: Update some predicate functions to return bool
@ 2019-04-29 21:03 Andrew Burgess
0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2019-04-29 21:03 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fc913e53c353218ba1a9efa423c08767691a682a
commit fc913e53c353218ba1a9efa423c08767691a682a
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Wed Apr 10 23:07:10 2019 +0100
gdb/ada: Update some predicate functions to return bool
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.
Diff:
---
gdb/ChangeLog | 7 +++++++
gdb/ada-lang.c | 8 ++++----
gdb/ada-lang.h | 4 ++--
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4f59592..718602e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2019-04-29 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * 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.
+
2019-04-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
Support style in 'frame|thread apply'
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 250ce43..3667817 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -9405,7 +9405,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;
@@ -9413,7 +9413,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. */
@@ -9429,7 +9429,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);
@@ -9444,7 +9444,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 ee03dbd..8740916 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-29 21:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 21:03 [binutils-gdb] gdb/ada: Update some predicate functions to return bool Andrew Burgess
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).