summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Preprocessor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/Preprocessor.cpp')
-rw-r--r--cpp/src/Slice/Preprocessor.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp
index 13a2a5cc4c8..c8e49029f25 100644
--- a/cpp/src/Slice/Preprocessor.cpp
+++ b/cpp/src/Slice/Preprocessor.cpp
@@ -14,6 +14,7 @@
#include <IceUtil/FileUtil.h>
#include <IceUtil/UUID.h>
#include <algorithm>
+#include <iterator>
#include <vector>
#include <fstream>
#include <sys/types.h>
@@ -140,7 +141,7 @@ namespace
{
vector<string>
-baseArgs(vector<string> args, bool keepComments, const string& extraArgs, const string& fileName)
+baseArgs(vector<string> args, bool keepComments, const vector<string>& extraArgs, const string& fileName)
{
if(keepComments)
{
@@ -161,10 +162,7 @@ baseArgs(vector<string> args, bool keepComments, const string& extraArgs, const
args.push_back(os.str());
}
- if(!extraArgs.empty())
- {
- args.push_back(extraArgs);
- }
+ copy(extraArgs.begin(), extraArgs.end(), back_inserter(args));
args.push_back(fileName);
return args;
}
@@ -172,7 +170,15 @@ baseArgs(vector<string> args, bool keepComments, const string& extraArgs, const
}
FILE*
-Slice::Preprocessor::preprocess(bool keepComments, const string& extraArgs)
+Slice::Preprocessor::preprocess(bool keepComments, const string& extraArg)
+{
+ vector<string> args;
+ args.push_back(extraArg);
+ return preprocess(keepComments, args);
+}
+
+FILE*
+Slice::Preprocessor::preprocess(bool keepComments, const vector<string>& extraArgs)
{
if(!checkInputFile())
{
@@ -287,7 +293,17 @@ Slice::Preprocessor::preprocess(bool keepComments, const string& extraArgs)
bool
Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, const vector<string>& includePaths,
- const string& extraArgs, const string& cppSourceExt,
+ const string& extraArg, const string& cppSourceExt,
+ const string& optValue)
+{
+ vector<string> extraArgs;
+ extraArgs.push_back(extraArg);
+ return printMakefileDependencies(out, lang, includePaths, extraArgs, cppSourceExt, optValue);
+}
+
+bool
+Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, const vector<string>& includePaths,
+ const vector<string>& extraArgs, const string& cppSourceExt,
const string& optValue)
{
if(!checkInputFile())
@@ -725,7 +741,7 @@ Slice::Preprocessor::checkInputFile()
return false;
}
- IceUtilInternal::ifstream test(_fileName);
+ ifstream test(IceUtilInternal::streamFilename(_fileName).c_str());
if(!test)
{
getErrorStream() << _path << ": error: cannot open `" << _fileName << "' for reading" << endl;