Re: follow-up on printf formatting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 22, 2019 at 01:06:28PM +0100, Ben Dooks wrote:
> On 25/09/2019 11:00, Ben Dooks wrote:
> > This is a re-send of the printf formatting parsing to see if there is
> > anything else that needs doing before getting it added to the next
> > release.
> 
> I've put a new copy of this up at:
> 
> https://github.com/bjdooks-ct/sparse bjdooks/printf19

Thank you for the quick updates.
I think everything is covered but my 2 last emails:
* an update about string-- in evaluate_format_printf().
  a test case is the following:
	void prt(const char *, ...) __attribute__((format(printf, 1, 2)));
	static void foo(int x, int y, const void *p)
	{
		prt("%02x%02x %8p\n", x, y, p);
	}

* one about get_printf_fmt() and the dereference of expr->string and
  expression's type vs. expr->symbol. A testcase for it is:
	void prt(const char *, ...) __attribute__((format(printf, 1, 2)));
	static inline void fun(int x) { prt("%08x\n", x); }
	static void foo(int x)
	{
		fun;
		fun(x);
	}

If you could also add to your tests one like:
	void prt(const char *, ...) __attribute__((format(printf, 1, 2)));
	static void foo(int i, unsigned int u)
	{
		prt("%d\n", i);
		prt("%x\n", u);
	}
This is surprisingly not covered by your more complex ones.
 
> we're back to having some tests fail as it looks like the current
> evaluation does not care about int vs long.

Yes. Sorry if I wasn't clear enough but I said that it needs something
*like* check_assignment_types() instead of directly comparing the pointers.
But, yes, check_assignment_types() itself ignore the size and signedness.

If help is needed, I can look at this in a few days.
-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux