Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5497696img; Wed, 27 Mar 2019 09:32:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlzUD9htkIH3nwDuANaLLJHg3A9MHl7xw0wxcC516iUk/Ld3vnqMB5EqseV0zQ1nRujRzW X-Received: by 2002:a63:1d26:: with SMTP id d38mr6289393pgd.357.1553704378815; Wed, 27 Mar 2019 09:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553704378; cv=none; d=google.com; s=arc-20160816; b=z8tPelXQ2XOxogbldzA20/L6pIQRNbZGU/VSjlQWD4dgOo+854pK62VgRqelD8UVGU Nw09oj2Irc5TQmYF2ommff9LemNdo2B+7QYrstbbZ3YYN4rDXF7aXR+CLf3pAvQuL5m3 ua0uQjPakxyeM6hVxwfRLlgfso4XH7mrUYMw1PA1VZve5DfRSBAK274EKJRfuOimfe5S wqhaDd2S1fY8d2rwhCnWTvO2aBY42ZIWauLuds+wkddcVAZUTASdf8rbPi/6df10niKP /coRS/heRmb4xFQgvt93oTs8pMVwqFAIgTvflzcVDkYHvF+2TkZjxHA0zkKRJXCFryhG x/dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3Ex4pqnXYsy1BXvNitwbeNq0NgbqhTx+5/3uhKIC6nk=; b=ewdh+kkFSPweshFij4wboljTEJ0Ad+Rqfz5HuY4ybOH0ul4isZMCVWwkYbM5LTwZW3 L45+HuLJCTLcAnkjGvjNLloSYruake5zHJxQR/A0xQZgsIDdxd9+f6ywi9GANRoe30/0 IxC1bcJuSRwVzQq6vdKPptO26m1V49BLSy5RfEgiL3o1gisD2Mre0QPgF/XGI+oGwAIa QZIcH7NRowP4XeCkqB1ppB4Fz5Ykr+MUZTZSUu2ZZwIOk0uDBCtVNs0gyTIwA+3XQFJQ Odzev1PjBgH4OpcztMDKfmWVLz1DVjYEXw01nxCruJec7iB4g8Q60ijGfJmLIL7GEp+y tqhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u70am0s9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si18523378pfn.10.2019.03.27.09.32.42; Wed, 27 Mar 2019 09:32:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u70am0s9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728252AbfC0Qbu (ORCPT + 99 others); Wed, 27 Mar 2019 12:31:50 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:35699 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727993AbfC0Qbt (ORCPT ); Wed, 27 Mar 2019 12:31:49 -0400 Received: by mail-io1-f66.google.com with SMTP id p16so14618168iod.2; Wed, 27 Mar 2019 09:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3Ex4pqnXYsy1BXvNitwbeNq0NgbqhTx+5/3uhKIC6nk=; b=u70am0s9UAWChG1dc5BBws3VJTrY9tkChZkHIRk8q7i9hN90OG6Z+EBfzzjTQmOGpp aFIQt2NTeg/hXhqkb+oLpUWdhgDjEySxFgeydS1MZ9xQqJgjUQs/wBCsTgOINDyhjbGQ tl11QaNQ8S0FiuR57+5jNt9jUjLYjSnWoSGlwoEHXO59rsFZyMfIB8PHyEruIOPUWZ/P mZ8sgCBTcB2BJnU/4BhWWgoEddIelS5lqG7rwb5m8R5aTBpKsFduRqwReu+UvaY3AmsX fnLpUNxRbUaBNVpex+Oh9JloUmq0jJUyqc/b9nw9zbDKsbzbkkbucpVMuY+2ybGHIY8j oznQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3Ex4pqnXYsy1BXvNitwbeNq0NgbqhTx+5/3uhKIC6nk=; b=gYd0XCbJIYzZb84gF+PJlpkQ7eY+QnFxDVpZbBGK598Xxm6UkrQC7tD40K1Ed1rv4P QczTDTyWdF9siuqEns2k/wC8cQFWTfLLENn1N1PsuBGhdrehs/Z8/0UxnOo7r+x1ZE9y PjgE3YjIodOymKGf/8UC43kEyd5K0+vluTzIYjdOi0icVI4H+2pU1Hv9vVwyVHtmy7HY ETLABgPc42QdDh+3g06UA5fApb+wEnjgbFGt8Vj1GSwQCvAacqwH0/3uzMG21sRYDX4l J+FbTDcaA3wjNAdKuA8UizOA78W1fkvu7FepZBFE2mNeafInIUdalRljIZGUbg0T81u8 MtVA== X-Gm-Message-State: APjAAAXOFe2ACgOsIBxAw+xObNXk9n+wkf/M9FoQpvANthd6YzMG6roE ggH24Xlx+/k41igYtPAf8EXGvRdjEQcpx4FUfwg= X-Received: by 2002:a5d:984a:: with SMTP id p10mr26291828ios.217.1553704308626; Wed, 27 Mar 2019 09:31:48 -0700 (PDT) MIME-Version: 1.0 References: <20190325125147.1436083-1-arnd@arndb.de> In-Reply-To: <20190325125147.1436083-1-arnd@arndb.de> From: Ilya Dryomov Date: Wed, 27 Mar 2019 17:33:07 +0100 Message-ID: Subject: Re: [PATCH] [v2] ceph: fix clang warning for CEPH_DEFINE_OID_ONSTACK To: Arnd Bergmann Cc: "Yan, Zheng" , Sage Weil , clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , Alex Elder , Ceph Development , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 25, 2019 at 1:51 PM Arnd Bergmann wrote: > > clang complains about assigning a variable to itself during the > declaration: > > fs/ceph/ioctl.c:187:26: error: variable 'oid' is uninitialized when used within its own initialization [-Werror,-Wuninitialized] > CEPH_DEFINE_OID_ONSTACK(oid); > ^~~ > include/linux/ceph/osdmap.h:122:52: note: expanded from macro 'CEPH_DEFINE_OID_ONSTACK' > struct ceph_object_id oid = CEPH_OID_INIT_ONSTACK(oid) > ~~~ ^~~ > include/linux/ceph/osdmap.h:120:29: note: expanded from macro 'CEPH_OID_INIT_ONSTACK' > ({ ceph_oid_init(&oid); oid; }) > ^~~ > > We use this trick in other places, but it is completely unnecessary > here, as we can just use a regular struct initializer. > > Signed-off-by: Arnd Bergmann > --- > v2: rearrange to only have one instance of the initializer > --- > include/linux/ceph/osdmap.h | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h > index 5675b1f09bc5..8794cf0f0b39 100644 > --- a/include/linux/ceph/osdmap.h > +++ b/include/linux/ceph/osdmap.h > @@ -110,17 +110,16 @@ struct ceph_object_id { > int name_len; > }; > > +#define CEPH_OID_INITIALIZER(oid) { .name = (oid).inline_name } > + > +#define CEPH_DEFINE_OID_ONSTACK(oid) \ > + struct ceph_object_id oid = CEPH_OID_INITIALIZER(oid) > + > static inline void ceph_oid_init(struct ceph_object_id *oid) > { > - oid->name = oid->inline_name; > - oid->name_len = 0; > + *oid = (struct ceph_object_id)CEPH_OID_INITIALIZER(*oid); > } > > -#define CEPH_OID_INIT_ONSTACK(oid) \ > - ({ ceph_oid_init(&oid); oid; }) > -#define CEPH_DEFINE_OID_ONSTACK(oid) \ > - struct ceph_object_id oid = CEPH_OID_INIT_ONSTACK(oid) > - > static inline bool ceph_oid_empty(const struct ceph_object_id *oid) > { > return oid->name == oid->inline_name && !oid->name_len; Applied. Thanks, Ilya