Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp104267pxx; Tue, 27 Oct 2020 22:58:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0uR7M97iGvVTqJbk/nAGP1pBZXvNhrIJ26jFgWwA6uGf7YdAM7amQso/xT2VHrQth+yzS X-Received: by 2002:a17:906:a20b:: with SMTP id r11mr1875427ejy.41.1603864739000; Tue, 27 Oct 2020 22:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603864738; cv=none; d=google.com; s=arc-20160816; b=EyOf2/oc5BvVBeXKCN6LA4dIpBJUkQIOPQ1pF45U04/zaq9QzGgyTmOGzSSXze3PMm RZykn+9CvuA9Sq5tHQ3fTVdJGxCX6Igi0wdn7DypHEHiW9G+Zev38Z4bkaZDwwRpw5fV 75D6+tcxqDhblHX5ZUpijrXAgxE6jORveHEcA2KS7FVNiD/ddw+wYUtU6p8kI9pvY7hD 1EE4woyJpdK9JG1E1KxTYbpbtzxiqZcSvgHJ5cSF/zfTjDStM2aYLYU4SOg8ejWB3xIy YoYGgZr1V4voNgE3lnpE9JApvJk/som1QLQFOjFP51m4lqEozKaQbsCyuD+1hhd1G3oo 7X3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Q/UbJjNfds8huNwQCL6j5KqblwN1Ltjs/bwlok4RlXE=; b=MKcntTEikZwynPoFbk5EnLp/guvY0mEb4p9QA4phMaYi389kpzsGfvXWVZCf12jDdx GHujDNc7C5K2ct15X3VxSpBvBObvxfoSCzoyMfcbuF5byUkw8nS9xxl6A3C1mDnmQTLy i1v8y4/k1NUWzZNx/cqJeClf27iLPwQUVbeibCsQzZxLjM84wZaSPBvjc1Rv1++lv5l3 k4ievWYINJPA/hWiiYw8+vr+GAY0WbYbh380KKoWANmU9PR5pCjEtMGBci8eh6Vedwte 8qzlTc/y9vsQOBRF5eVy8MtIS9cWhJywzuvP4eK3jhyQqbK/34GO5QFnelLD8QUePAsT 7XhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RG7CdBgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o60si2640395eda.61.2020.10.27.22.58.37; Tue, 27 Oct 2020 22:58:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RG7CdBgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2509249AbgJ0Iqr (ORCPT + 99 others); Tue, 27 Oct 2020 04:46:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:48350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404009AbgJ0Iqq (ORCPT ); Tue, 27 Oct 2020 04:46:46 -0400 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 90C162224E for ; Tue, 27 Oct 2020 08:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603788405; bh=vsxUUAOXqyP7qK5QCUqe8n8ns1GI6ih7irunW79BlGE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=RG7CdBgLIrBVtSdtOApL9xWA/gNp7mGQbzRLimFuWdKoBK+eAC7VmF20cOPj5wiMr d2mN0cqAXxdKIBzVZ0ZF9lJZmvrfnAlxiRAPTzfBQWMuBxfCLDBdXqYWSV1yi4pOgp ZUrcsDLmr4P6zYwtl2pk3VqAjp29F3ktfND+R6jQ= Received: by mail-qk1-f180.google.com with SMTP id k9so451916qki.6 for ; Tue, 27 Oct 2020 01:46:45 -0700 (PDT) X-Gm-Message-State: AOAM532q3UGXQzda5LNaqj8dTmPwcSZZSg6XR3L+3kYxcN78We0QBPtN 4fDKTAGHzUITNr0Elp42ZEF81arht6ziBjbrHVQ= X-Received: by 2002:a05:620a:74f:: with SMTP id i15mr1070105qki.352.1603788404671; Tue, 27 Oct 2020 01:46:44 -0700 (PDT) MIME-Version: 1.0 References: <20201026215004.3893088-1-arnd@kernel.org> <8f5c673a-0265-a6d0-57fc-98c788caadc9@rasmusvillemoes.dk> In-Reply-To: <8f5c673a-0265-a6d0-57fc-98c788caadc9@rasmusvillemoes.dk> From: Arnd Bergmann Date: Tue, 27 Oct 2020 09:46:28 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] printf: fix Woverride-init warning for EDEADLK errno To: Rasmus Villemoes Cc: Andrew Morton , Petr Mladek , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Andy Shevchenko , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 8:23 AM Rasmus Villemoes wrote: > On 26/10/2020 22.49, Arnd Bergmann wrote: > > From: Arnd Bergmann > > NAK. That would end up using the "EDEADLOCK" string for the value 35 on > those architectures where they are the same, despite EDEADLK being the > by far the most used symbol. See the comments and original commit log, > the placement of these is deliberate. Ok, I see. > How about we do this instead? > > From: Rasmus Villemoes > > The table of errno value->name contains a few duplicate entries since > e.g. EDEADLK == EDEADLOCK on most architectures. For the known cases, > the most used symbolic constant is listed last so that takes > precedence - the idea being that if someone sees "can't do that: > -EDEADLK" in dmesg, grepping for EDEADLK is more likely to find the > place where that error was generated (grepping for "can't do that" > will find the printk() that emitted it, but the source would often be > a few calls down). > > However, that means one gets > > warning: initialized field overwritten [-Woverride-init] > > when building with W=1. As the use of multiple initializers for the > same entry here is quite deliberate, explicitly disable that warning > for errname.o. > > Reported-by: Arnd Bergmann > Fixes: 57f5677e535b ("printf: add support for printing symbolic error > names") > Signed-off-by: Rasmus Villemoes > --- > lib/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/Makefile b/lib/Makefile > index ce45af50983a2a5e3582..a98119519e100103818d 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -224,6 +224,7 @@ obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o > > obj-$(CONFIG_DYNAMIC_DEBUG_CORE) += dynamic_debug.o > obj-$(CONFIG_SYMBOLIC_ERRNAME) += errname.o > +CFLAGS_errname.o += $(call cc-disable-warning, override-init) > This works, but it conflicts with a different patch series I have, and it disables a potentially useful warning in case we get another conflict in this file, so I'd prefer to find a way to avoid the warning rather than force-disabling it. How about adding the #ifdef around the EDEADLOCK line instead of the EDEADLK one? Something like diff --git a/lib/errname.c b/lib/errname.c index 0c4d3e66170e..93043fb960cc 100644 --- a/lib/errname.c +++ b/lib/errname.c @@ -38,7 +38,10 @@ static const char *names_0[] = { E(ECOMM), E(ECONNABORTED), E(ECONNRESET), + E(EDEADLK), /* EDEADLOCK */ +#if EDEADLK != EDEADLOCK /* mips, sparc, powerpc */ E(EDEADLOCK), +#endif E(EDESTADDRREQ), E(EDOM), E(EDOTDOT), @@ -169,7 +172,6 @@ static const char *names_0[] = { E(ECANCELED), /* ECANCELLED */ E(EAGAIN), /* EWOULDBLOCK */ E(ECONNREFUSED), /* EREFUSED */ - E(EDEADLK), /* EDEADLOCK */ }; #undef E Arnd