This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] take3: fix tst-pthread-getattr test case


> On Fri, 27 Jul 2012 21:11:56 -0700 (PDT), David wrote:
> > tst-pthread-getattr.c: In function 'check_stack_top':
> > tst-pthread-getattr.c:115:3: warning: format '%zu' expects argument
> > of type 'size_t', but argument 2 has type 'rlim_t' [-Wformat]
> 
> Thanks, fixed with this attached update of the patch. I wonder why I am
> not seeing those warnings on my box.

I did tell you about that one...  When there's fiddly stuff and casts
around it's always wise to test on both a 32-bit and a 64-bit platform.
But even so, which types match which others various between machines
even within those classes.  So as well as hoping for testers paying as
close attention to warnings as Dave does, it really pays just to be
thoroughly pedantic from the start about your choices of format
qualifiers and types to apply explicit casts.

> 	* tst-pthread-getattr.c (MAX_STACK_SIZE): New macro.
> 	(pagesize): New static variable.
> 	(allocate_and_test): Return MEM.  Rename parameter to TARGET.
> 	(check_stack_top): New local variables MEM and PAGEMASK.  Cap
> 	stack size to MAX_STACK_SIZE.  Call allocate_and_test for
> 	halfway up the stack top page.  Verify that the top page was
> 	written into. (do_test): Get pagesize using sysconf.

Missing line break before "(do_test)".

>    if ((ret = setrlimit (RLIMIT_STACK, &stack_limit)))

Not in your change, but while you're here, either add a < 0 or de-double
the parens.

Modulo those nits, this now looks fine to me.  (Yes, this all really was
excessive style detail for a mere test case, but I am incurably pedantic
that way, and I flatter myself it's good education for you and everyone
else newish to the project who bothers to read it.  Many kudos and
thanks for taking it all with such grace.)


Thanks,
Roland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]