Change #ifdef to #if after move to meson
Unlike with autotools, meson options negative-errno-on-fail and
update-functional-on-fail are written to the generated config.h file
regardless of if they are enabled are not, such as
#define NEGATIVE_ERRNO_ON_FAIL 1
and
#define NEGATIVE_ERRNO_ON_FAIL 0
That means the code that checks the values needs to be an #if and not an
The bitbake recipe has now switched over to building with meson, so
right now openbmc master may not be building with the correct options
depending on how these are set in the various bbappends.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I9db63c3b66c1e02175528b224cc9f0d997d31272
diff --git a/sensor.cpp b/sensor.cpp
index 09aeca6..43af2f6 100644
--- a/sensor.cpp
+++ b/sensor.cpp
@@ -96,7 +96,7 @@
// Because read doesn't have an out pointer to store errors.
// let's assume negative values are errors if they have this
// set.
-#ifdef NEGATIVE_ERRNO_ON_FAIL
+#if NEGATIVE_ERRNO_ON_FAIL
if (value < 0)
{
return value;
@@ -137,7 +137,7 @@
// Only read the input value if the status is functional
if (statusIface->functional())
{
-#ifdef UPDATE_FUNCTIONAL_ON_FAIL
+#if UPDATE_FUNCTIONAL_ON_FAIL
try
#endif
{
@@ -151,7 +151,7 @@
hwmon::entry::cinput, std::get<size_t>(retryIO),
std::get<std::chrono::milliseconds>(retryIO));
}
-#ifdef UPDATE_FUNCTIONAL_ON_FAIL
+#if UPDATE_FUNCTIONAL_ON_FAIL
catch (const std::system_error& e)
{
// Catch the exception here and update the functional property.