[igt-dev] [PATCH i-g-t] i915/intel_memory_region: Add missing forward declaration
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Tue Aug 10 08:55:26 UTC 2021
Hi Petri,
On wtorek, 10 sierpnia 2021 10:48:50 CEST Petri Latvala wrote:
> On Tue, Aug 10, 2021 at 10:14:40AM +0200, Janusz Krzysztofik wrote:
> > Intel memory region header declares some functions with a pointer to a
> > structure defined elsewhere as one of their arguments. Forward declare
> > that structure to avoid compiler warnings.
> >
> > ../lib/i915/intel_memory_region.h:69:19: warning: ‘struct
drm_i915_gem_memory_class_instance’ declared inside parameter list will not be
visible outside of this definition or declaration
> > 69 | struct drm_i915_gem_memory_class_instance *mem_regions,
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ../lib/i915/intel_memory_region.h:73:15: warning: ‘struct
drm_i915_gem_memory_class_instance’ declared inside parameter list will not be
visible outside of this definition or declaration
> > 73 | struct drm_i915_gem_memory_class_instance *mem_regions,
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> > ---
> > lib/i915/intel_memory_region.h | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/lib/i915/intel_memory_region.h b/lib/i915/
intel_memory_region.h
> > index e9d1d66d4..8cd18ea0e 100644
> > --- a/lib/i915/intel_memory_region.h
> > +++ b/lib/i915/intel_memory_region.h
> > @@ -62,6 +62,8 @@ uint8_t gem_get_lmem_region_count(int fd);
> >
> > bool gem_has_lmem(int fd);
> >
> > +struct drm_i915_gem_memory_class_instance;
> > +
>
>
> You want to avoid an #include <i915_drm.h> ?
The intel_memory_region.h header doesn't need to know anything about internals
of struct drm_i915_gem_memory_class_instance, then I think the forward
declaration is more standard, but we can add #include <i915_drm.h> if you
prefer.
Thanks,
Janusz
>
>
> > int __gem_create_in_memory_region_list(int fd, uint32_t *handle, uint64_t
size,
> > struct
drm_i915_gem_memory_class_instance *mem_regions,
> > int num_regions);
>
More information about the igt-dev
mailing list