Mark ARGC, ARGV*, and ARGN as used

This commit is contained in:
Ben Boeckel 2010-09-15 11:35:50 -04:00
parent a17aff74c7
commit e01e40cb87
1 changed files with 8 additions and 0 deletions

View File

@ -112,15 +112,19 @@ bool cmFunctionHelperCommand::InvokeInitialPass
// set the value of argc // set the value of argc
cmOStringStream strStream; cmOStringStream strStream;
strStream << expandedArgs.size(); strStream << expandedArgs.size();
this->Makefile->MarkVariableAsUsed("ARGC");
this->Makefile->AddDefinition("ARGC",strStream.str().c_str()); this->Makefile->AddDefinition("ARGC",strStream.str().c_str());
this->Makefile->MarkVariableAsUsed("ARGC");
// set the values for ARGV0 ARGV1 ... // set the values for ARGV0 ARGV1 ...
for (unsigned int t = 0; t < expandedArgs.size(); ++t) for (unsigned int t = 0; t < expandedArgs.size(); ++t)
{ {
cmOStringStream tmpStream; cmOStringStream tmpStream;
tmpStream << "ARGV" << t; tmpStream << "ARGV" << t;
this->Makefile->MarkVariableAsUsed(tmpStream.str().c_str());
this->Makefile->AddDefinition(tmpStream.str().c_str(), this->Makefile->AddDefinition(tmpStream.str().c_str(),
expandedArgs[t].c_str()); expandedArgs[t].c_str());
this->Makefile->MarkVariableAsUsed(tmpStream.str().c_str());
} }
// define the formal arguments // define the formal arguments
@ -152,8 +156,12 @@ bool cmFunctionHelperCommand::InvokeInitialPass
} }
cnt ++; cnt ++;
} }
this->Makefile->MarkVariableAsUsed("ARGV");
this->Makefile->AddDefinition("ARGV", argvDef.c_str()); this->Makefile->AddDefinition("ARGV", argvDef.c_str());
this->Makefile->MarkVariableAsUsed("ARGV");
this->Makefile->MarkVariableAsUsed("ARGN");
this->Makefile->AddDefinition("ARGN", argnDef.c_str()); this->Makefile->AddDefinition("ARGN", argnDef.c_str());
this->Makefile->MarkVariableAsUsed("ARGN");
// Invoke all the functions that were collected in the block. // Invoke all the functions that were collected in the block.
// for each function // for each function