Bug 1369837: Add a void cast to silence clang Wcomma build warning, in sandbox's snapshot of chromium header. r=bobowen
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 02 Jun 2017 12:45:01 -0700
changeset 412595 85f41e26f8b6e85b0d5ded8c182c5a6667968985
parent 412594 d9b7971a270cde0cff0adbe068707fd6f92f5028
child 412596 95432b49cac4e582c9d84907ea1c3bfd1fd2ff52
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen
bugs1369837, 729123
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1369837: Add a void cast to silence clang Wcomma build warning, in sandbox's snapshot of chromium header. r=bobowen The build warning is for "possible misuse of comma operator". The comma operator is a bit of a footgun becasue its first operand's result just gets dropped on the floor (in this case, the result of the DCHECK expression). It appears that Chromium's use of the comma operator here is intentional, though -- so we might as well accept clang's suggestion and "cast expression to void to silence warning". This is also filed upstream as: https://bugs.chromium.org/p/chromium/issues/detail?id=729123 MozReview-Commit-ID: Al2xsYEo3p0
security/sandbox/chromium/base/time/time.h
--- a/security/sandbox/chromium/base/time/time.h
+++ b/security/sandbox/chromium/base/time/time.h
@@ -682,17 +682,17 @@ constexpr TimeDelta TimeDelta::FromDoubl
 // static
 constexpr TimeDelta TimeDelta::FromProduct(int64_t value,
                                            int64_t positive_value) {
   return (
 #if !defined(_PREFAST_) || !defined(OS_WIN)
           // Avoid internal compiler errors in /analyze builds with VS 2015
           // update 3.
           // https://connect.microsoft.com/VisualStudio/feedback/details/2870865
-          DCHECK(positive_value > 0),
+          static_cast<void>(DCHECK(positive_value > 0)),
 #endif
           value > std::numeric_limits<int64_t>::max() / positive_value
               ? Max()
               : value < -std::numeric_limits<int64_t>::max() / positive_value
                     ? -Max()
                     : TimeDelta(value * positive_value));
 }