g++ emits warnings that it can't recognize the clang-specific diagnostic
pragmas. They are replaced by the internal compiler-specific macros so
that nothing is emitted when g++ is used.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I543987a861d2322aa2ef3b7d631f280d2ac999bf
#define DIAGNOSTIC_IGNORE_LOGICAL_OP
#define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES
#define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
+#define DIAGNOSTIC_IGNORE_INJECTED_CLASS_NAME \
+ _Pragma("GCC diagnostic ignored \"-Winjected-class-name\"")
_Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")
#else
/* GCC */
#define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES
#endif /* __GNUG__ && __GNUC__ >= 7 */
#define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")
+
+#define DIAGNOSTIC_IGNORE_INJECTED_CLASS_NAME
#endif
/* Used to make specific C++ functions to C code. */
#ifndef LTTNG_REFERENCE_H
#define LTTNG_REFERENCE_H
+#include <common/macros.hpp>
+
#include <algorithm>
#include <utility>
return;
}
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Winjected-class-name"
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_IGNORE_INJECTED_CLASS_NAME
static_assert(std::is_class<typename CustomDeleter::deleter>::value,
"CustomDeleter must define a 'deleter' callable class.");
const typename CustomDeleter::deleter del;
-#pragma clang diagnostic pop
+ DIAGNOSTIC_POP
del(_value);
release();