summaryrefslogtreecommitdiff
path: root/extra/bluez/fix-compile-issue.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extra/bluez/fix-compile-issue.patch')
-rw-r--r--extra/bluez/fix-compile-issue.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/extra/bluez/fix-compile-issue.patch b/extra/bluez/fix-compile-issue.patch
new file mode 100644
index 000000000..ddb5d94e8
--- /dev/null
+++ b/extra/bluez/fix-compile-issue.patch
@@ -0,0 +1,50 @@
+From 4002cf271e3939714296c535a1ed8d4f0d5ac005 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Mon, 16 Jan 2012 11:11:55 +0100
+Subject: [PATCH] lib: Fix compile issue when using in C++
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+The compiler error is:
+ /usr/include/bluetooth/bluetooth.h::131:9: error: invalid conversion from 'void*' to 'bt_get_le64(void*)::<anonymous struct>*'
+ ...
+
+The reason is that C++, in contrast to C, does not allow conversion of
+void * to anything, and this code gets compiled as C++ when the app is
+written in C++. The macro with the assignment itself is older, but only
+recent Bluez starts to use it in inline functions, thus triggering the
+problem.
+
+This patch keeps the "struct __attribute__((packed))" magic and merely
+changes the typecast so that it works in C and C++. Like the existing
+macro this patch relies on support for typeof.
+---
+ lib/bluetooth.h | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/bluetooth.h b/lib/bluetooth.h
+index ea7373d..0541842 100644
+--- a/lib/bluetooth.h
++++ b/lib/bluetooth.h
+@@ -141,7 +141,7 @@ enum {
+ ({ \
+ struct __attribute__((packed)) { \
+ typeof(*(ptr)) __v; \
+- } *__p = (void *) (ptr); \
++ } *__p = (typeof(__p)) (ptr); \
+ __p->__v; \
+ })
+
+@@ -149,7 +149,7 @@ enum {
+ do { \
+ struct __attribute__((packed)) { \
+ typeof(*(ptr)) __v; \
+- } *__p = (void *) (ptr); \
++ } *__p = (typeof(__p)) (ptr); \
+ __p->__v = (val); \
+ } while(0)
+
+--
+1.7.6.5
+