From 775cb681613f82f4753f9e76de2eadfa787f7666 Mon Sep 17 00:00:00 2001 From: David Frey Date: Thu, 20 May 2021 11:28:54 -0700 Subject: [PATCH] Disable free-nonheap-object warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without disabling this warning, g++ 11.1.0 emits this warning: /project/erpc/Debug/Linux/erpcsniffer/obj/erpcgen_parser.tab.cpp: In function ‘int yyparse(erpcgen::ErpcLexer*, erpcgen::AstNode**)’: /project/erpc/Debug/Linux/erpcsniffer/obj/erpcgen_parser.tab.cpp:3810:18: error: ‘void free(void*)’ called on unallocated object ‘yyssa’ [-Werror=free-nonheap-object] 3810 | YYSTACK_FREE (yyss); /project/erpc/Debug/Linux/erpcsniffer/obj/erpcgen_parser.tab.cpp:2025:16: note: declared here 2025 | yy_state_t yyssa[YYINITDEPTH]; | ^~~~~ cc1plus: all warnings being treated as errors Since -Werror is also enabled, this prevents erpcsniffer from building. Background on false positives relating to this warning: https://www.mail-archive.com/help-bison@gnu.org/msg04296.html https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98753 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54202 --- mk/flags.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/flags.mk b/mk/flags.mk index 1326271f7..e97276b97 100644 --- a/mk/flags.mk +++ b/mk/flags.mk @@ -28,7 +28,7 @@ else MARCH ?= # -m32 or -m64 endif -CXXFLAGS += -std=gnu++11 -D LINUX -Wunused-variable -Wno-deprecated-register -Wno-narrowing -Werror $(MARCH) +CXXFLAGS += -std=gnu++11 -D LINUX -Wunused-variable -Wno-deprecated-register -Wno-narrowing -Wno-free-nonheap-object -Werror $(MARCH) #CXXFLAGS += -Wall -Wextra -Wshadow -pedantic-errors CFLAGS += -std=gnu11 -D LINUX -D _GNU_SOURCE -Werror $(MARCH) YYFLAGS += -Wno-other # --debug --verbose