]> granicus.if.org Git - clang/commitdiff
improve a diagnostic to make more sense.
authorChris Lattner <sabre@nondot.org>
Sat, 25 Apr 2009 18:52:45 +0000 (18:52 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 25 Apr 2009 18:52:45 +0000 (18:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70062 91177308-0d34-0410-b5e6-96231b3b80d8

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

index b9310db762815b71dd4458e97928bd2ac2330060..6e9cde8c306eba234a0ba4fd301bf62de5204ff0 100644 (file)
@@ -874,8 +874,8 @@ def err_func_returning_array_function : Error<
 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">;
index b048f50c2db718e671e7d68da42ccad02d8d14c0..658e84b067b5876780f24ad4d8f317d9c213a5bf 100644 (file)
@@ -3930,7 +3930,7 @@ void Sema::ActOnFields(Scope* S,
           // 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.
index 9d9f52787051547577374a70ef5205ffd459122a..b288850a731af92de174bd37e9a765359a231226 100644 (file)
@@ -29,7 +29,7 @@ struct pppoe_tag {
  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;
 };