Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+12 -11
+2 -2
tools/perf/arch/arm/util/dwarf-regs.c
··· 9 9 */ 10 10 11 11 #include <stddef.h> 12 + #include <linux/stringify.h> 12 13 #include <dwarf-regs.h> 13 14 14 15 struct pt_regs_dwarfnum { ··· 17 16 unsigned int dwarfnum; 18 17 }; 19 18 20 - #define STR(s) #s 21 19 #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} 22 20 #define GPR_DWARFNUM_NAME(num) \ 23 - {.name = STR(%r##num), .dwarfnum = num} 21 + {.name = __stringify(%r##num), .dwarfnum = num} 24 22 #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} 25 23 26 24 /*
+2 -1
tools/perf/arch/arm64/util/dwarf-regs.c
··· 11 11 #include <stddef.h> 12 12 #include <dwarf-regs.h> 13 13 #include <linux/ptrace.h> /* for struct user_pt_regs */ 14 + #include <linux/stringify.h> 14 15 #include "util.h" 15 16 16 17 struct pt_regs_dwarfnum { ··· 21 20 22 21 #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} 23 22 #define GPR_DWARFNUM_NAME(num) \ 24 - {.name = STR(%x##num), .dwarfnum = num} 23 + {.name = __stringify(%x##num), .dwarfnum = num} 25 24 #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} 26 25 #define DWARFNUM2OFFSET(index) \ 27 26 (index * sizeof((struct user_pt_regs *)0)->regs[0])
+3 -2
tools/perf/arch/powerpc/util/dwarf-regs.c
··· 15 15 #include <dwarf-regs.h> 16 16 #include <linux/ptrace.h> 17 17 #include <linux/kernel.h> 18 + #include <linux/stringify.h> 18 19 #include "util.h" 19 20 20 21 struct pt_regs_dwarfnum { ··· 25 24 }; 26 25 27 26 #define REG_DWARFNUM_NAME(r, num) \ 28 - {.name = STR(%)STR(r), .dwarfnum = num, \ 27 + {.name = __stringify(%)__stringify(r), .dwarfnum = num, \ 29 28 .ptregs_offset = offsetof(struct pt_regs, r)} 30 29 #define GPR_DWARFNUM_NAME(num) \ 31 - {.name = STR(%gpr##num), .dwarfnum = num, \ 30 + {.name = __stringify(%gpr##num), .dwarfnum = num, \ 32 31 .ptregs_offset = offsetof(struct pt_regs, gpr[num])} 33 32 #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0} 34 33
+3 -2
tools/perf/util/cgroup.c
··· 4 4 #include "evsel.h" 5 5 #include "cgroup.h" 6 6 #include "evlist.h" 7 + #include <linux/stringify.h> 7 8 8 9 int nr_cgroups; 9 10 ··· 28 27 path_v1[0] = '\0'; 29 28 path_v2[0] = '\0'; 30 29 31 - while (fscanf(fp, "%*s %"STR(PATH_MAX)"s %"STR(PATH_MAX)"s %" 32 - STR(PATH_MAX)"s %*d %*d\n", 30 + while (fscanf(fp, "%*s %"__stringify(PATH_MAX)"s %"__stringify(PATH_MAX)"s %" 31 + __stringify(PATH_MAX)"s %*d %*d\n", 33 32 mountpoint, type, tokens) == 3) { 34 33 35 34 if (!path_v1[0] && !strcmp(type, "cgroup")) {
+2 -1
tools/perf/util/jitdump.c
··· 9 9 #include <byteswap.h> 10 10 #include <sys/stat.h> 11 11 #include <sys/mman.h> 12 + #include <linux/stringify.h> 12 13 13 14 #include "util.h" 14 15 #include "event.h" ··· 182 181 jd->use_arch_timestamp); 183 182 184 183 if (header.version > JITHEADER_VERSION) { 185 - pr_err("wrong jitdump version %u, expected " STR(JITHEADER_VERSION), 184 + pr_err("wrong jitdump version %u, expected " __stringify(JITHEADER_VERSION), 186 185 header.version); 187 186 goto error; 188 187 }
-3
tools/perf/util/util.h
··· 180 180 181 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 183 size_t hex_width(u64 v); 187 184 int hex2u64(const char *ptr, u64 *val); 188 185