Skip to content

Commit

Permalink
perf tools: Use __maybe_unused consistently
Browse files Browse the repository at this point in the history
Instead of defining __unused or redefining __maybe_unused.

Cc: Adrian Hunter <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Jun 19, 2017
1 parent 3ee350f commit 0353631
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tools/perf/bench/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ static inline uint32_t lfsr_32(uint32_t lfsr)
* kernel (KSM, zero page, etc.) cannot optimize away RAM
* accesses:
*/
static inline u64 access_data(u64 *data __attribute__((unused)), u64 val)
static inline u64 access_data(u64 *data, u64 val)
{
if (g->p.data_reads)
val += *data;
Expand Down
2 changes: 0 additions & 2 deletions tools/perf/jvmti/jvmti_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <stdint.h>
#include <jvmti.h>

#define __unused __attribute__((unused))

#if defined(__cplusplus)
extern "C" {
#endif
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/jvmti/libjvmti.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <linux/compiler.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -238,7 +239,7 @@ code_generated_cb(jvmtiEnv *jvmti,
}

JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __unused)
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __maybe_unused)
{
jvmtiEventCallbacks cb;
jvmtiCapabilities caps1;
Expand Down Expand Up @@ -313,7 +314,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __unused)
}

JNIEXPORT void JNICALL
Agent_OnUnload(JavaVM *jvm __unused)
Agent_OnUnload(JavaVM *jvm __maybe_unused)
{
int ret;

Expand Down
4 changes: 0 additions & 4 deletions tools/perf/pmu-events/jevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
#include "json.h"
#include "jevents.h"

#ifndef __maybe_unused
#define __maybe_unused __attribute__((unused))
#endif

int verbose;
char *prog;

Expand Down
3 changes: 2 additions & 1 deletion tools/perf/util/evsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <traceevent/event-parse.h>
#include <linux/hw_breakpoint.h>
#include <linux/perf_event.h>
#include <linux/compiler.h>
#include <linux/err.h>
#include <sys/ioctl.h>
#include <sys/resource.h>
Expand Down Expand Up @@ -1441,7 +1442,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
}

static int __open_attr__fprintf(FILE *fp, const char *name, const char *val,
void *priv __attribute__((unused)))
void *priv __maybe_unused)
{
return fprintf(fp, " %-32s %s\n", name, val);
}
Expand Down
3 changes: 2 additions & 1 deletion tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/bitops.h>
Expand Down Expand Up @@ -1274,7 +1275,7 @@ read_event_desc(struct perf_header *ph, int fd)
}

static int __desc_attr__fprintf(FILE *fp, const char *name, const char *val,
void *priv __attribute__((unused)))
void *priv __maybe_unused)
{
return fprintf(fp, ", %s = %s", name, val);
}
Expand Down

0 comments on commit 0353631

Please sign in to comment.