Hi,
Changes in v3:
- Rebase
At the bottom is the range-diff. The only conflicts appeared in the
documentation, so I haven't re-tested.
As said in the v1 discussion, IMO, the interaction of this feature with
forward declarations of array parameters is fine, and the only problem
is in the forward declarations, not in _Countof(). The behavior is
consistent with related features in GCC.
Have a lovely night!
Alex
Alejandro Colomar (1):
c: Add support for array parameters in _Countof
gcc/c/c-typeck.cc | 50 ++++++++++--
gcc/doc/extend.texi | 10 +++
gcc/testsuite/gcc.dg/countof-compile.c | 8 +-
gcc/testsuite/gcc.dg/countof-param-compile.c | 78 +++++++++++++++++++
gcc/testsuite/gcc.dg/countof-param-pedantic.c | 11 +++
gcc/testsuite/gcc.dg/countof-param.c | 25 ++++++
6 files changed, 167 insertions(+), 15 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/countof-param-compile.c
create mode 100644 gcc/testsuite/gcc.dg/countof-param-pedantic.c
create mode 100644 gcc/testsuite/gcc.dg/countof-param.c
Range-diff against v2:
1: 120e200700d5 ! 1: 345284f5de11 c: Add support for array parameters in
_Countof
@@ gcc/doc/extend.texi: _Countof (int [7][n++]); // integer constant
expression
+@{
+ assert(n == _Countof(a));
+@}
-+@end smallexample
+
- @node Inline
- @section An Inline Function is As Fast As a Macro
- @cindex inline functions
+ @node _Maxof and _Minof
+ @subsection The maximum and minimum representable values of a type
+ @findex _Maxof
## gcc/testsuite/gcc.dg/countof-compile.c ##
@@ gcc/testsuite/gcc.dg/countof-compile.c: void
base-commit: a440b382e43203857de9195eb526c4a16f21ceb1
--
2.51.0