From 20225fc330a4808f8b95edbbf9f181730824a2ae Mon Sep 17 00:00:00 2001 From: skewb1k Date: Wed, 18 Mar 2026 09:27:19 +0000 Subject: [PATCH] build: suppress -Wfree-nonheap-object false positives in lua_cjson #37250 Problem: Building with GCC emits -Wfree-nonheap-object warnings in lua_cjson code when calling strbuf_free(), despite the free being conditionally valid. This is an unresolved GCC issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98753 Solution: Supress warnings with the -Wno-free-nonheap-object flag for now. --- src/nvim/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 15aa28c6ba..b8160fea4b 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -134,6 +134,8 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU") $<$:-Wno-unused-result> $<$:-Wno-unused-result> $<$:-Wno-unused-result>) + + target_link_options(nvim_bin PRIVATE -Wno-free-nonheap-object) # see #37250 elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") # On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang # 3.4.1 used there.