* Compilation using clang
@ 2014-01-10 17:57 Donald Carr
2014-01-10 20:06 ` Vinicius Costa Gomes
0 siblings, 1 reply; 3+ messages in thread
From: Donald Carr @ 2014-01-10 17:57 UTC (permalink / raw)
To: linux-bluetooth
Top of the morning,
qtconnectivity currently contains a kludge which is required due to
the use of the GCC typeof extension in bluetooth.h which is breaking
with Clang compilation against the cxx11 spec.
The kludge in question involves molesting the standard (eg -std=cxx11)
specified to the compiler (explicitly away from cxx11 toward g++0x)
and hence I am hoping to be able to murder its intrusive self. I am
not entirely clear on the nuances though:
This is the offending section:
#define bt_get_unaligned(ptr) \
({ \
struct __attribute__((packed)) { \
typeof(*(ptr)) __v; \
} *__p = (typeof(__p)) (ptr); \
__p->__v; \
})
#define bt_put_unaligned(val, ptr) \
do { \
struct __attribute__((packed)) { \
typeof(*(ptr)) __v; \
} *__p = (typeof(__p)) (ptr); \
__p->__v = (val); \
} while(0)
and changing typeof to __typeof__ has been verified to succeed in the
stated circumstance. I don't know whether this is the ideal solution,
or whether decltype or so other designator would be a closer/better
match.
Any feedback would be greatly appreciated, I am using this change
locally and I think it could be of broader use to people.
Yours sincerely,
Donald Carr
--
-------------------------------
°v° Donald Carr
/(_)\ Vaguely Professional Penguin lover
^ ^
Cave canem, te necet lingendo
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Compilation using clang 2014-01-10 17:57 Compilation using clang Donald Carr @ 2014-01-10 20:06 ` Vinicius Costa Gomes 2014-01-17 21:26 ` Donald Carr 0 siblings, 1 reply; 3+ messages in thread From: Vinicius Costa Gomes @ 2014-01-10 20:06 UTC (permalink / raw) To: Donald Carr; +Cc: linux-bluetooth Hi Donald, On 09:57 Fri 10 Jan, Donald Carr wrote: > Top of the morning, > > qtconnectivity currently contains a kludge which is required due to > the use of the GCC typeof extension in bluetooth.h which is breaking > with Clang compilation against the cxx11 spec. Another kludge that I have seen is putting a "#define typeof(x) __tupeof__(x)" before including bluetooth.h. > > The kludge in question involves molesting the standard (eg -std=cxx11) > specified to the compiler (explicitly away from cxx11 toward g++0x) > and hence I am hoping to be able to murder its intrusive self. I am > not entirely clear on the nuances though: > > This is the offending section: > > #define bt_get_unaligned(ptr) \ > ({ \ > struct __attribute__((packed)) { \ > typeof(*(ptr)) __v; \ > } *__p = (typeof(__p)) (ptr); \ > __p->__v; \ > }) > > #define bt_put_unaligned(val, ptr) \ > do { \ > struct __attribute__((packed)) { \ > typeof(*(ptr)) __v; \ > } *__p = (typeof(__p)) (ptr); \ > __p->__v = (val); \ > } while(0) > > and changing typeof to __typeof__ has been verified to succeed in the > stated circumstance. I don't know whether this is the ideal solution, > or whether decltype or so other designator would be a closer/better > match. I would vote for changing it to __typeof__. > > Any feedback would be greatly appreciated, I am using this change > locally and I think it could be of broader use to people. Please send a patch and let's see what others think. > > Yours sincerely, > Donald Carr > > > -- > ------------------------------- > °v° Donald Carr > /(_)\ Vaguely Professional Penguin lover > ^ ^ > > Cave canem, te necet lingendo > -- > To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Cheers, -- Vinicius ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Compilation using clang 2014-01-10 20:06 ` Vinicius Costa Gomes @ 2014-01-17 21:26 ` Donald Carr 0 siblings, 0 replies; 3+ messages in thread From: Donald Carr @ 2014-01-17 21:26 UTC (permalink / raw) To: Vinicius Costa Gomes; +Cc: linux-bluetooth [-- Attachment #1: Type: text/plain, Size: 2753 bytes --] Hola, Thanks for the rapid response :) I am simply attaching a patch, probably in complete defiance of some standardized announcement/submission pattern. Yours sincerely, Donald On Fri, Jan 10, 2014 at 12:06 PM, Vinicius Costa Gomes <vcgomes@gmail.com> wrote: > Hi Donald, > > On 09:57 Fri 10 Jan, Donald Carr wrote: >> Top of the morning, >> >> qtconnectivity currently contains a kludge which is required due to >> the use of the GCC typeof extension in bluetooth.h which is breaking >> with Clang compilation against the cxx11 spec. > > Another kludge that I have seen is putting a > "#define typeof(x) __tupeof__(x)" before including bluetooth.h. > >> >> The kludge in question involves molesting the standard (eg -std=cxx11) >> specified to the compiler (explicitly away from cxx11 toward g++0x) >> and hence I am hoping to be able to murder its intrusive self. I am >> not entirely clear on the nuances though: >> >> This is the offending section: >> >> #define bt_get_unaligned(ptr) \ >> ({ \ >> struct __attribute__((packed)) { \ >> typeof(*(ptr)) __v; \ >> } *__p = (typeof(__p)) (ptr); \ >> __p->__v; \ >> }) >> >> #define bt_put_unaligned(val, ptr) \ >> do { \ >> struct __attribute__((packed)) { \ >> typeof(*(ptr)) __v; \ >> } *__p = (typeof(__p)) (ptr); \ >> __p->__v = (val); \ >> } while(0) >> >> and changing typeof to __typeof__ has been verified to succeed in the >> stated circumstance. I don't know whether this is the ideal solution, >> or whether decltype or so other designator would be a closer/better >> match. > > I would vote for changing it to __typeof__. > >> >> Any feedback would be greatly appreciated, I am using this change >> locally and I think it could be of broader use to people. > > Please send a patch and let's see what others think. > >> >> Yours sincerely, >> Donald Carr >> >> >> -- >> ------------------------------- >> °v° Donald Carr >> /(_)\ Vaguely Professional Penguin lover >> ^ ^ >> >> Cave canem, te necet lingendo >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > > Cheers, > -- > Vinicius -- ------------------------------- °v° Donald Carr /(_)\ Vaguely Professional Penguin lover ^ ^ Cave canem, te necet lingendo [-- Attachment #2: 0001-Bluez-Move-off-gcc-typeof-extension.patch --] [-- Type: text/x-patch, Size: 1026 bytes --] From 846b84143ee4240258b2aee6aad3cd95565caefb Mon Sep 17 00:00:00 2001 From: Donald Carr <sirspudd@gmail.com> Date: Fri, 17 Jan 2014 13:20:39 -0800 Subject: [PATCH] Bluez: Move off gcc typeof extension Change-Id: I63c70c9b43af6a29aa69ed11a720c45c1085dce9 --- bluetooth/bluetooth.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bluetooth/bluetooth.h b/bluetooth/bluetooth.h index 61c1f9a..bc9b35e 100644 --- a/bluetooth/bluetooth.h +++ b/bluetooth/bluetooth.h @@ -158,16 +158,16 @@ enum { #define bt_get_unaligned(ptr) \ ({ \ struct __attribute__((packed)) { \ - typeof(*(ptr)) __v; \ - } *__p = (typeof(__p)) (ptr); \ + __typeof__(*(ptr)) __v; \ + } *__p = (__typeof__(__p)) (ptr); \ __p->__v; \ }) #define bt_put_unaligned(val, ptr) \ do { \ struct __attribute__((packed)) { \ - typeof(*(ptr)) __v; \ - } *__p = (typeof(__p)) (ptr); \ + __typeof__(*(ptr)) __v; \ + } *__p = (__typeof__(__p)) (ptr); \ __p->__v = (val); \ } while(0) -- 1.8.5.3 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-17 21:26 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-01-10 17:57 Compilation using clang Donald Carr 2014-01-10 20:06 ` Vinicius Costa Gomes 2014-01-17 21:26 ` Donald Carr
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox