From patchwork Wed Oct 28 19:57:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 40909 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E7804397306E; Wed, 28 Oct 2020 19:57:37 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 6ACBB39724A0 for ; Wed, 28 Oct 2020 19:57:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6ACBB39724A0 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: rcPsTlBe8HNqS0Jqf9KWbwG9uRQpgm0VMELI4u443lapjq8s2jRsVPSEJywTkPK8hEA2zw5a0G NaXOToEmPyYuxyBWlif1AmojreJ7TEVsAvk1Kb1COwy4Cr+mDYdNuNBZUfyLH8aUj1kEFbJ7p1 WSpKFZJ9EHh093eTFaXLzNHDV8ks1bsMFRhftpMy9z/+iliNmP0Ct28feguglgprLb102/Fk5u A2GOzKh0P1eR+/ioNBWJqI+wwOubEmi8WLT722LkuwXK6n0VwwnS9J3GC3gKGabMshcbgxgykR Q2M= X-IronPort-AV: E=Sophos;i="5.77,427,1596528000"; d="scan'208";a="54445772" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 28 Oct 2020 11:57:34 -0800 IronPort-SDR: 0zo4iLROmGdBarBhFhXZjl/5Vp5CFQ39Qt7BqnoUB8P6cN8AW/BUgBtLl5MNXm40plMvU9/Su4 OjRmvJ7PHGqkOa/argZQ9Y9jWwJrGaPxL7qpHD21/1jYM9s5YnTuazd0Jl6s7fTq+Z+AmVjNmL tyaEwYcAT9qpIjdZ/4P49dNljSZCIxdqxK4hTEWF8xW34rXnldw3Bgd6lD7EBy1BWGvDkKeEen cATA8FR38VoIzJ4DqnUAg6jmKk49tNUguBTHyq8r8sHCTczlqY7T/NJziq+Xzy9bU0mX9i4I4N E5M= Date: Wed, 28 Oct 2020 19:57:29 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: Do not use array parameter to new_composite_name (bug 26726) Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3131.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "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;