<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Add diagnostics for "static" function without keyword, "virtual" function without keyword"
href="http://llvm.org/bugs/show_bug.cgi?id=16097">16097</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Add diagnostics for "static" function without keyword, "virtual" function without keyword
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>arthur.j.odwyer@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=10561" name="attach_10561" title="patch for "definition of %0 is missing the 'static' keyword"">attachment 10561</a> <a href="attachment.cgi?id=10561&action=edit" title="patch for "definition of %0 is missing the 'static' keyword"">[details]</a></span>
patch for "definition of %0 is missing the 'static' keyword"
We'd like to be able to diagnose the following two coding-standard violations
directly from Clang:
(1)
static void foo();
/* ... */
void foo()
{
/* ... */
}
(2)
class B {
virtual void bar();
};
class C : B {
void bar();
};
In example #1, foo() is silently treated as "static". In example #2, B::bar()
is silently treated as "virtual". This is all conforming, of course; but we'd
like to get a compiler diagnostic when it happens, so that we can keep our code
clean.
We've actually patched our local copy of Clang to handle #1 already. I've
attached the patch. However, this patch shouldn't be accepted as-is. It turns
on the warning by default, doesn't add any -Wdiagnostic-group, and doesn't add
any test cases. I would be willing to do that work, if I were assured that the
patch would get accepted into mainline. We would prefer not to have to use a
patched Clang indefinitely.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>