view usr/src/tools/smatch/src/validation/enum-bounds.c @ 19241:79022555a4a9

11972 resync smatch Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Dan McDonald <danmcd@joyent.com>
author John Levon <john.levon@joyent.com>
date Mon, 11 Nov 2019 16:23:50 +0000
parents
children
line wrap: on
line source

enum bound_int_max {
	IMAX = __INT_MAX__,
};
_Static_assert([typeof(IMAX)] == [int], "");

enum bound_int_maxp1 {
	IMP1 = __INT_MAX__ + 1L,
};
_Static_assert([typeof(IMP1)] == [unsigned int], "");

enum bound_int_maxm1 {
	IMM1 = -__INT_MAX__ - 1L,
};
_Static_assert([typeof(IMM1)] == [int], "");

enum bound_int_maxm2 {
	IMM2 = -__INT_MAX__ - 2L,
};
_Static_assert([typeof(IMM2)] == [long], "");

/*
 * check-name: enum-bounds
 * check-command: sparse -m64 $file
 * check-assert: sizeof(long) == 8
 */