Linux bluetooth development
 help / color / mirror / Atom feed
* 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

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