diff options
author | Jose <jose@zeroc.com> | 2009-02-09 20:54:21 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2009-02-09 20:54:21 +0100 |
commit | b7441f24c28a13b28b4c6a3630567876b2a209eb (patch) | |
tree | e4605c9715f41c7c1d8fdb3692c05a92db3f8915 /cpp/src/Slice/Util.cpp | |
parent | Support for serializable and protobuf metadata (from cs_serial branch) (diff) | |
download | ice-b7441f24c28a13b28b4c6a3630567876b2a209eb.tar.bz2 ice-b7441f24c28a13b28b4c6a3630567876b2a209eb.tar.xz ice-b7441f24c28a13b28b4c6a3630567876b2a209eb.zip |
Fix 3715 - Preprocessor warnings treated as errors by Eclipse plugin
Diffstat (limited to 'cpp/src/Slice/Util.cpp')
-rw-r--r-- | cpp/src/Slice/Util.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cpp/src/Slice/Util.cpp b/cpp/src/Slice/Util.cpp index 6a691df8fb3..106a14d989b 100644 --- a/cpp/src/Slice/Util.cpp +++ b/cpp/src/Slice/Util.cpp @@ -251,3 +251,53 @@ Slice::emitRaw(const char* message) { *errorStream << message << flush; } + +vector<string> +Slice::filterMcppWarnings(const string& message) +{ + static const int messagesSize = 2; + static const char* messages[messagesSize] = {"Converted [CR+LF] to [LF]", "End of input with no newline, supplemented newline"}; + + static const string delimiters = "\n"; + + // Skip delimiters at beginning. + string::size_type lastPos = message.find_first_not_of(delimiters, 0); + // Find first "non-delimiter". + string::size_type pos = message.find_first_of(delimiters, lastPos); + + vector<string> tokens; + bool skiped; + while (string::npos != pos || string::npos != lastPos) + { + skiped = false; + string token = message.substr(lastPos, pos - lastPos); + static const string warningPrefix = "warning:"; + if(token.find_first_of(warningPrefix) != string::npos) + { + for(int j = 0; j < messagesSize; ++j) + { + if(token.find_first_of(messages[j]) != string::npos) + { + skiped = true; + //Skip Next token. + + // Skip delimiters. Note the "not_of" + lastPos = message.find_first_not_of(delimiters, pos); + // Find next "non-delimiter" + pos = message.find_first_of(delimiters, lastPos); + break; + } + } + } + + if(!skiped) + { + tokens.push_back(token); + } + // Skip delimiters. Note the "not_of" + lastPos = message.find_first_not_of(delimiters, pos); + // Find next "non-delimiter" + pos = message.find_first_of(delimiters, lastPos); + } + return tokens; +} |