4 * Copyright (C) 2011 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
14 static void match_assign(struct expression
*expr
)
17 sval_t max_left
, max_right
;
23 macro
= get_macro_name(expr
->pos
);
26 if (strcmp(macro
, "min_t"))
29 if (!get_absolute_max(expr
->left
, &max_left
))
31 if (!get_absolute_max(expr
->right
, &max_right
))
34 if (sval_cmp(max_left
, max_right
) >= 0)
37 name
= get_variable_from_expr_complex(expr
->right
, NULL
);
38 sm_msg("warn: min_t truncates here '%s' (%s vs %s)", name
, sval_to_str(max_left
), sval_to_str(max_right
));
42 void check_min_t(int id
)
45 if (option_project
!= PROJ_KERNEL
)
47 add_hook(&match_assign
, ASSIGNMENT_HOOK
);