git: 4bddff0833d3 - main - libdtrace: Work around a warning from flex
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 01 Jun 2024 15:18:15 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4bddff0833d3efee77a099b3ef447fbae1e63d21 commit 4bddff0833d3efee77a099b3ef447fbae1e63d21 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-06-01 15:16:26 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-06-01 15:16:26 +0000 libdtrace: Work around a warning from flex When compiling dt_lex.l, flex produces warnings of the form: dt_lex.l:413: warning, trailing context made variable due to preceding '|' action dt_lex.l:412: warning, dangerous trailing context dt_lex.l:412: warning, dangerous trailing context Here, trailing context refers to the use of "$", which expands to "/\n". The meaning behind these warnings is described in the first two paragraphs of the flex manual's DEFICIENCIES/BUGS section: Some trailing context patterns cannot be properly matched and generate warning messages ("dangerous trailing context"). These are patterns where the ending of the first part of the rule matches the beginning of the second part, such as "zx*/xy*", where the 'x*' matches the 'x' at the beginning of the trailing context. (Note that the POSIX draft states that the text matched by such patterns is undefined.) For some trailing context rules, parts which are actually fixed-length are not recognized as such, leading to the above mentioned performance loss. In particular, parts using '|' or {n} (such as "foo{3}") are always considered variable-length. Here, the warnings appear to be bogus in this case. The lexer has no problem matching either of the referenced patterns, e.g., printf("foobar or # 1 "asdfasdf Introduce a small amount of code duplication to silence the warning. MFC after: 2 weeks --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l index d50369bb57c9..756a48b9c45f 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l @@ -407,7 +407,7 @@ if (yypcb->pcb_token != 0) { <S0>{RGX_FP} yyerror("floating-point constants are not permitted\n"); -<S0>\"{RGX_STR}$ | +<S0>\"{RGX_STR}$ xyerror(D_STR_NL, "newline encountered in string literal"); <S3>\"{RGX_STR}$ xyerror(D_STR_NL, "newline encountered in string literal"); <S0>\"{RGX_STR}\" |