commit | 014389b5a26ad277e1eea5953c57cf2623a9a1ca | [log] [tgz] |
---|---|---|
author | Scott Graham <scottmg@google.com> | Mon Feb 11 11:23:15 2019 -0800 |
committer | CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org> | Mon Feb 11 22:31:34 2019 +0000 |
tree | 3be6b53adc7dd46ac8e813263e68e07aa27798a3 | |
parent | de1113b1a375c181d35082fb8797b04668b06d94 [diff] |
[gn][fidl] Fix sign and shortening warnings in visitor_unittests The upcoming zircon gn build is less lenient and reports: ../system/utest/fidl-compiler/visitor_unittests.cpp:70:32: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare] int expected_end = (i + 10 < strlen(expected)) ? i + 10 : strlen(expected) - 1; ~~~~~~ ^ ~~~~~~~~~~~~~~~~ ../system/utest/fidl-compiler/visitor_unittests.cpp:70:80: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int expected_end = (i + 10 < strlen(expected)) ? i + 10 : strlen(expected) - 1; ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~^~~ ../system/utest/fidl-compiler/visitor_unittests.cpp:71:30: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare] int actual_end = (i + 10 < strlen(actual)) ? i + 10 : strlen(actual) - 1; ~~~~~~ ^ ~~~~~~~~~~~~~~ ../system/utest/fidl-compiler/visitor_unittests.cpp:71:74: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int actual_end = (i + 10 < strlen(actual)) ? i + 10 : strlen(actual) - 1; ~~~~~~~~~~ ~~~~~~~~~~~~~~~^~~ ../system/utest/fidl-compiler/visitor_unittests.cpp:95:72: warning: implicit conversion loses integer precision: 'std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> >::size_type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] std::string d = targeted_diff(expected.c_str(), actual, output.size()); ~~~~~~~~~~~~~ ~~~~~~~^~~~~~ As far as I could tell, I don't think any of these intend to be negative, and now it's (somewhat) more clear that negative values will not be passed to the string() constructor. ZX-3415 #comment [gn][fidl] Fix sign and shortening warnings in visitor_unittests Test: CQ Change-Id: I83d71e95394ba1b6874a43c62c00e57f0d33e8de
Pink + Purple == Fuchsia (a new operating system)
Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.
Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.
See Getting Started.
See the documentation.