[前][次][番号順一覧][スレッド一覧]

ruby-changes:32924

From: nobu <ko1@a...>
Date: Sun, 16 Feb 2014 16:53:26 +0900 (JST)
Subject: [ruby-changes:32924] nobu:r45003 (trunk): ext/psych/yaml: suppress warnings

nobu	2014-02-16 16:53:20 +0900 (Sun, 16 Feb 2014)

  New Revision: 45003

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45003

  Log:
    ext/psych/yaml: suppress warnings
    
    * ext/psych/yaml/emitter.c (WRITE_BREAK, PUT_BREAK): suppress
      unused-value warnings.
    
    * ext/psych/yaml/parser.c, ext/psych/yaml/scanner.c: suppress
      unused-but-set-variable warnings.
    
    * ext/psych/yaml/yaml_private.h (STACK_EMPTY): ditto.

  Modified files:
    trunk/ext/psych/yaml/emitter.c
    trunk/ext/psych/yaml/parser.c
    trunk/ext/psych/yaml/scanner.c
    trunk/ext/psych/yaml/yaml_private.h
Index: ext/psych/yaml/yaml_private.h
===================================================================
--- ext/psych/yaml/yaml_private.h	(revision 45002)
+++ ext/psych/yaml/yaml_private.h	(revision 45003)
@@ -433,7 +433,8 @@ yaml_queue_extend(void **start, void **h https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/yaml_private.h#L433
      (stack).start = (stack).top = (stack).end = 0)
 
 #define STACK_EMPTY(context,stack)                                              \
-    ((stack).start == (stack).top)
+    ((void)(context),                                                           \
+     ((stack).start == (stack).top))
 
 #define STACK_LIMIT(context,stack,size)                                         \
     ((stack).top - (stack).start < (size) ?                                     \
Index: ext/psych/yaml/emitter.c
===================================================================
--- ext/psych/yaml/emitter.c	(revision 45002)
+++ ext/psych/yaml/emitter.c	(revision 45003)
@@ -53,7 +53,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/emitter.c#L53
 #define WRITE_BREAK(emitter,string)                                             \
     (FLUSH(emitter)                                                             \
      && (CHECK(string,'\n') ?                                                   \
-         (PUT_BREAK(emitter),                                                   \
+         ((void)PUT_BREAK(emitter),                                             \
           string.pointer ++,                                                    \
           1) :                                                                  \
          (COPY(emitter->buffer,string),                                         \
Index: ext/psych/yaml/scanner.c
===================================================================
--- ext/psych/yaml/scanner.c	(revision 45002)
+++ ext/psych/yaml/scanner.c	(revision 45003)
@@ -1193,11 +1193,9 @@ yaml_parser_increase_flow_level(yaml_par https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/scanner.c#L1193
 static int
 yaml_parser_decrease_flow_level(yaml_parser_t *parser)
 {
-    yaml_simple_key_t dummy_key;    /* Used to eliminate a compiler warning. */
-
     if (parser->flow_level) {
         parser->flow_level --;
-        dummy_key = POP(parser, parser->simple_keys);
+        (void)POP(parser, parser->simple_keys);
     }
 
     return 1;
Index: ext/psych/yaml/parser.c
===================================================================
--- ext/psych/yaml/parser.c	(revision 45002)
+++ ext/psych/yaml/parser.c	(revision 45003)
@@ -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/

[前][次][番号順一覧][スレッド一覧]