Fix compatibility with GCC 6 and earlier 06/68606/1
authorXavier Simonart <xavier.simonart@intel.com>
Tue, 8 Oct 2019 21:54:22 +0000 (17:54 -0400)
committerXavier Simonart <xavier.simonart@intel.com>
Tue, 8 Oct 2019 21:54:22 +0000 (17:54 -0400)
fb0c44a fixed compilation on GCC 8 by using:
1) #pragma GCC diagnostic ignored "-Wstringop-truncation"
2) __attribute__ ((fallthrough));

However, -Wstringop-truncation has only been introduced in GCC 8 and
__attribute__ ((fallthrough)) has only been introduced in GCC 7.
Hence they caused Warnings/Errors on earlier versions.

Comments about fallthough (see https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/)
can be used on GCC 8 to prevent fall through warnings

Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Change-Id: I6f22e023191bbf22d8b01f1812061795a6494134

VNFs/DPPD-PROX/handle_acl.c
VNFs/DPPD-PROX/parse_utils.c
VNFs/DPPD-PROX/prox_compat.h

index c0a1b86..5138eef 100644 (file)
@@ -108,7 +108,7 @@ static int handle_acl_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin
                        break;
                case ACL_ALLOW:
                        out[i] = 0;
-                        __attribute__ ((fallthrough));
+                       // __attribute__ ((fallthrough));
                case ACL_RATE_LIMIT:
                        set_tc(mbufs[i], 3);
                        break;
index 84ff8cc..af98ec2 100644 (file)
@@ -923,12 +923,12 @@ int parse_kmg(uint32_t* val, const char *str2)
                if (*val >> 22)
                        return -2;
                *val <<= 10;
-                __attribute__ ((fallthrough));
+               // __attribute__ ((fallthrough));
        case 'M':
                if (*val >> 22)
                        return -2;
                *val <<= 10;
-                __attribute__ ((fallthrough));
+               // __attribute__ ((fallthrough));
        case 'K':
                if (*val >> 22)
                        return -2;
index 7564f29..e1ead1d 100644 (file)
@@ -133,6 +133,7 @@ static void *prox_rte_table_create(struct prox_rte_table_params *params, int soc
 static inline char *prox_strncpy(char * dest, const char * src, size_t count)
 {
 #pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpragmas"
 #pragma GCC diagnostic ignored "-Wstringop-truncation"
        strncpy(dest, src, count);
 #pragma GCC diagnostic pop