lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 23 Oct 2023 15:14:09 +0100
From:   Robin Murphy <>
To:     Mark Rutland <>,
        Ilkka Koskinen <>
Subject: Re: [PATCH 2/3] perf/arm-cmn: Rework DTC counters (again)

On 2023-10-23 10:06, Mark Rutland wrote:
> On Fri, Oct 20, 2023 at 03:50:30PM -0700, Ilkka Koskinen wrote:
>> Hi Robin,
>> I have one comment, otherwise the patch looks good to me.
>>> +/* @i is the DTC number, @idx is the counter index on that DTC */
>>> +#define for_each_hw_dtc_idx(hw, i, idx) \
>>> +	for (int i = 0, idx; i < CMN_MAX_DTCS; i++) if ((idx = hw->dtc_idx[i]) >= 0)
>> Isn't that "idx" unnecessary in the initialization?
> That creates the 'idx' variable that's assigned to by `idx = hw->dtc_idx[i]`,
> so that is necessary.

Right, the intent is to take advantage of locally-scoped iterator 
variables since they're a nice thing, but completely-implicit 
definitions aren't so nice (at best they'd be surprising, at worst they 
could confusingly shadow existing variables in the outer scope), so the 
macro invoker still provides their names to at least give some visible 
context to their use within the loop body.

I guess this is still a fairly new paradigm since the C11 switch, and 
I'm not aware of any "standard" style for such iterator macros yet, so I 
just did what seemed most logical.


Powered by blists - more mailing lists