From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-x243.google.com (mail-qt0-x243.google.com [IPv6:2607:f8b0:400d:c0d::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zrNVf03P6zF1JK for ; Wed, 28 Feb 2018 02:52:09 +1100 (AEDT) Received: by mail-qt0-x243.google.com with SMTP id t6so14240474qtn.9 for ; Tue, 27 Feb 2018 07:52:09 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <20180225172236.29650-1-malat@debian.org> <20180225172236.29650-2-malat@debian.org> <603d5335-6220-73f2-d902-b92bc74bc79e@c-s.fr> From: Andy Shevchenko Date: Tue, 27 Feb 2018 17:52:06 +0200 Message-ID: Subject: Re: [PATCH 01/21] powerpc: Remove warning on array size when empty To: Mathieu Malaterre Cc: Christophe LEROY , Linux Kernel Mailing List , Paul Mackerras , Jiri Slaby , "open list:LINUX FOR POWERPC PA SEMI PWRFICIENT" Content-Type: text/plain; charset="UTF-8" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue, Feb 27, 2018 at 9:44 AM, Mathieu Malaterre wrote: > On Tue, Feb 27, 2018 at 8:33 AM, Christophe LEROY > wrote: >>>>> Much simpler is just add >>>>> >>>>> if (ARRAY_SIZE() == 0) >>>>> return; >> Or add in front: >> if (!ARRAY_SIZE(feature_properties)) >> return; > > (not tested) I believe the compiler still go over the for() loop and > will complain about the original unsigned comparison. Did you run tests? Did you look into object file? In kernel we much rely on the compiling away the code which is deterministically not in use. Here I'm pretty sure it will compile away entire function. -- With Best Regards, Andy Shevchenko