Pass -Wdangling-alias to Bison 3.5 or newer

`bison -Wall` enables all diagnostics except `-Wcounterexamples`
(added in 3.7; we already pass it), `-Wyacc` (which we do not need),
and `-Wdangling-alias` (added in 3.5).
This commit is contained in:
Rangi
2026-03-06 22:01:37 -05:00
parent af0505b4cd
commit 48d58ba095
2 changed files with 7 additions and 4 deletions

View File

@@ -14,15 +14,18 @@ set(common_src
find_package(BISON 3.0.0 REQUIRED)
set(BISON_FLAGS "-Wall -Dlr.type=ielr")
# Set some optimization flags on versions that support them
# Set some flags on versions that support them
if(BISON_VERSION VERSION_GREATER_EQUAL "3.5")
set(BISON_FLAGS "${BISON_FLAGS} -Dparse.lac=full -Dapi.token.raw=true")
set(BISON_FLAGS "${BISON_FLAGS} -Dparse.lac=full -Dapi.token.raw=true -Wdangling-alias")
endif()
if(BISON_VERSION VERSION_GREATER_EQUAL "3.6")
set(BISON_FLAGS "${BISON_FLAGS} -Dparse.error=detailed")
else()
set(BISON_FLAGS "${BISON_FLAGS} -Dparse.error=verbose")
endif()
if(BISON_VERSION VERSION_GREATER_EQUAL "3.7")
set(BISON_FLAGS "${BISON_FLAGS} -Wcounterexamples")
endif()
BISON_TARGET(ASM_PARSER "asm/parser.y"
"${PROJECT_SOURCE_DIR}/src/asm/parser.cpp"