You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that this implies for pointers that the memory they point at has to be initialized, too.
159
+
Below windows.cfg is shown:
160
160
161
-
Here is the minimal windows.cfg:
161
+
Version 1:
162
162
163
163
<?xml version="1.0"?>
164
164
<def>
165
165
<function name="CopyMemory">
166
166
<arg nr="1"/>
167
167
<arg nr="2">
168
+
<not-null/>
168
169
<not-uninit/>
169
170
</arg>
170
171
<arg nr="3"/>
171
172
</function>
172
173
</def>
173
174
174
-
The `indirect` attribute can be set to control the indirection of uninitialized memory allowed. Setting `indirect` to `0` means no uninitialized memory is allowed. Setting it to `1` allows a pointer to uninitialized memory. Setting it to `2` allows a pointer to pointer to uninitialized memory.
175
+
Version 2:
176
+
177
+
<?xml version="1.0"?>
178
+
<def>
179
+
<function name="CopyMemory">
180
+
<arg nr="1"/>
181
+
<arg nr="2">
182
+
<not-uninit indirect="2"/>
183
+
</arg>
184
+
<arg nr="3"/>
185
+
</function>
186
+
</def>
187
+
188
+
189
+
Version 1: If `indirect` attribute is not used then the level of indirection is determined automatically. The `<not-null/>` tells Cppcheck that the pointer must be initialized. The `<not-uninit/>` tells Cppcheck to check 1 extra level. This configuration means that both the pointer and the data must be initialized.
175
190
176
-
By default, cppcheck will use an indirect value of `0` unless `not-null`is used. When `not-null` is used, then `indirect` will default to `1`.
191
+
Version 2: The `indirect` attribute can be set to explicitly control the level of indirection used in checking. Setting `indirect` to `0` means no uninitialized memory is allowed. Setting it to `1` allows a pointer to uninitialized memory. Setting it to `2` allows a pointer to pointer to uninitialized memory.
0 commit comments