From: Marcel Holtmann <marcel@holtmann.org>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: linux-bluetooth@vger.kernel.org, kanak.gupta@stericsson.com
Subject: Re: [PATCH] Fix compilation of C++ programs that include <bluetooth/bluetooth.h>
Date: Fri, 13 Jan 2012 09:21:13 +0100 [thread overview]
Message-ID: <1326442873.6454.258.camel@aeonflux> (raw)
In-Reply-To: <1326442733-11966-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
> C++ doesn't allow for implicit conversion from void*.
>
> /usr/include/bluetooth/bluetooth.h: In function ‘uint64_t bt_get_le64(void*)’:
> /usr/include/bluetooth/bluetooth.h:131: error: invalid conversion from ‘void*’ to ‘bt_get_le64(void*)::<anonymous struct>*’
> /usr/include/bluetooth/bluetooth.h: In function ‘uint64_t bt_get_be64(void*)’:
> /usr/include/bluetooth/bluetooth.h:136: error: invalid conversion from ‘void*’ to ‘bt_get_be64(void*)::<anonymous struct>*’
> /usr/include/bluetooth/bluetooth.h: In function ‘uint32_t bt_get_le32(void*)’:
> /usr/include/bluetooth/bluetooth.h:141: error: invalid conversion from ‘void*’ to ‘bt_get_le32(void*)::<anonymous struct>*’
> /usr/include/bluetooth/bluetooth.h: In function ‘uint32_t bt_get_be32(void*)’:
> /usr/include/bluetooth/bluetooth.h:146: error: invalid conversion from ‘void*’ to ‘bt_get_be32(void*)::<anonymous struct>*’
> /usr/include/bluetooth/bluetooth.h: In function ‘uint16_t bt_get_le16(void*)’:
> /usr/include/bluetooth/bluetooth.h:151: error: invalid conversion from ‘void*’ to ‘bt_get_le16(void*)::<anonymous struct>*’
> /usr/include/bluetooth/bluetooth.h: In function ‘uint16_t bt_get_be16(void*)’:
> /usr/include/bluetooth/bluetooth.h:156: error: invalid conversion from ‘void*’ to ‘bt_get_be16(void*)::<anonymous struct>*’
> ---
> lib/bluetooth.h | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lib/bluetooth.h b/lib/bluetooth.h
> index 5bd4f03..b4891ef 100644
> --- a/lib/bluetooth.h
> +++ b/lib/bluetooth.h
> @@ -111,17 +111,19 @@ enum {
> /* Bluetooth unaligned access */
> #define bt_get_unaligned(ptr) \
> ({ \
> - struct __attribute__((packed)) { \
> + struct __s { \
> typeof(*(ptr)) __v; \
> - } *__p = (void *) (ptr); \
> + } __attribute__((packed)) ; \
> + struct __s *__p = (struct __s *) (ptr); \
> __p->__v; \
> })
>
> #define bt_put_unaligned(val, ptr) \
> do { \
> - struct __attribute__((packed)) { \
> + struct __s { \
> typeof(*(ptr)) __v; \
> - } *__p = (void *) (ptr); \
> + }__attribute__((packed)) ; \
> + struct __s *__p = (struct __s *) (ptr); \
> __p->__v = (val); \
> } while(0)
>
you are messing with powers beyond your control here. I am not touching
this unless a GCC expert guarantees me that it equivalent.
Regards
Marcel
prev parent reply other threads:[~2012-01-13 8:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 8:18 [PATCH] Fix compilation of C++ programs that include <bluetooth/bluetooth.h> Szymon Janc
2012-01-13 8:21 ` Marcel Holtmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326442873.6454.258.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=kanak.gupta@stericsson.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=szymon.janc@tieto.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).