Re: [LTP] [PATCH 2/3] fanotify10: Add support for multiple event files

Petr Vorel
2022-11-22T08:20:02Z

> Hi!
> > > > > +#define foreach_path(tc, buf, pname) \
> > > > > + for (int piter = 0; format_path_check((buf), (tc)->pname##_fmt, \
> > > > Unfortunately we still support C99 due old compiler on CentOS 7,
> > > > therefore int piter needs to be defined outside of for loop.

> > > Hum, but variable declaration in the for loop is part of C99 standard (as
> > > the error message also says). So did you want to say you are compiling
> > > against C89 standard? And CentOS 7 ships with GCC 4.8.5 AFAICS which should
> > > be fully C99 compliant BTW. So what's the situation here?
> > I'm sorry, I didn't express clearly myself. Yes, 4.8.5 supports C99,
> > but the default is C90 [1].

> > > That being said I can workaround the problem in the macro, it will just be
> > > somewhat uglier. So before doing that I'd like to understand whether
> > > following C89 is really required...

> > I'm don't remember why we have just not specified -std=... already, Cyril had
> > some objections, thus Cc him.

> I think that at the time there stil was even older compiler we had to
> support. I guess that we can add -std=c99 now.

> So I would propose adding -std=c99 into CFLAGS and see if anyone would
> complain.
Ah, I overlooked this reply. Cyril, do you mean top level Makefile?
That's what I'd do (going to test it).

Kind regards,
Petr