diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index b146d2c37..60edd56ab 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -19,7 +19,9 @@ #include "cmCPluginAPI.cxx" #include "cmDynamicLoader.h" #include +extern "C" void TrapsForSignalsCFunction(int sig); + // a class for loadabple commands class cmLoadedCommand : public cmCommand { @@ -103,11 +105,11 @@ public: if(!remove) { - signal(SIGSEGV, cmLoadedCommand::TrapsForSignals); + signal(SIGSEGV, TrapsForSignalsCFunction); #ifdef SIGBUS - signal(SIGBUS, cmLoadedCommand::TrapsForSignals); + signal(SIGBUS, TrapsForSignalsCFunction); #endif - signal(SIGILL, cmLoadedCommand::TrapsForSignals); + signal(SIGILL, TrapsForSignalsCFunction); } else { @@ -142,6 +144,12 @@ public: cmLoadedCommandInfo info; }; +extern "C" void TrapsForSignalsCFunction(int sig) +{ + cmLoadedCommand::TrapsForSignals(sig); +} + + const char* cmLoadedCommand::LastName = 0; bool cmLoadedCommand::InitialPass(std::vector const& args) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index a393effff..1fd86544a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -71,10 +71,9 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) cmSystemTools::Error(error.str().c_str()); return true; } - - // now set the new argcDef - char argcDef[64]; - sprintf(argcDef,"%i",expandedArguments.size()); + cmOStringStream argcDefStream; + argcDefStream << expandedArguments.size(); + std::string argcDef = argcDefStream.str(); // Invoke all the functions that were collected in the block. cmListFileFunction newLFF; @@ -104,7 +103,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) for (unsigned int j = 1; j < m_Args.size(); ++j) { variable = "${ARGC}"; - cmSystemTools::ReplaceString(tmps, variable.c_str(),argcDef); + cmSystemTools::ReplaceString(tmps, variable.c_str(),argcDef.c_str()); } for (unsigned int j = 1; j < m_Args.size(); ++j) {