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 CHAR_TYPE usage from the C++ front-end


No prizes for expecting this one...

The following patch has been tested on x86_64-unknown-linux-gnu with
a full "make bootstrap", all default languages, and regression
tested with a top-level "make -k check" with no new failures.

Ok for mainline?


2006-02-05  Roger Sayle  <roger@eyesopen.com>

	* decl.c (grokdeclarator): Don't bother checking for CHAR_TYPE.
	* rtti.c (typeinfo_in_lib_p): Likewise.
	* cp-tree.h (INTEGRAL_CODE_P, CP_INTEGRAL_TYPE_P): Likewise.
	* name-lookup.c (arg_assoc_type): Likewise.


Index: decl.c
===================================================================
*** decl.c	(revision 110592)
--- decl.c	(working copy)
*************** grokdeclarator (const cp_declarator *dec
*** 7035,7042 ****
  	     `signed int' cannot be so controlled.  */
  	  && !(typedef_decl
  	       && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))
! 	  && (TREE_CODE (type) == INTEGER_TYPE
! 	      || TREE_CODE (type) == CHAR_TYPE)
  	  && !same_type_p (TYPE_MAIN_VARIANT (type), wchar_type_node)))
      {
        if (longlong)
--- 7035,7041 ----
  	     `signed int' cannot be so controlled.  */
  	  && !(typedef_decl
  	       && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))
! 	  && TREE_CODE (type) == INTEGER_TYPE
  	  && !same_type_p (TYPE_MAIN_VARIANT (type), wchar_type_node)))
      {
        if (longlong)
Index: rtti.c
===================================================================
*** rtti.c	(revision 110592)
--- rtti.c	(working copy)
*************** typeinfo_in_lib_p (tree type)
*** 986,992 ****
      {
      case INTEGER_TYPE:
      case BOOLEAN_TYPE:
-     case CHAR_TYPE:
      case REAL_TYPE:
      case VOID_TYPE:
        return true;
--- 986,991 ----
Index: cp-tree.h
===================================================================
*** cp-tree.h	(revision 110592)
--- cp-tree.h	(working copy)
*************** extern void decl_shadowed_for_var_insert
*** 2358,2369 ****
  #define DECL_EXTERNAL_LINKAGE_P(DECL) \
    (decl_linkage (DECL) == lk_external)

! /* Keep these codes in ascending code order.  CHAR_TYPE is used here
!    to completely fill the range.  */

! #define INTEGRAL_CODE_P(CODE)				\
!   ((CODE) == ENUMERAL_TYPE || (CODE) == BOOLEAN_TYPE	\
!    || (CODE) == CHAR_TYPE || (CODE) == INTEGER_TYPE)

  /* [basic.fundamental]

--- 2358,2369 ----
  #define DECL_EXTERNAL_LINKAGE_P(DECL) \
    (decl_linkage (DECL) == lk_external)

! /* Keep these codes in ascending code order.  */

! #define INTEGRAL_CODE_P(CODE)	\
!   ((CODE) == ENUMERAL_TYPE	\
!    || (CODE) == BOOLEAN_TYPE	\
!    || (CODE) == INTEGER_TYPE)

  /* [basic.fundamental]

*************** extern void decl_shadowed_for_var_insert
*** 2372,2382 ****

     Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
     types as well, which is incorrect in C++.  Keep these checks in
!    ascending code order.  CHAR_TYPE is added to complete the interval of
!    values.  */
  #define CP_INTEGRAL_TYPE_P(TYPE)		\
    (TREE_CODE (TYPE) == BOOLEAN_TYPE		\
-    || TREE_CODE (TYPE) == CHAR_TYPE		\
     || TREE_CODE (TYPE) == INTEGER_TYPE)

  /* Returns true if TYPE is an integral or enumeration name.  Keep
--- 2372,2380 ----

     Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
     types as well, which is incorrect in C++.  Keep these checks in
!    ascending code order.  */
  #define CP_INTEGRAL_TYPE_P(TYPE)		\
    (TREE_CODE (TYPE) == BOOLEAN_TYPE		\
     || TREE_CODE (TYPE) == INTEGER_TYPE)

  /* Returns true if TYPE is an integral or enumeration name.  Keep
Index: name-lookup.c
===================================================================
*** name-lookup.c	(revision 110592)
--- name-lookup.c	(working copy)
*************** arg_assoc_type (struct arg_lookup *k, tr
*** 4445,4451 ****
      case REAL_TYPE:
      case COMPLEX_TYPE:
      case VECTOR_TYPE:
-     case CHAR_TYPE:
      case BOOLEAN_TYPE:
        return false;
      case RECORD_TYPE:
--- 4445,4450 ----

Roger
--


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