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

ruby-changes:44948

From: shugo <ko1@a...>
Date: Thu, 8 Dec 2016 08:48:05 +0900 (JST)
Subject: [ruby-changes:44948] shugo:r57021 (trunk): Add volatile to a suppress warning.

shugo	2016-12-08 08:47:59 +0900 (Thu, 08 Dec 2016)

  New Revision: 57021

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57021

  Log:
    Add volatile to a suppress warning.
    
    Without the fix, the following warning is shown:
    
        compiling cont.c
        cont.c: In function ?\226?\128?\152rb_callcc?\226?\128?\153:
        cont.c:949:39: warning: passing argument 1 of ?\226?\128?\152cont_capture?\226?\128?\153 discards ?\226?\128?\152volatile?\226?\128?\153 qualifier from pointer target type [-Wdiscarded-qualifiers]
     volatile VALUE val = cont_capture(&called);
       ^
        cont.c:473:1: note: expected ?\226?\128?\152int * volatile?\226?\128?\153 but argument is of type ?\226?\128?\152volatile int *?\226?\128?\153
         cont_capture(int *volatile stat)
         ^

  Modified files:
    trunk/cont.c
Index: cont.c
===================================================================
--- cont.c	(revision 57020)
+++ cont.c	(revision 57021)
@@ -161,7 +161,7 @@ static VALUE rb_eFiberError; https://github.com/ruby/ruby/blob/trunk/cont.c#L161
     if (!(ptr)) rb_raise(rb_eFiberError, "uninitialized fiber"); \
 } while (0)
 
-NOINLINE(static VALUE cont_capture(int *volatile stat));
+NOINLINE(static VALUE cont_capture(volatile int *volatile stat));
 
 #define THREAD_MUST_BE_RUNNING(th) do { \
 	if (!(th)->tag) rb_raise(rb_eThreadError, "not running thread");	\
@@ -470,7 +470,7 @@ cont_new(VALUE klass) https://github.com/ruby/ruby/blob/trunk/cont.c#L470
 }
 
 static VALUE
-cont_capture(int *volatile stat)
+cont_capture(volatile int *volatile stat)
 {
     rb_context_t *volatile cont;
     rb_thread_t *th = GET_THREAD();

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

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