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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to