enable building with clang
Clang is more pedantic about systemd's use of C99 extensions when
high warning levels are enabled. Disable the "-Wc99-extensions"
when using the SD_BUS_ERROR_NULL macro from systemd. This enables
sdbusplus to compile with clang.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I5433244ad33e5803d0291de11056a7feee57d55c
diff --git a/include/sdbusplus/bus.hpp b/include/sdbusplus/bus.hpp
index a0b0b11..2ffaa82 100644
--- a/include/sdbusplus/bus.hpp
+++ b/include/sdbusplus/bus.hpp
@@ -14,6 +14,11 @@
#include <string>
#include <vector>
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wc99-extensions"
+#endif
+
namespace sdbusplus
{
@@ -597,3 +602,7 @@
}
} // namespace sdbusplus
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
diff --git a/include/sdbusplus/message.hpp b/include/sdbusplus/message.hpp
index 77a54c3..055a639 100644
--- a/include/sdbusplus/message.hpp
+++ b/include/sdbusplus/message.hpp
@@ -15,6 +15,11 @@
#include <type_traits>
#include <utility>
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wc99-extensions"
+#endif
+
namespace sdbusplus
{
@@ -491,3 +496,7 @@
} // namespace message
} // namespace sdbusplus
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
diff --git a/src/exception.cpp b/src/exception.cpp
index 17a988d..b58bd01 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -3,6 +3,11 @@
#include <stdexcept>
#include <utility>
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wc99-extensions"
+#endif
+
namespace sdbusplus
{
namespace exception
@@ -143,3 +148,7 @@
} // namespace exception
} // namespace sdbusplus
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif