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]

(C++) more small patches


Applied.  Fixes g++.other/decl2.C, g++.other/friend5.C, and
g++.law/friend4.C, respectively.

1998-10-26  Jason Merrill  <jason@yorick.cygnus.com>

	* decl.c (grokdeclarator): Complain about a variable using
	constructor syntax coming back null from start_decl.

	* friend.c (make_friend_class): Complain about trying to make
	a non-class type a friend.

	* decl.c (grokfndecl): Set DECL_INITIAL for a defn here.
	(start_function): Not here.

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.244
diff -c -p -r1.244 decl.c
*** decl.c	1998/10/25 23:15:00	1.244
--- decl.c	1998/10/26 19:57:45
*************** grokfndecl (ctype, type, declarator, ori
*** 8181,8186 ****
--- 8181,8191 ----
        && (! DECL_USE_TEMPLATE (decl) || name_mangling_version < 1))
      set_mangled_name_for_decl (decl);
  
+   if (funcdef_flag)
+     /* Make the init_value nonzero so pushdecl knows this is not
+        tentative.  error_mark_node is replaced later with the BLOCK.  */
+     DECL_INITIAL (decl) = error_mark_node;
+ 
    /* Caller will do the rest of this.  */
    if (check < 0)
      return decl;
*************** grokdeclarator (declarator, declspecs, d
*** 8641,8650 ****
  		init = TREE_OPERAND (decl, 1);
  
  		decl = start_decl (declarator, declspecs, 1, NULL_TREE, NULL_TREE);
! 		/* Look for __unused__ attribute */
! 		if (TREE_USED (TREE_TYPE (decl)))
! 		  TREE_USED (decl) = 1;
! 		finish_decl (decl, init, NULL_TREE);
  		return 0;
  	      }
  	    innermost_code = TREE_CODE (decl);
--- 8646,8660 ----
  		init = TREE_OPERAND (decl, 1);
  
  		decl = start_decl (declarator, declspecs, 1, NULL_TREE, NULL_TREE);
! 		if (decl)
! 		  {
! 		    /* Look for __unused__ attribute */
! 		    if (TREE_USED (TREE_TYPE (decl)))
! 		      TREE_USED (decl) = 1;
! 		    finish_decl (decl, init, NULL_TREE);
! 		  }
! 		else
! 		  cp_error ("invalid declarator");
  		return 0;
  	      }
  	    innermost_code = TREE_CODE (decl);
*************** start_function (declspecs, declarator, a
*** 12500,12509 ****
        && DECL_NAME (decl1) == ansi_opname[(int) MODIFY_EXPR]
        && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE)
      cp_warning ("`operator=' should return a reference to `*this'");
- 
-   /* Make the init_value nonzero so pushdecl knows this is not tentative.
-      error_mark_node is replaced below (in poplevel) with the BLOCK.  */
-   DECL_INITIAL (decl1) = error_mark_node;
  
  #ifdef SET_DEFAULT_DECL_ATTRIBUTES
    SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs);
--- 12510,12515 ----
Index: friend.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/friend.c,v
retrieving revision 1.33
diff -c -p -r1.33 friend.c
*** friend.c	1998/10/15 19:43:50	1.33
--- friend.c	1998/10/26 19:57:45
*************** make_friend_class (type, friend_type)
*** 255,264 ****
        error ("`friend' declaration in signature definition");
        return;
      }
!   if (IS_SIGNATURE (friend_type))
      {
!       error ("signature type `%s' declared `friend'",
! 	     IDENTIFIER_POINTER (TYPE_IDENTIFIER (friend_type)));
        return;
      }
  
--- 255,263 ----
        error ("`friend' declaration in signature definition");
        return;
      }
!   if (IS_SIGNATURE (friend_type) || ! IS_AGGR_TYPE (friend_type))
      {
!       cp_error ("invalid type `%T' declared `friend'", friend_type);
        return;
      }
  


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