OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.dg/] [debug/] [dwarf2/] [template-func-params-7.C] - Blame information for rev 384

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// Contributed by Dodji Seketeli 
2
// Origin PR debug/30161
3
// { dg-options "-g -dA -std=c++0x -fno-merge-debug-strings" }
4
// { dg-do compile }
5
 
6
// There must be 5 subprograms generated:
7
// printf(const char*), printf,
8
// printf, printf and foo().
9
// { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_subprogram" 5 } }
10
 
11
// That makes 6 template type parameters.
12
// { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_type_param" 6 } }
13
// { dg-final {scan-assembler-times "\"printf.0\".*?DW_AT_name" 1 } }
14
// { dg-final {scan-assembler-times "\"printf.0\".*?DW_AT_name" 1 } }
15
// { dg-final {scan-assembler-times "\"printf.0\".*?DW_AT_name" 1 } }
16
// { dg-final {scan-assembler-times "\"printf.0\".*?DW_AT_name" 1 } }
17
 
18
// printf and printf have a pack expansion as
19
// function parameters. There should then be 3
20
// DW_TAG_GNU_template_parameter_pack and 3 DW_TAG_GNU_formal_parameter_pack DIEs
21
// { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_GNU_template_parameter_pack" 3 } }
22
// { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_GNU_formal_parameter_pack" 3 } }
23
// These 3 function template instantiations has a total of 3 template
24
// parameters named T.
25
// { dg_final {scan-assembler-times "\.ascii \"T.0\"\[\t \]+.*?DW_AT_name" 3 } }
26
 
27
 
28
void
29
printf(const char* s)
30
{
31
  /* Commented this to not pull std::cout into what should be
32
     a simple test.
33
  while (*s)
34
    std::cout << *s++;
35
  */
36
}
37
 
38
template
39
void
40
printf(const char* s,
41
       T value,
42
       PackTypes... args)
43
{
44
  while (*s)
45
    {
46
      if (*s == '%' && *++s != '%')
47
        {
48
          /* std::cout << value; */
49
          return printf(++s, args...);
50
        }
51
    }
52
}
53
 
54
void
55
foo ()
56
{
57
  int x;
58
  printf("%c %d", x, 'x', 3);
59
}

powered by: WebSVN 2.1.0

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