]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Return bool in producer_is_gcc
authorTom de Vries <tdevries@suse.de>
Mon, 17 Nov 2025 16:33:03 +0000 (17:33 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 17 Nov 2025 16:33:03 +0000 (17:33 +0100)
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>
gdb/producer.c
gdb/producer.h

index 71e1b92e95e7ece6b5f0825ad5b4a6a17eafdca7..91c2d1c2ca3ac63b432d8bf1ca4c84247b57aa26 100644 (file)
@@ -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.  */
index f5bf807cf782acbed8c79b3e91a608eaac730c77..40a19724dfaacf03f95c8eda6b89cd673789e758 100644 (file)
    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