--- /dev/null
+// PR c++/100796
+// { dg-additional-options "-Wsuggest-override -fplugin-arg-location_overflow_plugin-value=0x60000001" }
+// Passing LINE_MAP_MAX_LOCATION_WITH_COLS meant we stopped distinguishing between lines in a macro.
+
+#define DO_PRAGMA(text) _Pragma(#text)
+#define WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
+#define WARNING_POP DO_PRAGMA(GCC diagnostic pop)
+#define WARNING_DISABLE(text) DO_PRAGMA(GCC diagnostic ignored text)
+#define NO_OVERRIDE_WARNING WARNING_DISABLE("-Wsuggest-override")
+
+#define BOILERPLATE \
+ WARNING_PUSH \
+ NO_OVERRIDE_WARNING \
+ void f(); \
+ WARNING_POP
+
+struct B
+{
+ virtual void f();
+};
+
+struct D: B
+{
+ BOILERPLATE
+};
../../gcc.dg/plugin/diagnostic-test-string-literals-3.c \
../../gcc.dg/plugin/diagnostic-test-string-literals-4.c } \
{ ../../gcc.dg/plugin/location_overflow_plugin.c \
- location-overflow-test-pr96391.c } \
+ location-overflow-test-pr96391.c \
+ location-overflow-test-pr100796.c } \
{ show_template_tree_color_plugin.c \
show-template-tree-color.C \
show-template-tree-color-labels.C \
if (l0 == l1
&& pre_virtual_p
- && post_virtual_p
- && l0 <= LINE_MAP_MAX_LOCATION_WITH_COLS)
+ && post_virtual_p)
{
/* So pre and post represent two tokens that are present in a
same macro expansion. Let's see if the token for pre was
before the token for post in that expansion. */
- unsigned i0, i1;
const struct line_map *map =
first_map_in_common (set, pre, post, &l0, &l1);
if (map == NULL)
- /* This should not be possible. */
- abort ();
-
- i0 = l0 - MAP_START_LOCATION (map);
- i1 = l1 - MAP_START_LOCATION (map);
- return i1 - i0;
+ /* This should not be possible while we have column information, but if
+ we don't, the tokens could be from separate macro expansions on the
+ same line. */
+ gcc_assert (l0 > LINE_MAP_MAX_LOCATION_WITH_COLS);
+ else
+ {
+ unsigned i0 = l0 - MAP_START_LOCATION (map);
+ unsigned i1 = l1 - MAP_START_LOCATION (map);
+ return i1 - i0;
+ }
}
if (IS_ADHOC_LOC (l0))