mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
Remove ALLOW_UNUSED_LOCAL from Crashpad
Bug: 1286390 Change-Id: I9755258960c55bef84e01812a14067ffaf89d2b1 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3388879 Commit-Queue: Avi Drissman <avi@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
23375ab37c
commit
b560edd484
2
DEPS
2
DEPS
@ -39,7 +39,7 @@ deps = {
|
||||
'e1e7b0ad8ee99a875b272c8e33e308472e897660',
|
||||
'crashpad/third_party/mini_chromium/mini_chromium':
|
||||
Var('chromium_git') + '/chromium/mini_chromium@' +
|
||||
'bbb68fcec19ff7c268fadeebd2ef79f7203fa2f2',
|
||||
'c2bc7a2a195eb8940215d0b81767f022aa5ecfdd',
|
||||
'crashpad/third_party/libfuzzer/src':
|
||||
Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' +
|
||||
'fda403cf93ecb8792cb1d061564d89a6553ca020',
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/auto_reset.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/scoped_file.h"
|
||||
#include "base/logging.h"
|
||||
@ -252,11 +251,10 @@ bool AddKeyValueToMap(std::map<std::string, std::string>* map,
|
||||
// a normal exit, or if a CallMetricsRecordNormalExit object is destroyed after
|
||||
// something else logs an exit event.
|
||||
void MetricsRecordExit(Metrics::LifetimeMilestone milestone) {
|
||||
static bool once = [](Metrics::LifetimeMilestone milestone) {
|
||||
[[maybe_unused]] static bool once = [](Metrics::LifetimeMilestone milestone) {
|
||||
Metrics::HandlerLifetimeMilestone(milestone);
|
||||
return true;
|
||||
}(milestone);
|
||||
ALLOW_UNUSED_LOCAL(once);
|
||||
}
|
||||
|
||||
// Calls MetricsRecordExit() to record a failure, and returns EXIT_FAILURE for
|
||||
@ -422,8 +420,8 @@ void InstallCrashHandler() {
|
||||
// enough. Note that destroying the TerminateHandler would wait for its thread
|
||||
// to exit, which isn’t necessary or desirable.
|
||||
SetConsoleCtrlHandler(ConsoleHandler, true);
|
||||
static TerminateHandler* terminate_handler = new TerminateHandler();
|
||||
ALLOW_UNUSED_LOCAL(terminate_handler);
|
||||
[[maybe_unused]] static TerminateHandler* terminate_handler =
|
||||
new TerminateHandler();
|
||||
}
|
||||
|
||||
#endif // OS_APPLE
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/format_macros.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
@ -436,8 +435,7 @@ TEST(MinidumpMiscInfoWriter, TimeZoneStringsOverflow) {
|
||||
|
||||
constexpr uint32_t kTimeZoneId = 2;
|
||||
constexpr int32_t kBias = 300;
|
||||
MINIDUMP_MISC_INFO_N tmp;
|
||||
ALLOW_UNUSED_LOCAL(tmp);
|
||||
[[maybe_unused]] MINIDUMP_MISC_INFO_N tmp;
|
||||
std::string standard_name(base::size(tmp.TimeZone.StandardName) + 1, 's');
|
||||
constexpr int32_t kStandardBias = 0;
|
||||
std::string daylight_name(base::size(tmp.TimeZone.DaylightName), 'd');
|
||||
@ -528,8 +526,7 @@ TEST(MinidumpMiscInfoWriter, BuildStringsOverflow) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
MINIDUMP_MISC_INFO_N tmp;
|
||||
ALLOW_UNUSED_LOCAL(tmp);
|
||||
[[maybe_unused]] MINIDUMP_MISC_INFO_N tmp;
|
||||
std::string build_string(base::size(tmp.BuildString) + 1, 'B');
|
||||
std::string debug_build_string(base::size(tmp.DbgBldStr), 'D');
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/format_macros.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
@ -86,8 +85,7 @@ TEST(MinidumpStringWriter, MinidumpUTF16StringWriter) {
|
||||
|
||||
const size_t expected_utf16_units_with_nul =
|
||||
kTestData[index].output_length + 1;
|
||||
MINIDUMP_STRING* tmp;
|
||||
ALLOW_UNUSED_LOCAL(tmp);
|
||||
[[maybe_unused]] MINIDUMP_STRING* tmp;
|
||||
const size_t expected_utf16_bytes =
|
||||
expected_utf16_units_with_nul * sizeof(tmp->Buffer[0]);
|
||||
ASSERT_EQ(string_file.string().size(), sizeof(*tmp) + expected_utf16_bytes);
|
||||
@ -130,8 +128,7 @@ TEST(MinidumpStringWriter, ConvertInvalidUTF8ToUTF16) {
|
||||
const MINIDUMP_STRING* minidump_string =
|
||||
MinidumpStringAtRVA(string_file.string(), 0);
|
||||
EXPECT_TRUE(minidump_string);
|
||||
MINIDUMP_STRING* tmp;
|
||||
ALLOW_UNUSED_LOCAL(tmp);
|
||||
[[maybe_unused]] MINIDUMP_STRING* tmp;
|
||||
EXPECT_EQ(
|
||||
minidump_string->Length,
|
||||
string_file.string().size() - sizeof(*tmp) - sizeof(tmp->Buffer[0]));
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
@ -39,8 +38,7 @@ void GetSystemInfoStream(const std::string& file_contents,
|
||||
const MINIDUMP_SYSTEM_INFO** system_info,
|
||||
const MINIDUMP_STRING** csd_version) {
|
||||
// The expected number of bytes for the CSD version’s MINIDUMP_STRING::Buffer.
|
||||
MINIDUMP_STRING* tmp;
|
||||
ALLOW_UNUSED_LOCAL(tmp);
|
||||
[[maybe_unused]] MINIDUMP_STRING* tmp;
|
||||
const size_t kCSDVersionBytes = csd_version_length * sizeof(tmp->Buffer[0]);
|
||||
const size_t kCSDVersionBytesWithNUL =
|
||||
kCSDVersionBytes + sizeof(tmp->Buffer[0]);
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "util/misc/arraysize.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -22,37 +21,29 @@ namespace test {
|
||||
namespace {
|
||||
|
||||
TEST(ArraySize, ArraySize) {
|
||||
char c1[1];
|
||||
[[maybe_unused]] char c1[1];
|
||||
static_assert(ArraySize(c1) == 1, "c1");
|
||||
ALLOW_UNUSED_LOCAL(c1);
|
||||
|
||||
char c2[2];
|
||||
[[maybe_unused]] char c2[2];
|
||||
static_assert(ArraySize(c2) == 2, "c2");
|
||||
ALLOW_UNUSED_LOCAL(c2);
|
||||
|
||||
char c4[4];
|
||||
[[maybe_unused]] char c4[4];
|
||||
static_assert(ArraySize(c4) == 4, "c4");
|
||||
ALLOW_UNUSED_LOCAL(c4);
|
||||
|
||||
int i1[1];
|
||||
[[maybe_unused]] int i1[1];
|
||||
static_assert(ArraySize(i1) == 1, "i1");
|
||||
ALLOW_UNUSED_LOCAL(i1);
|
||||
|
||||
int i2[2];
|
||||
[[maybe_unused]] int i2[2];
|
||||
static_assert(ArraySize(i2) == 2, "i2");
|
||||
ALLOW_UNUSED_LOCAL(i2);
|
||||
|
||||
int i4[4];
|
||||
[[maybe_unused]] int i4[4];
|
||||
static_assert(ArraySize(i4) == 4, "i4");
|
||||
ALLOW_UNUSED_LOCAL(i4);
|
||||
|
||||
long l8[8];
|
||||
[[maybe_unused]] long l8[8];
|
||||
static_assert(ArraySize(l8) == 8, "l8");
|
||||
ALLOW_UNUSED_LOCAL(l8);
|
||||
|
||||
int l9[9];
|
||||
[[maybe_unused]] int l9[9];
|
||||
static_assert(ArraySize(l9) == 9, "l9");
|
||||
ALLOW_UNUSED_LOCAL(l9);
|
||||
|
||||
struct S {
|
||||
char c;
|
||||
@ -61,13 +52,11 @@ TEST(ArraySize, ArraySize) {
|
||||
bool b;
|
||||
};
|
||||
|
||||
S s1[1];
|
||||
[[maybe_unused]] S s1[1];
|
||||
static_assert(ArraySize(s1) == 1, "s1");
|
||||
ALLOW_UNUSED_LOCAL(s1);
|
||||
|
||||
S s10[10];
|
||||
[[maybe_unused]] S s10[10];
|
||||
static_assert(ArraySize(s10) == 10, "s10");
|
||||
ALLOW_UNUSED_LOCAL(s10);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "build/build_config.h"
|
||||
#include "util/misc/initialization_state.h"
|
||||
|
||||
@ -175,11 +176,11 @@ using InitializationStateDcheck = bool[0];
|
||||
// Avoid triggering warnings by repurposing these macros when DCHECKs are
|
||||
// disabled.
|
||||
#define INITIALIZATION_STATE_SET_INITIALIZING(initialization_state_dcheck) \
|
||||
ALLOW_UNUSED_LOCAL(initialization_state_dcheck)
|
||||
do { std::ignore = initialization_state_dcheck; } while (false)
|
||||
#define INITIALIZATION_STATE_SET_VALID(initialization_state_dcheck) \
|
||||
ALLOW_UNUSED_LOCAL(initialization_state_dcheck)
|
||||
do { std::ignore = initialization_state_dcheck; } while (false)
|
||||
#define INITIALIZATION_STATE_DCHECK_VALID(initialization_state_dcheck) \
|
||||
ALLOW_UNUSED_LOCAL(initialization_state_dcheck)
|
||||
do { std::ignore = initialization_state_dcheck; } while (false)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "util/misc/scoped_forbid_return.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/gtest_death.h"
|
||||
|
||||
@ -43,13 +42,12 @@ void ScopedForbidReturnHelper(ForbidReturnType type) {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr char kForbiddenMessage[] = "attempt to exit scope forbidden";
|
||||
// kForbiddenMessage may appear to be unused if ASSERT_DEATH_CHECK() throws it
|
||||
// away.
|
||||
[[maybe_unused]] constexpr char kForbiddenMessage[] =
|
||||
"attempt to exit scope forbidden";
|
||||
|
||||
TEST(ScopedForbidReturnDeathTest, Default) {
|
||||
// kForbiddenMessage may appear to be unused if ASSERT_DEATH_CHECK() throws it
|
||||
// away.
|
||||
ALLOW_UNUSED_LOCAL(kForbiddenMessage);
|
||||
|
||||
ASSERT_DEATH_CHECK(ScopedForbidReturnHelper(kForbidReturnDefault),
|
||||
kForbiddenMessage);
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/files/scoped_file.h"
|
||||
#include "base/logging.h"
|
||||
@ -163,10 +162,9 @@ void CauseSignal(int sig, int code) {
|
||||
* Arm architecture.
|
||||
*/
|
||||
#if defined(ARCH_CPU_X86_FAMILY)
|
||||
volatile int a = 42;
|
||||
[[maybe_unused]] volatile int a = 42;
|
||||
volatile int b = 0;
|
||||
a /= b;
|
||||
ALLOW_UNUSED_LOCAL(a);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/gtest_death.h"
|
||||
|
||||
@ -93,12 +92,10 @@ TEST(AlignedAllocator, AlignedVector) {
|
||||
void BadAlignmentTest() {
|
||||
#if defined(OS_WIN)
|
||||
// Suppress the assertion MessageBox() normally displayed by the CRT in debug
|
||||
// mode.
|
||||
int previous = _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
|
||||
|
||||
// In release mode, _CrtSetReportMode() is #defined to ((int)0), so |previous|
|
||||
// would appear unused.
|
||||
ALLOW_UNUSED_LOCAL(previous);
|
||||
// mode. In release mode, _CrtSetReportMode() is #defined to ((int)0), so
|
||||
// |previous| would appear unused, thus the [[maybe_unused]].
|
||||
[[maybe_unused]] int previous =
|
||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
|
||||
#endif
|
||||
|
||||
// Alignment constraints must be powers of 2. 7 is not valid.
|
||||
|
Loading…
x
Reference in New Issue
Block a user