]> git.droids-corp.org - dpdk.git/commitdiff
lib: work around nonstandard bit-fields
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Thu, 8 Sep 2016 12:25:05 +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: type of bit-field `[...]' is a GCC extension

Note: the standard does not require implementations to issue a diagnostic
message with these, and such errors do not occur with recent GCC or clang
versions. However, GCC 4.7 is still common and using the extension keyword
is easier than checking compiler version.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
lib/librte_cryptodev/rte_cryptodev.h
lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
lib/librte_ether/rte_ethdev.h
lib/librte_kni/rte_kni.h
lib/librte_lpm/rte_lpm.h
lib/librte_mbuf/rte_mbuf.h

index 1e30a1978c69e9cf5c7de68452dfbea4cdf358f0..957bdd7396105f9213c5ebacf47a80e0a893274d 100644 (file)
@@ -619,6 +619,7 @@ struct rte_cryptodev {
        struct rte_cryptodev_cb_list link_intr_cbs;
        /**< User application callback for interrupts if present */
 
+       __extension__
        uint8_t attached : 1;
        /**< Flag indicating the device is attached */
 } __rte_cache_aligned;
@@ -642,6 +643,7 @@ struct rte_cryptodev_data {
        char name[RTE_CRYPTODEV_NAME_MAX_LEN];
        /**< Unique identifier name */
 
+       __extension__
        uint8_t dev_started : 1;
        /**< Device state: STARTED(1)/STOPPED(0) */
 
index 7f458a3608649ea4a1341aca098006066f406985..2ef050628ac33cd1da503a64c85e01e69291620d 100644 (file)
@@ -159,6 +159,7 @@ struct rte_kni_device_info {
        uint16_t group_id;            /**< Group ID */
        uint32_t core_id;             /**< core ID to bind for kernel thread */
 
+       __extension__
        uint8_t force_bind : 1;       /**< Flag for kernel thread binding */
 
        /* mbuf size */
index b0fe03340b2111e9aa48378d7845f293e265db2a..96575e8ae747b906c2c6f9d505599877fbcee9e6 100644 (file)
@@ -255,6 +255,7 @@ struct rte_eth_stats {
 /**
  * A structure used to retrieve link-level information of an Ethernet port.
  */
+__extension__
 struct rte_eth_link {
        uint32_t link_speed;        /**< ETH_SPEED_NUM_ */
        uint16_t link_duplex  : 1;  /**< ETH_LINK_[HALF/FULL]_DUPLEX */
@@ -346,6 +347,7 @@ struct rte_eth_rxmode {
        enum rte_eth_rx_mq_mode mq_mode;
        uint32_t max_rx_pkt_len;  /**< Only used if jumbo_frame enabled. */
        uint16_t split_hdr_size;  /**< hdr buf size (header_split enabled).*/
+       __extension__
        uint16_t header_split : 1, /**< Header Split enable. */
                hw_ip_checksum   : 1, /**< IP/UDP/TCP checksum offload enable. */
                hw_vlan_filter   : 1, /**< VLAN filter enable. */
@@ -645,6 +647,7 @@ struct rte_eth_txmode {
 
        /* For i40e specifically */
        uint16_t pvid;
+       __extension__
        uint8_t hw_vlan_reject_tagged : 1,
                /**< If set, reject sending out tagged pkts */
                hw_vlan_reject_untagged : 1,
@@ -1691,6 +1694,7 @@ struct rte_eth_dev_data {
        struct ether_addr* hash_mac_addrs;
        /** Device Ethernet MAC addresses of hash filtering. */
        uint8_t port_id;           /**< Device [external] port identifier. */
+       __extension__
        uint8_t promiscuous   : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
                scattered_rx : 1,  /**< RX of scattered packets is ON(1) / OFF(0) */
                all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
index 7363e6cf5074082beb445db2b6e8ef0282097f9a..5f6f9e4641d029043c5c4b8c6becc0fd93e5eaa7 100644 (file)
@@ -88,6 +88,7 @@ struct rte_kni_conf {
        struct rte_pci_addr addr;
        struct rte_pci_id id;
 
+       __extension__
        uint8_t force_bind : 1; /* Flag to bind kernel thread */
 };
 
index f8727572540822695aa40d8f2b2160c99817225c..fbda2930bbd077fccbe8de5b5f9b791f6ed55502 100644 (file)
@@ -93,6 +93,7 @@ extern "C" {
 
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 /** @internal Tbl24 entry structure. */
+__extension__
 struct rte_lpm_tbl_entry_v20 {
        /**
         * Stores Next hop (tbl8 or tbl24 when valid_group is not set) or
@@ -116,6 +117,7 @@ struct rte_lpm_tbl_entry_v20 {
        uint8_t depth       :6; /**< Rule depth. */
 };
 
+__extension__
 struct rte_lpm_tbl_entry {
        /**
         * Stores Next hop (tbl8 or tbl24 when valid_group is not set) or
@@ -137,6 +139,7 @@ struct rte_lpm_tbl_entry {
 };
 
 #else
+__extension__
 struct rte_lpm_tbl_entry_v20 {
        uint8_t depth       :6;
        uint8_t valid_group :1;
@@ -147,6 +150,7 @@ struct rte_lpm_tbl_entry_v20 {
        };
 };
 
+__extension__
 struct rte_lpm_tbl_entry {
        uint32_t depth       :6;
        uint32_t valid_group :1;
index 7ae65549069b95f192c14ee3b0fa3bd9b90d3612..c6cb299711b7a1825a0f7071a528498e180bb5d9 100644 (file)
@@ -865,6 +865,7 @@ struct rte_mbuf {
        /* fields to support TX offloads */
        union {
                uint64_t tx_offload;       /**< combined for easy fetch */
+               __extension__
                struct {
                        uint64_t l2_len:7; /**< L2 (MAC) Header Length. */
                        uint64_t l3_len:9; /**< L3 (IP) Header Length. */