From 3c504bb913b3e9bb1a5bbeb0f9936c03f6f7e2ac Mon Sep 17 00:00:00 2001
From: patrick96
Date: Tue, 30 Oct 2018 20:27:44 +0100
Subject: [PATCH] fix(build): remove side-effects of iwlib.h
wireless_tools 29 redefines inline in iwlib.h as:
#define inline inline __attribute__((always_inline))
which conflicts with POLYBAR_NS, which is defined as:
#define POLYBAR_NS \
namespace polybar { \
inline namespace APP_VERSION_NAMESPACE {
In version 30.pre9 this #define is moved into a source file and thus
cannot conflict.
The error only occurs when building with clang, so it seems gcc and
clang handle this differently
Fixes #1492
---
include/adapters/net.hpp | 25 +++++++++++++++----------
src/adapters/net.cpp | 4 ----
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/include/adapters/net.hpp b/include/adapters/net.hpp
index f9089df4..c22e3fcc 100644
--- a/include/adapters/net.hpp
+++ b/include/adapters/net.hpp
@@ -6,16 +6,6 @@
#include
#include
-#ifdef inline
-#undef inline
-#endif
-
-#include "common.hpp"
-#include "settings.hpp"
-#include "errors.hpp"
-#include "components/logger.hpp"
-#include "utils/math.hpp"
-
#if WITH_LIBNL
#include
@@ -23,7 +13,22 @@ struct nl_msg;
struct nlattr;
#else
#include
+
+/*
+ * wirless_tools 29 (and possibly earlier) redefines 'inline' in iwlib.h
+ * With clang this leads to a conflict in the POLYBAR_NS macro
+ * wirless_tools 30 doesn't have that issue anymore
+ */
+#ifdef inline
+#undef inline
#endif
+#endif
+
+#include "common.hpp"
+#include "settings.hpp"
+#include "errors.hpp"
+#include "components/logger.hpp"
+#include "utils/math.hpp"
POLYBAR_NS
diff --git a/src/adapters/net.cpp b/src/adapters/net.cpp
index 7168d01a..03bb5004 100644
--- a/src/adapters/net.cpp
+++ b/src/adapters/net.cpp
@@ -12,10 +12,6 @@
#include
#include
-#ifdef inline
-#undef inline
-#endif
-
#include "common.hpp"
#include "settings.hpp"
#include "utils/command.hpp"