Comments (7)
I am locally appling a patch like this:
From a6b6d2d7cfd9774220ccd00d031e2f699afd3d29 Mon Sep 17 00:00:00 2001
From: Mat Booth <[email protected]>
Date: Sun, 17 Mar 2024 15:32:40 +0000
Subject: [PATCH] Fix compilation errors caused by GCC 14
---
.../src/CMakeLists.txt | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/FTL-abcbcc58f5a63c21a11a4af2f0d5a664aa11ecfa/src/CMakeLists.txt b/FTL-abcbcc58f5a63c21a11a4af2f0d5a664aa11ecfa/src/CMakeLists.txt
index 185ba5d..f689760 100644
--- a/FTL-abcbcc58f5a63c21a11a4af2f0d5a664aa11ecfa/src/CMakeLists.txt
+++ b/FTL-abcbcc58f5a63c21a11a4af2f0d5a664aa11ecfa/src/CMakeLists.txt
@@ -155,11 +155,22 @@ else()
set(EXTRAWARN_GCC13 "")
endif()
+# Extra warnings flags available only in GCC 14 and higher
+# In GCC 14, -Wextra implies -Wcalloc-transposed-args however, there is
+# nothing wrong with the calls to calloc that it detects, so disable
+# that warning here
+if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL 14 OR CMAKE_C_COMPILER_VERSION VERSION_GREATER 14)
+set(EXTRAWARN_GCC14 "-Wno-calloc-transposed-args")
+else()
+set(EXTRAWARN_GCC14 "")
+endif()
+
set(EXTRAWARN "${EXTRAWARN_GCC6} \
${EXTRAWARN_GCC7} \
${EXTRAWARN_GCC8} \
${EXTRAWARN_GCC12} \
- ${EXTRAWARN_GCC13}")
+ ${EXTRAWARN_GCC13} \
+ ${EXTRAWARN_GCC14}")
# Remove extra spaces from EXTRAWARN
string(REGEX REPLACE " +" " " EXTRAWARN "${EXTRAWARN}")
--
2.41.0
from ftl.
Thanks for your comments, I haven't tried building on such a recent GCC version myself. I'm actually torn about the solution you suggest - yes, sure, there isn't anything wrong with our code. The warning wants to ensure we are using calloc()
as it was designed and that means the first argument is nmem
and the second size
. Even when it makes no functional difference, one could also argument that the "real" fix would be
-cap_user_header_t hdr = calloc(sizeof(*hdr), capsize);
+cap_user_header_t hdr = calloc(capsize, sizeof(*hdr));
What do you think? I'm always trying to try to comply with compiler warnings whenever possible (and meaningful). It seems meaningful here because (warning: rusty partially unreliable memory excerpt ahead!) I recall that calloc
may be implemented in a way that ensures alignment matching the size
parameter. So the order of the arguments can actually make a difference and the mere fact that someone did the work adding warning rules to GCC 14 (combined with that this has been accepted) tells me that there are good reasons to use the function as defined :-)
from ftl.
For reference: gcc-mirror/gcc@e7dd72a
from ftl.
I am happy to see it fixed in any manner you think is best -- I am not a GCC expert, nor am I a FTL expert -- but your fix may indeed be better if only because not disabling the warning would prevent more infractions from sneaking into the code base. :-)
from ftl.
You could test swapping the arguments locally to see if anything else comes up. As GCC 14 has not even been officially released, I'm a bit hesitant to invest time into creating/installing a full testing environment yet. We may simply wait for alpine:edge
to eventually pick it up once finalized.
from ftl.
This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.
from ftl.
This issue has been mentioned on Pi-hole Userspace. There might be relevant details there:
https://discourse.pi-hole.net/t/certificate-domain-mismatch-warning-behind-reverse-proxy/70521/3
from ftl.
Related Issues (20)
- debug.api help text needs another description HOT 1
- FTL Crash HOT 4
- Unable to build FTL from source HOT 9
- app password not working in v6 HOT 7
- [Pi-hole V6] Ftl crash because of database? HOT 10
- [Beta V6] FTL-Checksum error? HOT 4
- dns.hosts(0): invalid hostname HOT 4
- v6 Seg fault crash on first startup macOS M2 HOT 14
- Pihole-FTL v6 crash when ipv6 disabled and ipv6 dns given. HOT 2
- crash on internet outage HOT 6
- v6: documentation on PUT /clients/ is not complete HOT 8
- DHCP server is configured with incorrect netmask HOT 8
- Pihole is not installing update HOT 6
- Overzealous inline opitimizations? HOT 7
- FTL crashes when activating DHCP server HOT 6
- dev: webserver doesn't properly detect mbedtls dependency HOT 5
- PTR requests not being generated for local clients HOT 26
- Client ipv6 hostnames is not resolving and not being stored in FTL database HOT 5
- Obsolete MAC Vendor DB Script HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ftl.