aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-10-10 00:10:17 -0400
committerJason Merrill <jason@gcc.gnu.org>2019-10-10 00:10:17 -0400
commit6ea20bd0218fd6386cef3701befa653cee6f1101 (patch)
treebc43bdd32241c555b2f66419130b996ad9db98bb
parent66ef6ac5806f82fdaa35c01f89b6c8cd4b47b4b5 (diff)
downloadgcc-6ea20bd0218fd6386cef3701befa653cee6f1101.zip
gcc-6ea20bd0218fd6386cef3701befa653cee6f1101.tar.gz
gcc-6ea20bd0218fd6386cef3701befa653cee6f1101.tar.bz2
* cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
From-SVN: r276787
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/cp-tree.h62
2 files changed, 37 insertions, 29 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e47e8ca..2a35bf2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2019-10-09 Jason Merrill <jason@redhat.com>
+
+ * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
+
2019-10-09 Marek Polacek <polacek@redhat.com>
PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index c1301a4..663d84b 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -593,15 +593,46 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+
+/* Returns t iff the node can have a TEMPLATE_INFO field. */
+
+inline tree
+template_info_decl_check (const_tree t, const char* f, int l, const char* fn)
+{
+ switch (TREE_CODE (t))
+ {
+ case VAR_DECL:
+ case FUNCTION_DECL:
+ case FIELD_DECL:
+ case TYPE_DECL:
+ case CONCEPT_DECL:
+ case TEMPLATE_DECL:
+ return const_cast<tree>(t);
+ default:
+ break;
+ }
+ tree_check_failed (t, f, l, fn,
+ VAR_DECL, FUNCTION_DECL, FIELD_DECL, TYPE_DECL,
+ CONCEPT_DECL, TEMPLATE_DECL, 0);
+ gcc_unreachable ();
+}
+
+#define TEMPLATE_INFO_DECL_CHECK(NODE) \
+ template_info_decl_check ((NODE), __FILE__, __LINE__, __FUNCTION__)
+
#define THUNK_FUNCTION_CHECK(NODE) __extension__ \
({ __typeof (NODE) const __t = (NODE); \
if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
|| !__t->decl_common.lang_specific->u.fn.thunk_p) \
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
__t; })
-#else
+
+#else /* ENABLE_TREE_CHECKING */
+
+#define TEMPLATE_INFO_DECL_CHECK(NODE) (NODE)
#define THUNK_FUNCTION_CHECK(NODE) (NODE)
-#endif
+
+#endif /* ENABLE_TREE_CHECKING */
/* Language-dependent contents of an identifier. */
@@ -3348,33 +3379,6 @@ struct GTY(()) lang_decl {
#define TEMPLATE_DECL_COMPLEX_ALIAS_P(NODE) \
DECL_LANG_FLAG_2 (TEMPLATE_DECL_CHECK (NODE))
-/* Returns t iff the node can have a TEMPLATE_INFO field. */
-
-inline tree
-template_info_decl_check (const_tree t, const char* f, int l, const char* fn)
-{
- switch (TREE_CODE (t))
- {
- case VAR_DECL:
- case FUNCTION_DECL:
- case FIELD_DECL:
- case TYPE_DECL:
- case CONCEPT_DECL:
- case TEMPLATE_DECL:
- return const_cast<tree>(t);
- default:
- break;
- }
- tree_check_failed (t, f, l, fn,
- VAR_DECL, FUNCTION_DECL, FIELD_DECL, TYPE_DECL,
- CONCEPT_DECL, TEMPLATE_DECL, 0);
- gcc_unreachable ();
-}
-
-
-#define TEMPLATE_INFO_DECL_CHECK(NODE) \
- template_info_decl_check ((NODE), __FILE__, __LINE__, __FUNCTION__)
-
/* Nonzero for a type which is an alias for another type; i.e, a type
which declaration was written 'using name-of-type =
another-type'. */