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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Test demangling an Objective-C method.  */
2
/* { dg-do run } */
3
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
 
5
#include <string.h>
6
#include <stdlib.h>
7
#include <stdio.h>
8
 
9
#include <objc/objc.h>
10
 
11
@interface DemangleTest
12
{
13
  Class isa;
14
}
15
+ (id) initialize;
16
+ (int) testFunction1;
17
+ (int) test_function2;
18
+ (int) __testFunction3: (int)unused  andArgument: (char)unused2;
19
@end
20
 
21
@implementation DemangleTest
22
+ (id) initialize { return self; }
23
+ (int) testFunction1
24
{
25
  printf ("%s\n", __PRETTY_FUNCTION__);
26
  return strcmp (__PRETTY_FUNCTION__, "+[DemangleTest testFunction1]");
27
}
28
/* Note that in general, due to how mangling is done, it's impossible
29
   to get the demangling right for all functions containing '_' in the
30
   name.  But at least we should be able to get that right for single
31
   argument ones that don't end with '_', such as the following
32
   one.  */
33
+ (int) test_function2
34
{
35
  printf ("%s\n", __PRETTY_FUNCTION__);
36
  return strcmp (__PRETTY_FUNCTION__, "+[DemangleTest test_function2]");
37
}
38
+ (int) __testFunction3: (int)unused   andArgument: (char)unused2
39
{
40
  printf ("%s\n", __PRETTY_FUNCTION__);
41
  return strcmp (__PRETTY_FUNCTION__, "+[DemangleTest __testFunction3:andArgument:]");
42
}
43
@end
44
 
45
int main ()
46
{
47
  if ([DemangleTest testFunction1] != 0)
48
      abort ();
49
 
50
  if ([DemangleTest test_function2] != 0)
51
    abort ();
52
 
53
  if ([DemangleTest __testFunction3:0 andArgument: 'c'] != 0)
54
      abort ();
55
 
56
  return 0;
57
}
58
 
59
 

powered by: WebSVN 2.1.0

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