xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.cp/step-and-next-inline.cc (revision b2c35e17b976cf7ccd7250c86c6f5e95090ed636)
1 /* This testcase is part of GDB, the GNU debugger.
2 
3    Copyright 2019-2020 Free Software Foundation, Inc.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17 
18 #ifdef USE_NEXT_INLINE_H
19 
20 #include "step-and-next-inline.h"
21 
22 #else	/* USE_NEXT_INLINE_H */
23 
24 /* The code below must remain identical to the code in
25    step-and-next-inline.h.  */
26 
27 #include <stdlib.h>
28 
29 struct tree
30 {
31   volatile int x;
32   volatile int z;
33 };
34 
35 #define TREE_TYPE(NODE) (*tree_check (NODE, 0))
36 
37 inline tree *
38 tree_check (tree *t, int i)
39 {
40   if (t->x != i)
41     abort();
42   tree *x = t;
43   return x;
44 }
45 
46 #endif	/* USE_NEXT_INLINE_H */
47 
48 int __attribute__((noinline, noclone))
49 get_alias_set (tree *t)
50 {
51   if (t != NULL
52       && TREE_TYPE (t).z != 1
53       && TREE_TYPE (t).z != 2
54       && TREE_TYPE (t).z != 3)
55     return 0;
56   return 1;
57 }
58 
59 tree xx;
60 
61 int
62 main()
63 {
64   get_alias_set (&xx);
65   return 0;
66 }
67