diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-10-14 15:41:47 -0400 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-10-14 15:41:47 -0400 |
commit | dc664ee12621ad7d146ae9bcce92f17bad4c59e8 (patch) | |
tree | 37991d805ddac2305783cc3244b0142629040968 | |
parent | 08baa2bbcb727883a072143acbcf3680626979b9 (diff) |
add -std=gnu99 to compiling
Perf uses -std=gnu99 which causes some strange side effects.
To keep parse-events.c close to what is in perf, we use the same
option. Namely, it makes us typecast the options for "%a" in the
sscanf to float.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | parse-events.c | 8 |
2 files changed, 6 insertions, 5 deletions
@@ -1,9 +1,10 @@ | |||
1 | CC = gcc | 1 | CC = gcc |
2 | EXT = -std=gnu99 | ||
2 | CFLAGS = -g -Wall # -O2 | 3 | CFLAGS = -g -Wall # -O2 |
3 | INCLUDES = -I. -I/usr/local/include | 4 | INCLUDES = -I. -I/usr/local/include |
4 | 5 | ||
5 | %.o: %.c | 6 | %.o: %.c |
6 | $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ | 7 | $(CC) -c $(CFLAGS) $(EXT) $(INCLUDES) $< -o $@ |
7 | 8 | ||
8 | TARGETS = trace-cmd | 9 | TARGETS = trace-cmd |
9 | 10 | ||
diff --git a/parse-events.c b/parse-events.c index 1da9433..a9a06b9 100644 --- a/parse-events.c +++ b/parse-events.c | |||
@@ -95,7 +95,7 @@ void parse_cmdlines(char *file, int size __unused) | |||
95 | while (line) { | 95 | while (line) { |
96 | item = malloc_or_die(sizeof(*item)); | 96 | item = malloc_or_die(sizeof(*item)); |
97 | sscanf(line, "%d %as", &item->pid, | 97 | sscanf(line, "%d %as", &item->pid, |
98 | &item->comm); /* workaround gcc warning */ | 98 | (float *)(void *)&item->comm); /* workaround gcc warning */ |
99 | item->next = list; | 99 | item->next = list; |
100 | list = item; | 100 | list = item; |
101 | line = strtok_r(NULL, "\n", &next); | 101 | line = strtok_r(NULL, "\n", &next); |
@@ -175,10 +175,10 @@ void parse_proc_kallsyms(char *file, unsigned int size __unused) | |||
175 | item = malloc_or_die(sizeof(*item)); | 175 | item = malloc_or_die(sizeof(*item)); |
176 | item->mod = NULL; | 176 | item->mod = NULL; |
177 | ret = sscanf(line, "%as %c %as\t[%as", | 177 | ret = sscanf(line, "%as %c %as\t[%as", |
178 | &addr_str, | 178 | (float *)(void *)&addr_str, /* workaround gcc warning */ |
179 | &ch, | 179 | &ch, |
180 | &item->func, | 180 | (float *)(void *)&item->func, |
181 | &item->mod); | 181 | (float *)(void *)&item->mod); |
182 | item->addr = strtoull(addr_str, NULL, 16); | 182 | item->addr = strtoull(addr_str, NULL, 16); |
183 | free(addr_str); | 183 | free(addr_str); |
184 | 184 | ||