This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
misc patch tree.h + jcf-parse.c
- From: Graham Stott <grahams at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 01 Jan 2002 08:11:24 +0000
- Subject: misc patch tree.h + jcf-parse.c
All,
This patch mostly tidies up tree.h w.r.t whitespace and add
paranthesis where necessary. It also has an associated patch
for jcf-parse.c to go with the IDENTIFIER_POINTER change.
Bootstrapped i686-pc-linux + enable-checking + all languages
no regressions.
Graham
ChangeLog
* tree.h: Update copyright.
(IS_EXPR_CODE_CLASS): Add parenthesis.
(TREE_SET_CODE): Add whitespace.
(TREE_CHECK): Add parenthesis.
(TREE_CLASS_CODE): Add parenthesis and wrap long line.
(CST_OR_CONSTRUCTOR_CHECK):
(EXPR_CHECK): Add parenthis, whitespacce and wrap line.
(TREE_SYMBOL_REFERENCED): Whitespace.
(INT_CST_LT): Likewise.
(INT_CST_LT_UNSIGNED): Likewise.
(tree_real_cst): Unwrap comment.
(tree_string): Likewise.
(tree_complex): Likewise.
(IDENTIFIER_POINTER): correct cast.
(SAVE_EXPR_CONTEXT): Whitespace.
(EXPR_WFL_FILENAME_NODE): Likewise.
(EXPR_WFL_FILENAME): Remove parenthesis.
(DECL_ORIGIN): Add parenthesis.
(DECL_FROM_INLINE): Use NULL_TREE.
(build_int_2): Whitespace.
(build_type_variant): Add parenthesis.
* gcc/jcf-parse.c (yyparse): Constify resource_filename.
--------------------------------------------------------------------------
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.295
diff -c -p -r1.295 tree.h
*** tree.h 2001/12/31 04:07:11 1.295
--- tree.h 2002/01/01 07:43:30
***************
*** 1,6 ****
/* Front-end tree definitions for GNU compiler.
! Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
! Free Software Foundation, Inc.
This file is part of GCC.
--- 1,6 ----
/* Front-end tree definitions for GNU compiler.
! Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
! 2002 Free Software Foundation, Inc.
This file is part of GCC.
*************** extern char tree_code_type[MAX_TREE_CODE
*** 53,59 ****
expression. */
#define IS_EXPR_CODE_CLASS(CLASS) \
! (CLASS == '<' || CLASS == '1' || CLASS == '2' || CLASS == 'e')
/* Number of argument-words in each kind of tree-node. */
--- 53,59 ----
expression. */
#define IS_EXPR_CODE_CLASS(CLASS) \
! ((CLASS) == '<' || (CLASS) == '1' || (CLASS) == '2' || (CLASS) == 'e')
*************** struct tree_common
*** 268,303 ****
Codes are defined in tree.def. */
#define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code)
#define TREE_SET_CODE(NODE, VALUE) \
! ((NODE)->common.code = (ENUM_BITFIELD(tree_code)) (VALUE))
/* When checking is enabled, errors will be generated if a tree node
is accessed incorrectly. The macros abort with a fatal error. */
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
#define TREE_CHECK(t, code) __extension__ \
! ({ const tree __t = t; \
if (TREE_CODE(__t) != (code)) \
tree_check_failed (__t, code, __FILE__, __LINE__, __FUNCTION__); \
__t; })
#define TREE_CLASS_CHECK(t, class) __extension__ \
! ({ const tree __t = t; \
if (TREE_CODE_CLASS(TREE_CODE(__t)) != (class)) \
! tree_class_check_failed (__t, class, __FILE__, __LINE__, __FUNCTION__); \
__t; })
/* These checks have to be special cased. */
#define CST_OR_CONSTRUCTOR_CHECK(t) __extension__ \
! ({ const tree __t = t; \
! enum tree_code __c = TREE_CODE(__t); \
if (__c != CONSTRUCTOR && TREE_CODE_CLASS(__c) != 'c') \
! tree_check_failed (__t, CONSTRUCTOR, __FILE__, __LINE__, __FUNCTION__); \
__t; })
#define EXPR_CHECK(t) __extension__ \
! ({ const tree __t = t; \
! char __c = TREE_CODE_CLASS(TREE_CODE(__t)); \
if (__c != 'r' && __c != 's' && __c != '<' \
&& __c != '1' && __c != '2' && __c != 'e') \
! tree_class_check_failed(__t, 'e', __FILE__, __LINE__, __FUNCTION__); \
__t; })
extern void tree_check_failed PARAMS ((const tree, enum tree_code,
/* Number of argument-words in each kind of tree-node. */--- 268,306 ----
Codes are defined in tree.def. */
#define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code)
#define TREE_SET_CODE(NODE, VALUE) \
! ((NODE)->common.code = (ENUM_BITFIELD (tree_code)) (VALUE))
/* When checking is enabled, errors will be generated if a tree node
is accessed incorrectly. The macros abort with a fatal error. */
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
#define TREE_CHECK(t, code) __extension__ \
! ({ const tree __t = (t); \
if (TREE_CODE(__t) != (code)) \
tree_check_failed (__t, code, __FILE__, __LINE__, __FUNCTION__); \
__t; })
#define TREE_CLASS_CHECK(t, class) __extension__ \
! ({ const tree __t = (t); \
if (TREE_CODE_CLASS(TREE_CODE(__t)) != (class)) \
! tree_class_check_failed (__t, class, __FILE__, __LINE__, \
! __FUNCTION__); \
__t; })
/* These checks have to be special cased. */
#define CST_OR_CONSTRUCTOR_CHECK(t) __extension__ \
! ({ const tree __t = (t); \
! enum tree_code const __c = TREE_CODE(__t); \
if (__c != CONSTRUCTOR && TREE_CODE_CLASS(__c) != 'c') \
! tree_check_failed (__t, CONSTRUCTOR, __FILE__, __LINE__, \
! __FUNCTION__); \
__t; })
#define EXPR_CHECK(t) __extension__ \
! ({ const tree __t = (t); \
! char const __c = TREE_CODE_CLASS(TREE_CODE(__t)); \
if (__c != 'r' && __c != 's' && __c != '<' \
&& __c != '1' && __c != '2' && __c != 'e') \
! tree_class_check_failed (__t, 'e', __FILE__, __LINE__, \
! __FUNCTION__); \
__t; })
extern void tree_check_failed PARAMS ((const tree, enum tree_code,
*************** extern void tree_class_check_failed PARA
*** 509,515 ****
/* In an IDENTIFIER_NODE, this means that assemble_name was called with
this string as an argument. */
#define TREE_SYMBOL_REFERENCED(NODE) \
! (IDENTIFIER_NODE_CHECK (NODE)->common.static_flag)
/* In an INTEGER_CST, REAL_CST, of COMPLEX_CST, this means there was an
overflow in folding, and no warning has been issued for this subexpression.
--- 512,518 ----
/* In an IDENTIFIER_NODE, this means that assemble_name was called with
this string as an argument. */
#define TREE_SYMBOL_REFERENCED(NODE) \
! (IDENTIFIER_NODE_CHECK (NODE)->common.static_flag)
/* In an INTEGER_CST, REAL_CST, of COMPLEX_CST, this means there was an
overflow in folding, and no warning has been issued for this subexpression.
*************** extern void tree_class_check_failed PARA
*** 666,681 ****
#define TREE_INT_CST_LOW(NODE) (TREE_INT_CST (NODE).low)
#define TREE_INT_CST_HIGH(NODE) (TREE_INT_CST (NODE).high)
! #define INT_CST_LT(A, B) \
! (TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B) \
! || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B) \
&& TREE_INT_CST_LOW (A) < TREE_INT_CST_LOW (B)))
! #define INT_CST_LT_UNSIGNED(A, B) \
! (((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
! < (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (B)) \
! || (((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
! == (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (B)) \
&& TREE_INT_CST_LOW (A) < TREE_INT_CST_LOW (B)))
struct tree_int_cst
--- 669,684 ----
#define TREE_INT_CST_LOW(NODE) (TREE_INT_CST (NODE).low)
#define TREE_INT_CST_HIGH(NODE) (TREE_INT_CST (NODE).high)
! #define INT_CST_LT(A, B) \
! (TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B) \
! || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B) \
&& TREE_INT_CST_LOW (A) < TREE_INT_CST_LOW (B)))
! #define INT_CST_LT_UNSIGNED(A, B) \
! (((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
! < (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (B)) \
! || (((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
! == (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (B)) \
&& TREE_INT_CST_LOW (A) < TREE_INT_CST_LOW (B)))
struct tree_int_cst
*************** struct tree_int_cst
*** 710,717 ****
struct tree_real_cst
{
struct tree_common common;
! rtx rtl; /* acts as link to register transfer language
! (rtl) info */
REAL_VALUE_TYPE real_cst;
};
--- 713,719 ----
struct tree_real_cst
{
struct tree_common common;
! rtx rtl; /* acts as link to register transfer language (rtl) info */
REAL_VALUE_TYPE real_cst;
};
*************** struct tree_real_cst
*** 722,729 ****
struct tree_string
{
struct tree_common common;
! rtx rtl; /* acts as link to register transfer language
! (rtl) info */
int length;
const char *pointer;
};
--- 724,730 ----
struct tree_string
{
struct tree_common common;
! rtx rtl; /* acts as link to register transfer language (rtl) info */
int length;
const char *pointer;
};
*************** struct tree_string
*** 735,742 ****
struct tree_complex
{
struct tree_common common;
! rtx rtl; /* acts as link to register transfer language
! (rtl) info */
tree real;
tree imag;
};
--- 736,742 ----
struct tree_complex
{
struct tree_common common;
! rtx rtl; /* acts as link to register transfer language (rtl) info */
tree real;
tree imag;
};*************** struct tree_complex
*** 748,754 ****
#define IDENTIFIER_LENGTH(NODE) \
(IDENTIFIER_NODE_CHECK (NODE)->identifier.id.len)
#define IDENTIFIER_POINTER(NODE) \
! ((char *) IDENTIFIER_NODE_CHECK (NODE)->identifier.id.str)
/* Translate a hash table identifier pointer to a tree_identifier
pointer, and vice versa. */
--- 748,754 ----
#define IDENTIFIER_LENGTH(NODE) \
(IDENTIFIER_NODE_CHECK (NODE)->identifier.id.len)
#define IDENTIFIER_POINTER(NODE) \
! ((const char *) IDENTIFIER_NODE_CHECK (NODE)->identifier.id.str)
/* Translate a hash table identifier pointer to a tree_identifier
pointer, and vice versa. */
*************** struct tree_vec
*** 790,796 ****
/* Define fields and accessors for some nodes that represent expressions. */
/* In a SAVE_EXPR node. */
! #define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND(SAVE_EXPR_CHECK (NODE), 1)
#define SAVE_EXPR_RTL(NODE) (*(rtx *) &SAVE_EXPR_CHECK (NODE)->exp.operands[2])
#define SAVE_EXPR_NOPLACEHOLDER(NODE) TREE_UNSIGNED (SAVE_EXPR_CHECK (NODE))
/* Nonzero if the SAVE_EXPRs value should be kept, even if it occurs
--- 790,796 ----
/* Define fields and accessors for some nodes that represent expressions. */
/* In a SAVE_EXPR node. */
! #define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND (SAVE_EXPR_CHECK (NODE), 1)
#define SAVE_EXPR_RTL(NODE) (*(rtx *) &SAVE_EXPR_CHECK (NODE)->exp.operands[2])
#define SAVE_EXPR_NOPLACEHOLDER(NODE) TREE_UNSIGNED (SAVE_EXPR_CHECK (NODE))
/* Nonzero if the SAVE_EXPRs value should be kept, even if it occurs*************** struct tree_complex
*** 748,754 ****
#define IDENTIFIER_LENGTH(NODE) \
(IDENTIFIER_NODE_CHECK (NODE)->identifier.id.len)
#define IDENTIFIER_POINTER(NODE) \
! ((char *) IDENTIFIER_NODE_CHECK (NODE)->identifier.id.str)
/* Translate a hash table identifier pointer to a tree_identifier
pointer, and vice versa. */
--- 748,754 ----
#define IDENTIFIER_LENGTH(NODE) \
(IDENTIFIER_NODE_CHECK (NODE)->identifier.id.len)
#define IDENTIFIER_POINTER(NODE) \
! ((const char *) IDENTIFIER_NODE_CHECK (NODE)->identifier.id.str)
/* Translate a hash table identifier pointer to a tree_identifier
pointer, and vice versa. */
*************** struct tree_vec
*** 790,796 ****
/* Define fields and accessors for some nodes that represent expressions. */
/* In a SAVE_EXPR node. */
! #define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND(SAVE_EXPR_CHECK (NODE), 1)
#define SAVE_EXPR_RTL(NODE) (*(rtx *) &SAVE_EXPR_CHECK (NODE)->exp.operands[2])
#define SAVE_EXPR_NOPLACEHOLDER(NODE) TREE_UNSIGNED (SAVE_EXPR_CHECK (NODE))
/* Nonzero if the SAVE_EXPRs value should be kept, even if it occurs
--- 790,796 ----
/* Define fields and accessors for some nodes that represent expressions. */
/* In a SAVE_EXPR node. */
! #define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND (SAVE_EXPR_CHECK (NODE), 1)
#define SAVE_EXPR_RTL(NODE) (*(rtx *) &SAVE_EXPR_CHECK (NODE)->exp.operands[2])
#define SAVE_EXPR_NOPLACEHOLDER(NODE) TREE_UNSIGNED (SAVE_EXPR_CHECK (NODE))
/* Nonzero if the SAVE_EXPRs value should be kept, even if it occurs
*************** struct tree_vec
*** 835,843 ****
#define EXPR_WFL_NODE(NODE) \
TREE_OPERAND (EXPR_WITH_FILE_LOCATION_CHECK (NODE), 0)
#define EXPR_WFL_FILENAME_NODE(NODE) \
! TREE_OPERAND(EXPR_WITH_FILE_LOCATION_CHECK (NODE), 1)
#define EXPR_WFL_FILENAME(NODE) \
! IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE ((NODE)))
/* ??? Java uses this in all expressions. */
#define EXPR_WFL_LINECOL(NODE) (EXPR_CHECK (NODE)->exp.complexity)
#define EXPR_WFL_LINENO(NODE) (EXPR_WFL_LINECOL (NODE) >> 12)
--- 835,843 ----
#define EXPR_WFL_NODE(NODE) \
TREE_OPERAND (EXPR_WITH_FILE_LOCATION_CHECK (NODE), 0)
#define EXPR_WFL_FILENAME_NODE(NODE) \
! TREE_OPERAND (EXPR_WITH_FILE_LOCATION_CHECK (NODE), 1)
#define EXPR_WFL_FILENAME(NODE) \
! IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (NODE))
/* ??? Java uses this in all expressions. */
#define EXPR_WFL_LINECOL(NODE) (EXPR_CHECK (NODE)->exp.complexity)
#define EXPR_WFL_LINENO(NODE) (EXPR_WFL_LINECOL (NODE) >> 12)
*************** struct tree_type
*** 1500,1512 ****
/* Like DECL_ABSTRACT_ORIGIN, but returns NODE if there's no abstract
origin. This is useful when setting the DECL_ABSTRACT_ORIGIN. */
#define DECL_ORIGIN(NODE) \
! (DECL_ABSTRACT_ORIGIN (NODE) ? DECL_ABSTRACT_ORIGIN (NODE) : NODE)
/* Nonzero for any sort of ..._DECL node means this decl node represents an
inline instance of some original (abstract) decl from an inline function;
suppress any warnings about shadowing some other variable. FUNCTION_DECL
nodes can also have their abstract origin set to themselves. */
! #define DECL_FROM_INLINE(NODE) (DECL_ABSTRACT_ORIGIN (NODE) != (tree) 0 \
&& DECL_ABSTRACT_ORIGIN (NODE) != (NODE))
/* Nonzero if a _DECL means that the name of this decl should be ignored
--- 1500,1512 ----
/* Like DECL_ABSTRACT_ORIGIN, but returns NODE if there's no abstract
origin. This is useful when setting the DECL_ABSTRACT_ORIGIN. */
#define DECL_ORIGIN(NODE) \
! (DECL_ABSTRACT_ORIGIN (NODE) ? DECL_ABSTRACT_ORIGIN (NODE) : (NODE))
/* Nonzero for any sort of ..._DECL node means this decl node represents an
inline instance of some original (abstract) decl from an inline function;
suppress any warnings about shadowing some other variable. FUNCTION_DECL
nodes can also have their abstract origin set to themselves. */
! #define DECL_FROM_INLINE(NODE) (DECL_ABSTRACT_ORIGIN (NODE) != NULL_TREE \
&& DECL_ABSTRACT_ORIGIN (NODE) != (NODE))
/* Nonzero if a _DECL means that the name of this decl should be ignored
*************** extern tree maybe_get_identifier PARAMS
*** 2072,2078 ****
/* Construct various types of nodes. */
! #define build_int_2(LO,HI) \
build_int_2_wide ((unsigned HOST_WIDE_INT) (LO), (HOST_WIDE_INT) (HI))
extern tree build PARAMS ((enum tree_code, tree, ...));
--- 2072,2078 ----
/* Construct various types of nodes. */
! #define build_int_2(LO, HI) \
build_int_2_wide ((unsigned HOST_WIDE_INT) (LO), (HOST_WIDE_INT) (HI))
extern tree build PARAMS ((enum tree_code, tree, ...));
*************** extern tree build_qualified_type
*** 2272,2278 ****
build_qualified_type instead. */
#define build_type_variant(TYPE, CONST_P, VOLATILE_P) \
! build_qualified_type (TYPE, \
((CONST_P) ? TYPE_QUAL_CONST : 0) \
| ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
--- 2272,2278 ----
build_qualified_type instead. */
#define build_type_variant(TYPE, CONST_P, VOLATILE_P) \
! build_qualified_type ((TYPE), \
((CONST_P) ? TYPE_QUAL_CONST : 0) \
| ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
-----------------------------------------------------------------------------------
Index: gcc/java/jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.99
diff -c -p -r1.99 jcf-parse.c
*** jcf-parse.c 2001/12/16 16:23:49 1.99
--- jcf-parse.c 2002/01/01 07:01:59
*************** yyparse ()
*** 1080,1086 ****
if (resource_name)
{
! char *resource_filename;
/* Only one resource file may be compiled at a time. */
assert (TREE_CHAIN (current_file_list) == NULL);
--- 1080,1086 ----
if (resource_name)
{
! const char *resource_filename;
/* Only one resource file may be compiled at a time. */
assert (TREE_CHAIN (current_file_list) == NULL);
---------------------------------------------------------------------------------