public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed 1/3] selftests: split out make_fndecl from selftest.h to its own header
@ 2024-05-28 20:07 David Malcolm
  2024-05-28 20:07 ` [pushed 2/3] libcpp: move label_text " David Malcolm
  2024-05-28 20:07 ` [pushed 3/3] diagnostics: consolidate global state in diagnostic-color.cc David Malcolm
  0 siblings, 2 replies; 8+ messages in thread
From: David Malcolm @ 2024-05-28 20:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

Avoid selftest.h requiring the "tree" type.
No functional change intended.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r15-873-gfb7a943ead689e.

gcc/analyzer/ChangeLog:
	* region-model.cc: Include "selftest-tree.h".

gcc/ChangeLog:
	* function-tests.cc: Include "selftest-tree.h".
	* selftest-tree.h: New file.
	* selftest.h (make_fndecl): Move to selftest-tree.h.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
 gcc/analyzer/region-model.cc |  1 +
 gcc/function-tests.cc        |  1 +
 gcc/selftest-tree.h          | 41 ++++++++++++++++++++++++++++++++++++
 gcc/selftest.h               |  7 ------
 4 files changed, 43 insertions(+), 7 deletions(-)
 create mode 100644 gcc/selftest-tree.h

diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index bebe2ed3cd69..0dd5671db1be 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostic-color.h"
 #include "bitmap.h"
 #include "selftest.h"
+#include "selftest-tree.h"
 #include "analyzer/analyzer.h"
 #include "analyzer/analyzer-logging.h"
 #include "ordered-hash-map.h"
diff --git a/gcc/function-tests.cc b/gcc/function-tests.cc
index 827734422d88..ea3d722d4b69 100644
--- a/gcc/function-tests.cc
+++ b/gcc/function-tests.cc
@@ -76,6 +76,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-ref.h"
 #include "cgraph.h"
 #include "selftest.h"
+#include "selftest-tree.h"
 #include "print-rtl.h"
 
 #if CHECKING_P
diff --git a/gcc/selftest-tree.h b/gcc/selftest-tree.h
new file mode 100644
index 000000000000..9922af3340f2
--- /dev/null
+++ b/gcc/selftest-tree.h
@@ -0,0 +1,41 @@
+/* A self-testing framework, for use by -fself-test.
+   Copyright (C) 2015-2024 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_SELFTEST_TREE_H
+#define GCC_SELFTEST_TREE_H
+
+/* The selftest code should entirely disappear in a production
+   configuration, hence we guard all of it with #if CHECKING_P.  */
+
+#if CHECKING_P
+
+namespace selftest {
+
+/* Helper function for selftests that need a function decl.  */
+
+extern tree make_fndecl (tree return_type,
+			 const char *name,
+			 vec <tree> &param_types,
+			 bool is_variadic = false);
+
+} /* end of namespace selftest.  */
+
+#endif /* #if CHECKING_P */
+
+#endif /* GCC_SELFTEST_TREE_H */
diff --git a/gcc/selftest.h b/gcc/selftest.h
index 3bddaf1c3228..808d432ec480 100644
--- a/gcc/selftest.h
+++ b/gcc/selftest.h
@@ -178,13 +178,6 @@ class line_table_test
   ~line_table_test ();
 };
 
-/* Helper function for selftests that need a function decl.  */
-
-extern tree make_fndecl (tree return_type,
-			 const char *name,
-			 vec <tree> &param_types,
-			 bool is_variadic = false);
-
 /* Run TESTCASE multiple times, once for each case in our test matrix.  */
 
 extern void
-- 
2.26.3


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-06-17 17:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-28 20:07 [pushed 1/3] selftests: split out make_fndecl from selftest.h to its own header David Malcolm
2024-05-28 20:07 ` [pushed 2/3] libcpp: move label_text " David Malcolm
2024-06-06 13:01   ` Bert Wesarg
2024-06-06 15:40     ` Andrew Pinski
2024-06-06 16:00       ` David Malcolm
2024-06-06 17:05         ` Andrew Pinski
2024-06-17 17:42           ` Bert Wesarg
2024-05-28 20:07 ` [pushed 3/3] diagnostics: consolidate global state in diagnostic-color.cc David Malcolm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).