summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrucedawson <brucedawson@chromium.org>2015-12-02 17:54:27 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-03 01:55:35 +0000
commitc8e9e0d00bc2ba692ee4e61ae728a50e911513c1 (patch)
treebfbcb8da6e5e414de5577c01a3c263d77ee6578c
parent77c735a0eb3207605a8b5f841574468d7dcb8c81 (diff)
downloadchromium_src-c8e9e0d00bc2ba692ee4e61ae728a50e911513c1.zip
chromium_src-c8e9e0d00bc2ba692ee4e61ae728a50e911513c1.tar.gz
chromium_src-c8e9e0d00bc2ba692ee4e61ae728a50e911513c1.tar.bz2
Misc fixes for gn builds with VS 2015
These changes are enough to get gn_all building with VS 2015 in 32-bit gn builds. The changes are mostly to fix warnings about truncation from size_t to smaller types. One fix is to avoid illegal #defines, already fixed in the GYP builds. Warning 4267 is disabled in the main BUILD.gn file because many of the 4244 warnings that VC++ 2013 emits are now emitted as 4267, so we need to disable 4267 everywhere that 4244 is disabled. Fixing the code is best done as a separate task. The code fixes are to avoid truncations, mostly by using more appropriate types. BUG=440500 Review URL: https://codereview.chromium.org/1488933002 Cr-Commit-Position: refs/heads/master@{#362858}
-rw-r--r--build/config/compiler/BUILD.gn8
-rw-r--r--google_apis/gcm/base/mcs_util_unittest.cc4
-rw-r--r--gpu/command_buffer/client/query_tracker.cc2
-rw-r--r--printing/printing_context_win_unittest.cc8
-rw-r--r--third_party/leveldatabase/BUILD.gn7
-rw-r--r--third_party/libexif/BUILD.gn15
6 files changed, 32 insertions, 12 deletions
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index cce2c5e..b26f033 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -758,6 +758,14 @@ config("default_warnings") {
"/wd4459",
]
+ if (visual_studio_version == "2015") {
+ # VC++ 2015 changes 32-bit size_t truncation warnings from 4244 to 4267.
+ # Example: short TruncTest(size_t x) { return x; }
+ # Since we already disable 4244 we need to disable 4267 during migration.
+ # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+ cflags += [ "/wd4267" ]
+ }
+
# VS xtree header file needs to be patched or 4702 (unreachable code
# warning) is reported if _HAS_EXCEPTIONS=0. Disable the warning if xtree is
# not patched.
diff --git a/google_apis/gcm/base/mcs_util_unittest.cc b/google_apis/gcm/base/mcs_util_unittest.cc
index d51f5a07..34d482d 100644
--- a/google_apis/gcm/base/mcs_util_unittest.cc
+++ b/google_apis/gcm/base/mcs_util_unittest.cc
@@ -31,12 +31,12 @@ TEST(MCSUtilTest, BuildLoginRequest) {
// Test building a protobuf and extracting the tag from a protobuf.
TEST(MCSUtilTest, ProtobufToTag) {
- for (size_t i = 0; i < kNumProtoTypes; ++i) {
+ for (uint8 i = 0; i < kNumProtoTypes; ++i) {
scoped_ptr<google::protobuf::MessageLite> protobuf =
BuildProtobufFromTag(i);
if (!protobuf.get()) // Not all tags have protobuf definitions.
continue;
- ASSERT_EQ((int)i, GetMCSProtoTag(*protobuf)) << "Type " << i;
+ ASSERT_EQ(i, GetMCSProtoTag(*protobuf)) << "Type " << i;
}
}
diff --git a/gpu/command_buffer/client/query_tracker.cc b/gpu/command_buffer/client/query_tracker.cc
index ec678a2..f5363f0 100644
--- a/gpu/command_buffer/client/query_tracker.cc
+++ b/gpu/command_buffer/client/query_tracker.cc
@@ -67,7 +67,7 @@ bool QuerySyncManager::Alloc(QuerySyncManager::QueryInfo* info) {
buckets_.push_back(bucket);
}
- unsigned short index_in_bucket = 0;
+ size_t index_in_bucket = 0;
for (size_t i = 0; i < kSyncsPerBucket; i++) {
if (!bucket->in_use_queries[i]) {
index_in_bucket = i;
diff --git a/printing/printing_context_win_unittest.cc b/printing/printing_context_win_unittest.cc
index aab83f3..6b2b20f 100644
--- a/printing/printing_context_win_unittest.cc
+++ b/printing/printing_context_win_unittest.cc
@@ -118,13 +118,13 @@ class MockPrintingContextWin : public PrintingContextSytemDialogWin {
memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wDriverOffset,
info_2.get()->pDriverName,
driver_size);
- dev_names->wDeviceOffset =
- dev_names->wDriverOffset + driver_size / sizeof(wchar_t);
+ dev_names->wDeviceOffset = base::checked_cast<WORD>(
+ dev_names->wDriverOffset + driver_size / sizeof(wchar_t));
memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wDeviceOffset,
info_2.get()->pPrinterName,
printer_size);
- dev_names->wOutputOffset =
- dev_names->wDeviceOffset + printer_size / sizeof(wchar_t);
+ dev_names->wOutputOffset = base::checked_cast<WORD>(
+ dev_names->wDeviceOffset + printer_size / sizeof(wchar_t));
memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wOutputOffset,
info_2.get()->pPortName,
port_size);
diff --git a/third_party/leveldatabase/BUILD.gn b/third_party/leveldatabase/BUILD.gn
index b3080d8..0057c0e 100644
--- a/third_party/leveldatabase/BUILD.gn
+++ b/third_party/leveldatabase/BUILD.gn
@@ -282,6 +282,13 @@ if (!is_android) {
deps = [
":leveldb_testutil",
]
+
+ if (is_win) {
+ # db\log_test.cc(486) triggers two warnings:
+ # util\testharness.h(91): warning C4018: '<=': signed/unsigned mismatch
+ # util\testharness.h(89): warning C4018: '>=': signed/unsigned mismatch
+ cflags = [ "/wd4018" ] # Signed/unsigned mismatch in comparison.
+ }
}
test("leveldb_skiplist_test") {
diff --git a/third_party/libexif/BUILD.gn b/third_party/libexif/BUILD.gn
index 3f88f1c9..ea9ca90 100644
--- a/third_party/libexif/BUILD.gn
+++ b/third_party/libexif/BUILD.gn
@@ -57,11 +57,16 @@ if (!is_linux || is_chromeos) {
# TODO(GYP): Additional options for non-Windows platforms.
if (is_win) {
- defines = [
- # This seems like a hack, but this is what WebKit Win does.
- "snprintf=_snprintf",
- "inline=__inline",
- ]
+ import("//build/config/win/visual_studio_version.gni")
+
+ if (visual_studio_version == "2013" || visual_studio_version == "2013e") {
+ defines = [
+ # This seems like a hack, but this is what WebKit Win does.
+ # VS 2015 supports these natively so they cannot be #defines.
+ "snprintf=_snprintf",
+ "inline=__inline",
+ ]
+ }
ldflags = [ "/DEF:" + rebase_path("libexif.def") ]