Ignore deliberate free() of non-heap memory
Bug: http://b/181927912 Clang already has -Wfree-nonheap-object but it became a default warning with clang-r416183 Test: compile crasher.cpp Change-Id: Ice532e9f373a628e07acd08a4fc7bfa7cf5d4e08
This commit is contained in:
parent
f85f3d628e
commit
982e2a5018
2 changed files with 4 additions and 1 deletions
|
@ -13,7 +13,6 @@ cc_defaults {
|
|||
"-Werror",
|
||||
"-O0",
|
||||
"-fstack-protector-all",
|
||||
"-Wno-free-nonheap-object",
|
||||
"-Wno-date-time",
|
||||
],
|
||||
srcs: ["crasher.cpp"],
|
||||
|
|
|
@ -134,10 +134,14 @@ noinline int crash(int a) {
|
|||
return a*2;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wfree-nonheap-object"
|
||||
|
||||
noinline void abuse_heap() {
|
||||
char buf[16];
|
||||
free(buf); // GCC is smart enough to warn about this, but we're doing it deliberately.
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
noinline void leak() {
|
||||
while (true) {
|
||||
|
|
Loading…
Reference in a new issue