-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #390 from github/lcartey/m5-0-20-pointers
Exclude pointer assign from bitwise assign
- Loading branch information
Showing
11 changed files
with
77 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* `M5-0-20`, `M5-0-21`, `RULE-10-1` - exclude pointer assignment operators as bitwise operators. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- `M5-0-20` - `BitwiseOperatorOperandsHaveDifferentUnderlyingType.ql`: | ||
- Use the Misra definition of underlying type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 21 additions & 21 deletions
42
cpp/autosar/test/rules/M5-0-20/BitwiseOperatorOperandsHaveDifferentUnderlyingType.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
| test.cpp:18:3:18:6 | ... & ... | Operands of the '&' operation have different underlying types. | | ||
| test.cpp:19:3:19:7 | ... \| ... | Operands of the '\|' operation have different underlying types. | | ||
| test.cpp:20:3:20:7 | ... ^ ... | Operands of the '^' operation have different underlying types. | | ||
| test.cpp:21:3:21:8 | ... << ... | Operands of the '<<' operation have different underlying types. | | ||
| test.cpp:22:3:22:8 | ... >> ... | Operands of the '>>' operation have different underlying types. | | ||
| test.cpp:23:3:23:8 | ... &= ... | Operands of the '&=' operation have different underlying types. | | ||
| test.cpp:24:3:24:8 | ... \|= ... | Operands of the '\|=' operation have different underlying types. | | ||
| test.cpp:25:3:25:8 | ... ^= ... | Operands of the '^=' operation have different underlying types. | | ||
| test.cpp:26:3:26:9 | ... <<= ... | Operands of the '<<=' operation have different underlying types. | | ||
| test.cpp:27:3:27:9 | ... >>= ... | Operands of the '>>=' operation have different underlying types. | | ||
| test.cpp:45:3:45:6 | ... & ... | Operands of the '&' operation have different underlying types. | | ||
| test.cpp:46:3:46:7 | ... \| ... | Operands of the '\|' operation have different underlying types. | | ||
| test.cpp:47:3:47:7 | ... ^ ... | Operands of the '^' operation have different underlying types. | | ||
| test.cpp:48:3:48:8 | ... << ... | Operands of the '<<' operation have different underlying types. | | ||
| test.cpp:49:3:49:8 | ... >> ... | Operands of the '>>' operation have different underlying types. | | ||
| test.cpp:50:3:50:8 | ... &= ... | Operands of the '&=' operation have different underlying types. | | ||
| test.cpp:51:3:51:8 | ... \|= ... | Operands of the '\|=' operation have different underlying types. | | ||
| test.cpp:52:3:52:8 | ... ^= ... | Operands of the '^=' operation have different underlying types. | | ||
| test.cpp:53:3:53:9 | ... <<= ... | Operands of the '<<=' operation have different underlying types. | | ||
| test.cpp:54:3:54:9 | ... >>= ... | Operands of the '>>=' operation have different underlying types. | | ||
| test.cpp:67:3:67:14 | ... << ... | Operands of the '<<' operation have different underlying types. | | ||
| test.cpp:18:3:18:6 | ... & ... | Operands of the '&' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:19:3:19:7 | ... \| ... | Operands of the '\|' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:20:3:20:7 | ... ^ ... | Operands of the '^' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:21:3:21:8 | ... << ... | Operands of the '<<' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:22:3:22:8 | ... >> ... | Operands of the '>>' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:23:3:23:8 | ... &= ... | Operands of the '&=' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:24:3:24:8 | ... \|= ... | Operands of the '\|=' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:25:3:25:8 | ... ^= ... | Operands of the '^=' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:26:3:26:9 | ... <<= ... | Operands of the '<<=' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:27:3:27:9 | ... >>= ... | Operands of the '>>=' operation have different underlying types 'unsigned int' and 'unsigned short'. | | ||
| test.cpp:45:3:45:6 | ... & ... | Operands of the '&' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:46:3:46:7 | ... \| ... | Operands of the '\|' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:47:3:47:7 | ... ^ ... | Operands of the '^' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:48:3:48:8 | ... << ... | Operands of the '<<' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:49:3:49:8 | ... >> ... | Operands of the '>>' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:50:3:50:8 | ... &= ... | Operands of the '&=' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:51:3:51:8 | ... \|= ... | Operands of the '\|=' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:52:3:52:8 | ... ^= ... | Operands of the '^=' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:53:3:53:9 | ... <<= ... | Operands of the '<<=' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:54:3:54:9 | ... >>= ... | Operands of the '>>=' operation have different underlying types 'unsigned char' and 'unsigned short'. | | ||
| test.cpp:67:3:67:14 | ... << ... | Operands of the '<<' operation have different underlying types 'int &' and 'char &'. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* A library for addressing issues in bitwise operator modelling in our database schema. | ||
*/ | ||
|
||
private import cpp as cpp | ||
|
||
module Bitwise { | ||
/** | ||
* A binary bitwise assign operation, excluding += and -= on pointers, which seem to be erroneously | ||
* included. | ||
*/ | ||
class AssignBitwiseOperation extends cpp::AssignBitwiseOperation { | ||
AssignBitwiseOperation() { | ||
// exclude += and -= on pointers, which seem to be erroneously included | ||
// in the database schema | ||
not this instanceof cpp::AssignPointerAddExpr and | ||
not this instanceof cpp::AssignPointerSubExpr | ||
} | ||
} | ||
} |