Re: How to fix warning 'control reaches end of non-void function'

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

 



On 29-07-08 21:17, Alexander Beregalov wrote:

What is it a right way to fix these warnings?

smth function()
{
	switch (var) {
	case one:
		return 1;
	default:
		BUG();
	}
}

warning: control reaches end of non-void function

BUG() may actually do nothing so I'd just reorder things around as

int function(void)
{
	switch (var) {
	case 1:
		break;
	default:
		BUG();
	}
	return 1;
}

Rene.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux