summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-12-14 12:50:36 -0800
committerJose <jose@zeroc.com>2016-12-14 12:50:36 -0800
commitfb077d24cdf649e9b2c0a89e1c36ba4420bb1158 (patch)
treec181d9803ece8fc82fb9c3748612b53667a0ed5a /cpp
parentICE-7445 - Add libressl build support (diff)
downloadice-fb077d24cdf649e9b2c0a89e1c36ba4420bb1158.tar.bz2
ice-fb077d24cdf649e9b2c0a89e1c36ba4420bb1158.tar.xz
ice-fb077d24cdf649e9b2c0a89e1c36ba4420bb1158.zip
Fix for dependency parsing
MCPP can emit multiple file names in a single line that is the case when the max line lenght is no exceeded. With previous fixes to handle .ice in file paths that case was not correctly handled.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Slice/Preprocessor.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp
index 74513f736fb..3adba67d753 100644
--- a/cpp/src/Slice/Preprocessor.cpp
+++ b/cpp/src/Slice/Preprocessor.cpp
@@ -368,12 +368,40 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons
// First remove the backslash used to escape new lines.
//
string::size_type pos;
- while((pos = unprocessed.find("\\\n")) != string::npos)
+ while((pos = unprocessed.find(" \\\n")) != string::npos)
{
- unprocessed.replace(pos, 2, "\n");
+ unprocessed.replace(pos, 3, "\n");
}
//
+ // Split filenames in separate lines:
+ //
+ // /foo/A.ice /foo/B.ice becomes
+ // /foo/A.ice
+ // /foo/B.ice
+ //
+ // C:\foo\A.ice C:\foo\B.ice becomes
+ // C:\foo\A.ice
+ // C:\foo\B.ice
+ //
+ pos = 0;
+#ifdef _WIN32
+ while((pos = unprocessed.find(".ice ", pos)) != string::npos)
+ {
+ if(unprocessed.find(":", pos) == pos + 6)
+ {
+ unprocessed.replace(pos, 5, ".ice\n");
+ pos += 5;
+ }
+ }
+#else
+ while((pos = unprocessed.find(".ice /", pos)) != string::npos)
+ {
+ unprocessed.replace(pos, 5, ".ice\n");
+ }
+#endif
+
+ //
// Get the main output file name.
//
#ifdef _MSC_VER