Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3198714img; Mon, 25 Mar 2019 05:53:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwk8adLHr1OBhLq1gJa0+7B0kTheAqDaqZiXi6EDFhUxWgGcUK+QnWodsWb8Vh/lG0Fu5Rg X-Received: by 2002:a63:234c:: with SMTP id u12mr23645461pgm.282.1553518381636; Mon, 25 Mar 2019 05:53:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553518381; cv=none; d=google.com; s=arc-20160816; b=NCT8FWRHmmLeqgY2N5U4NFEtXwDksS+e5cik/WjR9HSZiFV9A189xX+rc4vIUwMx4T Sf+iiCIgwOhP7aMMgEJs1fs0QS0vZbYr/uvARM0+NKyu37xH9HqE8pydb1XBMN8V7hGg nEhQNlG4O7C2b6EtuR92q7HtxacEcGR2fAtmPCtm4oeZTPTkioDDxnZvt7TkeBCL/IUI pjIX/W0aXcwVts48hOD2mKkeYAvn4IS3/eHDrCwRchUAwJLi3KFPqeft7KAxsUFd6V5Y HnZS/6nI+2o0wRmYAG7n5eSW+g9fwTic2Db3XuxDHZsFIN3R2fccRp27AP6rY58rD8+k IazA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=oN7eN2jCUTSoXvqJzXz78R251kv5RIYt6WiLXD0fvpc=; b=xCJQ1EIcVoHDRmnirTYrcZ6dtwSrB9exsgApHEu67o2u/8q9sDSJ5X1h213LO+zFeZ t9PP9TmOD5vAVz3KXrUQVxODH9be6AJXvw5wt5AL5BLTlzpg9XU4T6c0dOYzZG0C8+Kl WyHrb6EE0ZyaZnlOlbTeBrggsImkOlahwC9TFm1F+ZMWFkx0dd/tIfcZg0lHxApZ/jE5 5Tux8cPn7U8zDqOPE+dh3yRCL6JQns6YZGaQn8Fch7WwSKAKyv0KaUkbonk4EGW0f520 yEcQy77XDVTa6BdHSeEo5A7/DNd0jzTki2LzDFuiai7J2nfkzpBfHU5vxjM3t2ovo0eU oNfw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si13359522pga.71.2019.03.25.05.52.47; Mon, 25 Mar 2019 05:53:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731243AbfCYMwL (ORCPT + 99 others); Mon, 25 Mar 2019 08:52:11 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:38175 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731088AbfCYMwK (ORCPT ); Mon, 25 Mar 2019 08:52:10 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1N1Oft-1gy2xS483n-012s2n; Mon, 25 Mar 2019 13:51:50 +0100 From: Arnd Bergmann To: Ilya Dryomov , "Yan, Zheng" , Sage Weil Cc: clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , Arnd Bergmann , Alex Elder , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] ceph: fix clang warning for CEPH_DEFINE_OID_ONSTACK Date: Mon, 25 Mar 2019 13:51:43 +0100 Message-Id: <20190325125147.1436083-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-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Nsev2TenA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.20.0