On Solaris 11.4 I see this warning, from "gcc -Wall -Wshadow=local":

In file included from ../../gllib/nstrftime.c:19:0:
../../gllib/strftime.c: In function ‘__strftime_internal’:
../../gllib/strftime.c:1662:41: warning: declaration of ‘p’ shadows a previous 
local [-Wshadow=local]
                             const char *p;
                                         ^
../../gllib/strftime.c:1250:21: note: shadowed declaration is here
   STREAM_OR_CHAR_T *p = s;
                     ^

This patch fixes it.


2025-11-18  Bruno Haible  <[email protected]>

        nstrftime, fprintftime: Fix a -Wshadow=local warning (regr. 2024-02-08).
        * lib/strftime.c (__strftime_internal): Rename a local variable.

diff --git a/lib/strftime.c b/lib/strftime.c
index 6445d6e3d2..fde7e6f7da 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -1659,10 +1659,10 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
                           {
                             /* The last word has length >= 3.  */
                             bool found_letter = false;
-                            const char *p;
-                            for (p = space + 1; *p != '\0'; p++)
-                              if ((*p >= 'A' && *p <= 'Z')
-                                  || (*p >= 'a' && *p <= 'z'))
+                            const char *wp;
+                            for (wp = space + 1; *wp != '\0'; wp++)
+                              if ((*wp >= 'A' && *wp <= 'Z')
+                                  || (*wp >= 'a' && *wp <= 'z'))
                                 {
                                   found_letter = true;
                                   break;




Reply via email to