Re: [PATCH V9 01/14] perf tools: add debug prints

From: Namhyung Kim
Date: Wed Aug 07 2013 - 04:50:37 EST

On Wed, 07 Aug 2013 11:13:23 +0300, Adrian Hunter wrote:
> On 07/08/13 09:44, Namhyung Kim wrote:
>> Things like this likely being ended up with typo. How about this? (not tested)
> And yet there aren't any typos.

Yes, but there's a possibility of adding one later. I have a memory
that when Jiri added something similar there's one so we changed to use
macros for that.

>> #define __PRINT_ATTR(fmt, cast, field) \
>> fprintf(fp, " %-28s "fmt"\n", #field, cast attr->field)
>> #define PRINT_ATTR_D32(field) __PRINT_ATTR("%u", ,field)
>> #define PRINT_ATTR_X32(field) __PRINT_ATTR("%#x", ,field)
>> #define PRINT_ATTR_D64(field) __PRINT_ATTR("%"PRIu64, (uint64_t), field)
>> #define PRINT_ATTR_X64(field) __PRINT_ATTR("%#"PRIx64, (uint64_t), field)
>> #define PRINT_ATTR2(field1, field2) \
>> fprintf(fp, " %-28s %u %-28s %u\n", \
>> #field1, attr->field1, #field2, attr->field2)
> That does not allow the output to be nicely formatted. In some cases the
> field name is just too long and I have abbreviated it.

But yet there aren't any longer than 28. :)

> When you add in all the variations you just get a macro mess.

I think above 5 is enough but who knows..

Anyway I won't arguing on it strongly, it's just a matter of styles IMHO.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at