.NAME No use of errno

.DESCRIPTION
The error indicator errno shall not be used. 

.COMMENT V7.0

.SEVERITY Required

.COMMENT
Please refer to the MISRA C++:2008 document for further details (www.misra-cpp.com)

.COMMAND tcl

.CODE

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

proc compute {standardName tree} {
  variable CurrentParameterList
  # Check all identifier nodes
  utilities::filterTree $tree [list [namespace current]::check]
}

proc isInMemberDecl { node } {
	while { "$node" != "NULL" } {
		if { [::utilities::isTreeOperator $node member_decl] } {
			return 1
		}
		set node [::logiscope::treeUp $node]
	}
	return 0
}

proc check { node } {
	if { [::utilities::isTreeOperator $node identifier] } {
		set name [::utilities::treeAtomString $node]
		if { "$name" == "errno" } {
			set father [::logiscope::treeUp $node]
			if { ![::utilities::isTreeOperator $father dot] && 
				 ![::utilities::isTreeOperator $father arrow] &&
				 ![isInMemberDecl $node] } {
				::logiscope::addViolation $node
			}
		}
	}
	return 1
}
