From: Chris Lattner Date: Sat, 25 Apr 2009 18:52:45 +0000 (+0000) Subject: improve a diagnostic to make more sense. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=740782a78386ad3c64c670ba9b1619545bbb4901;p=clang improve a diagnostic to make more sense. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70062 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index b9310db762..6e9cde8c30 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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">; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index b048f50c2d..658e84b067 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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. diff --git a/test/Sema/struct-decl.c b/test/Sema/struct-decl.c index 9d9f527870..b288850a73 100644 --- a/test/Sema/struct-decl.c +++ b/test/Sema/struct-decl.c @@ -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; };