[GOOGLE] Back port discriminator patches to gcc-4_8

Cary Coutant ccoutant@google.com
Mon May 20 22:53:00 GMT 2013


>> I've updated the patch. Bootstrapped and passed all regression test.
>>
>> OK for google-4_8?

Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 199127)
+++ gcc/Makefile.in (working copy)
@@ -1470,7 +1470,7 @@ OBJS-libcommon = diagnostic.o pretty-print.o intl.
 # compiler and containing target-dependent code.
 OBJS-libcommon-target = $(common_out_object_file) prefix.o params.o \
  opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o \
- hash-table.o file-find.o
+ hash-table.o file-find.o vec.o

This already has vec.o on the previous line. OBJS-libcommon is the one
that's missing vec.o.

+  /* If LOC describes a location with a discriminator, extract the
+     discriminator and map it to the real location.  */
+  if (min_discriminator_location != UNKNOWN_LOCATION
+      && loc >= min_discriminator_location
+      && loc < min_discriminator_location + next_discriminator_location)

The last test should be "loc < next_discriminator_location".

+bool
+has_discriminator (location_t locus)
+{
+  locus = LOCATION_LOCUS (locus);
+  return (min_discriminator_location != UNKNOWN_LOCATION
+  && locus >= min_discriminator_location
+  && locus < min_discriminator_location + next_discriminator_location);

Likewise.

+  ret = block ?
+      COMBINE_LOCATION_DATA (line_table, next_discriminator_location, block)
+      : LOCATION_LOCUS (next_discriminator_location);
+  next_discriminator_location++;
+  return ret;

LOCATION_LOCUS is unnecessary here (next_discriminator_location is
never an ad hoc location). This could be:

  ret = next_discriminator_location++;
  if (block != NULL)
    ret = COMBINE_LOCATION_DATA (line_table,
next_discriminator_location, block);
  return ret;

-cary



More information about the Gcc-patches mailing list