<html>
<head>
<base href="https://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 --- - [ms] Come up with something clever for -Wignored-attributes on enums" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24060&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=75eZYS1Nj-IicdBkoUEjFfafkaW8DBLzJrQ50568ONo&s=l896qasZRQZgY7nHVtqveY3KKhynWiETpJM6s7VIFjo&e=">24060</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ms] Come up with something clever for -Wignored-attributes on enums
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>nicolasweber@gmx.de
</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>In ms mode, clang warns on
enum __declspec(dllexport) foo { a, b, c };
saying that the dllexport has no effect on the enum. This is true. However,
it's common to do something like this:
#ifdef _MSC_VER
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __attribute__((visibility("default")))
#endif
EXPORT void myfunction();
while building a module that should export myfunction (with -fvisibility=hidden
on posix).
Now imagine that someone writes
enum EXPORT myenum { a, b, c };
This now warns in MS mode but not on posix. I thought it's just a bug that we
don't warn on this in posix, but having a visibility attribute on an enum does
have a semantic effect. Consider:
#define HIDDEN __attribute__((visibility("hidden")))
enum HIDDEN E { E0 };
struct A {
template <E> static void foo() {}
};
void test() {
A::foo<E0>();
}
Without the HIDDEN on the enum, A::foo<E0>() would be public, but with the
HIDDEN it can be a hidden symbol.
So I'm not sure what to do here, but having a warning that fires in MS mode on
`enum FOO_EXPORT E {};` while that's potentially misleading in posix mode isn't
ideal.</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>