[LLVMbugs] [Bug 24060] New: [ms] Come up with something clever for -Wignored-attributes on enums
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jul 7 21:24:42 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24060
Bug ID: 24060
Summary: [ms] Come up with something clever for
-Wignored-attributes on enums
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: nicolasweber at gmx.de
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150708/a8281c3e/attachment.html>
More information about the llvm-bugs
mailing list