diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-17 14:36:40 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-19 12:01:47 -0400 |
commit | aa8cc2f6b5faae3511ea229846d8e54bd8df40d1 (patch) | |
tree | a08b820903eec382d4b31a3c3deb847f105a23c5 | |
parent | c3dca1a1c0ec51f384515f7e6f3b4e289a1dea2f (diff) |
perf tools: Replace STR() calls with __stringify()
Both do the same thing, the later is the one we get from
linux/stringify.h, i.e. we now use the same function name/practice as
the kernel sources.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-w2sxa5o4bfx7fjrd5mu4zmke@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/arch/arm/util/dwarf-regs.c | 4 | ||||
-rw-r--r-- | tools/perf/arch/arm64/util/dwarf-regs.c | 3 | ||||
-rw-r--r-- | tools/perf/arch/powerpc/util/dwarf-regs.c | 5 | ||||
-rw-r--r-- | tools/perf/util/cgroup.c | 5 | ||||
-rw-r--r-- | tools/perf/util/jitdump.c | 3 | ||||
-rw-r--r-- | tools/perf/util/util.h | 3 |
6 files changed, 12 insertions, 11 deletions
diff --git a/tools/perf/arch/arm/util/dwarf-regs.c b/tools/perf/arch/arm/util/dwarf-regs.c index 33ec5b339da8..8bb176a37990 100644 --- a/tools/perf/arch/arm/util/dwarf-regs.c +++ b/tools/perf/arch/arm/util/dwarf-regs.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <stddef.h> | 11 | #include <stddef.h> |
12 | #include <linux/stringify.h> | ||
12 | #include <dwarf-regs.h> | 13 | #include <dwarf-regs.h> |
13 | 14 | ||
14 | struct pt_regs_dwarfnum { | 15 | struct pt_regs_dwarfnum { |
@@ -16,10 +17,9 @@ struct pt_regs_dwarfnum { | |||
16 | unsigned int dwarfnum; | 17 | unsigned int dwarfnum; |
17 | }; | 18 | }; |
18 | 19 | ||
19 | #define STR(s) #s | ||
20 | #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} | 20 | #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} |
21 | #define GPR_DWARFNUM_NAME(num) \ | 21 | #define GPR_DWARFNUM_NAME(num) \ |
22 | {.name = STR(%r##num), .dwarfnum = num} | 22 | {.name = __stringify(%r##num), .dwarfnum = num} |
23 | #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} | 23 | #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} |
24 | 24 | ||
25 | /* | 25 | /* |
diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c index 068b6189157b..aea610c292e6 100644 --- a/tools/perf/arch/arm64/util/dwarf-regs.c +++ b/tools/perf/arch/arm64/util/dwarf-regs.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <stddef.h> | 11 | #include <stddef.h> |
12 | #include <dwarf-regs.h> | 12 | #include <dwarf-regs.h> |
13 | #include <linux/ptrace.h> /* for struct user_pt_regs */ | 13 | #include <linux/ptrace.h> /* for struct user_pt_regs */ |
14 | #include <linux/stringify.h> | ||
14 | #include "util.h" | 15 | #include "util.h" |
15 | 16 | ||
16 | struct pt_regs_dwarfnum { | 17 | struct pt_regs_dwarfnum { |
@@ -20,7 +21,7 @@ struct pt_regs_dwarfnum { | |||
20 | 21 | ||
21 | #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} | 22 | #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} |
22 | #define GPR_DWARFNUM_NAME(num) \ | 23 | #define GPR_DWARFNUM_NAME(num) \ |
23 | {.name = STR(%x##num), .dwarfnum = num} | 24 | {.name = __stringify(%x##num), .dwarfnum = num} |
24 | #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} | 25 | #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} |
25 | #define DWARFNUM2OFFSET(index) \ | 26 | #define DWARFNUM2OFFSET(index) \ |
26 | (index * sizeof((struct user_pt_regs *)0)->regs[0]) | 27 | (index * sizeof((struct user_pt_regs *)0)->regs[0]) |
diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/powerpc/util/dwarf-regs.c index 41bdf9530d82..98ac87052a74 100644 --- a/tools/perf/arch/powerpc/util/dwarf-regs.c +++ b/tools/perf/arch/powerpc/util/dwarf-regs.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <dwarf-regs.h> | 15 | #include <dwarf-regs.h> |
16 | #include <linux/ptrace.h> | 16 | #include <linux/ptrace.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/stringify.h> | ||
18 | #include "util.h" | 19 | #include "util.h" |
19 | 20 | ||
20 | struct pt_regs_dwarfnum { | 21 | struct pt_regs_dwarfnum { |
@@ -24,10 +25,10 @@ struct pt_regs_dwarfnum { | |||
24 | }; | 25 | }; |
25 | 26 | ||
26 | #define REG_DWARFNUM_NAME(r, num) \ | 27 | #define REG_DWARFNUM_NAME(r, num) \ |
27 | {.name = STR(%)STR(r), .dwarfnum = num, \ | 28 | {.name = __stringify(%)__stringify(r), .dwarfnum = num, \ |
28 | .ptregs_offset = offsetof(struct pt_regs, r)} | 29 | .ptregs_offset = offsetof(struct pt_regs, r)} |
29 | #define GPR_DWARFNUM_NAME(num) \ | 30 | #define GPR_DWARFNUM_NAME(num) \ |
30 | {.name = STR(%gpr##num), .dwarfnum = num, \ | 31 | {.name = __stringify(%gpr##num), .dwarfnum = num, \ |
31 | .ptregs_offset = offsetof(struct pt_regs, gpr[num])} | 32 | .ptregs_offset = offsetof(struct pt_regs, gpr[num])} |
32 | #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0} | 33 | #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0} |
33 | 34 | ||
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c index 86399eda3684..03347748f3fa 100644 --- a/tools/perf/util/cgroup.c +++ b/tools/perf/util/cgroup.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "evsel.h" | 4 | #include "evsel.h" |
5 | #include "cgroup.h" | 5 | #include "cgroup.h" |
6 | #include "evlist.h" | 6 | #include "evlist.h" |
7 | #include <linux/stringify.h> | ||
7 | 8 | ||
8 | int nr_cgroups; | 9 | int nr_cgroups; |
9 | 10 | ||
@@ -27,8 +28,8 @@ cgroupfs_find_mountpoint(char *buf, size_t maxlen) | |||
27 | path_v1[0] = '\0'; | 28 | path_v1[0] = '\0'; |
28 | path_v2[0] = '\0'; | 29 | path_v2[0] = '\0'; |
29 | 30 | ||
30 | while (fscanf(fp, "%*s %"STR(PATH_MAX)"s %"STR(PATH_MAX)"s %" | 31 | while (fscanf(fp, "%*s %"__stringify(PATH_MAX)"s %"__stringify(PATH_MAX)"s %" |
31 | STR(PATH_MAX)"s %*d %*d\n", | 32 | __stringify(PATH_MAX)"s %*d %*d\n", |
32 | mountpoint, type, tokens) == 3) { | 33 | mountpoint, type, tokens) == 3) { |
33 | 34 | ||
34 | if (!path_v1[0] && !strcmp(type, "cgroup")) { | 35 | if (!path_v1[0] && !strcmp(type, "cgroup")) { |
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index c9a941ef0f6d..da6262dbe9e3 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <byteswap.h> | 9 | #include <byteswap.h> |
10 | #include <sys/stat.h> | 10 | #include <sys/stat.h> |
11 | #include <sys/mman.h> | 11 | #include <sys/mman.h> |
12 | #include <linux/stringify.h> | ||
12 | 13 | ||
13 | #include "util.h" | 14 | #include "util.h" |
14 | #include "event.h" | 15 | #include "event.h" |
@@ -181,7 +182,7 @@ jit_open(struct jit_buf_desc *jd, const char *name) | |||
181 | jd->use_arch_timestamp); | 182 | jd->use_arch_timestamp); |
182 | 183 | ||
183 | if (header.version > JITHEADER_VERSION) { | 184 | if (header.version > JITHEADER_VERSION) { |
184 | pr_err("wrong jitdump version %u, expected " STR(JITHEADER_VERSION), | 185 | pr_err("wrong jitdump version %u, expected " __stringify(JITHEADER_VERSION), |
185 | header.version); | 186 | header.version); |
186 | goto error; | 187 | goto error; |
187 | } | 188 | } |
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 593a24192924..aa35509464b5 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
@@ -180,9 +180,6 @@ struct perf_event_attr; | |||
180 | 180 | ||
181 | void event_attr_init(struct perf_event_attr *attr); | 181 | void event_attr_init(struct perf_event_attr *attr); |
182 | 182 | ||
183 | #define _STR(x) #x | ||
184 | #define STR(x) _STR(x) | ||
185 | |||
186 | size_t hex_width(u64 v); | 183 | size_t hex_width(u64 v); |
187 | int hex2u64(const char *ptr, u64 *val); | 184 | int hex2u64(const char *ptr, u64 *val); |
188 | 185 | ||