re PR objc++/23640 (obj-c++ does not call __objc_exec_class for the classes)

2005-08-31  Andrew Pinski  <pinskia@physics.uc.edu>

        PR obj-c++/23640
        * decl2.c (cp_finish_file): If this is obj-c++ and we need a static
        init, call generate_ctor_or_dtor_function.

2005-08-31  Andrew Pinski  <pinskia@physics.uc.edu>

        PR obj-c++/23640
        * obj-c++.dg/gnu-runtime-3.mm: New test.

From-SVN: r103673
This commit is contained in:
Andrew Pinski 2005-08-31 13:46:06 +00:00 committed by Andrew Pinski
parent ee5426a488
commit 7932444251
4 changed files with 45 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2005-08-31 Andrew Pinski <pinskia@physics.uc.edu>
PR obj-c++/23640
* decl2.c (cp_finish_file): If this is obj-c++ and we need a static
init, call generate_ctor_or_dtor_function.
2005-08-31 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/13377

View File

@ -3078,8 +3078,9 @@ cp_finish_file (void)
/*data=*/&locus);
else
{
if (static_ctors)
/* If we have a ctor or this is obj-c++ and we need a static init,
call generate_ctor_or_dtor_function. */
if (static_ctors || (c_dialect_objc () && objc_static_init_needed_p ()))
generate_ctor_or_dtor_function (/*constructor_p=*/true,
DEFAULT_INIT_PRIORITY, &locus);
if (static_dtors)

View File

@ -1,3 +1,8 @@
2005-08-31 Andrew Pinski <pinskia@physics.uc.edu>
PR obj-c++/23640
* obj-c++.dg/gnu-runtime-3.mm: New test.
2005-08-31 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/13377

View File

@ -0,0 +1,31 @@
/* Test that compiling for the GNU runtime works (regardless of
the system runtime used). */
/* Author: Ziemowit Laski <zlaski@apple.com> */
/* { dg-do run } */
/* { dg-options "-fgnu-runtime" } */
#include <objc/Object.h>
@interface FooBar: Object
- (void)boo;
@end
int called = 0;
extern "C" void abort ();
@implementation FooBar
- (void)boo
{
called ++;
}
@end
int main ()
{
id fooBarInst = [[FooBar alloc] init];
[fooBarInst boo];
if (called != 1)
abort ();
return 0;
}