diff --git a/debuggerd/crasher/Android.bp b/debuggerd/crasher/Android.bp index 7975a3a32..23b106ea4 100644 --- a/debuggerd/crasher/Android.bp +++ b/debuggerd/crasher/Android.bp @@ -13,7 +13,6 @@ cc_defaults { "-Werror", "-O0", "-fstack-protector-all", - "-Wno-free-nonheap-object", "-Wno-date-time", ], srcs: ["crasher.cpp"], diff --git a/debuggerd/crasher/crasher.cpp b/debuggerd/crasher/crasher.cpp index a2b13a36c..db30b8f07 100644 --- a/debuggerd/crasher/crasher.cpp +++ b/debuggerd/crasher/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) {