File: ghost_parameters.c

package info (click to toggle)
frama-c 20220511-manganese-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 66,472 kB
  • sloc: ml: 278,832; ansic: 47,093; sh: 4,823; makefile: 3,618; javascript: 2,436; python: 1,919; perl: 897; lisp: 293; xml: 62
file content (211 lines) | stat: -rw-r--r-- 4,033 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/* run.config
 EXIT: 1
   STDOPT: +" -cpp-extra-args=-DARGS_NOT_VOID"
   STDOPT: +" -cpp-extra-args=-DARGS_VOID"
 EXIT: 0
   STDOPT: +" -cpp-extra-args=-DCOHERENT_DECL"
 EXIT: 1
   STDOPT: +" -cpp-extra-args=-DINCOHERENT_LOCAL_DECL_NON_GHOST"
   STDOPT: +" -cpp-extra-args=-DINCOHERENT_GLOBAL_DECL_NON_GHOST"
   STDOPT: +" -cpp-extra-args=-DINCOHERENT_LOCAL_DECL_GHOST"
   STDOPT: +" -cpp-extra-args=-DINCOHERENT_GLOBAL_DECL_GHOST"
   STDOPT: +" -cpp-extra-args=-DINCOHERENT_LOCAL_DECL_MORE_GHOSTS"
   STDOPT: +" -cpp-extra-args=-DINCOHERENT_GLOBAL_DECL_MORE_GHOSTS"
   STDOPT: +" -cpp-extra-args=-DINCOHERENT_LOCAL_DECL_MORE_NON_GHOSTS"
   STDOPT: +" -cpp-extra-args=-DINCOHERENT_GLOBAL_DECL_MORE_NON_GHOSTS"
   STDOPT: +" -cpp-extra-args=-DVOID_EMPTY_GHOST_PARAMETER_LIST"
   STDOPT: +" -cpp-extra-args=-DVOID_GHOST_PARAMETER"
*/

#ifdef ARGS_NOT_VOID

void function(int a, int b) /*@ ghost (int c, int d) */{

}

void caller(void){
  // VALID
  function(1, 2) /*@ ghost (3, 4)*/ ;
  /*@ ghost function(1, 2, 3, 4) ; */

  // INVALID
  function(1, 2) ;
  function(1, 2) /*@ ghost (3) */ ;
  function(1) /*@ ghost (2, 3) */ ;
  function(1, 2, 3, 4) ;
  function() /*@ ghost (1, 2, 3, 4) */ ;

  /*@ ghost function(1, 2) ; */
  /*@ ghost function(1) ; */
  /*@ ghost function(1, 2, 3) ; */
}

#endif

#ifdef ARGS_VOID

void function(void) /*@ ghost (int c, int d) */{

}

void caller(void){
  // VALID
  function() /*@ ghost (3, 4)*/ ;
  /*@ ghost function(3, 4) ; */

  // INVALID
  function() ;
  function() /*@ ghost (3) */ ;
  function(1) /*@ ghost (2, 3) */ ;
  function(1, 2) ;
  function() /*@ ghost (1, 2, 3) */ ;

  /*@ ghost function() ; */
  /*@ ghost function(1) ; */
  /*@ ghost function(1, 2, 3) ; */
}

#endif

#ifdef COHERENT_DECL

void caller(void){
  void function(int a, int b) /*@ ghost(int c, int d) */ ;
  function(1, 2) /*@ ghost (3, 4) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ ;

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef INCOHERENT_LOCAL_DECL_NON_GHOST

void caller(void){
  void function(int b) /*@ ghost(int c, int d) */ ;
  function(2) /*@ ghost (3, 4) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef INCOHERENT_GLOBAL_DECL_NON_GHOST

void function(int b) /*@ ghost(int c, int d) */ ;

void caller(void){
  function(2) /*@ ghost (3, 4) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef INCOHERENT_LOCAL_DECL_GHOST

void caller(void){
  void function(int a, int b) /*@ ghost(int d) */ ;
  function(1, 2) /*@ ghost (4) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef INCOHERENT_GLOBAL_DECL_GHOST

void function(int a, int b) /*@ ghost(int d) */ ;

void caller(void){
  function(1, 2) /*@ ghost (3) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef INCOHERENT_LOCAL_DECL_MORE_GHOSTS

void caller(void){
  void function(int a, int b, int c) /*@ ghost(int d) */ ;
  function(1, 2, 3) /*@ ghost (4) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef INCOHERENT_GLOBAL_DECL_MORE_GHOSTS

void function(int a, int b, int c) /*@ ghost(int d) */ ;

void caller(void){
  function(1, 2, 3) /*@ ghost (4) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef INCOHERENT_LOCAL_DECL_MORE_NON_GHOSTS

void caller(void){
  void function(int a) /*@ ghost(int b, int c, int d) */ ;
  function(1) /*@ ghost (2, 3, 4) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef INCOHERENT_GLOBAL_DECL_MORE_NON_GHOSTS

void function(int a) /*@ ghost(int b, int c, int d) */ ;

void caller(void){
  function(1) /*@ ghost (2, 3, 4) */ ;
}

void function(int a, int b) /*@ ghost(int c, int d) */ {

}

#endif

#ifdef VOID_EMPTY_GHOST_PARAMETER_LIST

void function_void(void) /*@ ghost () */ {

}

#endif

#ifdef VOID_GHOST_PARAMETER

void function_void(void) /*@ ghost (void) */ {

}

void function_non_void(int x) /*@ ghost (void) */ {

}

#endif