From c19e7f1fba01ab4f9a604dec3d6be14fd9fcb02a Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 10 Mar 2016 16:58:52 -0500 Subject: [PATCH] templates: add __extension__ before statement expressions This removes the warnings printed by GCC with -pedantic, since statement expressions are a GCC extension. Signed-off-by: Philippe Proulx --- barectf/templates.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/barectf/templates.py b/barectf/templates.py index 8ba08c1..3efb080 100644 --- a/barectf/templates.py +++ b/barectf/templates.py @@ -404,7 +404,7 @@ _BITFIELD = '''#ifndef _$PREFIX$BITFIELD_H /* We can't shift a int from 32 bit, >> 32 and << 32 on int is undefined */ #define _$prefix$bt_piecewise_rshift(_v, _shift) \\ -({ \\ +__extension__ ({ \\ __typeof__(_v) ___v = (_v); \\ __typeof__(_shift) ___shift = (_shift); \\ unsigned long sb = (___shift) / (sizeof(___v) * CHAR_BIT - 1); \\ @@ -416,7 +416,7 @@ _BITFIELD = '''#ifndef _$PREFIX$BITFIELD_H }) #define _$prefix$bt_piecewise_lshift(_v, _shift) \\ -({ \\ +__extension__ ({ \\ __typeof__(_v) ___v = (_v); \\ __typeof__(_shift) ___shift = (_shift); \\ unsigned long sb = (___shift) / (sizeof(___v) * CHAR_BIT - 1); \\ @@ -430,7 +430,7 @@ _BITFIELD = '''#ifndef _$PREFIX$BITFIELD_H #define _$prefix$bt_is_signed_type(type) ((type) -1 < (type) 0) #define _$prefix$bt_unsigned_cast(type, v) \\ -({ \\ +__extension__ ({ \\ (sizeof(v) < sizeof(type)) ? \\ ((type) (v)) & (~(~(type) 0 << (sizeof(v) * CHAR_BIT))) : \\ (type) (v); \\ -- 2.34.1