1. -Wmisleading-indentation
/home/abuild/rpmbuild/BUILD/deviced-10.0.0/src/shared/devices.h:137:9:
warning: this 'if' clause does not guard... [-Wmisleading-indentation]
137 | if (!dev) dev = find_device(name); if (check_default(dev)) return -ENODEV; \
| ^~
| ^~~~~~~~~~~~~~~
/home/abuild/rpmbuild/BUILD/deviced-10.0.0/src/shared/devices.h:137:44: note:
...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
137 | if (!dev) dev = find_device(name); if (check_default(dev)) return -ENODEV; \
: Fixed them by breaking line.
2. -Wdangling-else
/home/abuild/rpmbuild/BUILD/deviced-10.0.0/tests/syscommon-plugin-test/display.cc:55:12:
warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
55 | if (ret_val == 0 && display_config)
: The EXPECT_EQ() macro following the above 'if' statement is expanded like below
if (ret_val == 0 && display_config)
switch (0) case 0: default: if (const ::testing::AssertionResult gtest_ar = (::testing::internal::EqHelper::Compare(
"display_config->display_dpms_type"
,
"SYSCOMMON_DEVICED_DPMS_TYPE_NONE"
,
display_config->display_dpms_type
,
SYSCOMMON_DEVICED_DPMS_TYPE_NONE
))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure,
"display.cc", 56, gtest_ar.failure_message()) = ::testing::Message()
;
And there is nested, inner 'if-else' statement at the EXPECT_EQ() and this
generates the warning. Fix it by enclosing the outmost if statement
with braces.
Change-Id: I4fc835e667302154e4ec165e8611dfad616078ea
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
} while (0)
#define FIND_DEVICE_INT(dev, name) do { \
- if (!dev) dev = find_device(name); if (check_default(dev)) return -ENODEV; \
+ if (!dev) \
+ dev = find_device(name); \
+ if (check_default(dev)) \
+ return -ENODEV; \
} while (0)
#define FIND_DEVICE_VOID(dev, name) do { \
- if (!dev) dev = find_device(name); if (check_default(dev)) return; \
+ if (!dev) \
+ dev = find_device(name); \
+ if (check_default(dev)) \
+ return; \
} while (0)
#define GET_DEVICE_STATUS(name, defaults, ret) do { \
}
ret_val = syscommon_plugin_deviced_display_load_config(&display_config);
- if (ret_val == 0 && display_config)
+ if (ret_val == 0 && display_config) {
EXPECT_EQ(display_config->display_dpms_type, SYSCOMMON_DEVICED_DPMS_TYPE_NONE);
+ }
}
\ No newline at end of file