From 59db13d3911068b52ef56802fd2368352eafe404 Mon Sep 17 00:00:00 2001
From: ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 14 Jan 2006 08:15:59 +0000
Subject: [PATCH] 	* tree.c (tree_not_class_check_failed): New function. 
 * tree.h (NON_TYPE_CHECK): Call tree_not_class_check_failed. 
 (tree_not_class_check_failed): Declare.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109699 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog |  6 ++++++
 gcc/tree.c    | 15 +++++++++++++++
 gcc/tree.h    |  8 ++++++--
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 57c19b9ea112..0e8ee822ca87 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-01-14  Ian Lance Taylor  <ian@airs.com>
+
+	* tree.c (tree_not_class_check_failed): New function.
+	* tree.h (NON_TYPE_CHECK): Call tree_not_class_check_failed.
+	(tree_not_class_check_failed): Declare.
+
 2006-01-13  Ian Lance Taylor  <ian@airs.com>
 
 	* reload1.c (do_output_reload): Add assertion rejecting a
diff --git a/gcc/tree.c b/gcc/tree.c
index 574e73b31a2e..4bda846734f3 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -6012,6 +6012,21 @@ tree_class_check_failed (const tree node, const enum tree_code_class cl,
      TREE_CODE_CLASS_STRING (TREE_CODE_CLASS (TREE_CODE (node))),
      tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
 }
+
+/* Similar to tree_check_failed, except that we check that a tree does
+   not have the specified code, given in CL.  */
+
+void
+tree_not_class_check_failed (const tree node, const enum tree_code_class cl,
+			     const char *file, int line, const char *function)
+{
+  internal_error
+    ("tree check: did not expect class %qs, have %qs (%s) in %s, at %s:%d",
+     TREE_CODE_CLASS_STRING (cl),
+     TREE_CODE_CLASS_STRING (TREE_CODE_CLASS (TREE_CODE (node))),
+     tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
+}
+
 #undef DEFTREESTRUCT
 #define DEFTREESTRUCT(VAL, NAME) NAME,
 
diff --git a/gcc/tree.h b/gcc/tree.h
index 78c3bc33738a..afeaf1eb040c 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -592,8 +592,8 @@ enum tree_node_structure_enum {
 #define NON_TYPE_CHECK(T) __extension__					\
 ({  const tree __t = (T);						\
     if (TYPE_P (__t))							\
-      tree_class_check_failed (__t, tcc_type, __FILE__, __LINE__,	\
-			       __FUNCTION__);				\
+      tree_not_class_check_failed (__t, tcc_type, __FILE__, __LINE__,	\
+				   __FUNCTION__);			\
     __t; })
 
 #define TREE_VEC_ELT_CHECK(T, I) __extension__				\
@@ -660,6 +660,10 @@ extern void tree_not_check_failed (const tree, const char *, int, const char *,
 extern void tree_class_check_failed (const tree, const enum tree_code_class,
 				     const char *, int, const char *)
     ATTRIBUTE_NORETURN;
+extern void tree_not_class_check_failed (const tree,
+					 const enum tree_code_class,
+					 const char *, int, const char *)
+    ATTRIBUTE_NORETURN;
 extern void tree_vec_elt_check_failed (int, int, const char *,
 				       int, const char *)
     ATTRIBUTE_NORETURN;
-- 
GitLab