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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.ext/] [pretty2.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
3
// Contributed by Nathan Sidwell 21 Nov 1999 
4
 
5
// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in member functions
6
 
7
#include 
8
#include 
9
 
10
static bool bad = false;
11
 
12
struct X
13
{
14
  X ();
15
  ~X ();
16
  void fn ();
17
  operator int ();
18
};
19
 
20
X::X ()
21
{
22
  char const *function = __FUNCTION__;
23
  char const *pretty = __PRETTY_FUNCTION__;
24
 
25
  printf ("ctor\n");
26
  printf ("__FUNCTION__ %s\n", function);
27
  printf ("__PRETTY_FUNCTION__ %s\n", pretty);
28
 
29
  if (strcmp (function, "X"))
30
    bad = true;
31
  if (strcmp (pretty, "X::X()"))
32
    bad = true;
33
}
34
X::~X ()
35
{
36
  char const *function = __FUNCTION__;
37
  char const *pretty = __PRETTY_FUNCTION__;
38
 
39
  printf ("dtor\n");
40
  printf ("__FUNCTION__ %s\n", function);
41
  printf ("__PRETTY_FUNCTION__ %s\n", pretty);
42
 
43
  if (strcmp (function, "~X"))
44
    bad = true;
45
  if (strcmp (pretty, "X::~X()"))
46
    bad = true;
47
}
48
void X::fn ()
49
{
50
  char const *function = __FUNCTION__;
51
  char const *pretty = __PRETTY_FUNCTION__;
52
 
53
  printf ("member fn\n");
54
  printf ("__FUNCTION__ %s\n", function);
55
  printf ("__PRETTY_FUNCTION__ %s\n", pretty);
56
 
57
  if (strcmp (function, "fn"))
58
    bad = true;
59
  if (strcmp (pretty, "void X::fn()"))
60
    bad = true;
61
}
62
X::operator int ()
63
{
64
  char const *function = __FUNCTION__;
65
  char const *pretty = __PRETTY_FUNCTION__;
66
 
67
  printf ("conversion\n");
68
  printf ("__FUNCTION__ %s\n", function);
69
  printf ("__PRETTY_FUNCTION__ %s\n", pretty);
70
 
71
  if (strcmp (pretty, "X::operator int()"))
72
    bad = true;
73
  return 0;
74
}
75
 
76
int main ()
77
{
78
  {
79
    X x;
80
 
81
    x.fn ();
82
    (void)int (x);
83
  }
84
  return bad;
85
}

powered by: WebSVN 2.1.0

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