diff options
author | Yi Kong <yikong@google.com> | 2022-03-16 10:44:11 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-03-16 10:44:11 +0000 |
commit | 96d0f70010b19f01ff4ea97caeb6ea78b0598235 (patch) | |
tree | 9b0a5ae6c2854f420650d70c9bd0d87e9eec9907 | |
parent | f63120aa1a3bdbddf82d71488eb2c5c8c237b656 (diff) | |
parent | be991da7a6c917bb635635d9553b9a81067dde3f (diff) | |
download | hidl-96d0f70010b19f01ff4ea97caeb6ea78b0598235.tar.gz |
Merge "Suppress int-in-bool-context warning" am: 261070e0cf am: be991da7a6
Original change: https://android-review.googlesource.com/c/platform/system/tools/hidl/+/2001260
Change-Id: I4cc2257584d60116ba81e940a68ef5d37e6edef1
-rw-r--r-- | ConstantExpression.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ConstantExpression.cpp b/ConstantExpression.cpp index 02fbf760..6930c0f4 100644 --- a/ConstantExpression.cpp +++ b/ConstantExpression.cpp @@ -137,6 +137,11 @@ T handleBinaryCommon(T lval, const std::string& op, T rval) { return static_cast<T>(0xdeadbeef); } +// The compiler doesn't know T is at least KIND_INT32, and will instantiate bool +// version of this function, and will warn about converting the result of '<<' +// to a boolean. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wint-in-bool-context" template <class T> T handleShift(T lval, const std::string& op, int64_t rval) { // just cast rval to int64_t and it should fit. @@ -147,6 +152,7 @@ T handleShift(T lval, const std::string& op, int64_t rval) { << lval << " " << op << " " << rval; return static_cast<T>(0xdeadbeef); } +#pragma GCC diagnostic pop bool handleLogical(bool lval, const std::string& op, bool rval) { COMPUTE_BINARY(||); |