<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello Rafael,<br>
<br>
To get an idea of whether this is the right direction I've pushed
forward a little, once again derived from your work.<br>
<br>
The attached patch implements the full set of alias and weak
attribute checking to reject some accepts-invalid that existed
before, along with nice diagnostics.<br>
<br>
The errors match gcc but we diagnose them more logically, for
example:<br>
<br>
<pre><code>void f2() {}</code></pre>
<pre><code>void fun2(void) __attribute((alias("f2")));</code></pre>
<pre><code>void fun2() {}</code></pre>
<pre><code>
</code><code>test/Sema/alias-redefinition.c:12:6: error: redefinition of alias 'fun2'</code></pre>
<pre><code>void fun2() {}</code></pre>
<pre><code> ^</code></pre>
<pre><code>test/Sema/alias-redefinition.c:11:6: note: previous definition is here</code></pre>
<pre><code>void fun2(void) __attribute((alias("f2")));</code></pre>
<pre><code> ^ ~~~~~~~~~~~</code></pre>
<br>
<br>
Some of the main changes:<br>
<ul>
<li>Mark declarations generated by pragma weak as implicit.</li>
<li>Fix for FIXME: we should reject this (pr17640).</li>
<li>Fix for FIXME: Missing call to CheckFunctionDeclaration().</li>
<li>Treat aliases similarly to definitions.</li>
<li>Diagnose as error all explicit redefinitions and
redefinitions-by-alias</li>
<li>Diagnose as extension warning all implicit compiler
redefinitions and redefinitions-by-alias</li>
<li>Tests for each variation (some of these look similar but
exercise different code paths)</li>
</ul>
<br>
I'm still not 100% comfortable with the lookup and checking order
for pragma weak in SemaDeclAttr.cpp, so will continue working on
this a little longer while your initial patch lands.<br>
<br>
But I'm encouraged that these two language features are nearing
completion :-)<br>
<br>
Alp.<br>
<br>
<br>
<div class="moz-cite-prefix">On 21/10/2013 21:25, Rafael Espíndola
wrote:<br>
</div>
<blockquote
cite="mid:CAG3jRe+B0oU0+3RqL4q+jYoFXVRKsjghVJU5A-FVN=gEGgM1yQ@mail.gmail.com"
type="cite">
<pre wrap="">The attached patch causes clang to reject alias attributes that point
to undefined names. For example, with this patch we now reject
void f1(void) __attribute__((alias("g1")));
Unlike the previous patch this one is implemented in CodeGen. It is
quiet a bit simpler. The downside is that the errors only fire during
-emit-llvm.
Cheers,
Rafael
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.nuanti.com">http://www.nuanti.com</a>
the browser experts
</pre>
</body>
</html>