ruby-changes:48149
From: kosaki <ko1@a...>
Date: Sat, 21 Oct 2017 22:01:56 +0900 (JST)
Subject: [ruby-changes:48149] kosaki:r60263 (trunk): kill variable set but not used warning
kosaki 2017-10-21 22:01:51 +0900 (Sat, 21 Oct 2017) New Revision: 60263 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60263 Log: kill variable set but not used warning Currently, dummy_mark variable makes following warnings. Let's fix it. ../../../ext/psych/yaml/parser.c: In function ?\226?\128?\152yaml_parser_parse_block_sequence_entry?\226?\128?\153: ../../../ext/psych/yaml/parser.c:762:21: warning: variable ?\226?\128?\152dummy_mark?\226?\128?\153 set but not used [-Wunused-but-set-variable] yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */ ^ Modified files: trunk/ext/psych/yaml/parser.c Index: ext/psych/yaml/parser.c =================================================================== --- ext/psych/yaml/parser.c (revision 60262) +++ ext/psych/yaml/parser.c (revision 60263) @@ -759,9 +759,8 @@ yaml_parser_parse_block_sequence_entry(y https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/parser.c#L759 else if (token->type == YAML_BLOCK_END_TOKEN) { - yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */ parser->state = POP(parser, parser->states); - dummy_mark = POP(parser, parser->marks); + (void)POP(parser, parser->marks); SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark); SKIP_TOKEN(parser); return 1; @@ -869,9 +868,8 @@ yaml_parser_parse_block_mapping_key(yaml https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/parser.c#L868 else if (token->type == YAML_BLOCK_END_TOKEN) { - yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */ parser->state = POP(parser, parser->states); - dummy_mark = POP(parser, parser->marks); + (void)POP(parser, parser->marks); MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark); SKIP_TOKEN(parser); return 1; @@ -952,7 +950,6 @@ yaml_parser_parse_flow_sequence_entry(ya https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/parser.c#L950 yaml_event_t *event, int first) { yaml_token_t *token; - yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */ if (first) { token = PEEK_TOKEN(parser); @@ -997,7 +994,7 @@ yaml_parser_parse_flow_sequence_entry(ya https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/parser.c#L994 } parser->state = POP(parser, parser->states); - dummy_mark = POP(parser, parser->marks); + (void)POP(parser, parser->marks); SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark); SKIP_TOKEN(parser); return 1; @@ -1104,7 +1101,6 @@ yaml_parser_parse_flow_mapping_key(yaml_ https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/parser.c#L1101 yaml_event_t *event, int first) { yaml_token_t *token; - yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */ if (first) { token = PEEK_TOKEN(parser); @@ -1158,7 +1154,7 @@ yaml_parser_parse_flow_mapping_key(yaml_ https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/parser.c#L1154 } parser->state = POP(parser, parser->states); - dummy_mark = POP(parser, parser->marks); + (void)POP(parser, parser->marks); MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark); SKIP_TOKEN(parser); return 1; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/