Create a separate directory for simulation compiliation.

Made some adjustments for sims larger than the ball sim.
Make some changes to handle library packages such as JEOD.  Also
removed some dead code.
This commit is contained in:
Alex Lin 2015-07-08 10:33:56 -05:00
parent 5a77824638
commit 5848d80bc4
9 changed files with 130 additions and 173 deletions

View File

@ -56,6 +56,7 @@ my $stls = 0; # option variable with default value (false)
my ( @include_paths, @include_dirs , @defines) ;
my ( @swig_exclude_dirs) ;
my ( @exclude_dirs) ;
my %sim ;
my %out_of_date ;
my ($version, $thread, $year) ;
@ -128,6 +129,7 @@ if ( $help ) {
if ( scalar @swig_exclude_dirs == 0 ) {
@swig_exclude_dirs = split /:/ , $ENV{"TRICK_ICG_EXCLUDE"} ;
}
@exclude_dirs = split /:/ , $ENV{"TRICK_EXCLUDE"} ;
push @include_paths , ("-I".$ENV{"TRICK_HOME"}."/trick_source" , "-I../include") ;
@defines = $ENV{"TRICK_CFLAGS"} =~ /(-D\S+)/g ; # get defines from TRICK_CFLAGS
if ( $ENV{"TRICK_CFLAGS"} !~ /DTRICK_VER=/ ) {
@ -151,7 +153,7 @@ if ( $system_type eq "Darwin" ) {
## the file ".S_library_swig". So, if .S_library_swig exists, we can just open and read it.
##
my ($s_library_swig) = ".S_library_swig" ;
my ($s_library_swig) = "build/S_library_swig" ;
if ( -e $s_library_swig ) {
open FILE_LIST, $s_library_swig ;
@ -247,6 +249,14 @@ if ( -e $s_library_swig ) {
last ; # break out of loop
}
}
foreach my $ie ( @exclude_dirs ) {
# if file location begins with $ie (an IGC exclude dir)
if ( $f =~ /^\Q$ie/ ) {
$skipped_files{$f} = "Exclude dir $ie" ;
delete $sim{final_all_includes}{$f} ;
last ; # break out of loop
}
}
}
}
}

View File

@ -23,7 +23,6 @@ sub make_makefile($$$) {
my @all_compile_libs ;
my %files_by_dir ;
my ( $sp_dir , $src_dir , $sp_file , $base_name , $suffix) ;
my $num_src_files ;
my @temp_array ;
if ( exists $$sim_ref{all_mis_depends} ) {
@ -112,16 +111,11 @@ sub make_makefile($$$) {
}
}
# count the number of source files and set the "dir_num" of each directory.
$num_src_files = 0;
# set the "dir_num" of each directory.
foreach $k ( sort keys %files_by_dir ) {
$_ = $k ;
($files_by_dir{$k}{dir_num} = $_) =~ s#^/## ;
$files_by_dir{$k}{dir_num} =~ s/[\/.]/_/g ;
if ( ! exists $files_by_dir{$k}{full_name} ) {
$num_src_files += $#{$files_by_dir{$k}{c}} + $#{$files_by_dir{$k}{f}} + $#{$files_by_dir{$k}{y}} + 3 ;
$num_src_files += $#{$files_by_dir{$k}{cpp}} + 1 ;
}
# if a particular directory had an override file, save that into memory
if (open OV_FILE, "$k/makefile_overrides") {
while ( <OV_FILE> ) {
@ -133,13 +127,15 @@ sub make_makefile($$$) {
while ( s,/[^/]+/\.\.,, ) {}
s//$comment/ ;
if ( s/^objects\s*:\s*// ) {
$files_by_dir{$k}{overrides} .= "model_obj_$files_by_dir{$k}{dir_num}: $_" ;
foreach my $ext ( qw{c C cc cxx cpp CPLUSPLUS l y} ) {
$files_by_dir{$k}{overrides} .= "\$(MODEL_${ext}_OBJ_$files_by_dir{$k}{dir_num}): $_" ;
}
}
elsif ( s/^depend\s*:\s*// ) {
$files_by_dir{$k}{overrides} .= "depend_$files_by_dir{$k}{dir_num}: $_" ;
}
elsif ( s/([cfhy]|cpp)_objects\s*:\s*// ) {
$files_by_dir{$k}{overrides} .= "model_$1_obj_$files_by_dir{$k}{dir_num}: $_" ;
elsif ( s/([cfhy]|C|cc|cxx|cpp|CPLUSPLUS)_objects\s*:\s*// ) {
$files_by_dir{$k}{overrides} .= "\$(MODEL_$1_OBJ_$files_by_dir{$k}{dir_num}): $_" ;
}
else {
$files_by_dir{$k}{overrides} .= $_ ;
@ -150,8 +146,6 @@ sub make_makefile($$$) {
chdir($make_cwd ) ;
my $wd = abs_path(cwd()) ;
my $sim_dir_name = basename($wd) ;
$sim_dir_name =~ s/SIM_// ;
my $dt = localtime();
my ($trick_ver) = get_trick_version() ;
chomp $trick_ver ;
@ -181,7 +175,6 @@ S_MAIN = \$(CURDIR)/T_main_\${TRICK_HOST_CPU}.exe
endif
LIB_DIR = \$(CURDIR)/build/lib
SIM_LIB = \$(LIB_DIR)/lib_${sim_dir_name}.a
ifdef TRICK_VERBOSE_BUILD
PRINT_ICG =
@ -241,15 +234,16 @@ S_OBJECT_FILES = \$(CURDIR)/build/S_source.o
foreach $f ( @{$files_by_dir{$k}{l}} ) {
print MAKEFILE " \\\n \$(CURDIR)/build$k/$files_by_dir{$k}{src_dir}$f" . "clex" ;
}
print MAKEFILE "\n\n" ;
}
if ( scalar @{$files_by_dir{$k}{y}} ne 0 ) {
print MAKEFILE "MODEL_y_c_SRC_$files_by_dir{$k}{dir_num} =" ;
foreach $f ( @{$files_by_dir{$k}{y}} ) {
print MAKEFILE " \\\n \$(CURDIR)/build$k/$files_by_dir{$k}{src_dir}$f" . "y.c" ;
}
print MAKEFILE "\n\n" ;
}
}
print MAKEFILE "\n\n" ;
foreach my $ext ( sort keys %object_files_by_type ) {
my $print_ext ;
@ -308,21 +302,6 @@ S_OBJECT_FILES = \$(CURDIR)/build/S_source.o
print MAKEFILE "-include \$(MODEL_cxx_OBJ:.o=.d)\n" ;
print MAKEFILE "-include \$(MODEL_CPLUSPLUS_OBJ:.o=.d)\n\n" ;
print MAKEFILE "\nDEFAULT_DATA_C_OBJ =" ;
if ( exists $$sim_ref{def_data_c} ) {
foreach my $d ( sort keys %{$$sim_ref{def_data_c}} ) {
print MAKEFILE " \\\n\t$wd/lib_\${TRICK_HOST_CPU}/$$sim_ref{def_data_c}{$d}{file_name}" . ".o" ;
}
}
print MAKEFILE "\n\nDEFAULT_DATA_CPP_OBJ =" ;
if ( exists $$sim_ref{def_data_cpp} ) {
foreach my $d ( sort keys %{$$sim_ref{def_data_cpp}} ) {
print MAKEFILE " \\\n\t$wd/lib_\${TRICK_HOST_CPU}/$$sim_ref{def_data_cpp}{$d}{file_name}" . ".o" ;
}
}
print MAKEFILE "\n\nDEFAULT_DATA_OBJECTS = \$(DEFAULT_DATA_C_OBJ) \$(DEFAULT_DATA_CPP_OBJ)\n\n" ;
printf MAKEFILE "\n\nOBJECTS =" ;
for( $i = 0 ; $i < $num_inc_objs ; $i++ ) {
print MAKEFILE " \\\n\t\$(LIB_DIR)/o$i.o" ;
@ -362,9 +341,6 @@ S_main : \$(S_MAIN) build/S_define.deps S_sie.resource
\t\t\$(LD_WHOLE_ARCHIVE) \${TRICK_LIBS} \$(LD_NO_WHOLE_ARCHIVE)\\
\t\t\${TRICK_EXEC_LINK_LIBS}
#\t\t\$(S_OBJECT_FILES) \@build/link_objs \\
#\t\t\$(LD_WHOLE_ARCHIVE) \$(SIM_LIB) \$(LD_NO_WHOLE_ARCHIVE)\\
\$(OBJECTS) : | \$(LIB_DIR)
\$(LIB_DIR) :
@ -390,26 +366,7 @@ S_sie.resource: \$(S_MAIN)
\t\$(ECHO_CMD)\$(S_MAIN) sie
S_define_exp:
\t\$(TRICK_CC) -E -C -xc++ \${TRICK_SFLAGS} S_define > \$@
\$(SIM_LIB) : \$(DEFAULT_DATA_OBJECTS)
\t@ echo \"Creating libraries...\"
\t\@ rm -rf \$\@
\t\@ ar crs \$\@ \$^ || touch \$\@\n\n" ;
print MAKEFILE "\n\n#DEFAULT_DATA_C_OBJ\n\n" ;
foreach my $d ( sort keys %{$$sim_ref{def_data_c}} ) {
print MAKEFILE "$wd/lib_\${TRICK_HOST_CPU}/$$sim_ref{def_data_c}{$d}{file_name}" , ".o" ,
" : $wd/Default_data/$$sim_ref{def_data_c}{$d}{file_name}" , ".c\n";
print MAKEFILE "\tcd $wd/Default_data ; \$(TRICK_CC) \$(TRICK_CFLAGS) -c \${\@F:.o=.c} -o \$\@\n" ;
}
print MAKEFILE "\n\n#DEFAULT_DATA_CPP_OBJ\n\n" ;
foreach my $d ( sort keys %{$$sim_ref{def_data_cpp}} ) {
print MAKEFILE "$wd/lib_\${TRICK_HOST_CPU}/$$sim_ref{def_data_cpp}{$d}{file_name}" , ".o" ,
" : $wd/Default_data/$$sim_ref{def_data_cpp}{$d}{file_name}" , ".cpp\n";
print MAKEFILE "\tcd $wd/Default_data ; \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) -c \${\@F:.o=.cpp} -o \$\@\n" ;
}
\t\$(TRICK_CC) -E -C -xc++ \${TRICK_SFLAGS} S_define > \$@\n\n" ;
# write out the override files we have read in
foreach $k ( sort keys %files_by_dir ) {
@ -420,17 +377,11 @@ S_define_exp:
}
print MAKEFILE "\n-include build/Makefile_io_src\n" ;
print MAKEFILE "\ninclude build/Makefile_swig\n" ;
print MAKEFILE "\n-include S_overrides.mk\n" ;
print MAKEFILE "include build/Makefile_swig\n" ;
print MAKEFILE "-include S_overrides.mk\n" ;
close MAKEFILE ;
open SIM_INC_OBJS , ">build/link_objs" or return ;
for( $i = 0 ; $i < $num_inc_objs ; $i++ ) {
print SIM_INC_OBJS "build/lib/o$i.o\n" ;
}
close SIM_INC_OBJS ;
# write out all of the files we used to S_library_list
open LIB_LIST, ">build/S_library_list" or die "Could not open build/S_library_list" ;
foreach $k ( sort keys %files_by_dir ) {
@ -443,18 +394,6 @@ S_define_exp:
}
}
@temp_array = sort @temp_array;
# Add the default data files to S_library_list
my %temp_hash ;
foreach my $obj ( @{$$sim_ref{objs}} ) {
foreach my $str ( @{$$obj{structs}} ) {
foreach my $l ( @{$$str{def_data}} ) {
$temp_hash{$l} = 1 if ( $l !~ /trick_source/ ) ;
}
}
}
push @temp_array , (sort keys %temp_hash) ;
print LIB_LIST (sort join "\n" , @temp_array) , "\n" ;
close LIB_LIST ;

View File

@ -202,6 +202,7 @@ sub make_swig_makefile($$$) {
print MAKEFILE "\
# SWIG rule
SWIG_FLAGS =
SWIG_CFLAGS := -I../include \${PYTHON_INCLUDES} -Wno-shadow -Wno-missing-field-initializers
ifeq (\$(IS_CC_CLANG), 1)
SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized
@ -297,7 +298,7 @@ SWIG_PY_OBJECTS =" ;
print MAKEFILE "$swig_object_dir/py_${swig_file_only}.o : $swig_f\n" ;
print MAKEFILE "\t\$(PRINT_SWIG)\n" ;
print MAKEFILE "\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) -c++ -python -includeall -ignoremissing -w201,303,362,389,401,451 -outdir trick -o $swig_dir/py_${swig_file_only}.cpp \$<\n" ;
print MAKEFILE "\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,362,389,401,451 -outdir trick -o $swig_dir/py_${swig_file_only}.cpp \$<\n" ;
print MAKEFILE "\t\$(PRINT_COMPILE_SWIG)\n" ;
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_IO_CXXFLAGS) \$(SWIG_CFLAGS) -c $swig_dir/py_${swig_file_only}.cpp -o \$@\n\n" ;
print LINK_PY_OBJS "$link_py_obj\n" ;
@ -359,6 +360,12 @@ SWIG_PY_OBJECTS =" ;
close MAKEFILE ;
close LINK_PY_OBJS ;
open SWIGLIB , ">build/S_library_swig" or return ;
foreach my $f ( @temp_array2 ) {
print SWIGLIB "$f\n" ;
}
close SWIGLIB ;
open TOPFILE , ">build/top.i" or return ;
print TOPFILE "\%module top\n\n" ;
print TOPFILE "\%{\n#include \"../S_source.hh\"\n\n" ;

View File

@ -65,7 +65,7 @@ clean: tidy
-rm -rf trick
@ echo "Removed build directory"
real_clean spotless: clean
spotless: clean
apocalypse: clean
@echo "I love the smell of napalm in the morning"

View File

@ -134,7 +134,6 @@ void HeaderSearchDirs::AddICGExcludeDirs () {
std::stringstream ss(s);
std::string item;
while(std::getline(ss, item, ':')) {
//icg_exclude_dirs.push_back(item);
item = trim(item) ;
if ( ! item.empty() ) {
char * resolved_path = realpath(item.c_str(), NULL) ;
@ -148,6 +147,28 @@ void HeaderSearchDirs::AddICGExcludeDirs () {
}
}
void HeaderSearchDirs::AddExcludeDirs () {
char * trick_exclude = getenv("TRICK_EXCLUDE") ;
if( trick_exclude != NULL ) {
std::string s = std::string(trick_exclude) ;
std::stringstream ss(s);
std::string item;
while(std::getline(ss, item, ':')) {
item = trim(item) ;
if ( ! item.empty() ) {
char * resolved_path = realpath(item.c_str(), NULL) ;
if ( resolved_path ) {
exclude_dirs.push_back(std::string(resolved_path) + std::string("/"));
} else {
std::cout << "Cannot find TRICK_ICG_EXCLUDE directory " << item << std::endl ;
}
}
}
}
}
void HeaderSearchDirs::AddICGNoCommentDirs () {
char * trick_icg_nocomment = getenv("TRICK_ICG_NOCOMMENT") ;
@ -191,6 +212,7 @@ void HeaderSearchDirs::addSearchDirs ( std::vector<std::string> & include_dirs )
AddUserSearchDirs( include_dirs ) ;
AddTrickSearchDirs() ;
AddCompilerBuiltInSearchDirs() ;
AddExcludeDirs() ;
AddICGExcludeDirs() ;
AddICGNoCommentDirs() ;
ApplyHeaderSearchOptions() ;
@ -226,6 +248,18 @@ bool HeaderSearchDirs::isPathInUserOrTrickDir (std::string in_dir ) {
return true ;
}
bool HeaderSearchDirs::isPathInExclude (std::string in_dir ) {
std::vector<std::string>::iterator vit ;
for ( vit = exclude_dirs.begin() ; vit != exclude_dirs.end() ; vit++ ) {
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
return true ;
}
}
return false ;
}
bool HeaderSearchDirs::isPathInICGExclude (std::string in_dir ) {
std::vector<std::string>::iterator vit ;
@ -262,6 +296,18 @@ bool HeaderSearchDirs::isPathInICGNoComment (std::string in_file ) {
return false ;
}
std::string HeaderSearchDirs::getPathInExclude (std::string in_dir ) {
std::vector<std::string>::iterator vit ;
for ( vit = exclude_dirs.begin() ; vit != exclude_dirs.end() ; vit++ ) {
if ( ! in_dir.compare(0, (*vit).size(), (*vit))) {
return (*vit) ;
}
}
return std::string() ;
}
std::string HeaderSearchDirs::getPathInICGExclude (std::string in_dir ) {
std::vector<std::string>::iterator vit ;

View File

@ -47,6 +47,13 @@ class HeaderSearchDirs {
*/
bool isPathInUserOrTrickDir (std::string path) ;
/** Returns true if directory is a subdirectory of an excluded directory listed
in the TRICK_EXCLUDE environment variable.
@param path = directory path to be checked
@return true = path is in a system directory, false = not in system directory.
*/
bool isPathInExclude (std::string path) ;
/** Returns true if directory is a subdirectory of an excluded directory listed
in the TRICK_ICG_EXCLUDE environment variable.
@param path = directory path to be checked
@ -61,6 +68,12 @@ class HeaderSearchDirs {
*/
bool isPathInICGNoComment (std::string path) ;
/** Returns the TRICK_EXCLUDE directory that contains the path argument.
@param path = path to be checked
@return string from TRICK_EXCLUDE that contains the path.
*/
std::string getPathInExclude (std::string path) ;
/** Returns the TRICK_ICG_EXCLUDE directory that contains the path argument.
@param path = path to be checked
@return string from TRICK_ICG_EXCLUDE that contains the path.
@ -100,6 +113,9 @@ class HeaderSearchDirs {
/** Adds ${TRICK_HOME}/trick_source to the search directories */
void AddTrickSearchDirs () ;
/** Create list of EXCLUDE directories */
void AddExcludeDirs () ;
/** Create list of ICG_EXCLUDE directories */
void AddICGExcludeDirs () ;
@ -109,6 +125,9 @@ class HeaderSearchDirs {
/** Apply all search directories to the preprocessor. */
void ApplyHeaderSearchOptions () ;
/** List of directoris to exclude from the TRICK_EXCLUDE environment variable */
std::vector<std::string> exclude_dirs ;
/** List of directoris to exclude from the TRICK_ICG_EXCLUDE environment variable */
std::vector<std::string> icg_exclude_dirs ;

View File

@ -103,15 +103,6 @@ bool PrintAttributes::doesIODirectoryExist(std::string io_file_name) {
dir_name = dirname((char *)temp_name) ;
_mkdir(dir_name) ;
/*
if ( stat( dir_name , &buf ) != 0 ) {
if ( mkdir( dir_name , 0755 ) != 0 ) {
// dir does not exist and cannot make the directory.
std::cout << "Unable to create " << dir_name << " for writing." << std::endl ;
ret = false ;
}
}
*/
free(temp_name) ;
return ret ;
}
@ -151,38 +142,43 @@ bool PrintAttributes::openIOFile(std::string header_file_name) {
// Only include user directories (not system dirs like /usr/include)
if ( hsd.isPathInUserDir(rp) ) {
// Don't process files in excluded directories
if ( hsd.isPathInICGExclude(rp) == false ) {
// Only include files that do not have ICG: (No)
// hasICGNo uses original header name, not the real path
if ( ! cs.hasICGNo(header_file_name) ) {
std::string io_file_name = createIOFileName(std::string(rp)) ;
all_io_files[header_file_name] = io_file_name ;
// Does the io_src directory exist or can we successfully mkdir it?
if ( doesIODirectoryExist(io_file_name) ) {
// Is the io_src file out of date or does not exist yet
if ( isIOFileOutOfDate(rp, io_file_name) ) {
// All conditions have been met. Store the io_src file name in out_of_date_io_files.
out_of_date_io_files[header_file_name] = io_file_name ;
free(rp) ;
/* This is the first time we are visiting the file,
open the file and write header information */
outfile.open(out_of_date_io_files[header_file_name].c_str()) ;
printer->printIOHeader(outfile, header_file_name) ;
std::cout << "Writing " << out_of_date_io_files[header_file_name] << "" << std::endl ;
// Get all of the ignored types from this file.
ignored_types[header_file_name] = cs.getIgnoreTypes(header_file_name) ;
return true ;
if ( hsd.isPathInExclude(rp) == false ) {
if ( hsd.isPathInICGExclude(rp) == false ) {
// Only include files that do not have ICG: (No)
// hasICGNo uses original header name, not the real path
if ( ! cs.hasICGNo(header_file_name) ) {
std::string io_file_name = createIOFileName(std::string(rp)) ;
all_io_files[header_file_name] = io_file_name ;
// Does the io_src directory exist or can we successfully mkdir it?
if ( doesIODirectoryExist(io_file_name) ) {
// Is the io_src file out of date or does not exist yet
if ( isIOFileOutOfDate(rp, io_file_name) ) {
// All conditions have been met. Store the io_src file name in out_of_date_io_files.
out_of_date_io_files[header_file_name] = io_file_name ;
free(rp) ;
/* This is the first time we are visiting the file,
open the file and write header information */
outfile.open(out_of_date_io_files[header_file_name].c_str()) ;
printer->printIOHeader(outfile, header_file_name) ;
std::cout << "Writing " << out_of_date_io_files[header_file_name] << "" << std::endl ;
// Get all of the ignored types from this file.
ignored_types[header_file_name] = cs.getIgnoreTypes(header_file_name) ;
return true ;
}
} else {
std::cout << "ICG skipping " << rp << " (cannot create io_src dir)" << std::endl ;
}
} else {
std::cout << "ICG skipping " << rp << " (cannot create io_src dir)" << std::endl ;
std::cout << "ICG skipping " << rp << " (ICG No found)" << std::endl ;
icg_no_files.push_back(rp) ;
}
} else {
std::cout << "ICG skipping " << rp << " (ICG No found)" << std::endl ;
icg_no_files.push_back(rp) ;
std::cout << "ICG skipping " << rp << " (ICG exclude dir " <<
hsd.getPathInICGExclude(rp) << ")" << std::endl ;
}
} else {
std::cout << "ICG skipping " << rp << " (ICG exclude dir " <<
hsd.getPathInICGExclude(rp) << ")" << std::endl ;
std::cout << "ICG skipping " << rp << " (exclude dir " <<
hsd.getPathInExclude(rp) << ")" << std::endl ;
}
} else {
//std::cout << "ICG skipping " << rp << " (not in user path) " << std::endl ;
@ -376,6 +372,7 @@ void PrintAttributes::printIOMakefile() {
makefile << " -Wno-invalid-offsetof \\" << std::endl ;
makefile << " -Wno-old-style-cast \\" << std::endl ;
makefile << " -Wno-write-strings \\" << std::endl ;
makefile << " -Wno-unused-local-typedefs \\" << std::endl ;
makefile << " -Wno-unused-variable" << std::endl ;
makefile << std::endl ;
makefile << "ifeq ($(IS_CC_CLANG), 0)" << std::endl ;
@ -392,6 +389,7 @@ void PrintAttributes::printIOMakefile() {
makefile << "PRINT_IO_COMPILE = @echo \"Compiling io $(subst $(CURDIR)/build,build,$<)\"" << std::endl ;
makefile << "PRINT_IO_INC_LINK = @echo \"Partial linking io objects\"" << std::endl ;
makefile << "endif" << std::endl ;
makefile << std::endl ;
//TODO: create the io_file name if it doesn't exist
makefile << "IO_OBJ_FILES =" ;
@ -436,62 +434,6 @@ void PrintAttributes::printIOMakefile() {
link_io_objs.close() ;
}
void PrintAttributes::printEmptyFiles() {
// this routine loops through all header files that were parsed and creates empty io_src files
// for the headers that have no classes or enums.
// The checks we have to do are the same as openIOFile.
clang::SourceManager::fileinfo_iterator fi ;
for ( fi = ci.getSourceManager().fileinfo_begin() ; fi != ci.getSourceManager().fileinfo_end() ; fi++ ) {
const clang::FileEntry * fe = (*fi).first ;
std::string header_file_name = fe->getName() ;
if ( visited_files.find(header_file_name) == visited_files.end() ) {
visited_files.insert(header_file_name) ;
// several tests require the real path of the header file.
char * rp = almostRealPath(header_file_name.c_str()) ;
if ( rp != NULL ) {
// Only include user directories (not system dirs like /usr/include)
if ( hsd.isPathInUserDir(rp) ) {
// Don't process files in excluded directories
if ( hsd.isPathInICGExclude(rp) == false ) {
// Only include files that do not have ICG: (No)
// hasICGNo uses original header name, not the real path
if ( ! cs.hasICGNo(header_file_name) ) {
std::string io_file_name = createIOFileName(std::string(rp)) ;
all_io_files[header_file_name] = io_file_name ;
// Does the io_src directory exist or can we successfully mkdir it?
if ( doesIODirectoryExist(io_file_name) ) {
// Is the io_src file out of date or does not exist yet
if ( isIOFileOutOfDate(rp, io_file_name) ) {
out_of_date_io_files[header_file_name] = io_file_name ;
// creates an empty io_src file
outfile.open(out_of_date_io_files[header_file_name].c_str()) ;
outfile.close() ;
std::cout << "Writing " << out_of_date_io_files[header_file_name] << "" << std::endl ;
}
} else {
std::cout << "ICG skipping " << rp << " (cannot create io_src dir)" << std::endl ;
}
} else {
std::cout << "ICG skipping " << rp << " (ICG No found)" << std::endl ;
icg_no_files.push_back(rp) ;
}
} else {
std::cout << "ICG skipping " << rp << " (ICG exclude dir " <<
hsd.getPathInICGExclude(rp) << ")" << std::endl ;
}
} else {
//std::cout << "ICG skipping " << rp << " (not in user path) " << std::endl ;
}
free(rp) ;
} else {
std::cout << "ICG could not resolve realpath of " << header_file_name << "" << std::endl ;
}
}
}
}
void PrintAttributes::printICGNoFiles() {
if ( ! sim_services_flag ) {
std::vector< std::string >::iterator it ;

View File

@ -45,9 +45,6 @@ class PrintAttributes {
/** Create makefile for IO files */
virtual void printIOMakefile() ;
/** Create empty io_files for headers that contain no class/struct information */
virtual void printEmptyFiles() ;
/** Prints list of files that contain ICG:(No) in the Trick header */
virtual void printICGNoFiles() ;

View File

@ -193,9 +193,6 @@ int main( int argc , char * argv[] ) {
pa.printIOMakefile() ;
}
// Print empty io_src files for headers that we visited, but have no class/struct information.
pa.printEmptyFiles() ;
// Close the map files
pa.closeMapFiles() ;