Skip to contentSkip to conversation

net: fix build with -Wpedantic

PATCH Applied Ali Alnubani 3 participants 6 messages Sep 29, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fix build with -Wpedantic

Adds the __extension__ attribute to resolve the following warning with gcc 4.8.5 on CentOS 7:
lib/net/rte_macsec.h:38:2: error: type of bit-field 'short_length' is
a GCC extension [-Werror=pedantic]

Fixes 0aaf097585a6 ("ethdev: add MACsec flow item")
---
 lib/net/rte_macsec.h | 1 +
 1 file changed, 1 insertion(+)
lib/net/rte_macsec.h +1 -0
index 9228ebd083..d0cd2f69ab 100644
@@ -28,6 +28,7 @@ extern "C" {
 /**
  * MACsec Header (SecTAG)
  */
+__extension__
 struct rte_macsec_hdr {
 	/**
 	 * Tag control information and Association number of secure channel.
Signature · 1 line
2.25.1
#1 lore raw
Quoted 18 lines

Adds the __extension__ attribute to resolve the following warning with gcc 4.8.5 on CentOS 7:
lib/net/rte_macsec.h:38:2: error: type of bit-field 'short_length' is
a GCC extension [-Werror=pedantic]

Fixes 0aaf097585a6 ("ethdev: add MACsec flow item")
---
 lib/net/rte_macsec.h | 1 +
 1 file changed, 1 insertion(+)
lib/net/rte_macsec.h +0 -0
index 9228ebd083..d0cd2f69ab 100644

lib/net/rte_macsec.h extern "C" { · line 31

Quoted 4 lines
lib/net/rte_macsec.h +1 -0
@@ -28,6 +28,7 @@ extern "C" {
 /**
  * MACsec Header (SecTAG)
  */
+__extension__

RTE_STD_C11 ??

Quoted 5 lines
lib/net/rte_macsec.h +0 -1
 struct rte_macsec_hdr {
 	/**
 	 * Tag control information and Association number of secure channel.
--

2.25.1

#2 lore raw
Quoted 19 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, September 29, 2022 10:02 AM
To: Ali Alnubani <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH] net: fix build with -Wpedantic

Quoted 13 lines

Adds the __extension__ attribute to resolve the following warning with gcc 4.8.5 on CentOS 7:
lib/net/rte_macsec.h:38:2: error: type of bit-field 'short_length' is
a GCC extension [-Werror=pedantic]

Fixes 0aaf097585a6 ("ethdev: add MACsec flow item")
---
 lib/net/rte_macsec.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

lib/net/rte_macsec.h extern "C" { · line 31

Quoted 9 lines
lib/net/rte_macsec.h +1 -0
index 9228ebd083..d0cd2f69ab 100644
@@ -28,6 +28,7 @@ extern "C" {
 /**
  * MACsec Header (SecTAG)
  */
+__extension__

RTE_STD_C11 ??

Replacing the __extension__ attribute with RTE_STD_C11 doesn't resolve the build failure for me.

Acked-by
#3 lore raw
Quoted 25 lines
Quoted 13 lines
Quoted 13 lines

Adds the __extension__ attribute to resolve the following warning with gcc 4.8.5 on CentOS 7:
lib/net/rte_macsec.h:38:2: error: type of bit-field 'short_length' is
a GCC extension [-Werror=pedantic]

Fixes 0aaf097585a6 ("ethdev: add MACsec flow item")
---
 lib/net/rte_macsec.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

lib/net/rte_macsec.h extern "C" { · line 31

Quoted 9 lines
lib/net/rte_macsec.h +1 -0
index 9228ebd083..d0cd2f69ab 100644
@@ -28,6 +28,7 @@ extern "C" {
 /**
  * MACsec Header (SecTAG)
  */
+__extension__

RTE_STD_C11 ??

Quoted 2 lines

Replacing the __extension__ attribute with RTE_STD_C11 doesn't resolve the build failure for me.

Ok, Thanks for the fix.

#4 lore raw

29/09/2022 09:09, Akhil Goyal:

Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 18 lines

Adds the __extension__ attribute to resolve the following warning with gcc 4.8.5 on CentOS 7:
lib/net/rte_macsec.h:38:2: error: type of bit-field 'short_length' is
a GCC extension [-Werror=pedantic]

Fixes 0aaf097585a6 ("ethdev: add MACsec flow item")
---
 lib/net/rte_macsec.h | 1 +
 1 file changed, 1 insertion(+)
lib/net/rte_macsec.h +0 -0
index 9228ebd083..d0cd2f69ab 100644

lib/net/rte_macsec.h extern "C" { · line 31

Quoted 4 lines
lib/net/rte_macsec.h +1 -0
@@ -28,6 +28,7 @@ extern "C" {
 /**
  * MACsec Header (SecTAG)
  */
+__extension__

RTE_STD_C11 ??

Quoted 6 lines
Quoted 2 lines

Replacing the __extension__ attribute with RTE_STD_C11 doesn't resolve the build failure for me.

Ok, Thanks for the fix.

Applied, thanks.

#5 lore raw
In reply to Akhil Goyal

29/09/2022 09:01, Akhil Goyal:

Quoted 8 lines
Quoted 8 lines

Adds the __extension__ attribute to resolve the following warning with gcc 4.8.5 on CentOS 7:
lib/net/rte_macsec.h:38:2: error: type of bit-field 'short_length' is
a GCC extension [-Werror=pedantic]

Fixes 0aaf097585a6 ("ethdev: add MACsec flow item")
Quoted 11 lines

lib/net/rte_macsec.h extern "C" { · line 31

Quoted 9 lines

---

lib/net/rte_macsec.h +1 -0
@@ -28,6 +28,7 @@ extern "C" {
 /**
  * MACsec Header (SecTAG)
  */
+__extension__

RTE_STD_C11 ??

We use RTE_STD_C11 only for anonymous struct and union. I don't know why we don't use it for bitfield in struct. It seems to be part of C11 standard, right?

In doubt, I would continue with __extension__
and we can replace all similar occurences in a separate patch, if confirmed it is well defined in C11.