diff options
author | Yi Kong <yikong@google.com> | 2022-03-16 09:54:12 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-03-16 09:54:12 +0000 |
commit | 261070e0cfc3581d7c7bb6f72ff9ff0bb6753cce (patch) | |
tree | 9b0a5ae6c2854f420650d70c9bd0d87e9eec9907 | |
parent | 35a41c628dc0430e65ef62932921270c298adb89 (diff) | |
parent | d5f12084981794159a927fe38362d165cfc77c1a (diff) | |
download | hidl-261070e0cfc3581d7c7bb6f72ff9ff0bb6753cce.tar.gz |
Merge "Suppress int-in-bool-context warning"
-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(||); |