ignoring return values on parser.c

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

 



Hi,

I have noticed that on parser.c the return values of strtol/strtoul is being ignored.

This is the warning messages when compiling the code:
parser.c: In function 'match_one':
parser.c:71: warning: ignoring return value of 'strtol', declared with attribute warn_unused_result
parser.c:74: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
parser.c:77: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
parser.c:80: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result

Below is the code:

switch (*p++) {
	case 's':
		if (strlen(s) == 0)
			return 0;
		else if (len == -1 || len > strlen(s))
			len = strlen(s);
		args[argc].to = s + len;
		break;
	case 'd':
		strtol(s, &args[argc].to, 0);
		goto num;
	case 'u':
		strtoul(s, &args[argc].to, 0);
		goto num;
	case 'o':
		strtoul(s, &args[argc].to, 8);
		goto num;
	case 'x':
		strtoul(s, &args[argc].to, 16);
	num:
		if (args[argc].to == args[argc].from)
			return 0;
		break;
	default:
		return 0;
	}
	s = args[argc].to;
	argc++;
}

As I understand, today, all other options beside 's' are not in use.
Are they exist only for future use?
Anyway, if we keep this code we need to check the return values in order to avoid
the above warnings. 

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

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux