[cfe-commits] r105011 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseDecl.cpp test/CodeGen/typedef-func.c test/Sema/enum.c test/Sema/function-redecl.c

Eli Friedman eli.friedman at gmail.com
Fri May 28 15:34:31 PDT 2010


On Fri, May 28, 2010 at 3:23 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Fri May 28 17:23:22 2010
> New Revision: 105011
>
> URL: http://llvm.org/viewvc/llvm-project?rev=105011&view=rev
> Log:
> Empty enum in c is now error to match gcc's behavior.
> (radar 8040068).
>
>
> Modified:
>    cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>    cfe/trunk/lib/Parse/ParseDecl.cpp
>    cfe/trunk/test/CodeGen/typedef-func.c
>    cfe/trunk/test/Sema/enum.c
>    cfe/trunk/test/Sema/function-redecl.c
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=105011&r1=105010&r2=105011&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri May 28 17:23:22 2010
> @@ -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">;

Umm, maybe change the text of the error message?  It's kind of
confusing to complain about a nonexistent union :)

-Eli

>  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">;
>
> Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=105011&r1=105010&r2=105011&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Fri May 28 17:23:22 2010
> @@ -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;
>
>
> Modified: cfe/trunk/test/CodeGen/typedef-func.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/typedef-func.c?rev=105011&r1=105010&r2=105011&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/typedef-func.c (original)
> +++ cfe/trunk/test/CodeGen/typedef-func.c Fri May 28 17:23:22 2010
> @@ -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 *);
>
>
> Modified: cfe/trunk/test/Sema/enum.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/enum.c?rev=105011&r1=105010&r2=105011&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/enum.c (original)
> +++ cfe/trunk/test/Sema/enum.c Fri May 28 17:23:22 2010
> @@ -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}}
>
> Modified: cfe/trunk/test/Sema/function-redecl.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function-redecl.c?rev=105011&r1=105010&r2=105011&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/function-redecl.c (original)
> +++ cfe/trunk/test/Sema/function-redecl.c Fri May 28 17:23:22 2010
> @@ -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) {}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list