Switch case range rule S3936

c
sonarcfamily
cpp

(Jordi Duatis Juarez) #1

Rule S3936 detects when in a switch case range, no real range is indicated. However, case ranges is a compiler extension, not something included in any C/C++ standard, as far as I know. Therefore, there should be a rule detecting switch case ranges (if any) since this is impacting code portability, better than only detecting when a range is meaningless. This rule should be with major impact at least. It is strange to me to see that there are many portability rules declared even as blocking, but nothing about this one.

As the detection of rule S3936 is already available, I guess that checking simply the existence of case ranges would be very easy to implement.

Thanks!


(Evgeny Mandrikov) #2

There is already S3715 , which

raises an issue when the following GNU extensions are used:

  • Case ranges