diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-04-06 13:32:24 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-05-16 14:41:07 -0400 |
commit | e90b0c8bf211958a296d60369fecd51b35864407 (patch) | |
tree | f7fd76b6783ef4ee3271e2374b07ded0badad74f /scripts/recordmcount.c | |
parent | dd5477ff3ba978892014ea5f988cb1bf04aa505e (diff) |
ftrace/trivial: Clean up record mcount to use Linux switch style
The Linux style for switch statements is:
switch (var) {
case x:
[...]
break;
}
Not:
switch (var) {
case x: {
[...]
} break;
Cc: John Reiser <jreiser@bitwagon.com>
Link: http://lkml.kernel.org/r/20110421023737.523968644@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'scripts/recordmcount.c')
-rw-r--r-- | scripts/recordmcount.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index 37afe0ecacb2..4ebd8399cb33 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c | |||
@@ -264,27 +264,27 @@ do_file(char const *const fname) | |||
264 | w8 = w8nat; | 264 | w8 = w8nat; |
265 | switch (ehdr->e_ident[EI_DATA]) { | 265 | switch (ehdr->e_ident[EI_DATA]) { |
266 | static unsigned int const endian = 1; | 266 | static unsigned int const endian = 1; |
267 | default: { | 267 | default: |
268 | fprintf(stderr, "unrecognized ELF data encoding %d: %s\n", | 268 | fprintf(stderr, "unrecognized ELF data encoding %d: %s\n", |
269 | ehdr->e_ident[EI_DATA], fname); | 269 | ehdr->e_ident[EI_DATA], fname); |
270 | fail_file(); | 270 | fail_file(); |
271 | } break; | 271 | break; |
272 | case ELFDATA2LSB: { | 272 | case ELFDATA2LSB: |
273 | if (*(unsigned char const *)&endian != 1) { | 273 | if (*(unsigned char const *)&endian != 1) { |
274 | /* main() is big endian, file.o is little endian. */ | 274 | /* main() is big endian, file.o is little endian. */ |
275 | w = w4rev; | 275 | w = w4rev; |
276 | w2 = w2rev; | 276 | w2 = w2rev; |
277 | w8 = w8rev; | 277 | w8 = w8rev; |
278 | } | 278 | } |
279 | } break; | 279 | break; |
280 | case ELFDATA2MSB: { | 280 | case ELFDATA2MSB: |
281 | if (*(unsigned char const *)&endian != 0) { | 281 | if (*(unsigned char const *)&endian != 0) { |
282 | /* main() is little endian, file.o is big endian. */ | 282 | /* main() is little endian, file.o is big endian. */ |
283 | w = w4rev; | 283 | w = w4rev; |
284 | w2 = w2rev; | 284 | w2 = w2rev; |
285 | w8 = w8rev; | 285 | w8 = w8rev; |
286 | } | 286 | } |
287 | } break; | 287 | break; |
288 | } /* end switch */ | 288 | } /* end switch */ |
289 | if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 | 289 | if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 |
290 | || w2(ehdr->e_type) != ET_REL | 290 | || w2(ehdr->e_type) != ET_REL |
@@ -295,11 +295,11 @@ do_file(char const *const fname) | |||
295 | 295 | ||
296 | gpfx = 0; | 296 | gpfx = 0; |
297 | switch (w2(ehdr->e_machine)) { | 297 | switch (w2(ehdr->e_machine)) { |
298 | default: { | 298 | default: |
299 | fprintf(stderr, "unrecognized e_machine %d %s\n", | 299 | fprintf(stderr, "unrecognized e_machine %d %s\n", |
300 | w2(ehdr->e_machine), fname); | 300 | w2(ehdr->e_machine), fname); |
301 | fail_file(); | 301 | fail_file(); |
302 | } break; | 302 | break; |
303 | case EM_386: reltype = R_386_32; break; | 303 | case EM_386: reltype = R_386_32; break; |
304 | case EM_ARM: reltype = R_ARM_ABS32; | 304 | case EM_ARM: reltype = R_ARM_ABS32; |
305 | altmcount = "__gnu_mcount_nc"; | 305 | altmcount = "__gnu_mcount_nc"; |
@@ -315,12 +315,12 @@ do_file(char const *const fname) | |||
315 | } /* end switch */ | 315 | } /* end switch */ |
316 | 316 | ||
317 | switch (ehdr->e_ident[EI_CLASS]) { | 317 | switch (ehdr->e_ident[EI_CLASS]) { |
318 | default: { | 318 | default: |
319 | fprintf(stderr, "unrecognized ELF class %d %s\n", | 319 | fprintf(stderr, "unrecognized ELF class %d %s\n", |
320 | ehdr->e_ident[EI_CLASS], fname); | 320 | ehdr->e_ident[EI_CLASS], fname); |
321 | fail_file(); | 321 | fail_file(); |
322 | } break; | 322 | break; |
323 | case ELFCLASS32: { | 323 | case ELFCLASS32: |
324 | if (w2(ehdr->e_ehsize) != sizeof(Elf32_Ehdr) | 324 | if (w2(ehdr->e_ehsize) != sizeof(Elf32_Ehdr) |
325 | || w2(ehdr->e_shentsize) != sizeof(Elf32_Shdr)) { | 325 | || w2(ehdr->e_shentsize) != sizeof(Elf32_Shdr)) { |
326 | fprintf(stderr, | 326 | fprintf(stderr, |
@@ -334,7 +334,7 @@ do_file(char const *const fname) | |||
334 | is_fake_mcount32 = MIPS32_is_fake_mcount; | 334 | is_fake_mcount32 = MIPS32_is_fake_mcount; |
335 | } | 335 | } |
336 | do32(ehdr, fname, reltype); | 336 | do32(ehdr, fname, reltype); |
337 | } break; | 337 | break; |
338 | case ELFCLASS64: { | 338 | case ELFCLASS64: { |
339 | Elf64_Ehdr *const ghdr = (Elf64_Ehdr *)ehdr; | 339 | Elf64_Ehdr *const ghdr = (Elf64_Ehdr *)ehdr; |
340 | if (w2(ghdr->e_ehsize) != sizeof(Elf64_Ehdr) | 340 | if (w2(ghdr->e_ehsize) != sizeof(Elf64_Ehdr) |
@@ -352,7 +352,8 @@ do_file(char const *const fname) | |||
352 | is_fake_mcount64 = MIPS64_is_fake_mcount; | 352 | is_fake_mcount64 = MIPS64_is_fake_mcount; |
353 | } | 353 | } |
354 | do64(ghdr, fname, reltype); | 354 | do64(ghdr, fname, reltype); |
355 | } break; | 355 | break; |
356 | } | ||
356 | } /* end switch */ | 357 | } /* end switch */ |
357 | 358 | ||
358 | cleanup(); | 359 | cleanup(); |
@@ -386,23 +387,23 @@ main(int argc, char const *argv[]) | |||
386 | continue; | 387 | continue; |
387 | 388 | ||
388 | switch (sjval) { | 389 | switch (sjval) { |
389 | default: { | 390 | default: |
390 | fprintf(stderr, "internal error: %s\n", argv[0]); | 391 | fprintf(stderr, "internal error: %s\n", argv[0]); |
391 | exit(1); | 392 | exit(1); |
392 | } break; | 393 | break; |
393 | case SJ_SETJMP: { /* normal sequence */ | 394 | case SJ_SETJMP: /* normal sequence */ |
394 | /* Avoid problems if early cleanup() */ | 395 | /* Avoid problems if early cleanup() */ |
395 | fd_map = -1; | 396 | fd_map = -1; |
396 | ehdr_curr = NULL; | 397 | ehdr_curr = NULL; |
397 | mmap_failed = 1; | 398 | mmap_failed = 1; |
398 | do_file(argv[0]); | 399 | do_file(argv[0]); |
399 | } break; | 400 | break; |
400 | case SJ_FAIL: { /* error in do_file or below */ | 401 | case SJ_FAIL: /* error in do_file or below */ |
401 | ++n_error; | 402 | ++n_error; |
402 | } break; | 403 | break; |
403 | case SJ_SUCCEED: { /* premature success */ | 404 | case SJ_SUCCEED: /* premature success */ |
404 | /* do nothing */ | 405 | /* do nothing */ |
405 | } break; | 406 | break; |
406 | } /* end switch */ | 407 | } /* end switch */ |
407 | } | 408 | } |
408 | return !!n_error; | 409 | return !!n_error; |