[C++ PATCH] more tidying

Nathan Sidwell nathan@codesourcery.com
Thu Dec 7 06:29:00 GMT 2000


Hi,
Some more tidying code that I've installed, no change in functionality.
I applied the obvious rule again.

built & tested on i686-pc-linux-gnu.

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-12-06  Nathan Sidwell  <nathan@codesourcery.com>

	* class.c (check_field_decls): Don't special case anonymous
	fields in error messages.
	(note_name_declared_in_class): Use %D on diagnostic.
	
	* tree.c (pod_type_p): Use strip_array_types.
	(cp_valid_lang_attribute): Likewise.
	* typeck.c (cp_type_quals): Strip arrays separately, to avoid
	multiple evaluations.
	(cp_has_mutable_p): Use strip_array_types.

Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/class.c,v
retrieving revision 1.345
diff -c -3 -p -r1.345 class.c
*** class.c	2000/12/05 15:50:02	1.345
--- class.c	2000/12/06 14:40:39
*************** check_field_decls (t, access_decls, empt
*** 3537,3548 ****
  	  TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
  
  	  if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)
! 	    {
! 	      if (DECL_NAME (x))
! 		cp_warning_at ("non-static reference `%#D' in class without a constructor", x);
! 	      else
! 		cp_warning_at ("non-static reference in class without a constructor", x);
! 	    }
  	}
  
        type = strip_array_types (type);
--- 3537,3543 ----
  	  TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
  
  	  if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)
!             cp_warning_at ("non-static reference `%#D' in class without a constructor", x);
  	}
  
        type = strip_array_types (type);
*************** check_field_decls (t, access_decls, empt
*** 3574,3585 ****
  	  TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
  
  	  if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)
! 	    {
! 	      if (DECL_NAME (x))
! 		cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
! 	      else
! 		cp_warning_at ("non-static const member in class without a constructor", x);
! 	    }
  	}
        /* A field that is pseudo-const makes the structure likewise.  */
        else if (IS_AGGR_TYPE (type))
--- 3569,3575 ----
  	  TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
  
  	  if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)
!             cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
  	}
        /* A field that is pseudo-const makes the structure likewise.  */
        else if (IS_AGGR_TYPE (type))
*************** note_name_declared_in_class (name, decl)
*** 6533,6540 ****
  	 in its context and when re-evaluated in the completed scope of
  	 S.  */
        cp_error ("declaration of `%#D'", decl);
!       cp_error_at ("changes meaning of `%s' from `%+#D'", 
! 		   IDENTIFIER_POINTER (DECL_NAME (OVL_CURRENT (decl))),
  		   (tree) n->value);
      }
  }
--- 6523,6530 ----
  	 in its context and when re-evaluated in the completed scope of
  	 S.  */
        cp_error ("declaration of `%#D'", decl);
!       cp_error_at ("changes meaning of `%D' from `%+#D'", 
! 		   DECL_NAME (OVL_CURRENT (decl)),
  		   (tree) n->value);
      }
  }
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tree.c,v
retrieving revision 1.223
diff -c -3 -p -r1.223 tree.c
*** tree.c	2000/12/04 17:00:04	1.223
--- tree.c	2000/12/06 14:41:13
*************** int
*** 2242,2249 ****
  pod_type_p (t)
       tree t;
  {
!   while (TREE_CODE (t) == ARRAY_TYPE)
!     t = TREE_TYPE (t);
  
    if (INTEGRAL_TYPE_P (t))
      return 1;  /* integral, character or enumeral type */
--- 2242,2248 ----
  pod_type_p (t)
       tree t;
  {
!   t = strip_array_types (t);
  
    if (INTEGRAL_TYPE_P (t))
      return 1;  /* integral, character or enumeral type */
*************** cp_valid_lang_attribute (attr_name, attr
*** 2310,2317 ****
  
        pri = TREE_INT_CST_LOW (initp_expr);
  	
!       while (TREE_CODE (type) == ARRAY_TYPE)
! 	type = TREE_TYPE (type);
  
        if (decl == NULL_TREE
  	  || TREE_CODE (decl) != VAR_DECL
--- 2309,2315 ----
  
        pri = TREE_INT_CST_LOW (initp_expr);
  	
!       type = strip_array_types (type);
  
        if (decl == NULL_TREE
  	  || TREE_CODE (decl) != VAR_DECL
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/typeck.c,v
retrieving revision 1.325
diff -c -3 -p -r1.325 typeck.c
*** typeck.c	2000/12/05 15:35:58	1.325
--- typeck.c	2000/12/06 14:41:24
*************** int
*** 6983,6989 ****
  cp_type_quals (type)
       tree type;
  {
!   return TYPE_QUALS (strip_array_types (type));
  }
  
  /* Returns non-zero if the TYPE contains a mutable member */
--- 6983,6990 ----
  cp_type_quals (type)
       tree type;
  {
!   type = strip_array_types (type);
!   return TYPE_QUALS (type);
  }
  
  /* Returns non-zero if the TYPE contains a mutable member */
*************** int
*** 6992,6999 ****
  cp_has_mutable_p (type)
       tree type;
  {
!   while (TREE_CODE (type) == ARRAY_TYPE)
!     type = TREE_TYPE (type);
  
    return CLASS_TYPE_P (type) && CLASSTYPE_HAS_MUTABLE (type);
  }
--- 6993,6999 ----
  cp_has_mutable_p (type)
       tree type;
  {
!   type = strip_array_types (type);
  
    return CLASS_TYPE_P (type) && CLASSTYPE_HAS_MUTABLE (type);
  }


More information about the Gcc-patches mailing list