From mboxrd@z Thu Jan 1 00:00:00 1970
Return-Path:
malloc
attribute has been extended so that it can be used to identify
- allocator/deallocator API pairs. A new
- -Wmismatched-dealloc
- warning will complain about incorrect calls. Additionally, the
- static analyzer will use these attributes when checking for leaks,
- double-frees, use-after-frees, and similar issues.
+ allocator/deallocator API pairs. A pair of new
+ -Wmismatched-dealloc
and -Wmismatched-new-delete
warnings will complain
+ about mismatched calls, and -Wfree-nonheap-object
about deallocation calls with pointers not obtained from allocation
+ functions. Additionally, the static analyzer will use these
+ attributes when checking for leaks, double-frees, use-after-frees,
+ and similar issues.
-Wmismatched-dealloc
,
+ enabled by default, warns about calls to deallocation functions
+ with pointers returned from mismatched allocation functions.
+ -Wsizeof-array-div
,
enabled by -Wall
, warns
about divisions of two sizeof operators when the first one is applied
to an array and the divisor does not equal the size of the array
element.
-Wstringop-overread
,
+ enabled by default, warns about calls to string functions reading
+ past the end of the arrays passed to them as arguments. In prior
+ GCC releases most instances of his warning are diagnosed by
+ -Wstringop-overflow
.
+ -Wfree-nonheap-object
+ detects many more instances of calls to deallocation functions with
+ pointers not returned from a dynamic memory allocation function.
+ -Wmaybe-uninitialized
+ diagnoses passing pointers or references to uninitialized memory
+ to functions taking const
-qualified arguments.
+ -Wuninitialized
+ detects reads from uninitialized dynamically allocated memory.
+ -Warray-parameter
,
+ enabled by -Wall
, warns about redeclarations of functions
+ with ordinary array arguments declared using inconsistent forms.
+ The warning also enables the detection of the likely out of bounds
+ accesses in calls to such functions with smaller arrays.
+ -Wvla-parameter
,
+ enabled by -Wall
, warns redeclarations of functions
+ with variable length array arguments declared using inconsistent
+ forms or with mismatched bounds. The warning also enables
+ the detection of the likely out of bounds accesses in calls to
+ such functions with smaller arrays.
+ -Wmismatched-new-delete
,
+ enabled by -Wall
, warns about calls to C++
+ operator delete
with pointers returned from mismatched
+ forms of operator new
or from other mismatched allocation
+ functions.
+ -Wvexing-parse
, enabled by default, warns about the most
vexing parse rule: the cases when a declaration looks like a variable
definition, but the C++ language requires it to be interpreted as a
function declaration.
-Wnonnull
+ considers the implicit this
argument of every C++
+ nonstatic member function to have been implicitly declared with
+ attribute nonnull
and triggers warnings for calls where
+ the pointer is null.
+