gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 29 Jun 2011 22:17:57 +0000 (22:17 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 29 Jun 2011 22:17:57 +0000 (22:17 +0000)
Code cleanup - reformatting.
* dwarf2read.c (producer_is_gcc_ge_4_0): Rename to ...
(producer_is_gcc_ge_4): ... here, change the return value.
(process_full_comp_unit): New variable gcc_4_minor, adjust the value
interpretation.

gdb/ChangeLog
gdb/dwarf2read.c

index af9f505..a64f76c 100644 (file)
@@ -1,5 +1,13 @@
 2011-06-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
+       Code cleanup - reformatting.
+       * dwarf2read.c (producer_is_gcc_ge_4_0): Rename to ...
+       (producer_is_gcc_ge_4): ... here, change the return value.
+       (process_full_comp_unit): New variable gcc_4_minor, adjust the value
+       interpretation.
+
+2011-06-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
        Fix non-only rename list for Fortran modules import.
        * cp-namespace.c (cp_scan_for_anonymous_namespaces): Adjust the
        cp_add_using_directive caller.
index ce43284..b17d74d 100644 (file)
@@ -4646,10 +4646,12 @@ compute_delayed_physnames (struct dwarf2_cu *cu)
     }
 }
 
-/* Check for GCC >= 4.0.  */
+/* Check for GCC >= 4.x.  Return minor version (x) of 4.x in such case.  If it
+   is not GCC or it is GCC older than 4.x return -1.  If it is GCC 5.x or
+   higher return INT_MAX.  */
 
 static int
-producer_is_gcc_ge_4_0 (struct dwarf2_cu *cu)
+producer_is_gcc_ge_4 (struct dwarf2_cu *cu)
 {
   const char *cs;
   int major, minor;
@@ -4660,7 +4662,7 @@ producer_is_gcc_ge_4_0 (struct dwarf2_cu *cu)
         this case can also happen for -gdwarf-4 type units supported since
         gcc-4.5.  */
 
-      return 0;
+      return -1;
     }
 
   /* Skip any identifier after "GNU " - such as "C++" or "Java".  */
@@ -4669,7 +4671,7 @@ producer_is_gcc_ge_4_0 (struct dwarf2_cu *cu)
     {
       /* For non-GCC compilers expect their behavior is not compliant.  */
 
-      return 0;
+      return -1;
     }
   cs = &cu->producer[strlen ("GNU ")];
   while (*cs && !isdigit (*cs))
@@ -4678,10 +4680,14 @@ producer_is_gcc_ge_4_0 (struct dwarf2_cu *cu)
     {
       /* Not recognized as GCC.  */
 
-      return 0;
+      return -1;
     }
 
-  return major >= 4;
+  if (major < 4)
+    return -1;
+  if (major > 4)
+    return INT_MAX;
+  return minor;
 }
 
 /* Generate full symbol information for PST and CU, whose DIEs have
@@ -4725,6 +4731,8 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
 
   if (symtab != NULL)
     {
+      int gcc_4_minor = producer_is_gcc_ge_4 (cu);
+
       /* Set symtab language to language from DW_AT_language.  If the
         compilation is from a C file generated by language preprocessors, do
         not set the language if it was already deduced by start_subfile.  */
@@ -4741,7 +4749,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
         Still one can confuse GDB by using non-standard GCC compilation
         options - this waits on GCC PR other/32998 (-frecord-gcc-switches).
         */ 
-      if (cu->has_loclist && producer_is_gcc_ge_4_0 (cu))
+      if (cu->has_loclist && gcc_4_minor >= 0)
        symtab->locations_valid = 1;
     }