File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
cpp/common/src/codingstandards/cpp/rules/bitfieldsshouldnotbedeclared Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1010import cpp
1111import codingstandards.cpp.Customizations
1212import codingstandards.cpp.Exclusions
13+ import codingstandards.cpp.HardwareOrProtocolInterface
1314
1415signature module BitFieldsShouldNotBeDeclaredConfigSig {
1516 Query getQuery ( ) ;
1617}
1718
1819module BitFieldsShouldNotBeDeclared< BitFieldsShouldNotBeDeclaredConfigSig Config> {
19- query predicate problems ( Element e , string message ) {
20- not isExcluded ( e , Config:: getQuery ( ) ) and message = "<replace with problem alert message for >"
20+ query predicate problems ( BitField bf , Class c , string message ) {
21+ /*
22+ * The condition that is allowed that is IF this is a bit-field, then it should be part of a class
23+ * that is flagged as a hardware or protocol class. To detect this we look for violations of that form.
24+ */
25+
26+ not isExcluded ( bf , Config:: getQuery ( ) ) and
27+ not isExcluded ( c , Config:: getQuery ( ) ) and
28+ bf = c .getAField ( ) and
29+ not c instanceof HardwareOrProtocolInterfaceClass and
30+ message = "Bit-field used within a class that is not a hardware or protocol class."
2131 }
2232}
You can’t perform that action at this time.
0 commit comments