.NAME Bit-field type

.DESCRIPTION
	Bit-fields shall be either bool type or an explicitly 
unsigned or signed integral type. 

.COMMENT V7.0

.SEVERITY Required

.COMMENT
Please refer to the MISRA C++:2008 document for further details (www.misra-cpp.com)
Note: In addition of wchar_t, forbidden types (because potentially signed or unsigned) are int, char, short, long.

.REQUIRED cpp_semantic

.COMMAND tcl

.CODE

::logiscope::include -once common utilities.tcl

proc compute {standardName tree} {
   utilities::filterTree $tree [list [namespace current]::check ]
}

proc check { node } {
	if { [::utilities::isTreeOperator $node bit_field] } {
		# Get the identifier of the bit_field
		set identifier [::logiscope::treeGetSon $node DECLARATOR_OPT]
		set identifierName [::utilities::getName $identifier]
		if {![string equal none $identifierName]} {
			set BFType [::Semantic::getTypeOf $identifier]
			set BFRealType [::Semantic::getAttribute $BFType type]
			set BFRealTypeName [::Semantic::getAttribute $BFRealType name]
			if {[expr [lsearch [list int char short long wchar_t] $BFRealTypeName] != -1]} {
				::logiscope::addViolation $node
			}
		}
	}
	return 1
} 
