[binutils-gdb] [gdb] Return bool in producer_is_gcc
Tom de Vries
vries@sourceware.org
Mon Nov 17 16:33:09 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c0ca3668aee9d71ff4c6336e07abb04e9df10916
commit c0ca3668aee9d71ff4c6336e07abb04e9df10916
Author: Tom de Vries <tdevries@suse.de>
Date: Mon Nov 17 17:33:03 2025 +0100
[gdb] Return bool in producer_is_gcc
Function producer_is_gcc returns int, but the result is interpreted as zero or
non-zero.
Make it return bool instead.
Tested on x86_64-linux.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diff:
---
gdb/producer.c | 8 ++++----
gdb/producer.h | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gdb/producer.c b/gdb/producer.c
index 71e1b92e95e..91c2d1c2ca3 100644
--- a/gdb/producer.c
+++ b/gdb/producer.c
@@ -39,7 +39,7 @@ producer_is_gcc_ge_4 (const char *producer)
/* See producer.h. */
-int
+bool
producer_is_gcc (const char *producer, int *major, int *minor)
{
const char *cs;
@@ -58,7 +58,7 @@ producer_is_gcc (const char *producer, int *major, int *minor)
/* Bail out for GNU AS. */
if (startswith (cs, "AS "))
- return 0;
+ return false;
/* Skip any identifier after "GNU " - such as "C11" "C++" or "Java".
A full producer string might look like:
@@ -71,11 +71,11 @@ producer_is_gcc (const char *producer, int *major, int *minor)
if (*cs && c_isspace (*cs))
cs++;
if (sscanf (cs, "%d.%d", major, minor) == 2)
- return 1;
+ return true;
}
/* Not recognized as GCC. */
- return 0;
+ return false;
}
/* See producer.h. */
diff --git a/gdb/producer.h b/gdb/producer.h
index f5bf807cf78..40a19724dfa 100644
--- a/gdb/producer.h
+++ b/gdb/producer.h
@@ -25,10 +25,10 @@
4.x return -1. If it is GCC 5.x or higher return INT_MAX. */
extern int producer_is_gcc_ge_4 (const char *producer);
-/* Returns nonzero if the given PRODUCER string is GCC and sets the MAJOR
- and MINOR versions when not NULL. Returns zero if the given PRODUCER
+/* Return true if the given PRODUCER string is GCC and sets the MAJOR
+ and MINOR versions when not NULL. Return false if the given PRODUCER
is NULL or it isn't GCC. */
-extern int producer_is_gcc (const char *producer, int *major, int *minor);
+extern bool producer_is_gcc (const char *producer, int *major, int *minor);
/* Returns nonzero if the given PRODUCER string is GAS and sets the MAJOR
and MINOR versions when not NULL. Returns zero if the given PRODUCER
More information about the Gdb-cvs
mailing list