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]

[C++] Remove uses of TREE_COMPLEXITY from the C++ front end


Hi,

The only correct uses of TREE_COMPLEXITY can be avoided by using
TREE_NO_WARNING.
The other uses appear to be relics from past times.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK?

Gr.
Steven
	* c-common.c (c_common_truthvalue_conversion): Don't warn if
	TREE_NO_WARNING is set.

cp/
	* cp-tree.h (C_SET_EXP_ORIGINAL_CODE): Remove.
	* decl.c (grokdeclarator): Ignore TREE_COMPLEXITY, it's never
	set anywhere.
	* decl2.c (grokfield): Likewise.
	* semantics.c (finish_parenthesized_expr): Don't set
	C_EXPR_ORIGINAL_CODE to avoid a warning.  Use TREE_NO_WARNING
	instead.
	* tree.c (build_min_nt, build_min, build_min_nop_dep): Don't
	set TREE_COMPLEXITY.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.511
diff -c -3 -p -r1.511 c-common.c
*** c-common.c	10 Jun 2004 08:07:44 -0000	1.511
--- c-common.c	12 Jun 2004 12:22:08 -0000
*************** c_common_truthvalue_conversion (tree exp
*** 2745,2751 ****
        break;
  
      case MODIFY_EXPR:
!       if (warn_parentheses && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR)
  	warning ("suggest parentheses around assignment used as truth value");
        break;
  
--- 2745,2753 ----
        break;
  
      case MODIFY_EXPR:
!       if (warn_parentheses
! 	  && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR
! 	  && !TREE_NO_WARNING (expr))
  	warning ("suggest parentheses around assignment used as truth value");
        break;
  
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.974
diff -c -3 -p -r1.974 cp-tree.h
*** cp/cp-tree.h	7 Jun 2004 02:10:55 -0000	1.974
--- cp/cp-tree.h	12 Jun 2004 12:22:08 -0000
*************** typedef enum cp_id_kind
*** 421,430 ****
  #define C_TYPE_FIELDS_READONLY(TYPE) \
    (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
  
- /* Store a value in that field.  */
- #define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
-   (TREE_COMPLEXITY (EXP) = (int)(CODE))
- 
  /* The tokens stored in the default argument.  */
  
  #define DEFARG_TOKENS(NODE) \
--- 421,426 ----
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1213
diff -c -3 -p -r1.1213 decl.c
*** cp/decl.c	10 Jun 2004 08:08:00 -0000	1.1213
--- cp/decl.c	12 Jun 2004 12:22:09 -0000
*************** grokdeclarator (tree declarator,
*** 6560,6567 ****
  		}
  	      else if (ctype == NULL_TREE)
  		ctype = cname;
- 	      else if (TREE_COMPLEXITY (decl) == current_class_depth)
- 		;
  	      else
  		{
  		  if (! UNIQUELY_DERIVED_FROM_P (cname, ctype))
--- 6560,6565 ----
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.713
diff -c -3 -p -r1.713 decl2.c
*** cp/decl2.c	3 Jun 2004 23:15:01 -0000	1.713
--- cp/decl2.c	12 Jun 2004 12:22:09 -0000
*************** grokfield (tree declarator, tree declspe
*** 850,863 ****
    if (declspecs == NULL_TREE
        && TREE_CODE (declarator) == SCOPE_REF
        && TREE_CODE (TREE_OPERAND (declarator, 1)) == IDENTIFIER_NODE)
!     {
!       /* Access declaration */
!       if (! IS_AGGR_TYPE_CODE (TREE_CODE (TREE_OPERAND (declarator, 0))))
! 	;
!       else if (TREE_COMPLEXITY (declarator) == current_class_depth)
! 	pop_nested_class ();
!       return do_class_using_decl (declarator);
!     }
  
    if (init
        && TREE_CODE (init) == TREE_LIST
--- 850,857 ----
    if (declspecs == NULL_TREE
        && TREE_CODE (declarator) == SCOPE_REF
        && TREE_CODE (TREE_OPERAND (declarator, 1)) == IDENTIFIER_NODE)
!     /* Access declaration */
!     return do_class_using_decl (declarator);
  
    if (init
        && TREE_CODE (init) == TREE_LIST
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.396
diff -c -3 -p -r1.396 semantics.c
*** cp/semantics.c	13 May 2004 06:40:22 -0000	1.396
--- cp/semantics.c	12 Jun 2004 12:22:09 -0000
*************** finish_parenthesized_expr (tree expr)
*** 1135,1141 ****
  {
    if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
      /* This inhibits warnings in c_common_truthvalue_conversion.  */
!     C_SET_EXP_ORIGINAL_CODE (expr, ERROR_MARK); 
  
    if (TREE_CODE (expr) == OFFSET_REF)
      /* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be
--- 1135,1141 ----
  {
    if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
      /* This inhibits warnings in c_common_truthvalue_conversion.  */
!     TREE_NO_WARNING (expr) = 1;
  
    if (TREE_CODE (expr) == OFFSET_REF)
      /* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.376
diff -c -3 -p -r1.376 tree.c
*** cp/tree.c	2 Jun 2004 21:12:54 -0000	1.376
--- cp/tree.c	12 Jun 2004 12:22:10 -0000
*************** build_min_nt (enum tree_code code, ...)
*** 1298,1304 ****
  
    t = make_node (code);
    length = TREE_CODE_LENGTH (code);
-   TREE_COMPLEXITY (t) = input_line;
  
    for (i = 0; i < length; i++)
      {
--- 1298,1303 ----
*************** build_min (enum tree_code code, tree tt,
*** 1325,1331 ****
    t = make_node (code);
    length = TREE_CODE_LENGTH (code);
    TREE_TYPE (t) = tt;
-   TREE_COMPLEXITY (t) = input_line;
  
    for (i = 0; i < length; i++)
      {
--- 1324,1329 ----
*************** build_min_non_dep (enum tree_code code, 
*** 1356,1362 ****
    t = make_node (code);
    length = TREE_CODE_LENGTH (code);
    TREE_TYPE (t) = TREE_TYPE (non_dep);
-   TREE_COMPLEXITY (t) = input_line;
    TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (non_dep);
  
    for (i = 0; i < length; i++)
--- 1354,1359 ----


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