aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-10-20 09:08:57 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-10-20 09:08:57 +0000
commit977e30bc45295e5c53967dc1a291fb93fe817a2a (patch)
tree77a27cf850b61490643a0ebe4d3a9737add96fa6
parentb170a7784c23c155f668bbe1c89cb81311a82e4a (diff)
downloadgcc-977e30bc45295e5c53967dc1a291fb93fe817a2a.zip
gcc-977e30bc45295e5c53967dc1a291fb93fe817a2a.tar.gz
gcc-977e30bc45295e5c53967dc1a291fb93fe817a2a.tar.bz2
In gcc/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * c-decl.c (c_write_global_declarations): Call objc_write_global_declarations when compiling Objective-C. * c-lang.c (finish_file): Removed. In gcc/c-family/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * c-common.h (finish_file): Removed. (objc_write_global_declarations): New. * c-opts.c (c_common_parse_file): Do not call finish_file. * stub-objc.c (objc_write_global_declarations): New. In gcc/cp/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * cp-lang.c (finish_file): Removed. * decl2.c (cp_write_global_declarations): Call objc_write_global_declarations when compiling Objective-C++. In gcc/objc/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * objc-lang.c (finish_file): Removed. * objc-act.c (objc_finish_file): Renamed to objc_write_global_declarations. Do not try to instantiate C++ templates when compiling Objective-C++ as this is now automatically done before this function is called. Do not check for syntax-only run or PCH generation as this is done by the callers. * objc-act.h (objc_finish_file): Removed. In gcc/objcp/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * objcp-lang.c (finish_file): Removed. In gcc/testsuite/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. Test adapted to not require Foundation and run with the GNU runtime as well. 2006-03-13 Fariborz Jahanian <fjahanian@apple.com> Radar 4439126 * obj-c++.dg/template-8.mm: New. From-SVN: r165714
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-decl.c6
-rw-r--r--gcc/c-family/ChangeLog7
-rw-r--r--gcc/c-family/c-common.h3
-rw-r--r--gcc/c-family/c-opts.c1
-rw-r--r--gcc/c-family/stub-objc.c5
-rw-r--r--gcc/c-lang.c7
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-lang.c5
-rw-r--r--gcc/cp/decl2.c8
-rw-r--r--gcc/objc/ChangeLog11
-rw-r--r--gcc/objc/objc-act.c17
-rw-r--r--gcc/objc/objc-act.h1
-rw-r--r--gcc/objc/objc-lang.c6
-rw-r--r--gcc/objcp/ChangeLog4
-rw-r--r--gcc/objcp/objcp-lang.c7
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/obj-c++.dg/template-8.mm49
18 files changed, 118 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9260c60..d1241cb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * c-decl.c (c_write_global_declarations): Call
+ objc_write_global_declarations when compiling Objective-C.
+ * c-lang.c (finish_file): Removed.
+
2010-10-19 DJ Delorie <dj@redhat.com>
* doc/tm.texi.in (TARGET_ASM_JUMP_ALIGN_MAX_SKIP): New.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index c1a44d8..a06d073 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -9782,6 +9782,12 @@ c_write_global_declarations (void)
if (pch_file)
return;
+ /* Do the Objective-C stuff. This is where all the Objective-C
+ module stuff gets generated (symtab, class/protocol/selector
+ lists etc). */
+ if (c_dialect_objc ())
+ objc_write_global_declarations ();
+
/* Close the external scope. */
ext_block = pop_scope ();
external_scope = 0;
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 1f8726c..97d5b28 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,10 @@
+2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * c-common.h (finish_file): Removed.
+ (objc_write_global_declarations): New.
+ * c-opts.c (c_common_parse_file): Do not call finish_file.
+ * stub-objc.c (objc_write_global_declarations): New.
+
2010-10-18 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented parsing @synthesize and @dynamic for
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 6b8a8f4..854693e 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -788,8 +788,6 @@ extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);
/* This is the basic parsing function. */
extern void c_parse_file (void);
-/* This is misnamed, it actually performs end-of-compilation processing. */
-extern void finish_file (void);
extern void warn_for_omitted_condop (location_t, tree);
@@ -981,6 +979,7 @@ extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char);
/* The following ObjC/ObjC++ functions are called by the C and/or C++
front-ends; they all must have corresponding stubs in stub-objc.c. */
+extern void objc_write_global_declarations (void);
extern tree objc_is_class_name (tree);
extern tree objc_is_object_ptr (tree);
extern void objc_check_decl (tree);
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 3df0492..8f60834 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -1160,7 +1160,6 @@ c_common_parse_file (int set_yydebug)
pch_init ();
push_file_scope ();
c_parse_file ();
- finish_file ();
pop_file_scope ();
/* And end the main input file, if the debug writer wants it */
if (debug_hooks->start_end_main_source_file)
diff --git a/gcc/c-family/stub-objc.c b/gcc/c-family/stub-objc.c
index a1ea033..3356d0b 100644
--- a/gcc/c-family/stub-objc.c
+++ b/gcc/c-family/stub-objc.c
@@ -416,3 +416,8 @@ objc_finish_foreach_loop (location_t ARG_UNUSED (location), tree ARG_UNUSED (obj
{
return;
}
+
+void
+objc_write_global_declarations (void)
+{
+}
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index 45a764f..0ca2e7c 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -47,11 +47,4 @@ enum c_language_kind c_language = clk_c;
/* Each front end provides its own lang hook initializer. */
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
-/* Final processing of file-scope data. The Objective-C version of
- this function still does something. */
-void
-finish_file (void)
-{
-}
-
#include "gtype-c.h"
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8a084df..7343b2d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * cp-lang.c (finish_file): Removed.
+ * decl2.c (cp_write_global_declarations): Call
+ objc_write_global_declarations when compiling Objective-C++.
+
2010-10-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/46046
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index a07d7be..f274d31 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -154,11 +154,6 @@ cp_classify_record (tree type)
return RECORD_IS_STRUCT;
}
-void
-finish_file (void)
-{
-}
-
static GTY(()) tree cp_eh_personality_decl;
static tree
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index fcc83fb..f27e7d6 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3896,6 +3896,14 @@ cp_write_global_declarations (void)
if (!decl_defined_p (decl))
no_linkage_error (decl);
+ /* Then, do the Objective-C stuff. This is where all the
+ Objective-C module stuff gets generated (symtab,
+ class/protocol/selector lists etc). This must be done after C++
+ templates, destructors etc. so that selectors used in C++
+ templates are properly allocated. */
+ if (c_dialect_objc ())
+ objc_write_global_declarations ();
+
/* We give C linkage to static constructors and destructors. */
push_lang_context (lang_name_c);
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 745b7bb..b3881ae 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-lang.c (finish_file): Removed.
+ * objc-act.c (objc_finish_file): Renamed to
+ objc_write_global_declarations. Do not try to instantiate C++
+ templates when compiling Objective-C++ as this is now
+ automatically done before this function is called. Do not check
+ for syntax-only run or PCH generation as this is done by the
+ callers.
+ * objc-act.h (objc_finish_file): Removed.
+
2010-10-18 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented parsing @synthesize and @dynamic for
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 048d2ae..2d5a905 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -624,22 +624,15 @@ objc_init (void)
return true;
}
+/* This is called automatically (at the very end of compilation) by
+ c_write_global_declarations and cp_write_global_declarations. */
void
-objc_finish_file (void)
+objc_write_global_declarations (void)
{
mark_referenced_methods ();
-#ifdef OBJCPLUS
- /* We need to instantiate templates _before_ we emit ObjC metadata;
- if we do not, some metadata (such as selectors) may go missing. */
- at_eof = 1;
- instantiate_pending_templates (0);
-#endif
-
- /* Finalize Objective-C runtime data. No need to generate tables
- and code if only checking syntax, or if generating a PCH file. */
- if (!flag_syntax_only && !pch_file)
- finish_objc ();
+ /* Finalize Objective-C runtime data. */
+ finish_objc ();
if (gen_declaration_file)
fclose (gen_declaration_file);
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index a11a6de..b7bb6f2 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);
-void objc_finish_file (void);
tree objc_fold_obj_type_ref (tree, tree);
int objc_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
tree objc_eh_runtime_type (tree);
diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c
index 2469845..839db5d 100644
--- a/gcc/objc/objc-lang.c
+++ b/gcc/objc/objc-lang.c
@@ -92,10 +92,4 @@ objc_init_ts (void)
tree_contains_struct[PROPERTY_DECL][TS_DECL_COMMON] = 1;
}
-void
-finish_file (void)
-{
- objc_finish_file ();
-}
-
#include "gtype-objc.h"
diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
index c60766e..7141dd8 100644
--- a/gcc/objcp/ChangeLog
+++ b/gcc/objcp/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objcp-lang.c (finish_file): Removed.
+
2010-10-14 Iain Sandoe <iains@gcc.gnu.org>
merge from FSF apple 'trunk' branch.
diff --git a/gcc/objcp/objcp-lang.c b/gcc/objcp/objcp-lang.c
index d03e754..e353021 100644
--- a/gcc/objcp/objcp-lang.c
+++ b/gcc/objcp/objcp-lang.c
@@ -156,11 +156,4 @@ objcxx_eh_personality (void)
return objcp_eh_personality_decl;
}
-
-void
-finish_file (void)
-{
- objc_finish_file ();
-}
-
#include "gtype-objcp.h"
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 74c11e8..f777c3f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,14 @@
2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Merge from 'apple/trunk' branch on FSF servers. Test adapted to
+ not require Foundation and run with the GNU runtime as well.
+
+ 2006-03-13 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4439126
+ * obj-c++.dg/template-8.mm: New.
+
+2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
PR objc/23709
* objc.dg/pr23709.m: New.
diff --git a/gcc/testsuite/obj-c++.dg/template-8.mm b/gcc/testsuite/obj-c++.dg/template-8.mm
new file mode 100644
index 0000000..eb01aa8
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/template-8.mm
@@ -0,0 +1,49 @@
+/* Test that all pending instantiations have taken place before meta-data
+ generation. */
+/* Author: Fariborz Jahanian <fjahanian@apple.com> */
+/* Adapted by Nicola Pero <nicola.pero@meta-innovation.com> */
+/* { dg-do run } */
+
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{ Class isa; }
++ alloc;
+- init;
+- doSomething;
+@end
+
+@implementation MyRootClass
++ alloc { return class_createInstance (self, 0); }
+- init { return self; }
+- doSomething { return self; }
+@end
+
+class Base
+{
+public:
+ Base() { }
+ virtual ~Base() { }
+
+ void destroy() { delete this; }
+};
+
+template<class T>
+class Subclass : public T
+{
+public:
+ Subclass() { }
+
+ virtual ~Subclass()
+ {
+ [[[MyRootClass alloc] init] doSomething];
+ }
+};
+
+int main(int argc, const char * argv[])
+{
+ Subclass<Base>* theSubclass = new Subclass<Base>();
+ theSubclass->destroy();
+ return 0;
+}