mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 14:53:03 +00:00
diagnostics: fix invalid error message indentation
https://lists.gnu.org/archive/html/bison-patches/2019-08/msg00007.html When Bison is started with a flag that suppresses warning messages, the error_message() function can produce a few gigabytes of indentation because of a dangling pointer. * src/complain.c (error_message): Don't reset indent_ptr here, but... (complain_indent): here. * tests/diagnostics.at (Indentation with message suppression): Check this case.
This commit is contained in:
committed by
Akim Demaille
parent
d7cf3f5b18
commit
9145bd0b61
@@ -242,3 +242,33 @@ input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option
|
||||
|
||||
|
||||
m4_popdef([AT_TEST])
|
||||
|
||||
|
||||
|
||||
|
||||
## -------------------------------------- ##
|
||||
## Indentation with message suppression. ##
|
||||
## -------------------------------------- ##
|
||||
|
||||
AT_SETUP([[Indentation with message suppression]])
|
||||
|
||||
# https://lists.gnu.org/archive/html/bug-bison/2019-08/msg00002.html
|
||||
|
||||
AT_DATA([[input.y]],
|
||||
[[%define api.pure
|
||||
%pure-parser
|
||||
%error-verbose
|
||||
%%
|
||||
exp : '0'
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-fcaret -Wno-other input.y]], [0], [],
|
||||
[[input.y:2.1-12: warning: deprecated directive, use '%define api.pure' [-Wdeprecated]
|
||||
2 | %pure-parser
|
||||
| ^~~~~~~~~~~~
|
||||
input.y:3.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
|
||||
3 | %error-verbose
|
||||
| ^~~~~~~~~~~~~~
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user