lib: Change bluetooth.h to compile using strict C
Subsystems (2)
PATCH 1/1 lib: Change bluetooth.h to compile using strict C
---
This change enables programs writen with strict C syntax (e.g. "-std=c11 -pedantic") to compile when including bluetooth.h. Also changed src/shared/util.h to match.
lib/bluetooth.h | 10 +++++----- src/shared/util.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-)
lib/bluetooth.h +5 -5
@@ -156,18 +156,18 @@ enum {/* Bluetooth unaligned access */ #define bt_get_unaligned (ptr) \ -({ \ +__extension__ ({ \ 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)
src/shared/util.h +5 -5
@@ -57,18 +57,18 @@#endif #define get_unaligned (ptr) \ -({ \ +__extension__ ({ \ struct __attribute__((packed)) { \ - typeof(*(ptr)) __v; \ - } *__p = (typeof(__p)) (ptr); \ + __typeof__(*(ptr)) __v; \ + } *__p = (__typeof__(__p)) (ptr); \ __p->__v; \ })#define 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)
Signature · 1 line
2.1.2
Marcel Holtmann
maintainerHi Gabriel,
Quoted 2 lines
Signed-off-by Gabriel Souza Franco <[email protected]>
no signed-off-by for userspace patches please.
Quoted 9 lines
---
This change enables programs writen with strict C syntax (e.g. "-std=c11 -pedantic") to compile when including
bluetooth.h. Also changedsrc/shared/util.hto match.
lib/bluetooth.h| 10 +++++-----src/shared/util.h| 10 +++++-----2 files changed, 10 insertions(+), 10 deletions(-)
Split this into two patches. lib/ and src/shared/ should always be patched independently.
Quoted 46 lines
lib/bluetooth.h +5
-5@@ -156,18 +156,18 @@ enum {/* Bluetooth unaligned access */ #define bt_get_unaligned (ptr) \ -({ \ +__extension__ ({ \ 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)src/shared/util.h +3
-3@@ -57,18 +57,18 @@#endif #define get_unaligned (ptr) \ -({ \ +__extension__ ({ \ struct __attribute__((packed)) { \ - typeof(*(ptr)) __v; \ - } *__p = (typeof(__p)) (ptr); \ + __typeof__(*(ptr)) __v; \ + } *__p = (__typeof__(__p)) (ptr); \ __p->__v; \ })
src/shared/util.h line 73
Quoted 10 lines
src/shared/util.h +2
-2#define 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)
Regards
Marcel
PATCH v2 1/2 lib: Change bluetooth.h to compile in strict C
---
This change enables programs writen with strict C syntax (e.g. "-std=c11 -pedantic") to compile when including bluetooth.h.
v2: Resend with fixed commits.
lib/bluetooth.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/bluetooth.h +5 -5
@@ -156,18 +156,18 @@ enum {/* Bluetooth unaligned access */ #define bt_get_unaligned (ptr) \ -({ \ +__extension__ ({ \ 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)
Signature · 1 line
2.1.2
PATCH v2 2/2 shared: Change util.h to compile in strict C
--- src/shared/util.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
src/shared/util.h +5 -5
@@ -57,18 +57,18 @@#endif #define get_unaligned (ptr) \ -({ \ +__extension__ ({ \ struct __attribute__((packed)) { \ - typeof(*(ptr)) __v; \ - } *__p = (typeof(__p)) (ptr); \ + __typeof__(*(ptr)) __v; \ + } *__p = (__typeof__(__p)) (ptr); \ __p->__v; \ })#define 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)
Signature · 1 line
2.1.2
Re: [PATCH BlueZ v2 1/2] lib: Change bluetooth.h to compile in strict C
In reply to Gabriel Souza FrancoHi Gabriel,
Quoted 10 lines · Gabriel Souza Franco
---
This change enables programs writen with strict C syntax (e.g. "-std=c11 -pedantic") to compile when including
bluetooth.h.v2: Resend with fixed commits.
lib/bluetooth.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Both of these patches have been applied. Thanks.
Johan