Re: [PATCH BlueZ] lib: Change bluetooth.h to compile using strict C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gabriel,

> 
> Signed-off-by: Gabriel Souza Franco <gabrielfrancosouza@xxxxxxxxx>

no signed-off-by for userspace patches please.

> ---
> 
> 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(-)

Split this into two patches. lib/ and src/shared/ should always be patched independently.

> 
> diff --git a/lib/bluetooth.h b/lib/bluetooth.h
> index 61c1f9a..f214d81 100644
> --- a/lib/bluetooth.h
> +++ b/lib/bluetooth.h
> @@ -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)
> 
> diff --git a/src/shared/util.h b/src/shared/util.h
> index 04c600f..8437662 100644
> --- a/src/shared/util.h
> +++ b/src/shared/util.h
> @@ -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)

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux