From fb077d24cdf649e9b2c0a89e1c36ba4420bb1158 Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 14 Dec 2016 12:50:36 -0800 Subject: 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. --- cpp/src/Slice/Preprocessor.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'cpp/src/Slice/Preprocessor.cpp') 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,11 +368,39 @@ 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. // -- cgit v1.2.3