From b4c1a87d3baac7b07265be831c5ca929b065c06c Mon Sep 17 00:00:00 2001 From: Tracy Narine <76846523+tmnarine@users.noreply.github.com> Date: Wed, 10 Jun 2026 10:12:47 -0400 Subject: [PATCH] Fixing warnings - The warning in V3ParseBison.c is not valid but gcc still reports it - Added code to generate push and pop pragmas to ignore the warning under gcc - Only needed in the .c file and not the header --- src/bisonpre | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/bisonpre b/src/bisonpre index 9be647f39..36db4b48f 100755 --- a/src/bisonpre +++ b/src/bisonpre @@ -145,6 +145,25 @@ def clean_output(filename: str, outname: str, is_output: bool, is_c: bool) -> No out.append(line) lines = out out = [] + # Code updates for the .c + if outname.endswith(".c"): + for line in lines: + modify = "YYSTACK_FREE (yyss);" in line and "if (yyss != yyssa)" in out[-1] + ifdefined = "#if defined __GNUC__ && ! defined __ICC\n" + endif = "#endif\n" + if modify: + out.insert(-1, ifdefined) + out.insert(-1, " _Pragma (\"GCC diagnostic push\")\n") + out.insert(-1, + " _Pragma (\"GCC diagnostic ignored \\\"-Wfree-nonheap-object\\\"\")\n") + out.insert(-1, endif) + out.append(line) + if modify: + out.append(ifdefined) + out.append(" _Pragma (\"GCC diagnostic pop\")\n") + out.append(endif) + lines = out + out = [] with open(outname, "w", encoding="utf-8") as fh: tmpy = re.escape(tmp_prefix() + ".y")