public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Do not use array parameter to new_composite_name (bug 26726)
@ 2020-10-28 19:57 Joseph Myers
  2020-10-30 20:05 ` DJ Delorie
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2020-10-28 19:57 UTC (permalink / raw)
  To: libc-alpha

Among the warnings causing a glibc build with GCC 11 to fail is one
for a call new_composite_name in setlocale.c.  The newnames argument
is declared as an array with __LC_LAST elements, but when the category
argument is not LC_ALL, it actually only has one element.  Since the
number of elements depends on the first argument to the function, it
seems clearer to declare the argument as a pointer.

Tested with build-many-glibcs.py for arm-linux-gnueabi, where this
allows the build to get further.

---

After this patch and the one for bug 26647 are applied, I see the
build failing with the ypclnt.c errors mentioned in bug 26687.  That
is, despite that bug having been marked FIXED, it seems only some of
the warnings from it have actually been fixed so far.

diff --git a/locale/setlocale.c b/locale/setlocale.c
index 030f172..89e8724 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -135,7 +135,7 @@ extern int _nl_msg_cat_cntr;
 
 /* Construct a new composite name.  */
 static char *
-new_composite_name (int category, const char *newnames[__LC_LAST])
+new_composite_name (int category, const char **newnames)
 {
   size_t last_len = 0;
   size_t cumlen = 0;

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Do not use array parameter to new_composite_name (bug 26726)
  2020-10-28 19:57 Do not use array parameter to new_composite_name (bug 26726) Joseph Myers
@ 2020-10-30 20:05 ` DJ Delorie
  0 siblings, 0 replies; 2+ messages in thread
From: DJ Delorie @ 2020-10-30 20:05 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

Joseph Myers <joseph@codesourcery.com> writes:
> is declared as an array with __LC_LAST elements, but when the category
> argument is not LC_ALL, it actually only has one element.  Since the

Confirmed that new_composite_name() is only called twice; once with
LC_ALL and a large-enough array, and once without LC_ALL and a small array.

> -new_composite_name (int category, const char *newnames[__LC_LAST])
> +new_composite_name (int category, const char **newnames)

Ok.

LGTM

Reviewed-by: DJ Delorie <dj@redhat.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-30 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 19:57 Do not use array parameter to new_composite_name (bug 26726) Joseph Myers
2020-10-30 20:05 ` DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).