[igt-dev] [PATCH i-g-t 5/7] igt/params: add generic saving module parameter set

Petri Latvala petri.latvala at intel.com
Wed May 6 10:09:04 UTC 2020


On Wed, May 06, 2020 at 12:54:37PM +0300, Juha-Pekka Heikkila wrote:
> On 6.5.2020 12.05, Arkadiusz Hiler wrote:
> > On Tue, May 05, 2020 at 11:00:03PM +0300, Juha-Pekka Heikkila wrote:
> > > On 5.5.2020 21.46, Juha-Pekka Heikkila wrote:
> > > > On 5.5.2020 17.09, Arkadiusz Hiler wrote:
> > > > > On Tue, Apr 28, 2020 at 11:22:53PM +0300, Juha-Pekka Heikkila wrote:
> > > > > > From: Jani Nikula <jani.nikula at intel.com>
> > > > > > 
> > > > > > Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> > > > > > Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> > > > > > ---
> > > > > >    lib/igt_params.c | 57 ++++++++++++++++++++++++++++++++++++++++--------
> > > > > >    lib/igt_params.h |  3 +++
> > > > > >    2 files changed, 51 insertions(+), 9 deletions(-)
> > > > > > 
> > > > > > diff --git a/lib/igt_params.c b/lib/igt_params.c
> > > > > > index fe4b1df3..d9cf986c 100644
> > > > > > --- a/lib/igt_params.c
> > > > > > +++ b/lib/igt_params.c
> > > > > > @@ -153,6 +153,29 @@ int igt_params_open(int device)
> > > > > >        return __igt_params_open(device, NULL);
> > > > > >    }
> > > > > > +__attribute__((format(printf, 3, 0)))
> > > > > 
> > > > > this is using a va_list, not "...", so this format attirbue should not
> > > > > be here
> > > > > 
> > > > 
> > > > Good catch
> > > > 
> > > 
> > > Looking it with bit more thought, what's wrong with it? I think it is
> > > required there.
> > 
> > I found it a bit useless that we do printf format checking without
> > having any arugments to match types for as they are wrapped in va_list,
> > but if compilers are screeming that it's necessary so be it.
> > 
> > Not sure what benefit does it provide though.
> 
> Benefit is not to get compiler warning which would be caused from later
> usage of vsnprintf. Other way to avoid it is to take out
> "missing-format-attribute" warnings.

First I thought format_arg(3) is proper here but after checking the
docs, it is as J-P says:

"For functions where the arguments are not available to be checked
(such as vprintf), specify the third parameter as zero. In this case
the compiler only checks the format string for consistency."


-- 
Petri Latvala


More information about the igt-dev mailing list