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]

Re: PATCH: Call ObjC hook from C++'s finish_compound_stmt()


Ziemowit Laski wrote:

This patch basically mirrors what c_end_compound_stmt() in C land
already does, namely destroys the 'super' receiver variable (if one
was created in the scope we're exiting).

Is this OK to commit?  Or should I get rid of the c_dialect_objc()
check and call objc_clear_super_receiver() unconditionally?

The latter. OK with that change.


If this proves to be too expensive, we will turn the functions into macros with the conditionals embedded there.

It
is already a no-op stub in stub-objc.c.

Thanks,

--Zem

[gcc/cp/ChangeLog]
2004-09-08  Ziemowit Laski  <zlaski@apple.com>

        * Make-lang.in (cp/semantics.o): Depend on c-common.h.
        * semantics.c: Include c-common.h.
        (finish_compound_stmt): In ObjC++ mode, call
        objc_clear_super_receiver().

Index: gcc/cp/Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Make-lang.in,v
retrieving revision 1.192
diff -u -3 -p -r1.192 Make-lang.in
--- gcc/cp/Make-lang.in 31 Aug 2004 18:51:06 -0000 1.192
+++ gcc/cp/Make-lang.in 9 Sep 2004 00:57:40 -0000
@@ -267,7 +267,7 @@ cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_
gt-cp-repo.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) except.h toplev.h \
flags.h debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
- tree-inline.h cgraph.h $(TARGET_H)
+ tree-inline.h cgraph.h $(TARGET_H) c-common.h
cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) tree-dump.h
cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h integrate.h insn-config.h \
input.h $(PARAMS_H) debug.h tree-inline.h tree-gimple.h $(TARGET_H)
Index: gcc/cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.431
diff -u -3 -p -r1.431 semantics.c
--- gcc/cp/semantics.c 9 Sep 2004 00:48:27 -0000 1.431
+++ gcc/cp/semantics.c 9 Sep 2004 00:57:41 -0000
@@ -31,6 +31,7 @@
#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
+#include "c-common.h"
#include "tree-inline.h"
#include "tree-mudflap.h"
#include "except.h"
@@ -1088,7 +1089,14 @@ finish_compound_stmt (tree stmt)
else if (STATEMENT_LIST_NO_SCOPE (stmt))
stmt = pop_stmt_list (stmt);
else
- stmt = do_poplevel (stmt);
+ {
+ /* Destroy any ObjC "super" receivers that may have been
+ created. */
+ if (c_dialect_objc ())
+ objc_clear_super_receiver ();
+
+ stmt = do_poplevel (stmt);
+ }


   /* ??? See c_end_compound_stmt wrt statement expressions.  */
   add_stmt (stmt);



--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com


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