From 160e1c5bf75485080fe2c6d077c348d462050061 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 13 Jan 2026 16:25:28 +0100 Subject: [PATCH] fix(heap): Fixed const qualifier warning in heap_task_info.c Fixed compilation error when building with -Wwrite-strings or -Wdiscarded-qualifiers by adding const qualifier to char pointers with string literals. Closes https://github.com/espressif/esp-idf/issues/18120 --- components/heap/heap_task_info.c | 4 ++-- .../heap/test_apps/heap_tests/sdkconfig.ci.no_poisoning | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/heap/heap_task_info.c b/components/heap/heap_task_info.c index 8844e4fea8..c4a1c27769 100644 --- a/components/heap/heap_task_info.c +++ b/components/heap/heap_task_info.c @@ -641,8 +641,8 @@ static void heap_caps_print_task_info(FILE *stream, task_info_t *task_info, bool heap_stats_t *heap_info = NULL; STAILQ_FOREACH(heap_info, &task_info->heaps_stats, next_heap_stat) { - char *next_heap_visual = !STAILQ_NEXT(heap_info, next_heap_stat) ? " " : "│"; - char *next_heap_visual_start = !STAILQ_NEXT(heap_info, next_heap_stat) ? "└" : "├"; + const char *next_heap_visual = !STAILQ_NEXT(heap_info, next_heap_stat) ? " " : "│"; + const char *next_heap_visual_start = !STAILQ_NEXT(heap_info, next_heap_stat) ? "└" : "├"; fprintf(stream, "%s %s HEAP: %s, CAPS: 0x%08lx, SIZE: %d, USAGE: CURRENT %d (%d%%), PEAK %d (%d%%), ALLOC COUNT: %d\n", task_info_visual, next_heap_visual_start, diff --git a/components/heap/test_apps/heap_tests/sdkconfig.ci.no_poisoning b/components/heap/test_apps/heap_tests/sdkconfig.ci.no_poisoning index 9ea37891c5..2280067160 100644 --- a/components/heap/test_apps/heap_tests/sdkconfig.ci.no_poisoning +++ b/components/heap/test_apps/heap_tests/sdkconfig.ci.no_poisoning @@ -4,3 +4,4 @@ CONFIG_HEAP_POISONING_COMPREHENSIVE=n CONFIG_HEAP_TASK_TRACKING=y # to make sure the config doesn't induce unexpected behavior CONFIG_HEAP_TRACK_DELETED_TASKS=y # to make sure the config doesn't induce unexpected behavior +CONFIG_COMPILER_WARN_WRITE_STRINGS=y