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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c3dca1a1
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include <stddef.h> #include <stddef.h>
#include <linux/stringify.h>
#include <dwarf-regs.h> #include <dwarf-regs.h>
struct pt_regs_dwarfnum { struct pt_regs_dwarfnum {
...@@ -16,10 +17,9 @@ struct pt_regs_dwarfnum { ...@@ -16,10 +17,9 @@ struct pt_regs_dwarfnum {
unsigned int dwarfnum; unsigned int dwarfnum;
}; };
#define STR(s) #s
#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
#define GPR_DWARFNUM_NAME(num) \ #define GPR_DWARFNUM_NAME(num) \
{.name = STR(%r##num), .dwarfnum = num} {.name = __stringify(%r##num), .dwarfnum = num}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
/* /*
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <stddef.h> #include <stddef.h>
#include <dwarf-regs.h> #include <dwarf-regs.h>
#include <linux/ptrace.h> /* for struct user_pt_regs */ #include <linux/ptrace.h> /* for struct user_pt_regs */
#include <linux/stringify.h>
#include "util.h" #include "util.h"
struct pt_regs_dwarfnum { struct pt_regs_dwarfnum {
...@@ -20,7 +21,7 @@ struct pt_regs_dwarfnum { ...@@ -20,7 +21,7 @@ struct pt_regs_dwarfnum {
#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
#define GPR_DWARFNUM_NAME(num) \ #define GPR_DWARFNUM_NAME(num) \
{.name = STR(%x##num), .dwarfnum = num} {.name = __stringify(%x##num), .dwarfnum = num}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
#define DWARFNUM2OFFSET(index) \ #define DWARFNUM2OFFSET(index) \
(index * sizeof((struct user_pt_regs *)0)->regs[0]) (index * sizeof((struct user_pt_regs *)0)->regs[0])
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <dwarf-regs.h> #include <dwarf-regs.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/stringify.h>
#include "util.h" #include "util.h"
struct pt_regs_dwarfnum { struct pt_regs_dwarfnum {
...@@ -24,10 +25,10 @@ struct pt_regs_dwarfnum { ...@@ -24,10 +25,10 @@ struct pt_regs_dwarfnum {
}; };
#define REG_DWARFNUM_NAME(r, num) \ #define REG_DWARFNUM_NAME(r, num) \
{.name = STR(%)STR(r), .dwarfnum = num, \ {.name = __stringify(%)__stringify(r), .dwarfnum = num, \
.ptregs_offset = offsetof(struct pt_regs, r)} .ptregs_offset = offsetof(struct pt_regs, r)}
#define GPR_DWARFNUM_NAME(num) \ #define GPR_DWARFNUM_NAME(num) \
{.name = STR(%gpr##num), .dwarfnum = num, \ {.name = __stringify(%gpr##num), .dwarfnum = num, \
.ptregs_offset = offsetof(struct pt_regs, gpr[num])} .ptregs_offset = offsetof(struct pt_regs, gpr[num])}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0} #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0}
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "evsel.h" #include "evsel.h"
#include "cgroup.h" #include "cgroup.h"
#include "evlist.h" #include "evlist.h"
#include <linux/stringify.h>
int nr_cgroups; int nr_cgroups;
...@@ -27,8 +28,8 @@ cgroupfs_find_mountpoint(char *buf, size_t maxlen) ...@@ -27,8 +28,8 @@ cgroupfs_find_mountpoint(char *buf, size_t maxlen)
path_v1[0] = '\0'; path_v1[0] = '\0';
path_v2[0] = '\0'; path_v2[0] = '\0';
while (fscanf(fp, "%*s %"STR(PATH_MAX)"s %"STR(PATH_MAX)"s %" while (fscanf(fp, "%*s %"__stringify(PATH_MAX)"s %"__stringify(PATH_MAX)"s %"
STR(PATH_MAX)"s %*d %*d\n", __stringify(PATH_MAX)"s %*d %*d\n",
mountpoint, type, tokens) == 3) { mountpoint, type, tokens) == 3) {
if (!path_v1[0] && !strcmp(type, "cgroup")) { if (!path_v1[0] && !strcmp(type, "cgroup")) {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <byteswap.h> #include <byteswap.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <linux/stringify.h>
#include "util.h" #include "util.h"
#include "event.h" #include "event.h"
...@@ -181,7 +182,7 @@ jit_open(struct jit_buf_desc *jd, const char *name) ...@@ -181,7 +182,7 @@ jit_open(struct jit_buf_desc *jd, const char *name)
jd->use_arch_timestamp); jd->use_arch_timestamp);
if (header.version > JITHEADER_VERSION) { if (header.version > JITHEADER_VERSION) {
pr_err("wrong jitdump version %u, expected " STR(JITHEADER_VERSION), pr_err("wrong jitdump version %u, expected " __stringify(JITHEADER_VERSION),
header.version); header.version);
goto error; goto error;
} }
......
...@@ -180,9 +180,6 @@ struct perf_event_attr; ...@@ -180,9 +180,6 @@ struct perf_event_attr;
void event_attr_init(struct perf_event_attr *attr); void event_attr_init(struct perf_event_attr *attr);
#define _STR(x) #x
#define STR(x) _STR(x)
size_t hex_width(u64 v); size_t hex_width(u64 v);
int hex2u64(const char *ptr, u64 *val); int hex2u64(const char *ptr, u64 *val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment