Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/gcc.dg/init-excess-2.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/gcc.dg/init-excess-2.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,48 @@ +/* Test for diagnostics about excess initializers when using a macro + defined in a system header: + c/71115 - Missing warning: excess elements in struct initializer. */ +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-require-effective-target int32plus } */ + +#include <stddef.h> + +int* a[1] = { + 0, + NULL /* { dg-warning "excess elements|near init" } */ +}; + +const char str[1] = { + 0, + NULL /* { dg-warning "excess elements|near init" } */ +}; + +struct S { + int *a; +} s = { + 0, + NULL /* { dg-warning "excess elements|near init" } */ +}; + +struct __attribute__ ((designated_init)) S2 { + int *a; +} s2 = { + NULL /* { dg-warning "positional initialization|near init" } */ +}; + +union U { + int *a; +} u = { + 0, + NULL /* { dg-warning "excess elements|near init" } */ +}; + +int __attribute__ ((vector_size (16))) ivec = { + 0, 0, 0, 0, + NULL /* { dg-warning "excess elements|near init" } */ +}; + +int* scal = { + 0, + NULL /* { dg-warning "excess elements|near init" } */ +};