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]

PATCH: REFERENCE_TYPES are always TREE_READONLY



You can't ever assign to anything of reference type; like `const'
variables they are intiailized, and then never assigned again.  So, a
DECL of REFERENCE_TYPE should always be TREE_READONLY.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-04-27  Mark Mitchell  <mark@codesourcery.com>

	* c-commom.c (c_apply_type_quals_to_decl): REFERENCE_TYPES are
	always TREE_READONLY.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.107
diff -c -p -r1.107 c-common.c
*** c-common.c	2000/04/20 16:09:27	1.107
--- c-common.c	2000/04/28 01:46:33
*************** c_apply_type_quals_to_decl (type_quals, 
*** 3217,3223 ****
       int type_quals;
       tree decl;
  {
!   if (type_quals & TYPE_QUAL_CONST)
      TREE_READONLY (decl) = 1;
    if (type_quals & TYPE_QUAL_VOLATILE)
      {
--- 3217,3225 ----
       int type_quals;
       tree decl;
  {
!   if ((type_quals & TYPE_QUAL_CONST)
!       || (TREE_TYPE (decl) 
! 	  && TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE))
      TREE_READONLY (decl) = 1;
    if (type_quals & TYPE_QUAL_VOLATILE)
      {

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