Only disable -Wconstant-conversion for Clang, not GCC

The warning suppression was recently added in a51e912004a6, and I don’t
know what I was thinking. I went out of my way to make it apply to both
Clang and GCC, but GCC doesn’t recognize this warning at all, nor does
it need any other warning suppressed.

Change-Id: I50341bfe81ee4799b3f6278d2e31ec31741952ac
Reviewed-on: https://chromium-review.googlesource.com/755654
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Mark Mentovai 2017-11-06 18:09:27 -05:00 committed by Commit Bot
parent 18726100ed
commit 34f5e8d513

View File

@ -21,7 +21,6 @@
#include <utility>
#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"
@ -396,16 +395,16 @@ 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"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconstant-conversion"
#define DISABLED_WCONSTANT_CONVERSION
#endif // COMPILER_GCC || __clang__
#endif // __clang__
MSVC_SUPPRESS_WARNING(4309); // Truncation of constant value.
MSVC_SUPPRESS_WARNING(4838); // Narrowing conversion.
constexpr timeval kSnapshotTimeval = {static_cast<time_t>(kSnapshotTime), 0};
#if defined(DISABLED_WCONSTANT_CONVERSION)
#pragma GCC diagnostic pop
#pragma clang diagnostic pop
#undef DISABLED_WCONSTANT_CONVERSION
#endif // DISABLED_WCONSTANT_CONVERSION