.NAME use of pre-processor

.DESCRIPTION
The pre-processor shall only be used for file inclusion and include guards. 

.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 #define nodes
  utilities::filterTree $tree [list [namespace current]::check]
}

proc check { node } {
	if { [::utilities::isTreeOperator $node pp_define] } {
		set pp_macro_args [::logiscope::treeDown $node 1]
		if { [::utilities::isTreeOperator $pp_macro_args pp_macro_args] } {
			# macro with parameters => not allowed
			::logiscope::addViolation $node
			return 0
		}
		set pp_text [::logiscope::treeDown $node 2]
		set content ""
		::logiscope::forobj l $pp_text treeChild {
			set content $content[::utilities::treeAtomString $l]
		}		
		set content [::utilities::suppressComments $content]
		if { ![regexp {^\s*$} $content] } {
			::logiscope::addViolation $node
		}
	}
	return 1
}

