diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-07-27 11:47:47 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-07-27 11:47:47 +0300 |
commit | 30e8a37825c9b9e67c0cf440f7617508b7898c2b (patch) | |
tree | 81df2faabd09de798f93c73b07a0e961f4674e5e /awkgram.y | |
parent | 3ddc932b0a808a4f5f55519ccf1d65f6caa41666 (diff) | |
download | egawk-30e8a37825c9b9e67c0cf440f7617508b7898c2b.tar.gz egawk-30e8a37825c9b9e67c0cf440f7617508b7898c2b.tar.bz2 egawk-30e8a37825c9b9e67c0cf440f7617508b7898c2b.zip |
Add lint warning for `print "foo" > "foo" 1'.
Diffstat (limited to 'awkgram.y')
-rw-r--r-- | awkgram.y | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1296,6 +1296,8 @@ output_redir && $3->lasti->opcode == Op_K_getline_redir && $3->lasti->redir_type == redirect_twoway) yyerror(_("multistage two-way pipelines don't work")); + if (do_lint && $1->redir_type == redirect_output && $3->lasti->opcode == Op_concat) + lintwarn(_("concatenation as I/O `>' redirection target is ambiguous")); $$ = list_prepend($3, $1); } ; @@ -1729,10 +1731,11 @@ non_post_simp_exp } | '(' exp r_paren { - if (do_pretty_print) - $$ = list_append($2, bcalloc(Op_parens, 1, sourceline)); - else - $$ = $2; + // Always include. Allows us to lint warn on + // print "foo" > "bar" 1 + // but not warn on + // print "foo" > ("bar" 1) + $$ = list_append($2, bcalloc(Op_parens, 1, sourceline)); } | LEX_BUILTIN '(' opt_fcall_expression_list r_paren { |