From a3a9a72f31401b83a264e64cc2f2190dffdfb380 Mon Sep 17 00:00:00 2001
From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com>
Date: Mon, 13 Feb 2023 11:19:11 +0100
Subject: [PATCH] Fix compilation with GCC-7 and latest RoaringBitmap code
(#1886)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Latest RoaringBitmap version (introduced with bf413afb) triggers a new
warning with GCC-7:
```
ivan@ivan-Latitude-E6540:~/svnrepos/nDPI(dev)$ CC=gcc-7 CXX=g++-7 ./autogen.sh && make -s
autoreconf: Entering directory `.'
[...]
third_party/src/roaring.c:1815:1: warning: ‘no_sanitize’ attribute directive ignored [-Wattributes]
static inline int array_container_cardinality(const array_container_t *array) {
^~~~~~
third_party/src/roaring.c:1964:5: warning: ‘no_sanitize’ attribute directive ignored [-Wattributes]
const array_container_t *container2) {
[..]
```
The core issue is that `no_sanitize` attribute is defined only for GCC
>= 8.
That breaks the CI since we still use GCC-7 and `-Werror`: add a simple
workaround.
Fix compilation on Windows
---
configure.ac | 4 +++-
windows/nDPI.vcxproj | 1 +
windows/nDPI.vcxproj.filters | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index a92a2ffebcf..fba220b03d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,7 +170,9 @@ AS_IF([test "x${enable_tls_sigs}" = "xyes"],[
HANDLE_TLS_SIGS=""
])
-NDPI_CFLAGS="-W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-address-of-packed-member ${NDPI_CFLAGS}"
+NDPI_CFLAGS="-W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-address-of-packed-member ${NDPI_CFLAGS} -Wno-attributes"
+#Workaround for RoaringBitmap with gcc-7
+NDPI_CFLAGS="-Wno-attributes ${NDPI_CFLAGS}"
AS_IF([test "${with_lto_and_gold_linker+set}" = set], [
NDPI_CFLAGS="${NDPI_CFLAGS} -flto -fuse-ld=gold -Wno-unused-command-line-argument"
diff --git a/windows/nDPI.vcxproj b/windows/nDPI.vcxproj
index 5b8c7d7f4f9..f0bf2ff80d3 100644
--- a/windows/nDPI.vcxproj
+++ b/windows/nDPI.vcxproj
@@ -203,6 +203,7 @@
+
diff --git a/windows/nDPI.vcxproj.filters b/windows/nDPI.vcxproj.filters
index d3a07fd7972..45cdf4b4f57 100644
--- a/windows/nDPI.vcxproj.filters
+++ b/windows/nDPI.vcxproj.filters
@@ -167,6 +167,7 @@
+
third_party