Change producer_is_gcc function return type to bool.
authorMark Wielaard <mjw@redhat.com>
Wed, 4 Feb 2015 17:14:33 +0000 (18:14 +0100)
committerMark Wielaard <mjw@redhat.com>
Tue, 10 Feb 2015 20:20:38 +0000 (21:20 +0100)
gdb/ChangeLog:

        * utils.h (producer_is_gcc): Change return type to bool. Add major
        argument.
        * utils.c (producer_is_gcc): Likewise.
        (producer_is_gcc_ge_4): Adjust producer_is_gcc call.
        * dwarf2read.c (check_producer): Likewise.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/utils.c
gdb/utils.h

index 58df0ca592a0a0a8b413d4e82a431c0ba57270ca..a23c2d880c5e5026cb11fe8d267e72907c03bee3 100644 (file)
@@ -1,3 +1,11 @@
+2015-02-04  Mark Wielaard  <mjw@redhat.com>
+
+       * utils.h (producer_is_gcc): Change return type to bool. Add major
+       argument.
+       * utils.c (producer_is_gcc): Likewise.
+       (producer_is_gcc_ge_4): Adjust producer_is_gcc call.
+       * dwarf2read.c (check_producer): Likewise.
+
 2015-02-10  Pedro Alves  <palves@redhat.com>
 
        * infrun.c (displaced_step_fixup): Switch to the event thread
index db35e7e8f783e7a2130fb3ed2c382259b211634d..a7643896c75ef2081c35b5b84ec62e3af72952c1 100644 (file)
@@ -12293,7 +12293,7 @@ check_producer (struct dwarf2_cu *cu)
         combination.  gcc-4.5.x -gdwarf-4 binaries have DW_AT_accessibility
         interpreted incorrectly by GDB now - GCC PR debug/48229.  */
     }
-  else if ((major = producer_is_gcc (cu->producer, &minor)) > 0)
+  else if (producer_is_gcc (cu->producer, &major, &minor))
     {
       cu->producer_is_gxx_lt_4_6 = major < 4 || (major == 4 && minor < 6);
       cu->producer_is_gcc_lt_4_3 = major < 4 || (major == 4 && minor < 3);
index 909476bce2e467f7d129a5f0dd8f3a4d5c4392b8..2b5473947ced8732fd8dc00d68c22bf73f678d4d 100644 (file)
@@ -3259,7 +3259,9 @@ int
 producer_is_gcc_ge_4 (const char *producer)
 {
   int major, minor;
-  major = producer_is_gcc (producer, &minor);
+
+  if (! producer_is_gcc (producer, &major, &minor))
+    return -1;
   if (major < 4)
     return -1;
   if (major > 4)
@@ -3267,17 +3269,24 @@ producer_is_gcc_ge_4 (const char *producer)
   return minor;
 }
 
-/* Returns the major version number if the given PRODUCER string is GCC and
-   sets the MINOR version.  Returns -1 if the given PRODUCER is NULL or it
-   isn't GCC.  */
-int
-producer_is_gcc (const char *producer, int *minor)
+/* Returns true if the given PRODUCER string is GCC and sets the MAJOR
+   and MINOR versions when not NULL.  Returns false if the given PRODUCER
+   is NULL or it isn't GCC.  */
+
+bool
+producer_is_gcc (const char *producer, int *major, int *minor)
 {
   const char *cs;
-  int major;
 
   if (producer != NULL && strncmp (producer, "GNU ", strlen ("GNU ")) == 0)
     {
+      int maj, min;
+
+      if (major == NULL)
+       major = &maj;
+      if (minor == NULL)
+       minor = &min;
+
       /* Skip any identifier after "GNU " - such as "C11" "C++" or "Java".
         A full producer string might look like:
         "GNU C 4.7.2"
@@ -3289,7 +3298,7 @@ producer_is_gcc (const char *producer, int *minor)
         cs++;
       if (*cs && isspace (*cs))
         cs++;
-      if (sscanf (cs, "%d.%d", &major, minor) == 2)
+      if (sscanf (cs, "%d.%d", major, minor) == 2)
        return major;
     }
 
index 6724d7ce8da40df66da4ca17c82f740b6d549cd3..d8afa794813aa4d9e46abf221e4755665d7336e5 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef UTILS_H
 #define UTILS_H
 
+#include <stdbool.h>
+
 #include "exceptions.h"
 
 extern void initialize_utils (void);
@@ -302,7 +304,7 @@ extern pid_t wait_to_die_with_timeout (pid_t pid, int *status, int timeout);
 #endif
 
 extern int producer_is_gcc_ge_4 (const char *producer);
-extern int producer_is_gcc (const char *producer, int *minor);
+extern bool producer_is_gcc (const char *producer, int *major, int *minor);
 
 extern int myread (int, char *, int);
 
This page took 0.047739 seconds and 4 git commands to generate.