Skip to contentSkip to conversation

power: don't disable all cast qualifier warnings

PATCH Applied Stephen Hemminger 6 participants 6 messages Aug 12, 2024 – Oct 17, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: don't disable all cast qualifier warnings

Only in one place does the power library need un-constify a pointer and this can be done by casting to uintptr_t first. Better, to have the warning enabled across the rest of the code.

---
 lib/power/meson.build          | 4 +---
 lib/power/rte_power_pmd_mgmt.c | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
lib/power/meson.build +1 -3
index b8426589b2..2f0f3d26e9 100644
@@ -30,7 +30,5 @@ headers = files(
         'rte_power_pmd_mgmt.h',
         'rte_power_uncore.h',
 )
-if cc.has_argument('-Wno-cast-qual')
-    cflags += '-Wno-cast-qual'
-endif
+
 deps += ['timer', 'ethdev']
lib/power/rte_power_pmd_mgmt.c +1 -1
index b1c18a5f56..6dec282054 100644
@@ -664,7 +664,7 @@ rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id,
 	 * ports before calling any of these API's, so we can assume that the
 	 * callbacks can be freed. we're intentionally casting away const-ness.
 	 */
-	rte_free((void *)queue_cfg->cb);
+	rte_free((void *)(uintptr_t)queue_cfg->cb);
 	free(queue_cfg);
 
 	return 0;
Signature · 1 line
2.43.0
Acked-by Bruce Richardson Acked-by Huisong Li Acked-by Tyler Retzlaff Applied
#2 lore raw

13/08/2024 08:11, Morten Brørup:

Quoted 6 lines
Quoted 6 lines

From: Stephen Hemminger [mailto:[email protected]]

Only in one place does the power library need un-constify a pointer and this can be done by casting to uintptr_t first. Better, to have the warning enabled across the rest of the code.

Quoted 6 lines
Quoted 2 lines

---

Agree; disabling warnings should be avoided.

Applied, thanks