diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2026-05-26 17:51:44 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2026-05-26 21:57:20 -0700 |
| commit | 225876e97999664a075eb6f1489b4b4c8e515ded (patch) | |
| tree | 87ef4401231a27883205d68c05b8abf76986436d /admin | |
| parent | 834ff524f98024cbf30771df3849a5d9241ab2e2 (diff) | |
ARRAYELTS → countof
C2y will standardize countof as the macro that Emacs uses the name
ARRAYELTS for. Switch to the standard name, which is supported
by GCC 16+, by Clang 21, and by the Gnulib stdcountof-h module already
in use for compilers that do not support countof.
Also, use countof in a few places where we missed using ARRAYELTS.
* admin/coccinelle/arrayelts.cocci: Suggest countof, not ARRAYELTS.
* admin/merge-gnulib (GNULIB_MODULES): Add stdcountof-h,
as it is now a direct rather than an indirect dependency.
* exec/trace.c, src/lisp.h, src/sfnt.c: Include <stdcountof.h>.
(ARRAYELTS): Remove. All uses replaced by countof.
* lib-src/ebrowse.c, lib-src/etags.c, lib-src/make-docfile.c:
* lib-src/seccomp-filter.c, lwlib/lwlib-Xaw.c:
Prefer <stdcountof.h> and countof to doing things by hand.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/coccinelle/arrayelts.cocci | 8 | ||||
| -rwxr-xr-x | admin/merge-gnulib | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/admin/coccinelle/arrayelts.cocci b/admin/coccinelle/arrayelts.cocci index 5376a94bd85..9e1e0e64a9d 100644 --- a/admin/coccinelle/arrayelts.cocci +++ b/admin/coccinelle/arrayelts.cocci @@ -1,21 +1,21 @@ -// Use the ARRAYELTS macro where possible. +// Use the countof macro where possible. @@ type T; T[] E; @@ - (sizeof (E) / sizeof (E[...])) -+ ARRAYELTS (E) ++ countof (E) @@ type T; T[] E; @@ - (sizeof (E) / sizeof (T)) -+ ARRAYELTS (E) ++ countof (E) @@ type T; T[] E; @@ - (sizeof (E) / sizeof (*E)) -+ ARRAYELTS (E) ++ countof (E) diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 20cea5b41e4..8c906d34cef 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -50,7 +50,7 @@ GNULIB_MODULES=' qcopy-acl readlink readlinkat realloc-posix regex sig2str sigdescr_np socklen stat-time std-gnu23 stdc_bit_width stdc_count_ones stdc_trailing_zeros - stdckdint-h stddef-h stdio-h stdio-windows + stdckdint-h stdcountof-h stddef-h stdio-h stdio-windows stpcpy streq strnlen strtoimax symlink sys_stat-h sys_time-h tempname time-h time_r time_rz timegm timer-time timespec-add timespec-sub unlocked-io update-copyright utimensat |
