update_engine: Specifically cast macro param to "bool"
This CL casts TEST_AND_RETURN*** macro params to bool when appropriate.
Without this, a TEST_AND_RETURN(uniq) will fail, even though if (uniq)
succeeds where "uniq" is a std::unique_ptr (or shared_ptr).
BUG=none
TEST=unittest
Change-Id: Icaaf84630ab8133667583bba962068dbad65e626
Reviewed-on: https://chromium-review.googlesource.com/233006
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
diff --git a/utils.h b/utils.h
index 8a6510c..50e5864 100644
--- a/utils.h
+++ b/utils.h
@@ -567,7 +567,7 @@
#define TEST_AND_RETURN_FALSE_ERRNO(_x) \
do { \
- bool _success = (_x); \
+ bool _success = static_cast<bool>(_x); \
if (!_success) { \
std::string _msg = \
chromeos_update_engine::utils::ErrnoNumberAsString(errno); \
@@ -578,7 +578,7 @@
#define TEST_AND_RETURN_FALSE(_x) \
do { \
- bool _success = (_x); \
+ bool _success = static_cast<bool>(_x); \
if (!_success) { \
LOG(ERROR) << #_x " failed."; \
return false; \
@@ -587,7 +587,7 @@
#define TEST_AND_RETURN_ERRNO(_x) \
do { \
- bool _success = (_x); \
+ bool _success = static_cast<bool>(_x); \
if (!_success) { \
std::string _msg = \
chromeos_update_engine::utils::ErrnoNumberAsString(errno); \
@@ -598,7 +598,7 @@
#define TEST_AND_RETURN(_x) \
do { \
- bool _success = (_x); \
+ bool _success = static_cast<bool>(_x); \
if (!_success) { \
LOG(ERROR) << #_x " failed."; \
return; \