Add --preproc-token-limit (#5768)

This commit is contained in:
Krzysztof Bieganski
2025-02-07 10:32:12 -05:00
committed by GitHub
parent 5b65c15eca
commit 283f6c7433
10 changed files with 45 additions and 8 deletions
+3 -3
View File
@@ -963,9 +963,9 @@ int V3PreProcImp::getRawToken() {
if (m_lastLineno != m_lexp->m_tokFilelinep->lineno()) {
m_lastLineno = m_lexp->m_tokFilelinep->lineno();
m_tokensOnLine = 0;
} else if (++m_tokensOnLine > LINE_TOKEN_MAX) {
error("Too many preprocessor tokens on a line (>" + cvtToStr(LINE_TOKEN_MAX)
+ "); perhaps recursive `define");
} else if (++m_tokensOnLine > v3Global.opt.preprocTokenLimit()) {
error("Too many preprocessor tokens on a line (>"
+ cvtToStr(v3Global.opt.preprocTokenLimit()) + "); perhaps recursive `define");
tok = VP_EOF_ERROR;
}