Hi! v7:
- Tests: - Fix 2 tests (whitespace fix). - Fix typo in comment. Alejandro Colomar (3): gcc/: Rename array_type_nelts() => array_type_nelts_minus_one() Merge definitions of array_type_nelts_top() c: Add __lengthof__ operator gcc/c-family/c-common.cc | 26 ++++ gcc/c-family/c-common.def | 3 + gcc/c-family/c-common.h | 2 + gcc/c/c-decl.cc | 30 +++-- gcc/c/c-fold.cc | 7 +- gcc/c/c-parser.cc | 61 +++++++--- gcc/c/c-tree.h | 4 + gcc/c/c-typeck.cc | 118 ++++++++++++++++++- gcc/config/aarch64/aarch64.cc | 2 +- gcc/config/i386/i386.cc | 2 +- gcc/cp/cp-tree.h | 1 - gcc/cp/decl.cc | 2 +- gcc/cp/init.cc | 8 +- gcc/cp/lambda.cc | 3 +- gcc/cp/operators.def | 1 + gcc/cp/tree.cc | 13 -- gcc/doc/extend.texi | 31 +++++ gcc/expr.cc | 8 +- gcc/fortran/trans-array.cc | 2 +- gcc/fortran/trans-openmp.cc | 4 +- gcc/rust/backend/rust-tree.cc | 13 -- gcc/rust/backend/rust-tree.h | 2 - gcc/target.h | 3 + gcc/testsuite/gcc.dg/lengthof-compile.c | 115 ++++++++++++++++++ gcc/testsuite/gcc.dg/lengthof-vla.c | 46 ++++++++ gcc/testsuite/gcc.dg/lengthof.c | 150 ++++++++++++++++++++++++ gcc/tree.cc | 17 ++- gcc/tree.h | 3 +- 28 files changed, 598 insertions(+), 79 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/lengthof-compile.c create mode 100644 gcc/testsuite/gcc.dg/lengthof-vla.c create mode 100644 gcc/testsuite/gcc.dg/lengthof.c Range-diff against v6: 1: 8b68e250503 = 1: 8b68e250503 gcc/: Rename array_type_nelts() => array_type_nelts_minus_one() 2: 21433097103 = 2: 21433097103 Merge definitions of array_type_nelts_top() 3: 71fd2013967 ! 3: 4bd3837d09c c: Add __lengthof__ operator @@ gcc/testsuite/gcc.dg/lengthof-compile.c (new) + int n = 7; + + _Static_assert (__lengthof__ (int [3][n]) == 3); -+ _Static_assert (__lengthof__ (int [n][3]) == 7); /* { dg-error "not constant"} */ ++ _Static_assert (__lengthof__ (int [n][3]) == 7); /* { dg-error "not constant" } */ + _Static_assert (__lengthof__ (int [0][3]) == 0); + _Static_assert (__lengthof__ (int [0]) == 0); + -+ /* FIXME: lengthog(int [0][n]) should result in a constant expression. */ -+ _Static_assert (__lengthof__ (int [0][n]) == 0); /* { dg-error "not constant"} */ ++ /* FIXME: lengthof(int [0][n]) should result in a constant expression. */ ++ _Static_assert (__lengthof__ (int [0][n]) == 0); /* { dg-error "not constant" } */ +} ## gcc/testsuite/gcc.dg/lengthof-vla.c (new) ## -- 2.45.2
signature.asc
Description: PGP signature