https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112013-01-30T05:32:43ZRuby Issue Tracking SystemRuby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=357062013-01-30T05:32:43Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>Hm, maybe we need another workaround.<br>
Does <strong>attribute</strong> (unused) works on your compiler?</p>
<p>likes</p>
<p>#ifdef <strong>GNUC</strong><br>
#define UNINITIALIZED_VAR(x) x <strong>attribute</strong> (unused) = x<br>
#else<br>
....</p> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=357102013-01-30T08:53:41Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>=begin<br>
This patch works:</p>
<a name="Index-vm_coreh"></a>
<h1 >Index: vm_core.h<a href="#Index-vm_coreh" class="wiki-anchor">¶</a></h1>
<p>--- vm_core.h (revision 38980)<br>
+++ vm_core.h (working copy)<br>
@@ -116,7 +116,7 @@<br>
#endif /* <strong>GNUC</strong> >= 3 */</p>
<p>#if <strong>GNUC</strong> >= 3<br>
-#define UNINITIALIZED_VAR(x) x = x<br>
+#define UNINITIALIZED_VAR(x) x <strong>attribute</strong>((unused))<br>
#else<br>
#define UNINITIALIZED_VAR(x) x<br>
#endif<br>
=end</p> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=363592013-02-17T13:50:01Zko1 (Koichi Sasada)
<ul><li><strong>Assignee</strong> set to <i>mame (Yusuke Endoh)</i></li></ul><p>mame-san, how about it?</p> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=363892013-02-17T14:44:45Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Target version</strong> changed from <i>2.0.0</i> to <i>2.6</i></li></ul><p>It emits just a warning, not an error, right?<br>
Looks not significant.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=364482013-02-18T02:31:23Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>It is only a warning</p> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=375202013-03-12T09:23:52Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>=begin<br>
Unfortunately, it doesn't shut up gcc-4.7.</p>
<p>thread.c: In function 'do_select':<br>
thread.c:3155:26: warning: 'orig_except.fdset' may be used uninitialized in this function [-Wmaybe-uninitialized]<br>
thread.c:3352:16: note: 'orig_except.fdset' was declared here<br>
thread.c:3229:19: warning: 'orig_except.maxfd' may be used uninitialized in this function [-Wmaybe-uninitialized]<br>
thread.c:3352:16: note: 'orig_except.maxfd' was declared here<br>
thread.c:3155:26: warning: 'orig_write.fdset' may be used uninitialized in this function [-Wmaybe-uninitialized]<br>
thread.c:3351:16: note: 'orig_write.fdset' was declared here<br>
thread.c:3229:19: warning: 'orig_write.maxfd' may be used uninitialized in this function [-Wmaybe-uninitialized]<br>
thread.c:3351:16: note: 'orig_write.maxfd' was declared here<br>
thread.c:3155:26: warning: 'orig_read.fdset' may be used uninitialized in this function [-Wmaybe-uninitialized]<br>
thread.c:3350:16: note: 'orig_read.fdset' was declared here<br>
thread.c:3229:19: warning: 'orig_read.maxfd' may be used uninitialized in this function [-Wmaybe-uninitialized]<br>
thread.c:3350:16: note: 'orig_read.maxfd' was declared here<br>
=end</p> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=375252013-03-12T15:10:42Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>GCC 4.6 and clang (2.8?) supports pragma diagnostic, but its syntax is different from current UNINITIALIZED_VAR().</p>
<p>#pragma GCC diagnostic push<br>
#pragma GCC diagnostic ignored "-Wuninitialized"<br>
blah blah<br>
#pragma GCC diagnostic pop</p>
<p><a href="http://gcc.gnu.org/gcc-4.6/changes.html" class="external">http://gcc.gnu.org/gcc-4.6/changes.html</a><br>
<a href="http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html" class="external">http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html</a><br>
<a href="http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas" class="external">http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas</a></p> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=377412013-03-20T02:11:51Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>A macro can be following, but it still changes syntax from current UNINITIALIZED_VAR.</p>
<p>#if GCC_VERSION_SINCE(4,6,0) || defined(<strong>clang</strong>)</p>
<a name="define-SUPPRESS_DIAGNOSTICargrest-"></a>
<h1 >define SUPPRESS_DIAGNOSTIC(arg,rest) \<a href="#define-SUPPRESS_DIAGNOSTICargrest-" class="wiki-anchor">¶</a></h1>
<pre><code> _Pragma("GCC diagnostic push") \
_Pragma(STRINGIZE(GCC diagnostic ignored arg)) \
rest \
_Pragma("GCC diagnostic pop")
</code></pre>
<p>#else</p>
<a name="define-SUPPRESS_DIAGNOSTICargrest-rest"></a>
<h1 >define SUPPRESS_DIAGNOSTIC(arg,rest) rest<a href="#define-SUPPRESS_DIAGNOSTICargrest-rest" class="wiki-anchor">¶</a></h1>
<p>#endif</p> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=377832013-03-21T13:50:40Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Subject</strong> changed from <i>clang 3.2 sees through UNINITIALIZED_VAR macro, gives warning</i> to <i>clang 4.2 sees through UNINITIALIZED_VAR macro, gives warning</i></li></ul> Ruby master - Bug #7756: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://redmine.ruby-lang.org/issues/7756?journal_id=377842013-03-21T13:50:54Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r39855.<br>
Eric, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>vm_core.h: suppress warnings</p>
<ul>
<li>vm_core.h (UNINITIALIZED_VAR): suppress warnings by clang 4.2.<br>
<a href="/issues/7756">[ruby-core:51742]</a> [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: clang 4.2 sees through UNINITIALIZED_VAR macro, gives warning (Closed)" href="https://redmine.ruby-lang.org/issues/7756">#7756</a>]</li>
</ul>