diff options
Diffstat (limited to 'cpp/src/Slice/Preprocessor.cpp')
-rw-r--r-- | cpp/src/Slice/Preprocessor.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index 7feffe9d1c4..627d19cb370 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> @@ -82,11 +83,9 @@ Slice::Preprocessor::addQuotes(const string& arg) { // // Add quotes around the given argument to ensure that arguments - // with spaces will be preserved as a single argument. We also - // escape the "\" character to ensure that we don't end up with a - // \" at the end of the string. + // with spaces will be preserved as a single argument // - return "\"" + IceUtilInternal::escapeString(arg, "\\") + "\""; + return "\"" + escapeString(arg, "", IceUtilInternal::Unicode) + "\""; } string @@ -140,7 +139,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 +160,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 +168,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 +291,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()) @@ -729,7 +743,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; |