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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [gcov/] [gcov-5.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* Check that execution counts for template functions
2
   are reported correctly by gcov. */
3
 
4
#include 
5
#include 
6
 
7
/* { dg-options "-fprofile-arcs -ftest-coverage -fno-inline" } */
8
/* { dg-do run { target native } } */
9
 
10
class A {
11
  int count;
12
 public:
13
  A(int c) { count = c; }
14
  void func(void) { printf("func\n"); }
15
  bool done(void) {
16
    return (count == 0) ? true : (count-- != 0);
17
  }
18
  void run(void) { abort(); }
19
};
20
 
21
//typedef A T;
22
template
23
void WithoutBrace(T *a) {
24
  while (!a->done())
25
    a->run();           /* count(#####) */
26
}                       /* count(1) */
27
 
28
template
29
void WithBrace(T *a)
30
{
31
  while (!a->done())
32
    {
33
      a->run();         /* count(#####) */
34
    }
35
}                       /* count(1) */
36
 
37
A *func(A *a)
38
{
39
  WithoutBrace(a);
40
  WithBrace(a);
41
  return a;
42
}
43
 
44
int main() {
45
  A a(0);
46
  func(&a);
47
  return 0;
48
}
49
 
50
/* { dg-final { run-gcov gcov-5.C } } */

powered by: WebSVN 2.1.0

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