| 1 |
# This file is part of GNU cflow testsuite. -*- Autotest -*- |
| 2 |
# Copyright (C) 2016-2025 Sergey Poznyakoff |
| 3 |
# |
| 4 |
# This program is free software; you can redistribute it and/or |
| 5 |
# modify it under the terms of the GNU General Public License as |
| 6 |
# published by the Free Software Foundation; either version 3, or (at |
| 7 |
# your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, but |
| 10 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
# General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
AT_SETUP([member of]) |
| 18 |
AT_KEYWORDS([memberof]) |
| 19 |
|
| 20 |
CFLOW_CHECK( |
| 21 |
[int bar(struct foo *a) { |
| 22 |
return a.bar(); |
| 23 |
} |
| 24 |
], |
| 25 |
[bar() <int bar (struct foo *a) at prog:1> |
| 26 |
]) |
| 27 |
|
| 28 |
# https://savannah.gnu.org/bugs/index.php?47110 |
| 29 |
CFLOW_CHECK( |
| 30 |
[int bar(struct foo *a) { |
| 31 |
return (*a).bar(); |
| 32 |
} |
| 33 |
], |
| 34 |
[bar() <int bar (struct foo *a) at prog:1> |
| 35 |
]) |
| 36 |
|
| 37 |
CFLOW_CHECK( |
| 38 |
[int bar(struct foo **a) { |
| 39 |
return (*a)->bar(); |
| 40 |
} |
| 41 |
], |
| 42 |
[bar() <int bar (struct foo **a) at prog:1> |
| 43 |
]) |
| 44 |
|
| 45 |
CFLOW_CHECK( |
| 46 |
[int bar(void *a) { |
| 47 |
return (*(struct foo*)a).bar(); |
| 48 |
} |
| 49 |
], |
| 50 |
[bar() <int bar (void *a) at prog:1> |
| 51 |
]) |
| 52 |
|
| 53 |
CFLOW_CHECK( |
| 54 |
[int bar(void *a) { |
| 55 |
return (*(struct foo*)(((struct qux*)a)->foo)).bar(); |
| 56 |
} |
| 57 |
], |
| 58 |
[bar() <int bar (void *a) at prog:1> |
| 59 |
]) |
| 60 |
|
| 61 |
AT_CLEANUP |
| 62 |
|