diff mbox series

[committed] Fix warning in gcc.dg/plugin/expensive_selftests_plugin.c with !CHECKING_P

Message ID 1515006846-51525-1-git-send-email-dmalcolm@redhat.com
State New
Headers show
Series [committed] Fix warning in gcc.dg/plugin/expensive_selftests_plugin.c with !CHECKING_P | expand

Commit Message

David Malcolm Jan. 3, 2018, 7:14 p.m. UTC
On Tue, 2018-01-02 at 21:25 +0100, Andreas Schwab wrote:
> /daten/gcc/gcc-
> 20180101/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.c:175
> :1: warning: no return statement in function returning non-void [-
> Wreturn-type]
> 
> Andreas.

Thanks.  

I forgot to handle the --enable-checking=release case here; sorry.

I've committed the following patch to trunk to fix this (as r256183),
under the "obvious fixes" rule, borrowing the note from
toplev::run_self_tests to give the dg-regexp something to look for for
the !CHECKING_P case.

Tested with and without --enable-checking=release.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/expensive-selftests-1.c: Update regexp to handle
	the !CHECKING_P case by expecting a note.
	* gcc.dg/plugin/expensive_selftests_plugin.c (plugin_init): Issue
	a note for the !CHECKING_P case, and move the return statement
	outside of #if CHECKING_P guard.
---
 gcc/testsuite/gcc.dg/plugin/expensive-selftests-1.c      | 2 +-
 gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/plugin/expensive-selftests-1.c b/gcc/testsuite/gcc.dg/plugin/expensive-selftests-1.c
index e464117..64f168d 100644
--- a/gcc/testsuite/gcc.dg/plugin/expensive-selftests-1.c
+++ b/gcc/testsuite/gcc.dg/plugin/expensive-selftests-1.c
@@ -1,3 +1,3 @@ 
 int not_empty;
 
-/* { dg-regexp "expensive_selftests_plugin: .* pass\\(es\\) in .* seconds" } */
+/* { dg-regexp "expensive_selftests_plugin: .* pass\\(es\\) in .* seconds|not enabled in this build" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.c b/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.c
index 9470764..a7c6728 100644
--- a/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.c
@@ -170,6 +170,8 @@  plugin_init (struct plugin_name_args *plugin_info,
 		     PLUGIN_FINISH,
 		     selftest::expensive_tests,
 		     NULL); /* void *user_data */
-  return 0;
+#else
+  inform (UNKNOWN_LOCATION, "self-tests are not enabled in this build");
 #endif /* #if CHECKING_P */
+  return 0;
 }