lkml.org 
[lkml]   [2013]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf tools: Renaming 'time' variable in perf_time_to_tsc due to name shadowing error
On 2/08/2013 4:33 p.m., Jiri Olsa wrote:
> The perf compilation fails with following error:
> ...
> CC arch/x86/util/tsc.o
> arch/x86/util/tsc.c: In function ‘perf_time_to_tsc’:
> arch/x86/util/tsc.c:13:6: error: declaration of ‘time’ shadows a global declaration [-Werror=shadow]
> cc1: all warnings being treated as errors
>
> Renaming the 'time' variable to prevent this.

Did you see David did the same patch.

Although David noted the gcc version. It doesn't happen for gcc 4.7.3.
The commit message should probably reflect that it depends on the gcc
version.

Otherwise:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>


>
> Signed-off-by: Jiri Olsa<jolsa@redhat.com>
> Cc: Arnaldo Carvalho de Melo<acme@redhat.com>
> Cc: Corey Ashford<cjashfor@linux.vnet.ibm.com>
> Cc: Ingo Molnar<mingo@elte.hu>
> Cc: Paul Mackerras<paulus@samba.org>
> Cc: Peter Zijlstra<a.p.zijlstra@chello.nl>
> Cc: Arnaldo Carvalho de Melo<acme@redhat.com>
> Cc: David Ahern<dsahern@gmail.com>
> Cc: Adrian Hunter<adrian.hunter@intel.com>
> ---
> tools/perf/arch/x86/util/tsc.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c
> index f111744..9570c2b 100644
> --- a/tools/perf/arch/x86/util/tsc.c
> +++ b/tools/perf/arch/x86/util/tsc.c
> @@ -10,11 +10,11 @@
>
> u64 perf_time_to_tsc(u64 ns, struct perf_tsc_conversion *tc)
> {
> - u64 time, quot, rem;
> + u64 t, quot, rem;
>
> - time = ns - tc->time_zero;
> - quot = time / tc->time_mult;
> - rem = time % tc->time_mult;
> + t = ns - tc->time_zero;
> + quot = t / tc->time_mult;
> + rem = t % tc->time_mult;
> return (quot<< tc->time_shift) +
> (rem<< tc->time_shift) / tc->time_mult;
> }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2013-08-03 21:41    [W:0.093 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site