1 /* testvarnames.cpp --- semantic-ia-utest completion engine unit tests
2
3 Copyright (C) 2008-2023 Free Software Foundation, Inc.
4
5 Author: Eric M. Ludlam <zappo@gnu.org>
6
7 This file is part of GNU Emacs.
8
9 GNU Emacs is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 GNU Emacs is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22 */
23
24 struct independent {
25 int indep_1;
26 int indep_2;
27 };
28
29 struct independent var_indep_struct;
30
31 struct {
32 int unnamed_1;
33 int unnamed_2;
34 } var_unnamed_struct;
35
36 struct {
37 int unnamed_3;
38 int unnamed_4;
39 } var_un_2, var_un_3;
40
41 struct inlinestruct {
42 int named_1;
43 int named_2;
44 } var_named_struct;
45
46 struct inline2struct {
47 int named_3;
48 int named_4;
49 } var_n_2, var_n_3;
50
51 /* Structures with names that then declare variables
52 * should also be completable.
53 *
54 * Getting this to work is the bugfix in semantic-c.el CVS v 1.122
55 */
56 struct inlinestruct in_var1;
57 struct inline2struct in_var2;
58
59 /*
60 * Structures (or any types) could have the same name as a variable.
61 * Make sure we complete vars over types.
62 *
63 * See cedet-devel mailing list Dec 23, 2013 for details.
64 */
65 struct varorstruct {};
66 int varorstruct;
67
68 int assigntovarorstruct;
69
70 int test_1(int var_arg1) {
71
72 var_// -1-
73 ; // #1# ("var_arg1" "var_indep_struct" "var_n_2" "var_n_3" "var_named_struct" "var_un_2" "var_un_3" "var_unnamed_struct")
74
75 var_indep_struct.// -2-
76 ; // #2# ( "indep_1" "indep_2" )
77
78 var_unnamed_struct.// -3-
79 ; // #3# ( "unnamed_1" "unnamed_2" )
80
81 var_named_struct.// -4-
82 ; // #4# ( "named_1" "named_2" )
83
84 var_un_2.// -5-
85 ; // #5# ( "unnamed_3" "unnamed_4" )
86 var_un_3.// -6-
87 ; // #6# ( "unnamed_3" "unnamed_4" )
88
89 var_n_2.// -7-
90 ; // #7# ( "named_3" "named_4" )
91 var_n_3.// -8-
92 ; // #8# ( "named_3" "named_4" )
93
94 in_// -9-
95 ; // #9# ( "in_var1" "in_var2" )
96
97 in_var1.// -10-
98 ; // #10# ( "named_1" "named_2")
99 in_var2.// -11-
100 ; // #11# ( "named_3" "named_4")
101
102 varorstruct = assign// -12-
103 ; // #12# ( "assigntovarorstruct" )
104 }