lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 07 Aug 2013 17:50:30 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Adrian Hunter <adrian.hunter@...el.com>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Stephane Eranian <eranian@...gle.com>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH V9 01/14] perf tools: add debug prints

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.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ