[LTP] [PATCH] common_timers: staticize all definitions

Viresh Kumar viresh.kumar@linaro.org
Tue Apr 28 08:14:24 CEST 2020


On 28-04-20, 10:30, Viresh Kumar wrote:
> Staticize all variable and function definitions to avoid build failures
> in the future if this gets included by multiple files.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  include/lapi/common_timers.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/lapi/common_timers.h b/include/lapi/common_timers.h
> index df4196eeb579..d2d0d0dab5fd 100644
> --- a/include/lapi/common_timers.h
> +++ b/include/lapi/common_timers.h
> @@ -15,7 +15,7 @@
>  #define NSEC_PER_SEC (1000000000L)
>  #endif
>  
> -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 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.

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.

-- 
viresh


More information about the ltp mailing list