From patchwork Mon Sep 10 20:00:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 968230 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 428Jnw4lvzz9s4V for ; Tue, 11 Sep 2018 06:01:08 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E2C081251; Mon, 10 Sep 2018 20:01:06 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5CC2A124D for ; Mon, 10 Sep 2018 20:01:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C0ADA766 for ; Mon, 10 Sep 2018 20:01:05 +0000 (UTC) X-Originating-IP: 208.91.3.26 Received: from sigabrt.benpfaff.org (unknown [208.91.3.26]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id E333B40008; Mon, 10 Sep 2018 20:01:02 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 10 Sep 2018 13:00:59 -0700 Message-Id: <20180910200059.31636-1-blp@ovn.org> X-Mailer: git-send-email 2.16.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH] ovsdb-idlc: Use ALIGNED_CAST to avoid spurious warnings for index rows. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The *_index_init_row() function casts a generic ovsdb_idl_row pointer to a specific type of row pointer. This can cause an increase in required alignment with some kinds of data on some architectures. GCC complains, e.g.: lib/vswitch-idl.c: In function 'ovsrec_flow_sample_collector_set_index_init_row' lib/vswitch-idl.c:9277:12: warning: cast increases required alignment of target However, rows are always allocated with malloc(), which returns member suitable for any type, so this is a false positive warning and this commit suppresses it. Signed-off-by: Ben Pfaff Acked-by: hzhou8@ebay.com --- ovsdb/ovsdb-idlc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in index 1c9483cbe393..40fef39edff7 100755 --- a/ovsdb/ovsdb-idlc.in +++ b/ovsdb/ovsdb-idlc.in @@ -1217,7 +1217,7 @@ struct %(s)s * %(s)s_index_init_row(struct ovsdb_idl_index *index) { ovs_assert(index->table->class_ == &%(p)stable_%(tl)s); - return (struct %(s)s *) ovsdb_idl_index_init_row(index); + return ALIGNED_CAST(struct %(s)s *, ovsdb_idl_index_init_row(index)); } struct %(s)s *