templates: add __extension__ before statement expressions
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 10 Mar 2016 21:58:52 +0000 (16:58 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 11 Mar 2016 18:41:17 +0000 (13:41 -0500)
This removes the warnings printed by GCC with -pedantic, since
statement expressions are a GCC extension.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/templates.py

index 8ba08c1f42ea8fd634274a3eb8b8d8e873b68af3..3efb080bafe2061293caa53476efae9c334f8e4b 100644 (file)
@@ -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);                                             \\
This page took 0.025369 seconds and 4 git commands to generate.