src/cpu/cpu.cpp: Add suffix `u` to `4294967295` to signify an unsigned number
Paul Menzel
PATCH 1/1 src/cpu/cpu.cpp: Add suffix `u` to `4294967295` to signify an unsigned number
Date: Sat, 2 Feb 2013 22:27:58 +0100
The C++ compiler
$ g++ --version
g++-4.7.real (Debian 4.7.2-15) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.reports the following warning.
$ make
[…]
CXX cpu/powertop-cpu.o
cpu/cpu.cpp:776:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
[…]Adding the suffix to the constant gets rid of the warning [1].
--- src/cpu/cpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/cpu/cpu.cpp +1 -1
@@ -797,7 +797,7 @@ void perf_power_bundle::handle_trace_point(void *trace, int cpunr, uint64_t time exit(-1); } - if (val == 4294967295) + if (val == 4294967295u) cpu->go_unidle(time); else cpu->go_idle(time);
Signature · 1 line
1.7.10.4
Sergey Senozhatsky
NAKQuoted 30 lines · Paul Menzel
Date: Sat, 2 Feb 2013 22:27:58 +0100
The C++ compiler
$ g++ --version g++-4.7.real (Debian 4.7.2-15) 4.7.2 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.reports the following warning.
$ make […] CXX cpu/powertop-cpu.o cpu/cpu.cpp:776:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default] […]Adding the suffix to the constant gets rid of the warning [1].
--- src/cpu/cpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/cpu/cpu.cpp +0
-0
src/cpu/cpu.cpp void perf_power_bundle::handle_trace_point(void *trace, int cpunr, uint64_t time · line 800
Quoted 5 lines
src/cpu/cpu.cpp +1
-1@@ -797,7 +797,7 @@ void perf_power_bundle::handle_trace_point(void *trace, int cpunr, uint64_t time exit(-1); } - if (val == 4294967295) + if (val == 4294967295u)
NACK.
cpu_idle tracepoint defined as
TP_PROTO(unsigned int state, unsigned int cpu_id)
please use `== (unsigned int)-1', which is, by the way, more clear than 4294967295.
-ss
Quoted 12 lines
src/cpu/cpu.cpp +0
-0cpu->go_unidle(time); else cpu->go_idle(time);Signature · 8 lines
1.7.10.4 _______________________________________________ PowerTop mailing list PowerTop(a)lists.01.org https://lists.01.org/mailman/listinfo/powertop
Paul Menzel
Dear Sergey,
thank you for your review!
Am Sonntag, den 03.02.2013, 18:07 +0300 schrieb Sergey Senozhatsky:
Quoted 39 lines · Paul Menzel
Quoted 30 lines
Date: Sat, 2 Feb 2013 22:27:58 +0100
The C++ compiler
$ g++ --version g++-4.7.real (Debian 4.7.2-15) 4.7.2 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.reports the following warning.
$ make […] CXX cpu/powertop-cpu.o cpu/cpu.cpp:776:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default] […]Adding the suffix to the constant gets rid of the warning [1].
--- src/cpu/cpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/cpu/cpu.cpp +0
-0src/cpu/cpu.cpp void perf_power_bundle::handle_trace_point(void *trace, int cpunr, uint64_t time · line 800
Quoted 5 lines
src/cpu/cpu.cpp +1
-1@@ -797,7 +797,7 @@ void perf_power_bundle::handle_trace_point(void *trace, int cpunr, uint64_t time exit(-1); } - if (val == 4294967295) + if (val == 4294967295u)NACK.
Quoted 5 lines
cpu_idletracepoint defined as
TP_PROTO(unsigned int state, unsigned int cpu_id)please use `== (unsigned int)-1', which is, by the way, more clear than 4294967295.
Could you please elaborate your answer as I do not understand it. I could not find that TP_PROTO definition in the PowerTOP source using git grep.
Also beforehand val is defined as follows.
unsigned long long val;
Thanks and sorry for not understanding it,
Paul