diff options
author | Martin Liska <mliska@suse.cz> | 2022-10-08 10:19:23 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-10-08 10:19:23 +0200 |
commit | d9e7934d25da4a78ffef1f738206aa1d897911df (patch) | |
tree | 1bd1697c14259e095f4b4790946eae7df0c5a2e3 /gcc/testsuite/gcc.dg/strict-flex-array-1.c | |
parent | da0970e441345f8349522ff1abac5c223044ebb1 (diff) | |
parent | 6ffbf87ca66f4ed9cd79cff675fabe2109e46e85 (diff) | |
download | gcc-d9e7934d25da4a78ffef1f738206aa1d897911df.zip gcc-d9e7934d25da4a78ffef1f738206aa1d897911df.tar.gz gcc-d9e7934d25da4a78ffef1f738206aa1d897911df.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/testsuite/gcc.dg/strict-flex-array-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/strict-flex-array-1.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/strict-flex-array-1.c b/gcc/testsuite/gcc.dg/strict-flex-array-1.c new file mode 100644 index 0000000..5b8a793 --- /dev/null +++ b/gcc/testsuite/gcc.dg/strict-flex-array-1.c @@ -0,0 +1,33 @@ +/* testing the correct usage of attribute strict_flex_array. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + + +int x __attribute__ ((strict_flex_array (1))); /* { dg-error "'strict_flex_array' attribute may not be specified for 'x'" } */ + +int [[gnu::strict_flex_array(1)]] x; /* { dg-warning "'strict_flex_array' attribute does not apply to types" } */ + +struct trailing { + int a; + int c __attribute ((strict_flex_array)); /* { dg-error "wrong number of arguments specified for 'strict_flex_array' attribute" } */ +}; + +struct trailing_1 { + int a; + int b; + int c __attribute ((strict_flex_array (2))); /* { dg-error "'strict_flex_array' attribute may not be specified for a non-array field" } */ +}; + +extern int d; + +struct trailing_array_2 { + int a; + int b; + int c[1] __attribute ((strict_flex_array (d))); /* { dg-error "'strict_flex_array' attribute argument not an integer" } */ +}; + +struct trailing_array_3 { + int a; + int b; + int c[0] __attribute ((strict_flex_array (5))); /* { dg-error "'strict_flex_array' attribute argument '5' is not an integer constant between 0 and 3" } */ +}; |