[sw, dif] add C/C++ guard to dif_warn_unused_result.h
This header is used included by other polyglot headers, and must
also be a polyglot header, as per
https://docs.opentitan.org/doc/rm/c_cpp_coding_style/, "Polyglot
headers":
"Moreover, all non-system #includes in a polyglot header must also be
of other polyglot headers. (In other words, all C system headers may
be assumed to be polyglot, even if they lack guards.)"
In practice this header is not likely to cause any issues, however, it
easier to add the guard than treat it as an exception.
Signed-off-by: Silvestrs Timofejevs <silvestrst@lowrisc.org>
diff --git a/sw/device/lib/dif/dif_warn_unused_result.h b/sw/device/lib/dif/dif_warn_unused_result.h
index 987db6e..315f243 100644
--- a/sw/device/lib/dif/dif_warn_unused_result.h
+++ b/sw/device/lib/dif/dif_warn_unused_result.h
@@ -10,6 +10,11 @@
* @brief Unused Result Warning Macro for DIFs.
*/
+// Header Extern Guard (so header can be used from C and C++)
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
/**
* Attribute for functions which return errors that must be acknowledged.
*
@@ -19,4 +24,8 @@
*/
#define DIF_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
#endif // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_