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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc/] [execute/] [nested-func-1.m] - Blame information for rev 825

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test basic nested C function functionality within ObjC
2
   methods.  */
3
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
4
#include <stdio.h>
5
#include <stdlib.h>
6
#include <objc/objc.h>
7
#include <objc/Object.h>
8
 
9
int bappy (int (*blargh) (int a, int b, int c))
10
{
11
  return blargh (4, 7, 2) + 3;
12
}
13
 
14
@interface Foo: Object
15
+ (int)foo;
16
@end
17
 
18
@implementation Foo
19
+ (int)foo
20
{
21
  int blargh (int a, int b, int c)
22
  {
23
    return a * b + c;
24
  }
25
  return bappy (blargh);
26
}
27
@end
28
 
29
int main ()
30
{
31
  int f = [Foo foo];
32
  if (f != 33)
33
    abort ();
34
 
35
  return 0;
36
}

powered by: WebSVN 2.1.0

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