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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [sizeof-1.m] - Blame information for rev 774

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

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