perf tools: use ansi versions of asm and volatile
PATCH v2 1/1 perf tools: use ansi versions of asm and volatile
asm and volatile are provided for backward compatibility; use the ansi versions __asm__ and __volatile__.
---
Thanks to Peter for pointing out the instances I missed.
tools/perf/arch/powerpc/util/header.c | 2 +- tools/perf/perf.h | 54 +++++++++++++++++------------------ tools/perf/tests/perf-time-to-tsc.c | 2 +- tools/perf/tests/rdpmc.c | 6 ++-- 4 files changed, 32 insertions(+), 32 deletions(-)
tools/perf/arch/powerpc/util/header.c +1 -1
@@ -10,7 +10,7 @@#define __stringify (x) __stringify_1(x)#define mfspr (rn) ({unsigned long rval; \ - asm volatile("mfspr %0," __stringify(rn) \ + __asm__ __volatile__("mfspr %0," __stringify(rn) \ : "=r" (rval)); rval; })#define SPRN_PVR 0x11F/* Processor Version Register */
tools/perf/perf.h +27 -27
126 lines not on this page · raw message
tools/perf/tests/perf-time-to-tsc.c +1 -1
@@ -31,7 +31,7 @@ static u64 rdtsc(void) {unsigned int low, high; - asmvolatile ("rdtsc" :"=a" (low),"=d" (high)); + __asm__ __volatile__("rdtsc" :"=a" (low),"=d" (high));return low | ((u64 )high) <<32 ; }
tools/perf/tests/rdpmc.c +3 -3
@@ -9,13 +9,13 @@#if defined(__x86_64__) || defined(__i386__) -#define barrier () asm volatile("" ::: "memory") +#define barrier () __asm__ __volatile__("" ::: "memory")static u64 rdpmc (unsigned int counter) {unsigned int low, high; - asmvolatile ("rdpmc" :"=a" (low),"=d" (high) :"c" (counter)); + __asm__ __volatile__("rdpmc" :"=a" (low),"=d" (high) :"c" (counter));return low | ((u64 )high) <<32 ; }
@@ -24,7 +24,7 @@ static u64 rdtsc(void) {unsigned int low, high; - asmvolatile ("rdtsc" :"=a" (low),"=d" (high)); + __asm__ __volatile__("rdtsc" :"=a" (low),"=d" (high));return low | ((u64 )high) <<32 ; }
Signature · 1 line
1.8.4.477.g5d89aa9
Quoted 22 lines · Ramkumar Ramachandra
asm and volatile are provided for backward compatibility; use the ansi versions
__asm__and__volatile__.Cc Peter Zijlstra <[email protected]>Cc Paul Mackerras <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Ramkumar Ramachandra <[email protected]>---
Thanks to Peter for pointing out the instances I missed.tools/perf/arch/powerpc/util/header.c | 2 +- tools/perf/perf.h | 54 +++++++++++++++++------------------ tools/perf/tests/perf-time-to-tsc.c | 2 +- tools/perf/tests/rdpmc.c | 6 ++-- 4 files changed, 32 insertions(+), 32 deletions(-)tools/perf/arch/powerpc/util/header.c +0
-0
tools/perf/arch/powerpc/util/header.c line 13
Quoted 5 lines
tools/perf/arch/powerpc/util/header.c +1
-1@@ -10,7 +10,7 @@#define __stringify (x) __stringify_1(x)#define mfspr (rn) ({unsigned long rval; \ - asm volatile("mfspr %0," __stringify(rn) \ + __asm__ __volatile__("mfspr %0," __stringify(rn) \
The thing is, there's a few thousand more 'nonstandard' cases in the kernel source:
comet:~/tip> git grep -w 'asm.*(' | wc -l
2617
comet:~/tip> git grep -w '__asm__.*(' | wc -l
2376
So unless all of them are converted I'm not convinced at all about the necessity of this change.
It's not like GCC will (be able to) reuse 'asm' and 'volatile' for some other purpose anytime soon (read: within decades, or ever), so this change brings not much useful to the table AFAICS.
I personally find 'asm volatile' plenty readable, the underscores don't add any extra info.
Thanks,
Ingo