Re: [igt-dev] [PATCH v2] tests/i915_pm_rpm: improved strictness and verbosity of i2c subtest

Petri Latvala
2019-06-17T13:40:24Z

On Mon, Jun 17, 2019 at 04:26:45PM +0300, Ville Syrjälä wrote:
> On Mon, Jun 17, 2019 at 10:05:29AM +0000, Vasilev, Oleg wrote:
> > Hi,
> >
> > Thank you for the review. I've sent an updated patch.
> >
> > On Fri, 2019-06-14 at 18:30 +0300, Ville Syrjälä wrote:
> > > On Thu, Jun 13, 2019 at 04:06:23PM +0300, Oleg Vasilev wrote:
> > > >
> > > > +static void format_hex_string(unsigned char edid[static
> > > > EDID_LENGTH],
> > > > + char buf[static EDID_LENGTH * 5 + 1])
> > >
> > > What's the deal with those 'static's?
> >
> > This enforces an array size to be at least EDID_LENGTH.
> >
> > https://hamberg.no/erlend/posts/2013-02-18-static-array-indices.html
>
> Interesting. Ugly, but interesting.
>
> Doesn't look like gcc cares about this at all though. I doesn't even
> care if I do silly things like:
>
> int foo(int x[static 8])
> {
> return x[20];
> }
>
> I guess clang is better?

The 8 means there's at least 8 elements, it doesn't restrict there being more.

And it's mostly for the call site. Try calling foo(NULL) now.

--
Petri Latvala