testsuite: add coverage for diagnostics relating to inlining (PR tree-optimization...
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 18 Dec 2017 19:23:30 +0000 (19:23 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Mon, 18 Dec 2017 19:23:30 +0000 (19:23 +0000)
commitab6e54a684f6fcbf9eed989d170905fd889e19cc
tree7302a65ee17fdb19155db0c24ffe950010dc58f8
parent5dd44f4ea5924ad31f7e70b6afba353032b8387d
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".

From-SVN: r255786
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C
gcc/testsuite/g++.dg/plugin/diagnostic-test-inlining-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/plugin/plugin.exp
gcc/testsuite/gcc.dg/plugin/diagnostic-test-inlining-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/diagnostic-test-inlining-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/diagnostic-test-inlining-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/diagnostic-test-inlining-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/plugin.exp
gcc/testsuite/lib/prune.exp