OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [obj-c++.dg/] [cxx-ivars-3.mm] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
// Check if ObjC classes with non-POD C++ ivars are specially marked in the metadata.
2
 
3
// { dg-do run { target *-*-darwin* } }
4
// { dg-options "-fobjc-call-cxx-cdtors -fnext-runtime" }
5
 
6
#include 
7
#include 
8
#define CHECK_IF(expr) if(!(expr)) abort()
9
 
10
#ifndef CLS_HAS_CXX_STRUCTORS
11
#define CLS_HAS_CXX_STRUCTORS 0x2000L
12
#endif
13
 
14
struct cxx_struct {
15
  int a, b;
16
  cxx_struct (void) { a = b = 55; }
17
};
18
 
19
@interface Foo {
20
  int c;
21
  cxx_struct s;
22
}
23
@end
24
 
25
@interface Bar: Foo {
26
  float f;
27
}
28
@end
29
 
30
@implementation Foo
31
@end
32
 
33
@implementation Bar
34
@end
35
 
36
int main (void)
37
{
38
  Class cls;
39
 
40
  cls = objc_getClass("Foo");
41
  CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS);
42
  cls = objc_getClass("Bar");
43
  CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS));
44
 
45
  return 0;
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.