All of lore.kernel.org
 help / color / mirror / Atom feed
* bluez 4.97: build failure when used in C++ apps
@ 2012-01-16  8:25 Patrick Ohly
  2012-01-16  8:48 ` Deng, Ying An
  2012-01-16  9:24 ` Marcel Holtmann
  0 siblings, 2 replies; 18+ messages in thread
From: Patrick Ohly @ 2012-01-16  8:25 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Milan Crha, ying.an.deng, ulf.hofemeier, ning.w.wang

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

Hello!

Bluez 4.97 has entered some distros recently (Fedora Core, MeeGo 1.2
update), which broke compilation of the C++ code in SyncEvolution
using /usr/lib/bluetooth.h.

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.

Attached is a proposed solution. Note that I have only verified that it
now compiles in C and C++, I have not actually tested the resulting
Bluez, because compilation fails for me on Debian Testing for another
reason (libcheck.a linked into shared object, doesn't work because not
relocatable).

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.


[-- Attachment #2: bluez-4.97-cplusplus.patch --]
[-- Type: text/x-patch, Size: 819 bytes --]

*** bluez-4.97/lib/bluetooth.h.orig	2012-01-16 09:06:07.171931288 +0100
--- bluez-4.97/lib/bluetooth.h	2012-01-16 09:07:02.523930152 +0100
***************
*** 113,119 ****
  ({						\
  	struct __attribute__((packed)) {	\
  		typeof(*(ptr)) __v;		\
! 	} *__p = (void *) (ptr);		\
  	__p->__v;				\
  })
  
--- 113,119 ----
  ({						\
  	struct __attribute__((packed)) {	\
  		typeof(*(ptr)) __v;		\
! 	} *__p = (typeof(__p)) (ptr);		\
  	__p->__v;				\
  })
  
***************
*** 121,127 ****
  do {						\
  	struct __attribute__((packed)) {	\
  		typeof(*(ptr)) __v;		\
! 	} *__p = (void *) (ptr);		\
  	__p->__v = (val);			\
  } while(0)
  
--- 121,127 ----
  do {						\
  	struct __attribute__((packed)) {	\
  		typeof(*(ptr)) __v;		\
! 	} *__p = (typeof(__p)) (ptr);		\
  	__p->__v = (val);			\
  } while(0)
  

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-02-06  9:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-16  8:25 bluez 4.97: build failure when used in C++ apps Patrick Ohly
2012-01-16  8:48 ` Deng, Ying An
2012-01-16  9:24 ` Marcel Holtmann
2012-01-16 10:09   ` Patrick Ohly
2012-02-05 10:56     ` Patrick Ohly
2012-02-05 10:57       ` [PATCH] bluetooth.h: fix compile issue in C++ with ifdef Patrick Ohly
2012-02-05 11:07         ` Rohan Garg
2012-02-05 11:33           ` Patrick Ohly
2012-02-05 11:33             ` Rohan Garg
2012-02-05 12:23               ` Rohan Garg
2012-02-05 12:28                 ` Rohan Garg
2012-02-05 10:59       ` bluez 4.97: build failure when used in C++ apps Rohan Garg
2012-02-05 12:02         ` Rohan Garg
2012-02-06  8:46         ` Milan Crha
2012-02-06  9:29           ` Patrick Ohly
2012-02-06  9:51             ` Milan Crha
2012-02-05 14:29       ` Tino Keitel
2012-02-05 14:50         ` Rohan Garg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.