]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
stdcountof-h: Tweaks.
authorBruno Haible <bruno@clisp.org>
Mon, 2 Jun 2025 22:48:06 +0000 (00:48 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 2 Jun 2025 22:48:06 +0000 (00:48 +0200)
Reported by Alejandro Colomar <alx@kernel.org>.

* lib/stdcountof.in.h (countof): Parenthesize better.
* modules/stdcountof-h (Description): To appear in C2y, not C23.

ChangeLog
lib/stdcountof.in.h
modules/stdcountof-h

index 7f5017392493f343d98b8f3a5b3aeae4928144d0..fc7b56a69abcc2d2df1e5c11b548c8edf10c7218 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2025-06-02  Bruno Haible  <bruno@clisp.org>
 
+       stdcountof-h: Tweaks.
+       Reported by Alejandro Colomar <alx@kernel.org>.
+       * lib/stdcountof.in.h (countof): Parenthesize better.
+       * modules/stdcountof-h (Description): To appear in C2y, not C23.
+
        stdcountof-h: Add tests.
        * tests/test-stdcountof-h.c: New file.
        * tests/test-stdcountof-h-c++.cc: New file.
index 3bbb78390ac62f69804549b64eb9a60a1ff8b7f5..af62b4d45bfefb8a2f55d23c61ee45cc64eb3e3d 100644 (file)
@@ -33,7 +33,7 @@
      void func (int a[10]) { ... }
  */
 #define countof(a) \
-  (sizeof (a) / sizeof (a[0]) + 0 * _gl_verify_is_array (a))
+  (sizeof (a) / sizeof ((a)[0]) + 0 * _gl_verify_is_array (a))
 
 /* Attempts to verify that A is an array.  */
 #if defined __cplusplus
index 1408e5ea2b044ce0a92c580b5f56ac0fb504f350..e8fa2775975e46a4898ce96351b3bf408a10cdf9 100644 (file)
@@ -1,5 +1,5 @@
 Description:
-An <stdcountof.h> that is like C23.
+An <stdcountof.h> that is like C2y.
 
 Files:
 lib/stdcountof.in.h