[PATCH 3/6] Cygwin: Fix warning about address known to be non-NULL in /proc/locales
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Aug 5 10:18:05 GMT 2024
On Aug 4 22:48, Jon Turney wrote:
> Fix a gcc 12 warning about an address known to be non-NULL in
> format_proc_locale_proc().
>
> > ../../../../src/winsup/cygwin/fhandler/proc.cc: In function ‘BOOL format_proc_locale_proc(LPWSTR, DWORD, LPARAM)’:
> > ../../../../src/winsup/cygwin/fhandler/proc.cc:2156:11: error: the address of ‘iso15924’ will never be NULL [-Werror=address]
> > 2156 | if (iso15924)
> > | ^~~~~~~~
> > ../../../../src/winsup/cygwin/fhandler/proc.cc:2133:11: note: ‘iso15924’ declared here
> > 2133 | wchar_t iso15924[ENCODING_LEN + 1] = { 0 };
> > | ^~~~~~~~
> ---
> winsup/cygwin/fhandler/proc.cc | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
> index 8c7a4ab06..f1cd468fc 100644
> --- a/winsup/cygwin/fhandler/proc.cc
> +++ b/winsup/cygwin/fhandler/proc.cc
> @@ -2193,8 +2193,7 @@ format_proc_locale_proc (LPWSTR win_locale, DWORD info, LPARAM param)
> if (!(cp2 = wcschr (cp + 2, L'-')))
> return TRUE;
> /* Otherwise, store in iso15924 */
> - if (iso15924)
> - wcpcpy (wcpncpy (iso15924, cp, cp2 - cp), L";");
> + wcpcpy (wcpncpy (iso15924, cp, cp2 - cp), L";");
> }
> cp = wcsrchr (win_locale, L'-');
> if (cp)
> --
> 2.45.1
I think iso15924 was supposed to be a pointer at first and after
converting it to an array I just forgot to take out the check.
Can you please add
Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/locales")
Oh and, while I'm at it, please add your Signed-off-by to all your
patches.
Thanks,
Corinna
More information about the Cygwin-patches
mailing list