#This script is designed to run with Understand - CodeCheck use base ("Understand::Codecheck"); use strict; use constant ERR1 => ' included in file %1'; sub register_tr_text() { my $check = shift; $check->add_tr_text(ERR1); } sub name { return "20.12 The time handling functions of library shall not be used";} sub description { return "20.12 (Required) The time handling functions of library shall not be used";} sub detailed_description { return <<"END_DESC" Includes time, strftime. This library is associated with clock times. Various aspects are implementation dependent or unspecified, such as the formats of times. If any of the facilities of time.h are used then the exact implementation for the compiler being used must be determined and a deviation raised. END_DESC } sub test_language { my $language = shift; return $language =~ /C\+\+/; #Handles C and C++ } sub test_entity { return 1;} sub test_global { return 0;} sub define_options{} sub check { my $check = shift; my $file = shift; return unless $file->kind->check("file ~unknown ~unresolved"); foreach my $includes($file->filerefs("include","file")){ if($includes->ent->name eq "time.h"){ $check->violation($includes->ent,$file,$includes->line,$includes->column,ERR1,$file->name); } } }