Empty enum in c is now error to match gcc's behavior.
(radar 8040068).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105011 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index 934bd0d..50427cc 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -35,6 +35,7 @@
def ext_empty_struct_union_enum : Extension<"use of empty %0 extension">;
+def error_empty_enum : Error<"use of empty union">;
def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
def err_invalid_short_spec : Error<"'short %0' is invalid">;
def err_invalid_long_spec : Error<"'long %0' is invalid">;
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 3e7d4a1..76da135 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2013,7 +2013,7 @@
// C does not allow an empty enumerator-list, C++ does [dcl.enum].
if (Tok.is(tok::r_brace) && !getLang().CPlusPlus)
- Diag(Tok, diag::ext_empty_struct_union_enum) << "enum";
+ Diag(Tok, diag::error_empty_enum);
llvm::SmallVector<DeclPtrTy, 32> EnumConstantDecls;
diff --git a/test/CodeGen/typedef-func.c b/test/CodeGen/typedef-func.c
index bc08b35..1467e8b 100644
--- a/test/CodeGen/typedef-func.c
+++ b/test/CodeGen/typedef-func.c
@@ -2,7 +2,7 @@
// PR2414
struct mad_frame{};
-enum mad_flow {};
+enum mad_flow {ont};
typedef enum mad_flow filter_func_t(void *, struct mad_frame *);
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index ba4e56b..4a5771d 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -51,7 +51,7 @@
}
// PR2416
-enum someenum {}; // expected-warning {{use of empty enum extension}}
+enum someenum {}; // expected-error {{use of empty union}}
// <rdar://problem/6093889>
enum e0 { // expected-note {{previous definition is here}}
diff --git a/test/Sema/function-redecl.c b/test/Sema/function-redecl.c
index 633ad21..27ec163 100644
--- a/test/Sema/function-redecl.c
+++ b/test/Sema/function-redecl.c
@@ -126,6 +126,6 @@
x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int' to parameter of type 'int *'}}
}
-enum e0 {};
+enum e0 {one};
void f3();
void f3(enum e0 x) {}