summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Util.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2009-02-09 20:54:21 +0100
committerJose <jose@zeroc.com>2009-02-09 20:54:21 +0100
commitb7441f24c28a13b28b4c6a3630567876b2a209eb (patch)
treee4605c9715f41c7c1d8fdb3692c05a92db3f8915 /cpp/src/Slice/Util.cpp
parentSupport for serializable and protobuf metadata (from cs_serial branch) (diff)
downloadice-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.cpp50
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;
+}