Fix in MISRA rule 6.1 check#3458
Conversation
|
It looks like some checks are failing because the check is testing the 6.1 misra rule. If this PR is accepted....the checks shall be changed aswell |
|
Using valuetype is ok. can you please look at the test also. You should be able to run it locally like this: |
|
Any maintainer could please run the pipeline?? |
| unsigned int a:2; // Compliant | ||
| signed int b:2; // Compliant | ||
| UINT_TYPEDEF c:2; // Compliant | ||
| int d:2; // 6.1 - plain int not compliant |
There was a problem hiding this comment.
I believe we should warn about this
|
Hi @danmar I've been reviewing this....understanding the way the tests are done......and my initial fix was not correct, I think. That's why I needed to delete a test to run successfully. Your infraestructure is quite complex.....I'm learning about it. Now I thinks it looks better locally in all the tests that I've achieved to perform. In my local code, this is how it looks like: If you could run the pipelines again, please.... Thanks!!! |
|
From my side it's ready to be merged |
|
I would like that you add a line of test code in cppcheck/addons/test/misra/misra-test.c please tweak the |
Fix 6.1 for C89 test
|
my fault!! I was testing locally only --std=c99, and not --std=c89 |

Hi @danmar congrats for cppcheck!!! such a great tool. We are using it and we found some with MISRA rule 6.1.
This is an example of our code:
and this is the report:
as you can see, "unsigned int" is being accepted, but "uint16_t" not.
This is the official MIRSA 2012 rule:

(see in yellow that typedefs shall be accepted)
so I've been debuging your misra.py file......and I did a fix. Now It detects the sign for both conventions ("unsiged int" and "uint")
Thanks!!
Dani