Checking for (integer) constants in lints is inconsistent and does not handle all cases (e.g., static constants) #6365
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
Several lints such as the integer_arithmetic and modulo_one lint check for specific integer constants, typically +/-1, 0, MIN, MAX. However, this is currently implemented inconsistently, sometimes only checking for (+/-) literals (
integer_arithmetic
, see also #6209), sometimes also for constants (modulo_one
). However, themodulo_one
lint also fails to properly handle static constants (see also #6360); I am not sure, if this is due to some deeper reason I don't yet understand or if this is simply a bug.I would suggest consolidating these checks for particular values to rely on a single constant-comparison function similar to (or replacing) the is_integer_const function, but also handling static constants. Likely, this could be used in other places as well.
The text was updated successfully, but these errors were encountered: