]> git.droids-corp.org - dpdk.git/commitdiff
lib: work around braced-groups within expressions
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Thu, 8 Sep 2016 12:25:02 +0000 (14:25 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 13 Sep 2016 13:35:28 +0000 (15:35 +0200)
Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

This commit prevents the following errors:

 error: ISO C forbids braced-groups within expressions

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h
lib/librte_eal/common/include/arch/ppc_64/rte_memcpy.h
lib/librte_eal/common/include/arch/x86/rte_memcpy.h
lib/librte_eal/common/include/arch/x86/rte_vect.h
lib/librte_eal/common/include/rte_common.h

index da6c233a31e663a7787b70f56086fd138a8278aa..c3a26192f33c589bfa59beac51a27f825a009d18 100644 (file)
@@ -148,7 +148,8 @@ rte_mov256(uint8_t *dst, const uint8_t *src)
 }
 
 #define rte_memcpy(dst, src, n)              \
-       ({ (__builtin_constant_p(n)) ?       \
+       __extension__ ({                     \
+       (__builtin_constant_p(n)) ?          \
        memcpy((dst), (src), (n)) :          \
        rte_memcpy_func((dst), (src), (n)); })
 
index acf7aac237d066c6d2776bccec0c6c3fb37e58cc..ca9d1dc56592884be1657cb05187ddcd3ca43588 100644 (file)
@@ -95,7 +95,8 @@ rte_mov256(uint8_t *dst, const uint8_t *src)
 }
 
 #define rte_memcpy(dst, src, n)              \
-       ({ (__builtin_constant_p(n)) ?       \
+       __extension__ ({                     \
+       (__builtin_constant_p(n)) ?          \
        memcpy((dst), (src), (n)) :          \
        rte_memcpy_func((dst), (src), (n)); })
 
index 413035e702804f2b3fa05354443b44d035f321a7..b3bfc23571680ac2496289e4644fd3f1588a23c8 100644 (file)
@@ -594,7 +594,7 @@ rte_mov256(uint8_t *dst, const uint8_t *src)
  * - __m128i <xmm0> ~ <xmm8> must be pre-defined
  */
 #define MOVEUNALIGNED_LEFT47_IMM(dst, src, len, offset)                                                     \
-({                                                                                                          \
+__extension__ ({                                                                                            \
     int tmp;                                                                                                \
     while (len >= 128 + 16 - offset) {                                                                      \
         xmm0 = _mm_loadu_si128((const __m128i *)((const uint8_t *)src - offset + 0 * 16));                  \
@@ -655,7 +655,7 @@ rte_mov256(uint8_t *dst, const uint8_t *src)
  * - __m128i <xmm0> ~ <xmm8> used in MOVEUNALIGNED_LEFT47_IMM must be pre-defined
  */
 #define MOVEUNALIGNED_LEFT47(dst, src, len, offset)                   \
-({                                                                    \
+__extension__ ({                                                      \
     switch (offset) {                                                 \
     case 0x01: MOVEUNALIGNED_LEFT47_IMM(dst, src, n, 0x01); break;    \
     case 0x02: MOVEUNALIGNED_LEFT47_IMM(dst, src, n, 0x02); break;    \
index b698797c808b867d9d27c0dc93057f68aba329dc..2836f2c25743d94907780c7d670e08abc29ee10f 100644 (file)
@@ -106,7 +106,8 @@ typedef union rte_ymm {
 #endif /* __AVX__ */
 
 #ifdef RTE_ARCH_I686
-#define _mm_cvtsi128_si64(a) ({ \
+#define _mm_cvtsi128_si64(a)    \
+__extension__ ({                \
        rte_xmm_t m;            \
        m.x = (a);              \
        (m.u64[0]);             \
@@ -117,7 +118,8 @@ typedef union rte_ymm {
  * Prior to version 12.1 icc doesn't support _mm_set_epi64x.
  */
 #if (defined(__ICC) && __ICC < 1210)
-#define _mm_set_epi64x(a, b)  ({ \
+#define _mm_set_epi64x(a, b)     \
+__extension__ ({                 \
        rte_xmm_t m;             \
        m.u64[0] = b;            \
        m.u64[1] = a;            \
index 332f2a439e657bf542d9a5a2750da2eb8a6055a9..477472bf0ecf297daeb567324be43f8ee66d16da 100644 (file)
@@ -268,7 +268,8 @@ rte_align64pow2(uint64_t v)
 /**
  * Macro to return the minimum of two numbers
  */
-#define RTE_MIN(a, b) ({ \
+#define RTE_MIN(a, b) \
+       __extension__ ({ \
                typeof (a) _a = (a); \
                typeof (b) _b = (b); \
                _a < _b ? _a : _b; \
@@ -277,7 +278,8 @@ rte_align64pow2(uint64_t v)
 /**
  * Macro to return the maximum of two numbers
  */
-#define RTE_MAX(a, b) ({ \
+#define RTE_MAX(a, b) \
+       __extension__ ({ \
                typeof (a) _a = (a); \
                typeof (b) _b = (b); \
                _a > _b ? _a : _b; \