[igt-dev] [PATCH i-g-t] i915/intel_memory_region: Add missing forward declaration

Janusz Krzysztofik janusz.krzysztofik at linux.intel.com
Wed Aug 11 09:12:18 UTC 2021


On wtorek, 10 sierpnia 2021 11:27:51 CEST Petri Latvala wrote:
> On Tue, Aug 10, 2021 at 10:55:26AM +0200, Janusz Krzysztofik wrote:
> > 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.
> 
> Nah, I don't have a preference. Indeed nothing else in that file needs
> any further knowledge so let's go with the forward declaration.
> 
> Reviewed-by: Petri Latvala <petri.latvala at intel.com>

Thank you Petri, pushed.

Janusz





More information about the igt-dev mailing list