Cleanup for #inclusivefixit.

The comment and pragma for GCC genuinely don't seem to be needed for
Clang.

Clarify the comment about the two ways in which clang_fortify_tests.cpp
is used.

Test: treehugger
Change-Id: Icb48a5848c005104ab2d2456da3978bbaf7e158c
This commit is contained in:
Elliott Hughes 2020-07-23 13:40:39 -07:00
parent c79ea23941
commit cfd8f581fa
2 changed files with 13 additions and 14 deletions

View file

@ -18,17 +18,24 @@
#error "Non-clang isn't supported"
#endif
//
// Clang compile-time and run-time tests for Bionic's FORTIFY.
//
// This file is compiled in two configurations ways to give us a sane set of tests for clang's
// FORTIFY implementation.
// This file is compiled in two configurations to give us reasonable coverage of clang's
// FORTIFY implementation:
//
// One configuration uses clang's diagnostic consumer
// 1. For compile-time checks, we use clang's diagnostic consumer
// (https://clang.llvm.org/doxygen/classclang_1_1VerifyDiagnosticConsumer.html#details)
// to check diagnostics (e.g. the expected-* comments everywhere).
//
// Please note that this test does things like leaking memory. That's WAI.
// 2. For run-time checks, we build and run as regular gtests.
// Note that these tests do things like leaking memory. That's WAI.
//
// Configuration for the compile-time checks. (These comments have side effects!)
//
// Silence all "from 'diagnose_if'" `note`s from anywhere, including headers; they're uninteresting
// for this test case, and their line numbers may change over time.
// expected-note@* 0+{{from 'diagnose_if'}}
@ -39,8 +46,8 @@
// And finally, all explicitly-unavailable-here complaints from headers are
// uninteresting
// expected-note@* 0+{{has been explicitly marked unavailable here}}
// Note that some of these diags come from clang itself, while others come from
//
// Note that some of these diagnostics come from clang itself, while others come from
// `diagnose_if`s sprinkled throughout Bionic.
#ifndef _FORTIFY_SOURCE

View file

@ -14,14 +14,6 @@
* limitations under the License.
*/
// -Werror is on whether we like it or not, and we're intentionally doing awful
// things in this file. GCC is dumb and doesn't have a specific error class for
// the fortify failures (it's just -Werror), so we can't use anything more
// constrained than disabling all the warnings in the file :( It also won't let
// us use system_header in a .cpp file, so we have to #include this from
// fortify_test_main.cpp.
#pragma GCC system_header
#include <gtest/gtest.h>
#include "BionicDeathTest.h"