mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 22:26:06 +00:00
Use recently imported MSVC warning macros
The PUSH/POP are less noisy for sure. SUPPRESS is a little more subtle -- it's correctly documented as "for this line and the next" but that doesn't work well with our coding style. R=mark@chromium.org BUG=crashpad:1 Review URL: https://codereview.chromium.org/898133002
This commit is contained in:
parent
878400947f
commit
22c82f0c6c
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "base/compiler_specific.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "snapshot/cpu_context.h"
|
#include "snapshot/cpu_context.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
@ -39,16 +40,10 @@ scoped_ptr<MinidumpContextWriter> MinidumpContextWriter::CreateFromSnapshot(
|
|||||||
}
|
}
|
||||||
|
|
||||||
case kCPUArchitectureX86_64: {
|
case kCPUArchitectureX86_64: {
|
||||||
#if defined(COMPILER_MSVC) && defined(ARCH_CPU_X86)
|
MSVC_PUSH_DISABLE_WARNING(4316); // Object on heap may not be aligned.
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable: 4316) // Object allocated on the heap may not be 16
|
|
||||||
// byte aligned.
|
|
||||||
#endif
|
|
||||||
MinidumpContextAMD64Writer* context_amd64 =
|
MinidumpContextAMD64Writer* context_amd64 =
|
||||||
new MinidumpContextAMD64Writer();
|
new MinidumpContextAMD64Writer();
|
||||||
#if defined(COMPILER_MSVC) && defined(ARCH_CPU_X86)
|
MSVC_POP_WARNING(); // C4316
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
context.reset(context_amd64);
|
context.reset(context_amd64);
|
||||||
context_amd64->InitializeFromSnapshot(context_snapshot->x86_64);
|
context_amd64->InitializeFromSnapshot(context_snapshot->x86_64);
|
||||||
break;
|
break;
|
||||||
|
@ -24,15 +24,12 @@
|
|||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
|
|
||||||
#if defined(COMPILER_MSVC)
|
|
||||||
// C4200 is "nonstandard extension used : zero-sized array in struct/union".
|
// C4200 is "nonstandard extension used : zero-sized array in struct/union".
|
||||||
// We would like to globally disable this warning, but unfortunately, the
|
// We would like to globally disable this warning, but unfortunately, the
|
||||||
// compiler is buggy and only supports disabling it with a pragma, so we can't
|
// compiler is buggy and only supports disabling it with a pragma, so we can't
|
||||||
// disable it with other silly warnings in build/common.gypi. See:
|
// disable it with other silly warnings in build/common.gypi. See:
|
||||||
// https://connect.microsoft.com/VisualStudio/feedback/details/1114440
|
// https://connect.microsoft.com/VisualStudio/feedback/details/1114440
|
||||||
#pragma warning(push)
|
MSVC_PUSH_DISABLE_WARNING(4200);
|
||||||
#pragma warning(disable: 4200)
|
|
||||||
#endif // COMPILER_MSVC
|
|
||||||
|
|
||||||
#if defined(COMPILER_MSVC)
|
#if defined(COMPILER_MSVC)
|
||||||
#define PACKED
|
#define PACKED
|
||||||
@ -470,9 +467,7 @@ struct ALIGNAS(4) PACKED MinidumpCrashpadInfo {
|
|||||||
#endif // COMPILER_MSVC
|
#endif // COMPILER_MSVC
|
||||||
#undef PACKED
|
#undef PACKED
|
||||||
|
|
||||||
#if defined(COMPILER_MSVC)
|
MSVC_POP_WARNING(); // C4200
|
||||||
#pragma warning(pop) // C4200
|
|
||||||
#endif // COMPILER_MSVC
|
|
||||||
|
|
||||||
} // namespace crashpad
|
} // namespace crashpad
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
|
#include "base/compiler_specific.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
@ -287,15 +288,9 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
|||||||
TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
||||||
// In a 32-bit environment, this will give a “timestamp out of range” warning,
|
// In a 32-bit environment, this will give a “timestamp out of range” warning,
|
||||||
// but the test should complete without failure.
|
// but the test should complete without failure.
|
||||||
#if defined(OS_WIN) && defined(ARCH_CPU_X86)
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable: 4309) // Truncation of constant value.
|
|
||||||
#endif // OS_WIN && ARCH_CPU_X86
|
|
||||||
const uint32_t kSnapshotTime = 0xfd469ab8;
|
const uint32_t kSnapshotTime = 0xfd469ab8;
|
||||||
|
MSVC_SUPPRESS_WARNING(4309); // Truncation of constant value.
|
||||||
const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
|
const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
|
||||||
#if defined(OS_WIN) && defined(ARCH_CPU_X86)
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif // OS_WIN && ARCH_CPU_X86
|
|
||||||
|
|
||||||
TestProcessSnapshot process_snapshot;
|
TestProcessSnapshot process_snapshot;
|
||||||
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "base/compiler_specific.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_context_writer.h"
|
#include "minidump/minidump_context_writer.h"
|
||||||
@ -219,7 +220,7 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
|||||||
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
|
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
|
||||||
thread_writer->SetStack(memory_writer.Pass());
|
thread_writer->SetStack(memory_writer.Pass());
|
||||||
|
|
||||||
MSVC_SUPPRESS_WARNING(4316) // Object allocated on heap may not be aligned.
|
MSVC_SUPPRESS_WARNING(4316); // Object allocated on heap may not be aligned.
|
||||||
auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer());
|
auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer());
|
||||||
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
|
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
|
||||||
thread_writer->SetContext(context_amd64_writer.Pass());
|
thread_writer->SetContext(context_amd64_writer.Pass());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user