.NAME C library

.DESCRIPTION
	The C library 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

.PARAMETERS LIST "assert.h" "ctype.h" "errno.h" "float.h" "limit.h" "locale.h" "math.h" "setjmp.h" "signal.h" "stdarg.h" "stddef.h" "stdio.h" "stdlib.h" "string.h" "type.h" END LIST

.CODE

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

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

proc check { node } {
	variable CurrentParameterList
	
	if { [::utilities::isTreeOperator $node pp_include] } {
		set kind [::logiscope::treeDown $node 0]
		if { [::utilities::isTreeOperator $kind pp_external_file] } {
			set name [::utilities::treeAtomString $kind]
			if { [lsearch [lindex $CurrentParameterList 0] $name] >= 0 } {
				::logiscope::addViolation $node
			}
		}
	}
	return 1
}
