diff --git a/minidump/minidump_file_writer_test.cc b/minidump/minidump_file_writer_test.cc index 448ee60..e41ed75 100644 --- a/minidump/minidump_file_writer_test.cc +++ b/minidump/minidump_file_writer_test.cc @@ -21,6 +21,7 @@ #include #include "base/compiler_specific.h" +#include "build/build_config.h" #include "gtest/gtest.h" #include "minidump/minidump_stream_writer.h" #include "minidump/minidump_user_extension_stream_data_source.h" @@ -395,9 +396,18 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) { // In a 32-bit environment, this will give a “timestamp out of range” warning, // but the test should complete without failure. constexpr uint32_t kSnapshotTime = 0xfd469ab8; +#if defined(COMPILER_GCC) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconstant-conversion" +#define DISABLED_WCONSTANT_CONVERSION +#endif // COMPILER_GCC || __clang__ MSVC_SUPPRESS_WARNING(4309); // Truncation of constant value. MSVC_SUPPRESS_WARNING(4838); // Narrowing conversion. constexpr timeval kSnapshotTimeval = {static_cast(kSnapshotTime), 0}; +#if defined(DISABLED_WCONSTANT_CONVERSION) +#pragma GCC diagnostic pop +#undef DISABLED_WCONSTANT_CONVERSION +#endif // DISABLED_WCONSTANT_CONVERSION TestProcessSnapshot process_snapshot; process_snapshot.SetSnapshotTime(kSnapshotTimeval); diff --git a/snapshot/mac/process_reader_test.cc b/snapshot/mac/process_reader_test.cc index 36b372f..c9f39e7 100644 --- a/snapshot/mac/process_reader_test.cc +++ b/snapshot/mac/process_reader_test.cc @@ -42,16 +42,6 @@ #include "util/misc/from_pointer_cast.h" #include "util/synchronization/semaphore.h" -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10 -extern "C" { - -// Redeclare a typedef whose availability (OS X 10.10) is newer than the -// deployment target. -typedef struct _cl_device_id* cl_device_id; - -} // extern "C" -#endif - namespace crashpad { namespace test { namespace { @@ -574,10 +564,24 @@ class ScopedOpenCLNoOpKernel { cl_int rv = clGetPlatformIDs(1, &platform_id, nullptr); ASSERT_EQ(rv, CL_SUCCESS) << "clGetPlatformIDs"; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 && \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10 + // cl_device_id is really available in OpenCL.framework back to 10.5, but in + // the 10.10 SDK and later, OpenCL.framework includes , + // which has its own cl_device_id that was introduced in 10.10. That + // triggers erroneous availability warnings. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" +#define DISABLED_WUNGUARDED_AVAILABILITY +#endif // SDK >= 10.10 && DT < 10.10 // Use CL_DEVICE_TYPE_CPU to ensure that the kernel would execute on the // CPU. This is the only device type that a cl_kernels image will be created // for. cl_device_id device_id; +#if defined(DISABLED_WUNGUARDED_AVAILABILITY) +#pragma clang diagnostic pop +#undef DISABLED_WUNGUARDED_AVAILABILITY +#endif // DISABLED_WUNGUARDED_AVAILABILITY rv = clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_CPU, 1, &device_id, nullptr); ASSERT_EQ(rv, CL_SUCCESS) << "clGetDeviceIDs"; diff --git a/snapshot/win/cpu_context_win_test.cc b/snapshot/win/cpu_context_win_test.cc index 41adde3..aa2afe9 100644 --- a/snapshot/win/cpu_context_win_test.cc +++ b/snapshot/win/cpu_context_win_test.cc @@ -80,9 +80,9 @@ void TestInitializeX86Context_FsaveWithoutFxsave() { EXPECT_EQ(cpu_context_x86.fxsave.fsw, 0x0004); EXPECT_EQ(cpu_context_x86.fxsave.ftw, 0x00f0); EXPECT_EQ(cpu_context_x86.fxsave.fop, 0x0bad); - EXPECT_EQ(cpu_context_x86.fxsave.fpu_ip, 0x01234567); + EXPECT_EQ(cpu_context_x86.fxsave.fpu_ip, 0x01234567u); EXPECT_EQ(cpu_context_x86.fxsave.fpu_cs, 0x0003); - EXPECT_EQ(cpu_context_x86.fxsave.fpu_dp, 0x89abcdef); + EXPECT_EQ(cpu_context_x86.fxsave.fpu_dp, 0x89abcdefu); EXPECT_EQ(cpu_context_x86.fxsave.fpu_ds, 0x0007); for (size_t st_mm = 0; st_mm < 7; ++st_mm) { EXPECT_EQ( diff --git a/snapshot/win/crashpad_snapshot_test_image_reader.cc b/snapshot/win/crashpad_snapshot_test_image_reader.cc index 6f4203d..4ebd98e 100644 --- a/snapshot/win/crashpad_snapshot_test_image_reader.cc +++ b/snapshot/win/crashpad_snapshot_test_image_reader.cc @@ -28,7 +28,7 @@ DWORD WINAPI LotsOfReferencesThreadProc(void* param) { // Allocate a bunch of pointers to things on the stack. int* pointers[1000]; - for (int i = 0; i < arraysize(pointers); ++i) { + for (size_t i = 0; i < arraysize(pointers); ++i) { pointers[i] = new int[2048]; } @@ -52,7 +52,7 @@ int wmain(int argc, wchar_t* argv[]) { // verify the cap on pointed-to memory. crashpad::Semaphore semaphore(0); crashpad::ScopedKernelHANDLE threads[100]; - for (int i = 0; i < arraysize(threads); ++i) { + for (size_t i = 0; i < arraysize(threads); ++i) { threads[i].reset(CreateThread(nullptr, 0, &LotsOfReferencesThreadProc, @@ -65,7 +65,7 @@ int wmain(int argc, wchar_t* argv[]) { } } - for (int i = 0; i < arraysize(threads); ++i) { + for (size_t i = 0; i < arraysize(threads); ++i) { semaphore.Wait(); } diff --git a/snapshot/win/exception_snapshot_win_test.cc b/snapshot/win/exception_snapshot_win_test.cc index a782ae6..6ed0739 100644 --- a/snapshot/win/exception_snapshot_win_test.cc +++ b/snapshot/win/exception_snapshot_win_test.cc @@ -203,7 +203,7 @@ class SimulateDelegate : public ExceptionHandlerServer::Delegate { exception_information_address, debug_critical_section_address); EXPECT_TRUE(snapshot.Exception()); - EXPECT_EQ(snapshot.Exception()->Exception(), 0x517a7ed); + EXPECT_EQ(snapshot.Exception()->Exception(), 0x517a7edu); // Verify the dump was captured at the expected location with some slop // space. @@ -271,7 +271,7 @@ void TestDumpWithoutCrashingChild(const base::FilePath& directory) { EXPECT_EQ(WaitForSingleObject(completed.get(), INFINITE), WAIT_OBJECT_0) << ErrorMessage("WaitForSingleObject"); - EXPECT_EQ(child.WaitForExit(), 0); + EXPECT_EQ(child.WaitForExit(), 0u); } TEST(SimulateCrash, ChildDumpWithoutCrashing) { diff --git a/snapshot/win/pe_image_reader_test.cc b/snapshot/win/pe_image_reader_test.cc index bf53279..145e867 100644 --- a/snapshot/win/pe_image_reader_test.cc +++ b/snapshot/win/pe_image_reader_test.cc @@ -73,13 +73,14 @@ void TestVSFixedFileInfo(ProcessReaderWin* process_reader, ASSERT_TRUE(observed_rv || !known_dll); if (observed_rv) { - EXPECT_EQ(observed.dwSignature, VS_FFI_SIGNATURE); - EXPECT_EQ(observed.dwStrucVersion, VS_FFI_STRUCVERSION); - EXPECT_EQ(observed.dwFileFlags & ~observed.dwFileFlagsMask, 0); - EXPECT_EQ(observed.dwFileOS, VOS_NT_WINDOWS32); + EXPECT_EQ(observed.dwSignature, static_cast(VS_FFI_SIGNATURE)); + EXPECT_EQ(observed.dwStrucVersion, static_cast(VS_FFI_STRUCVERSION)); + EXPECT_EQ(observed.dwFileFlags & ~observed.dwFileFlagsMask, 0u); if (known_dll) { - EXPECT_EQ(observed.dwFileType, VFT_DLL); + EXPECT_EQ(observed.dwFileOS, static_cast(VOS_NT_WINDOWS32)); + EXPECT_EQ(observed.dwFileType, static_cast(VFT_DLL)); } else { + EXPECT_NE(observed.dwFileOS & VOS_NT_WINDOWS32, 0u); EXPECT_TRUE(observed.dwFileType == VFT_APP || observed.dwFileType == VFT_DLL); } diff --git a/snapshot/win/process_reader_win_test.cc b/snapshot/win/process_reader_win_test.cc index 9e62e11..d0d4d96 100644 --- a/snapshot/win/process_reader_win_test.cc +++ b/snapshot/win/process_reader_win_test.cc @@ -107,12 +107,12 @@ TEST(ProcessReaderWin, SelfOneThread) { EXPECT_EQ(threads[0].id, GetCurrentThreadId()); #if defined(ARCH_CPU_64_BITS) - EXPECT_NE(threads[0].context.native.Rip, 0); + EXPECT_NE(threads[0].context.native.Rip, 0u); #else EXPECT_NE(threads[0].context.native.Eip, 0u); #endif - EXPECT_EQ(threads[0].suspend_count, 0); + EXPECT_EQ(threads[0].suspend_count, 0u); } class ProcessReaderChildThreadSuspendCount final : public WinMultiprocess { @@ -188,7 +188,7 @@ class ProcessReaderChildThreadSuspendCount final : public WinMultiprocess { // the pipe. CheckedReadFileAtEOF(ReadPipeHandle()); - for (int i = 0; i < arraysize(threads); ++i) + for (size_t i = 0; i < arraysize(threads); ++i) done.Signal(); for (auto& thread : threads) thread.Join(); diff --git a/snapshot/win/process_snapshot_win_test.cc b/snapshot/win/process_snapshot_win_test.cc index 839ba48..11291a0 100644 --- a/snapshot/win/process_snapshot_win_test.cc +++ b/snapshot/win/process_snapshot_win_test.cc @@ -109,7 +109,7 @@ void TestImageReaderChild(const base::FilePath& directory) { // Tell the child it can terminate. EXPECT_TRUE(SetEvent(done.get())) << ErrorMessage("SetEvent"); - EXPECT_EQ(child.WaitForExit(), 0); + EXPECT_EQ(child.WaitForExit(), 0u); } TEST(ProcessSnapshotTest, CrashpadInfoChild) {