[cfe-commits] r65253 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def test/Sema/struct-decl.c
Daniel Dunbar
daniel at zuster.org
Sat Feb 21 16:48:07 PST 2009
This was intentionally changed recently to allow supporting this
construct. I think the right fix is to make this work in ExprConstant
and so on.
See: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090209/012076.html
Personally I still think we should reject it.
- Daniel
On Sat, Feb 21, 2009 at 4:20 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> Author: efriedma
> Date: Sat Feb 21 18:20:44 2009
> New Revision: 65253
>
> URL: http://llvm.org/viewvc/llvm-project?rev=65253&view=rev
> Log:
> Sanity fix for PR3642: if we're treating a diagnostic as an error, it's
> required to actually be an error for correctness. The attached testcase
> now gives an error instead of mysteriously crashing.
>
> Now, it's possible we actually want to support the given usage, but I
> haven't looked at the relevant code closely.
>
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
> cfe/trunk/test/Sema/struct-decl.c
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def?rev=65253&r1=65252&r2=65253&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def Sat Feb 21 18:20:44 2009
> @@ -728,7 +728,7 @@
> "field %0 declared as a function")
> DIAG(err_field_incomplete, ERROR,
> "field has incomplete type %0")
> -DIAG(err_variable_sized_type_in_struct, EXTENSION,
> +DIAG(err_variable_sized_type_in_struct, ERROR,
> "variable sized type %0 must be at end of struct or class")
> DIAG(err_flexible_array_empty_struct, ERROR,
> "flexible array %0 not allowed in otherwise empty struct")
>
> Modified: cfe/trunk/test/Sema/struct-decl.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/struct-decl.c?rev=65253&r1=65252&r2=65253&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Sema/struct-decl.c (original)
> +++ cfe/trunk/test/Sema/struct-decl.c Sat Feb 21 18:20:44 2009
> @@ -22,3 +22,14 @@
> struct st *f;
> return f->v + f[0].v;
> }
> +
> +// PR3642
> +struct pppoe_tag {
> + short tag_type;
> + char tag_data[];
> +};
> +struct datatag {
> + struct pppoe_tag hdr; //expected-error{{variable sized type 'hdr' must be at end of struct}}
> + char data;
> +};
> +
>
>
> _______________________________________________
> 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