This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix names of various macro parameters in tree.h


I noticed that some of the macros in tree.h that act on trees have
parameters named "CODE", rather "NODE", which is confusing when in the
presence of other macros that act on enum tree_code values.

The attached patch renames such params for macros that I believe act on
trees (mostly because they go ahead and lookup the TREE_CODE() of the
param).

Successfully bootstrapped&regtested on x86_64-unknown-linux.

OK for trunk?

(fwiw the macros appear to have been this way since they were introduced
in 87675 in 2004-09-17)

gcc/
	* tree.h (EXCEPTIONAL_CLASS_P): Rename parameter from "CODE"
	to "NODE", since this works on a "tree", not an
	"enum tree_code".
	(CONSTANT_CLASS_P): Likewise.
	(TYPE_P): Likewise.
	(DECL_P): Likewise.
	(INDIRECT_REF_P): Likewise.
	(REFERENCE_CLASS_P): Likewise.
	(COMPARISON_CLASS_P): Likewise.
	(UNARY_CLASS_P): Likewise.
	(BINARY_CLASS_P): Likewise.
	(STATEMENT_CLASS_P): Likewise.
	(VL_EXP_CLASS_P): Likewise.
	(EXPRESSION_CLASS_P): Likewise.
	(IS_TYPE_OR_DECL_P): Likewise.

diff --git a/gcc/tree.h b/gcc/tree.h
index 2f4514d..6325e3c 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -90,25 +90,25 @@ along with GCC; see the file COPYING3.  If not see
 
 #define TREE_CODE_CLASS(CODE)	tree_code_type[(int) (CODE)]
 
-/* Nonzero if CODE represents an exceptional code.  */
+/* Nonzero if NODE represents an exceptional code.  */
 
-#define EXCEPTIONAL_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_exceptional)
+#define EXCEPTIONAL_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_exceptional)
 
-/* Nonzero if CODE represents a constant.  */
+/* Nonzero if NODE represents a constant.  */
 
-#define CONSTANT_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_constant)
+#define CONSTANT_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_constant)
 
-/* Nonzero if CODE represents a type.  */
+/* Nonzero if NODE represents a type.  */
 
-#define TYPE_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_type)
+#define TYPE_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_type)
 
-/* Nonzero if CODE represents a declaration.  */
+/* Nonzero if NODE represents a declaration.  */
 
-#define DECL_P(CODE)\
-        (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_declaration)
+#define DECL_P(NODE)\
+        (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_declaration)
 
 /* True if NODE designates a variable declaration.  */
 #define VAR_P(NODE) \
@@ -119,52 +119,52 @@ along with GCC; see the file COPYING3.  If not see
 #define VAR_OR_FUNCTION_DECL_P(DECL)\
   (TREE_CODE (DECL) == VAR_DECL || TREE_CODE (DECL) == FUNCTION_DECL)
 
-/* Nonzero if CODE represents a INDIRECT_REF.  Keep these checks in
+/* Nonzero if NODE represents a INDIRECT_REF.  Keep these checks in
    ascending code order.  */
 
-#define INDIRECT_REF_P(CODE)\
-  (TREE_CODE (CODE) == INDIRECT_REF)
+#define INDIRECT_REF_P(NODE)\
+  (TREE_CODE (NODE) == INDIRECT_REF)
 
-/* Nonzero if CODE represents a reference.  */
+/* Nonzero if NODE represents a reference.  */
 
-#define REFERENCE_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_reference)
+#define REFERENCE_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_reference)
 
-/* Nonzero if CODE represents a comparison.  */
+/* Nonzero if NODE represents a comparison.  */
 
-#define COMPARISON_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_comparison)
+#define COMPARISON_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_comparison)
 
-/* Nonzero if CODE represents a unary arithmetic expression.  */
+/* Nonzero if NODE represents a unary arithmetic expression.  */
 
-#define UNARY_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_unary)
+#define UNARY_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_unary)
 
-/* Nonzero if CODE represents a binary arithmetic expression.  */
+/* Nonzero if NODE represents a binary arithmetic expression.  */
 
-#define BINARY_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_binary)
+#define BINARY_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_binary)
 
-/* Nonzero if CODE represents a statement expression.  */
+/* Nonzero if NODE represents a statement expression.  */
 
-#define STATEMENT_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_statement)
+#define STATEMENT_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_statement)
 
-/* Nonzero if CODE represents a function call-like expression with a
+/* Nonzero if NODE represents a function call-like expression with a
    variable-length operand vector.  */
 
-#define VL_EXP_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_vl_exp)
+#define VL_EXP_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_vl_exp)
 
-/* Nonzero if CODE represents any other expression.  */
+/* Nonzero if NODE represents any other expression.  */
 
-#define EXPRESSION_CLASS_P(CODE)\
-	(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_expression)
+#define EXPRESSION_CLASS_P(NODE)\
+	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_expression)
 
-/* Returns nonzero iff CODE represents a type or declaration.  */
+/* Returns nonzero iff NODE represents a type or declaration.  */
 
-#define IS_TYPE_OR_DECL_P(CODE)\
-	(TYPE_P (CODE) || DECL_P (CODE))
+#define IS_TYPE_OR_DECL_P(NODE)\
+	(TYPE_P (NODE) || DECL_P (NODE))
 
 /* Returns nonzero iff CLASS is the tree-code class of an
    expression.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]