[cfe-commits] r70062 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/Sema/struct-decl.c

Chris Lattner sabre at nondot.org
Sat Apr 25 11:52:46 PDT 2009


Author: lattner
Date: Sat Apr 25 13:52:45 2009
New Revision: 70062

URL: http://llvm.org/viewvc/llvm-project?rev=70062&view=rev
Log:
improve a diagnostic to make more sense.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/Sema/struct-decl.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=70062&r1=70061&r2=70062&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sat Apr 25 13:52:45 2009
@@ -874,8 +874,8 @@
 def err_field_declared_as_function : Error<"field %0 declared as a function">;
 def err_field_incomplete : Error<"field has incomplete type %0">;
 def ext_variable_sized_type_in_struct : ExtWarn<
-  "field of variable sized type %0 not at the end of a struct or class is a "
-  "GNU extension">;
+  "field %0 with variable sized type %1 not at the end of a struct or class is"
+  " a GNU extension">;
 
 def err_flexible_array_empty_struct : Error<
   "flexible array %0 not allowed in otherwise empty struct">;

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=70062&r1=70061&r2=70062&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Apr 25 13:52:45 2009
@@ -3930,7 +3930,7 @@
           // structures.
           if (i != NumFields-1)
             Diag(FD->getLocation(), diag::ext_variable_sized_type_in_struct)
-              << FD->getDeclName();
+              << FD->getDeclName() << FD->getType();
           else {
             // We support flexible arrays at the end of structs in
             // other structs as an extension.

Modified: cfe/trunk/test/Sema/struct-decl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/struct-decl.c?rev=70062&r1=70061&r2=70062&view=diff

==============================================================================
--- cfe/trunk/test/Sema/struct-decl.c (original)
+++ cfe/trunk/test/Sema/struct-decl.c Sat Apr 25 13:52:45 2009
@@ -29,7 +29,7 @@
  char tag_data[];
 };
 struct datatag {
- struct pppoe_tag hdr; //expected-warning{{field of variable sized type 'hdr' not at the end of a struct or class is a GNU extension}}
+ struct pppoe_tag hdr; //expected-warning{{field 'hdr' with variable sized type 'struct pppoe_tag' not at the end of a struct or class is a GNU extension}}
  char data;
 };
 





More information about the cfe-commits mailing list