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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [objc.dg/] [sizeof-1.m] - 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 that the sizeof() operator works with ObjC classes and their aliases. */
2
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
3
/* { dg-options "-lobjc" } */
4
/* { dg-do run } */
5
 
6
#include <objc/objc.h>
7
#include <objc/Object.h>
8
 
9
extern void abort(void);
10
#define CHECK_IF(expr) if(!(expr)) abort();
11
 
12
@interface Foo: Object {
13
  int a, b;
14
  float c, d;
15
}
16
@end
17
 
18
@implementation Foo
19
@end
20
 
21
typedef Object MyObject;
22
typedef struct Foo Foo_type;
23
 
24
@compatibility_alias AliasObject Object;
25
 
26
int main(void) {
27
  CHECK_IF(sizeof(Foo) > sizeof(Object) && sizeof(Object) > 0);
28
  CHECK_IF(sizeof(Foo) == sizeof(Foo_type));
29
  CHECK_IF(sizeof(Object) == sizeof(MyObject));
30
  CHECK_IF(sizeof(Object) == sizeof(AliasObject));
31
  return 0;
32
}
33
 

powered by: WebSVN 2.1.0

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