https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83336

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Mon Dec 18 19:23:30 2017
New Revision: 255786

URL: https://gcc.gnu.org/viewcvs?rev=255786&root=gcc&view=rev
Log:
testsuite: add coverage for diagnostics relating to inlining (PR
tree-optimization/83336)

In theory, the diagnostics subsystem can print context information on
code inlining when diagnostics are emitted by the middle-end, describing
the chain of inlined callsites that led to a particular warning,
but PR tree-optimization/83336 describes various issues with this.

An underlying issue is that we have very little automated testing for
this code: gcc.dg/tm/pr52141.c has a test, but in general, prune.exp
filters out the various "inlined from" lines.

The following patch adds test coverage for it for C and C++ via a new
testsuite plugin, which emits a warning from the middle-end; the test
cases use dg-regexp to verify that the "inlined from" lines are
emitted correctly, with the correct function names and source locations.

Doing so requires a change to prune.exp: the dg-regexp lines have to
be handled *before* the "inlined from" lines are stripped.

gcc/testsuite/ChangeLog:
        PR tree-optimization/83336
        * g++.dg/cpp0x/missing-initializer_list-include.C: Update for
        changes to prune.exp's handling of dg-regexp.
        * g++.dg/plugin/diagnostic-test-inlining-1.C: New test case.
        * g++.dg/plugin/plugin.exp (plugin_test_list): Add it, via
        gcc.dg's plugin/diagnostic_plugin_test_inlining.c.
        * gcc.dg/plugin/diagnostic-test-inlining-1.c: New test case.
        * gcc.dg/plugin/diagnostic-test-inlining-2.c: Likewise.
        * gcc.dg/plugin/diagnostic-test-inlining-3.c: Likewise.
        * gcc.dg/plugin/diagnostic-test-inlining-4.c: Likewise.
        * gcc.dg/plugin/diagnostic_plugin_test_inlining.c: New test
        plugin.
        * gcc.dg/plugin/plugin.exp (plugin_test_list): Add them.
        * lib/prune.exp (prune_gcc_output): Move call to handle-dg-regexps
        to before the various text stripping regsup invocations,
        in particular, to before the stripping of "inlined from".


Added:
    trunk/gcc/testsuite/g++.dg/plugin/diagnostic-test-inlining-1.C
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-inlining-1.c
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-inlining-2.c
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-inlining-3.c
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-inlining-4.c
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C
    trunk/gcc/testsuite/g++.dg/plugin/plugin.exp
    trunk/gcc/testsuite/gcc.dg/plugin/plugin.exp
    trunk/gcc/testsuite/lib/prune.exp

Reply via email to