[LTP] [PATCH] common_timers: staticize all definitions
Petr Vorel
pvorel@suse.cz
Tue Apr 28 09:25:16 CEST 2020
Hi,
...
> > > -clock_t clock_list[] = {
> > > +static clock_t clock_list[] = {
> > > CLOCK_REALTIME,
> > > CLOCK_MONOTONIC,
> > > CLOCK_PROCESS_CPUTIME_ID,
> > > @@ -34,7 +34,7 @@ clock_t clock_list[] = {
> > > case def_name: \
> > > return #def_name;
> > Unfortunately this still generates warning:
> > warning: ‘clock_list’ defined but not used
> > I missed seeing this earlier in the full build and saw it now while
> > building a single test case.
I overlooked that too, sorry.
> > I think we need to move this to some .c file and remove the "static"
> > part. But I am not sure which one to. If we do that, then rest of the
> > series will not be affected by it.
> That is probably the cleanest way, yes
Yes, but it's a bit complicated, lapi headers were expected to be not part of
the library. As you write, -fno-common make use variables in header files a bit
complicated.
> > Or we can simply drop the "static" part and multiple copies of this
> > will be present in different .c files. Which I don't really like to be
> > honest.
> There is usually no warning about variables in header files
> that are marked 'static const' rather than just 'static', as that
> is a common way to do things in C++.
Correct, static const clock_t clock_list[] would work.
I'd be for this solution.
> > Or we can simply drop the "static" part and multiple copies of this
> > will be present in different .c files. Which I don't really like to be
> > honest.
> With gcc-10 and clang-10 this will cause a link-time failure, because
> they now both default to "-fno-common" behavior.
True, we build in travis with -fno-common (fixed recently).
> Arnd
Kind regards,
Petr
More information about the ltp
mailing list