[Bug #1692] warning: useless use of a literal in void context

Bug #1692: warning: useless use of a literal in void context
http://redmine.ruby-lang.org/issues/show/1692

e$B5/I<<Te(B: Kazuhiro NISHIYAMA
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
ruby -v: ruby 1.9.2dev (2009-06-24 trunk 23837) [i686-linux]

1.8 e$B$G$Oe(B
warning: useless use of a literal in void context
e$B$,=P$k$H$-$Ke(B 1.9 e$B$@$H2?$b=P$^$;$s!#e(B

% ruby18 -ve ‘1’
ruby 1.8.8dev (2009-06-23 revision 23825) [i686-linux]
-e:1: warning: useless use of a literal in void context
% ruby-trunk -ve ‘1’
ruby 1.9.2dev (2009-06-24 trunk 23837) [i686-linux]
%

e$B%A%1%C%He(B #1692 e$B$,99?7$5$l$^$7$?!#e(B (by Yukihiro M.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r23864.

http://redmine.ruby-lang.org/issues/show/1692

e$B%A%1%C%He(B #1692 e$B$,99?7$5$l$^$7$?!#e(B (by Yukihiro M.)

e$B%9%F!<%?%9e(B Closede$B$+$ie(BOpene$B$KJQ99e(B

wrong ML ref

http://redmine.ruby-lang.org/issues/show/1692

e$B%A%1%C%He(B #1692 e$B$,99?7$5$l$^$7$?!#e(B (by Yuki S.)

e$BC4Ev<Te(B Yukihiro M.e$B$K%;%C%He(B
Target version 1.9.2e$B$K%;%C%He(B

e$B0U?^$5$l$?$3$H$G$7$g$&$+e(B? < e$B$^$D$b$H$5$se(B

http://redmine.ruby-lang.org/issues/show/1692

e$B%A%1%C%He(B #1692 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

This issue was solved with changeset r27504.
Kazuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


http://redmine.ruby-lang.org/issues/show/1692

e$B%A%1%C%He(B #1692 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$BC4Ev<Te(B Yukihiro M.e$B$+$ie(BNobuyoshi N.e$B$KJQ99e(B

e$B1sF#$G$9!#e(B

r23474 e$B$N1F6A$N$h$&$G!"0U?^$5$l$?$3$H$G$O$J$$$H;W$$$^$9!#e(B

e$B%Q%C%A$K$O$“$^$j<+?.$”$j$^$;$s$,!"$J$+$@$5$s$I$&$G$7$g$&$+!#e(B

diff --git a/parse.y b/parse.y
index c88a727…cb49fa1 100644
— a/parse.y
+++ b/parse.y
@@ -785,8 +785,7 @@ static void token_info_pop(struct parser_params*,
const char token);
program : {
lex_state = EXPR_BEG;
/
%%%*/

  •  $<num>$ = compile_for_eval || rb_parse_in_main();
    
  •  local_push($<num>$);
    
  •  local_push(compile_for_eval || rb_parse_in_main());
       /*%
     local_push(0);
       %*/
    

@@ -794,7 +793,7 @@ program : {
top_compstmt
{
/%%%/

  •  if ($2 && !$<num>1) {
    
  •  if ($2 && !compile_for_eval) {
         /* last expression should not be void */
         if (nd_type($2) != NODE_BLOCK) void_expr($2);
         else {
    


Yusuke E. [email protected]

http://redmine.ruby-lang.org/issues/show/1692