eal: remove unnecessary use of statement expression

Message ID 1706660329-1752-1-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series eal: remove unnecessary use of statement expression |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Tyler Retzlaff Jan. 31, 2024, 12:18 a.m. UTC
  Remove use of statement expression syntax in expansion of
MOVEUNALIGNED_LEFT47_IMM and MOVEUNALIGNED_LEFT47 macro expansions.

There appears to be no need to use the statement expression compiler
extension a simple block should work.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/x86/include/rte_memcpy.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Tyler Retzlaff Feb. 12, 2024, 5:56 p.m. UTC | #1
ping

could relevant maintainers take a look?

thank you!

On Tue, Jan 30, 2024 at 04:18:49PM -0800, Tyler Retzlaff wrote:
> Remove use of statement expression syntax in expansion of
> MOVEUNALIGNED_LEFT47_IMM and MOVEUNALIGNED_LEFT47 macro expansions.
> 
> There appears to be no need to use the statement expression compiler
> extension a simple block should work.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/eal/x86/include/rte_memcpy.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h
> index fd151be..72a9229 100644
> --- a/lib/eal/x86/include/rte_memcpy.h
> +++ b/lib/eal/x86/include/rte_memcpy.h
> @@ -610,7 +610,7 @@
>   * - __m128i <xmm0> ~ <xmm8> must be pre-defined
>   */
>  #define MOVEUNALIGNED_LEFT47_IMM(dst, src, len, offset)                                                     \
> -__extension__ ({                                                                                            \
> +{                                                                                            \
>      size_t tmp;                                                                                                \
>      while (len >= 128 + 16 - offset) {                                                                      \
>          xmm0 = _mm_loadu_si128((const __m128i *)(const void *)((const uint8_t *)src - offset + 0 * 16));                  \
> @@ -656,7 +656,7 @@
>          src = (const uint8_t *)src + tmp;                                                                   \
>          dst = (uint8_t *)dst + tmp;                                                                         \
>      }                                                                                                       \
> -})
> +}
>  
>  /**
>   * Macro for copying unaligned block from one location to another,
> @@ -671,7 +671,7 @@
>   * - __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;    \
> @@ -690,7 +690,7 @@
>      case 0x0F: MOVEUNALIGNED_LEFT47_IMM(dst, src, n, 0x0F); break;    \
>      default:;                                                         \
>      }                                                                 \
> -})
> +}
>  
>  static __rte_always_inline void *
>  rte_memcpy_generic(void *dst, const void *src, size_t n)
> -- 
> 1.8.3.1
  
David Marchand Feb. 13, 2024, 10:41 a.m. UTC | #2
On Mon, Feb 12, 2024 at 6:56 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> ping
>
> could relevant maintainers take a look?

This change comes from the old commit 5f2c68a710e1 ("lib: work around
braced-groups within expressions").
I suspect this change breaks application compiling with pedantic,
without setting a C standard >= C11.
  
David Marchand Feb. 13, 2024, 11:10 a.m. UTC | #3
On Tue, Feb 13, 2024 at 11:41 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Mon, Feb 12, 2024 at 6:56 PM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > ping
> >
> > could relevant maintainers take a look?
>
> This change comes from the old commit 5f2c68a710e1 ("lib: work around
> braced-groups within expressions").
> I suspect this change breaks application compiling with pedantic,
> without setting a C standard >= C11.

Oh, I get it now.
I was confused because of the other series 30308.

I'll merge this first patch.
  
David Marchand Feb. 14, 2024, 12:21 p.m. UTC | #4
On Wed, Jan 31, 2024 at 1:19 AM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> Remove use of statement expression syntax in expansion of
> MOVEUNALIGNED_LEFT47_IMM and MOVEUNALIGNED_LEFT47 macro expansions.
>
> There appears to be no need to use the statement expression compiler
> extension a simple block should work.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Applied, thanks.
  

Patch

diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h
index fd151be..72a9229 100644
--- a/lib/eal/x86/include/rte_memcpy.h
+++ b/lib/eal/x86/include/rte_memcpy.h
@@ -610,7 +610,7 @@ 
  * - __m128i <xmm0> ~ <xmm8> must be pre-defined
  */
 #define MOVEUNALIGNED_LEFT47_IMM(dst, src, len, offset)                                                     \
-__extension__ ({                                                                                            \
+{                                                                                            \
     size_t tmp;                                                                                                \
     while (len >= 128 + 16 - offset) {                                                                      \
         xmm0 = _mm_loadu_si128((const __m128i *)(const void *)((const uint8_t *)src - offset + 0 * 16));                  \
@@ -656,7 +656,7 @@ 
         src = (const uint8_t *)src + tmp;                                                                   \
         dst = (uint8_t *)dst + tmp;                                                                         \
     }                                                                                                       \
-})
+}
 
 /**
  * Macro for copying unaligned block from one location to another,
@@ -671,7 +671,7 @@ 
  * - __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;    \
@@ -690,7 +690,7 @@ 
     case 0x0F: MOVEUNALIGNED_LEFT47_IMM(dst, src, n, 0x0F); break;    \
     default:;                                                         \
     }                                                                 \
-})
+}
 
 static __rte_always_inline void *
 rte_memcpy_generic(void *dst, const void *src, size_t n)