Received: by 10.192.165.156 with SMTP id m28csp640969imm; Tue, 17 Apr 2018 17:08:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Oahw5vjXlA2OhYAbnmx6p1apNGGSz44RYPRZdxH3icJH5DGmKYHQhcnjuzs26dCGuyJ1v X-Received: by 10.98.75.194 with SMTP id d63mr3654583pfj.99.1524010109824; Tue, 17 Apr 2018 17:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524010109; cv=none; d=google.com; s=arc-20160816; b=BtwyA8B/PgVy7mDTBr/TjcKEo3pnMb3TcsKvXygG3kQ7DEyNg4cPzZ4k7VLN9EMAnn +fErWLktxLZ92w/F+pqPW8hSk4WrlFFUUD58/Kjyh/qzHrAAqAm4MbV5I59GBI5v8Uvq QEi8BPK6G+7gS5p8Xfx2gKfFgKT7+9oGtG7XvrbobnH8SVpFxrKAF+6XDzAE3aNacath ajSVY0QT1k5zZ5S9QOpjB7FsEZRE6XAiimoAbhR8HdZWSmQxNN1LGGgXYkO15B48NYrM o1oVJnbUIUbOo2QIJuaWDQRXnO5VvPxGti7ph1xi4HMro59hSXa+Kq/o7x7bjq3fpNqu IBPw== 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 :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=4LGhhw3RhkDEruDyQZInvV0Mz6fYqrXzIjBZ+JJNsu4=; b=bfG+G/iBflQpKdIyZL9QAcDDHE8XD/r3IHkoh0cykP8qCkFy2lioE2Bn9mup/JDtvi S2MHV5XWQRxy19im6scGCGjUiAxLX5Wns21MvQigEgBYzGND5Jwn4iIxExxCtnZiif9D Qy/AeNl5GZONwKwihKAuSkMbTtsMFCFqH5yh5hUp6TFdNb/i3mMHjfXbp6dYk4fnmakr 0JD9eB5cRlq8Pq1b22loYpUiVkjsPaerTaTCWnDwzbx1CQrYRI7pW/I7WygFx9/XxBFf TzpPVVCHf5+G7VzUZbWs6V8g2yzFfWvP2q5v14Npjky5HQpqJqCsADhjvrSxrg1MyCej K3Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=s2DOGel0; dkim=fail header.i=@linux-foundation.org header.s=google header.b=HRxdZQ2J; 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 h12si12853573pgn.317.2018.04.17.17.08.15; Tue, 17 Apr 2018 17:08:29 -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=fail header.i=@gmail.com header.s=20161025 header.b=s2DOGel0; dkim=fail header.i=@linux-foundation.org header.s=google header.b=HRxdZQ2J; 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 S1753057AbeDRAHH (ORCPT + 99 others); Tue, 17 Apr 2018 20:07:07 -0400 Received: from mail-io0-f171.google.com ([209.85.223.171]:36237 "EHLO mail-io0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752757AbeDRAHF (ORCPT ); Tue, 17 Apr 2018 20:07:05 -0400 Received: by mail-io0-f171.google.com with SMTP id c26-v6so327017iob.3; Tue, 17 Apr 2018 17:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=4LGhhw3RhkDEruDyQZInvV0Mz6fYqrXzIjBZ+JJNsu4=; b=s2DOGel00ZLjnozxDd6XPWVVOdjzhRNiR6o1gMwhFFomegkoczmlpxY+A3LFcfdBDI b5cK0yjcrhACsJX5PijRyDQSEuSzgqTCkVyOGtLWwo81hc3uy6ajIDcHqXPF3l2c5jCo AfA38PA1g6THMr5K3S57eQeUbxkg4gLBtALlUnXkGeHsyaamnRINaqZ+RZe5SBnJ/xfO G0cMHPJtwuTV/6Li1no8BF9wwBldcJ9HjRp91uuc552Xy4u6AvX63IjEpA5HUfkbaGWM RPMPDAXvRnWb8dMo+vpH1qi6FUjloWP4e8WUfE0iGZA2+dKRQz+/cHy3/ybT9fs8dXE+ AAKQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=4LGhhw3RhkDEruDyQZInvV0Mz6fYqrXzIjBZ+JJNsu4=; b=HRxdZQ2JukWFV0I2LShOTJum2nYV49JcUSC4W8PZTjqksuCOe1jEG6jUgZ2CsIlPPR yt2kgV5DEPiImTnyiOJVa96PLnt3ZfNrfIU/Ic+8sU8EIKdZdk5e+kdo5xK75BUIP9eO oyiWtYtRLNNcuFS6MLkSMldrgC4i1u0E9Cahs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=4LGhhw3RhkDEruDyQZInvV0Mz6fYqrXzIjBZ+JJNsu4=; b=kYjleXzc3hXUpS4t63I0K/l4C2uu0xhn6ZzazB4kRSIrD6wfpDDFCwJLZ8RBCaxe4w uUhcM21Qh3GaBCq90QGYdbmHlQ9pJlwkqXBiVQVvwlG3y9eQDSme+n0TClNuyVNrwP/j 8Hi13vmYohonzAX9VCA2ub3zFRhQVYeazlsZw1BBUgU609RohabfTnfEEeeW8CR1JspK 385toOItT1eSogWb/6FQryD8/EN1b+xvCqEyI7wHJ1jojIg/QYsWozHjak06dc/iKLGx bCzMEDPsmEy9coPFS0NEebxGztbyMCGsLKNJSJpeAa0B2gTysxl1GEIGs5QkxR/BObUF uMXA== X-Gm-Message-State: ALQs6tDak5qyaBbUGq02K+zZMEpgPn3s4/EzRLvUuH4Sxbmp2Jy5OV5E AdeO0A6gho1hDYpuGOxHQMJkM5two/cr4FsqYT4= X-Received: by 10.107.70.4 with SMTP id t4mr4436674ioa.203.1524010024709; Tue, 17 Apr 2018 17:07:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.95.15 with HTTP; Tue, 17 Apr 2018 17:07:04 -0700 (PDT) In-Reply-To: <20180417233511.6573-2-mwilck@suse.com> References: <20180417233511.6573-1-mwilck@suse.com> <20180417233511.6573-2-mwilck@suse.com> From: Linus Torvalds Date: Tue, 17 Apr 2018 17:07:04 -0700 X-Google-Sender-Auth: bq0Vc3R39WQFishxi-Aj04Ic5-U Message-ID: Subject: Re: [PATCH v3 1/6] ilog2: create truly constant version for sparse To: Martin Wilck Cc: "Martin K. Petersen" , Linux SCSI List , Linux Kernel Mailing List , Hannes Reinecke , James Bottomley , Xose Vazquez Perez , Bart Van Assche , Ard Biesheuvel , Thomas Gleixner , Jonathan Corbet , Randy Dunlap 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 Tue, Apr 17, 2018 at 4:35 PM, Martin Wilck wrote: > Sparse emits errors about ilog2() in array indices because of the use of > __ilog2_32() and __ilog2_64(), If sparse warns about it, then presumably gcc with -Wvla warns about it too? And if thats the case, then __builtin_constant_p() and a ternary operation isn't good enough, because gcc -Wvla is even more anal than sparse is. Which is why we have that __is_constexpr() magic for min/max(). So I suspect that what you'd want is #define ilog2(n) \ __builtin_choose_expr(__is_constexpr(n), \ const_ilog2(n), \ __builtin_choose_expr(sizeof(n) <= 4, \ __ilog2_u32(n), \ __ilog2_u64(n))) or something. Hmm? Linus