Sparse doesn't seem to check __must_hold macros.

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

 



Hello,

I was just testing sparse on a large (non-linux) code base using the
__must_hold macro (eg __attribute__((context, 1, 1))).

However I don't seem to be able to trigger a warning from it.

I've attached a test case below, is there some magic I need to do get sparse
to trigger on this case.  I also note there are currently no tests in
validation that check for this case.

Regards,
nash
static int must_hold(int x) __attribute__((context(1,1))) {
	int z;

	return x * 7;
}

static int release(int x) __attribute__((context(1, 0))) {
	__context__(-1);
	return 0;
}

static int acquiresilently(int x) {
	__context__(1);

	return 1;
}

int main(int argc, char **argv) {
	must_hold(8);
	__context__(1);
	must_hold(0);
	__context__(-1);
	return 0;
}

[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