public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, C++] Remove unused cp_fold_obj_type_ref
@ 2011-04-22 14:39 Martin Jambor
  2011-04-26 18:59 ` Rainer Orth
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Jambor @ 2011-04-22 14:39 UTC (permalink / raw)
  To: GCC Patches

Hi,

last year I removed the last use of cp_fold_obj_type_ref (which was a
language hook) but forgot to remove the function itself.  So I'm about
to do it now.

I'm currently bootstrapping and testing the following patch.  I
consider it obvious enough to commit it myself on Tuesday if it
passes.

Thanks,

Martin


2011-04-22  Martin Jambor  <mjambor@suse.cz>

	* class.c (cp_fold_obj_type_ref): Remove.
	* cp-tree.h (cp_fold_obj_type_ref): Remove declaration.

Index: src/gcc/cp/class.c
===================================================================
--- src.orig/gcc/cp/class.c
+++ src/gcc/cp/class.c
@@ -8377,32 +8377,4 @@ build_rtti_vtbl_entries (tree binfo, vtb
   CONSTRUCTOR_APPEND_ELT (vid->inits, NULL_TREE, init);
 }
 
-/* Fold a OBJ_TYPE_REF expression to the address of a function.
-   KNOWN_TYPE carries the true type of OBJ_TYPE_REF_OBJECT(REF).  */
-
-tree
-cp_fold_obj_type_ref (tree ref, tree known_type)
-{
-  HOST_WIDE_INT index = tree_low_cst (OBJ_TYPE_REF_TOKEN (ref), 1);
-  HOST_WIDE_INT i = 0;
-  tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type));
-  tree fndecl;
-
-  while (i != index)
-    {
-      i += (TARGET_VTABLE_USES_DESCRIPTORS
-	    ? TARGET_VTABLE_USES_DESCRIPTORS : 1);
-      v = TREE_CHAIN (v);
-    }
-
-  fndecl = BV_FN (v);
-
-#ifdef ENABLE_CHECKING
-  gcc_assert (tree_int_cst_equal (OBJ_TYPE_REF_TOKEN (ref),
-				  DECL_VINDEX (fndecl)));
-#endif
-
-  return build_address (fndecl);
-}
-
 #include "gt-cp-class.h"
Index: src/gcc/cp/cp-tree.h
===================================================================
--- src.orig/gcc/cp/cp-tree.h
+++ src/gcc/cp/cp-tree.h
@@ -4713,7 +4713,6 @@ extern void note_name_declared_in_class
 extern tree get_vtbl_decl_for_binfo		(tree);
 extern void debug_class				(tree);
 extern void debug_thunks			(tree);
-extern tree cp_fold_obj_type_ref		(tree, tree);
 extern void set_linkage_according_to_type	(tree, tree);
 extern void determine_key_method		(tree);
 extern void check_for_override			(tree, tree);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, C++] Remove unused cp_fold_obj_type_ref
  2011-04-22 14:39 [PATCH, C++] Remove unused cp_fold_obj_type_ref Martin Jambor
@ 2011-04-26 18:59 ` Rainer Orth
  2011-04-26 22:06   ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Orth @ 2011-04-26 18:59 UTC (permalink / raw)
  To: GCC Patches

Martin,

> last year I removed the last use of cp_fold_obj_type_ref (which was a
> language hook) but forgot to remove the function itself.  So I'm about
> to do it now.
>
> I'm currently bootstrapping and testing the following patch.  I
> consider it obvious enough to commit it myself on Tuesday if it
> passes.

the patch was so obvious that it broke bootstrap:

/vol/gcc/src/hg/trunk/local/gcc/objc/objc-act.c: In function 'objc_fold_obj_type_ref':
/vol/gcc/src/hg/trunk/local/gcc/objc/objc-act.c:8625:3: error: implicit declaration of function 'cp_fold_obj_type_ref' [-Werror=implicit-function-declaration]
/vol/gcc/src/hg/trunk/local/gcc/objc/objc-act.c:8625:3: error: return makes pointer from integer without a cast [-Werror]
cc1: all warnings being treated as errors

make[3]: *** [objcp/objcp-act.o] Error 1

grep is your friend.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, C++] Remove unused cp_fold_obj_type_ref
  2011-04-26 18:59 ` Rainer Orth
@ 2011-04-26 22:06   ` Jason Merrill
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2011-04-26 22:06 UTC (permalink / raw)
  To: Rainer Orth; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 139 bytes --]

On 04/26/2011 02:07 PM, Rainer Orth wrote:
> the patch was so obvious that it broke bootstrap:

I'm applying this patch to fix bootstrap.


[-- Attachment #2: obj-boot.patch --]
[-- Type: text/plain, Size: 1815 bytes --]

commit 922f4a593d65ab65025b0af7b59bb9513d394aac
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Apr 26 21:12:57 2011 +0000

    	* objc-act.c (objc_fold_objc_type_ref): Remove.
    	* objc-act.h: Remove prototype.
    
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 0b6b793..250b317 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -8602,33 +8602,6 @@ objc_type_valid_for_messaging (tree type, bool accept_classes)
   return false;
 }
 
-/* Fold an OBJ_TYPE_REF expression for ObjC method dispatches, where
-   this occurs.  ObjC method dispatches are _not_ like C++ virtual
-   member function dispatches, and we account for the difference here.  */
-tree
-#ifdef OBJCPLUS
-objc_fold_obj_type_ref (tree ref, tree known_type)
-#else
-objc_fold_obj_type_ref (tree ref ATTRIBUTE_UNUSED,
-			tree known_type ATTRIBUTE_UNUSED)
-#endif
-{
-#ifdef OBJCPLUS
-  tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type));
-
-  /* If the receiver does not have virtual member functions, there
-     is nothing we can (or need to) do here.  */
-  if (!v)
-    return NULL_TREE;
-
-  /* Let C++ handle C++ virtual functions.  */
-  return cp_fold_obj_type_ref (ref, known_type);
-#else
-  /* For plain ObjC, we currently do not need to do anything.  */
-  return NULL_TREE;
-#endif
-}
-
 void
 objc_start_function (tree name, tree type, tree attrs,
 #ifdef OBJCPLUS
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index 909181a..d604299 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -26,7 +26,6 @@ along with GCC; see the file COPYING3.  If not see
 
 bool objc_init (void);
 const char *objc_printable_name (tree, int);
-tree objc_fold_obj_type_ref (tree, tree);
 int objc_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
 void objc_common_init_ts (void);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-26 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-22 14:39 [PATCH, C++] Remove unused cp_fold_obj_type_ref Martin Jambor
2011-04-26 18:59 ` Rainer Orth
2011-04-26 22:06   ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).