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/hwmonio.cpp b/hwmonio.cpp
index 82d1a9d..8f0acf2 100644
--- a/hwmonio.cpp
+++ b/hwmonio.cpp
@@ -150,7 +150,7 @@
!retries)
{
// Not a retryable error or out of retries.
-#ifdef NEGATIVE_ERRNO_ON_FAIL
+#if NEGATIVE_ERRNO_ON_FAIL
return -rc;
#endif
diff --git a/mainloop.cpp b/mainloop.cpp
index ecceee5..40c429a 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -527,7 +527,7 @@
}
catch (const std::system_error& e)
{
-#ifdef UPDATE_FUNCTIONAL_ON_FAIL
+#if UPDATE_FUNCTIONAL_ON_FAIL
// If UPDATE_FUNCTIONAL_ON_FAIL is defined and an exception was
// thrown, set the functional property to false.
// We cannot set this with the 'continue' in the lower block
@@ -553,7 +553,7 @@
}
continue;
}
-#ifdef UPDATE_FUNCTIONAL_ON_FAIL
+#if UPDATE_FUNCTIONAL_ON_FAIL
// Do not exit with failure if UPDATE_FUNCTIONAL_ON_FAIL is set
continue;
#endif
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.