diff options
author | Jose <jose@zeroc.com> | 2019-06-22 00:29:53 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-06-22 00:29:53 +0200 |
commit | c5959fd09de61604bedd75354401df6a57395d65 (patch) | |
tree | 3b0227f631c8b20fb1a1a274b92f63f52f34af2c /cpp/src/Slice | |
parent | Small fix (diff) | |
parent | Enable -Wconversion with clang - Close #363 (diff) | |
download | ice-c5959fd09de61604bedd75354401df6a57395d65.tar.bz2 ice-c5959fd09de61604bedd75354401df6a57395d65.tar.xz ice-c5959fd09de61604bedd75354401df6a57395d65.zip |
Merge remote-tracking branch 'origin/3.7' into swift
Diffstat (limited to 'cpp/src/Slice')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.y | 8 | ||||
-rw-r--r-- | cpp/src/Slice/MD5I.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Slice/Preprocessor.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 18 | ||||
-rw-r--r-- | cpp/src/Slice/Scanner.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Slice/Scanner.l | 8 |
8 files changed, 52 insertions, 11 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 5120a15877a..853bbed5d49 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -1621,7 +1621,7 @@ Slice::writeStreamHelpers(Output& out, void Slice::writeIceTuple(::IceUtilInternal::Output& out, const string& scope, DataMemberList dataMembers, int typeCtx) { - out << sp << nl << "std::tuple<"; + out << nl << "std::tuple<"; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { if(q != dataMembers.begin()) diff --git a/cpp/src/Slice/Grammar.cpp b/cpp/src/Slice/Grammar.cpp index 9d7b21e244f..3cb7c833df6 100644 --- a/cpp/src/Slice/Grammar.cpp +++ b/cpp/src/Slice/Grammar.cpp @@ -98,6 +98,14 @@ # pragma GCC diagnostic ignored "-Wold-style-cast" #endif +// +// Avoid clang conversion warnings +// +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wconversion" +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + using namespace std; using namespace Slice; diff --git a/cpp/src/Slice/Grammar.y b/cpp/src/Slice/Grammar.y index a9af4724d8a..837ab577bc8 100644 --- a/cpp/src/Slice/Grammar.y +++ b/cpp/src/Slice/Grammar.y @@ -25,6 +25,14 @@ # pragma GCC diagnostic ignored "-Wold-style-cast" #endif +// +// Avoid clang conversion warnings +// +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wconversion" +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + using namespace std; using namespace Slice; diff --git a/cpp/src/Slice/MD5I.cpp b/cpp/src/Slice/MD5I.cpp index 79071b34452..66f4de545bc 100644 --- a/cpp/src/Slice/MD5I.cpp +++ b/cpp/src/Slice/MD5I.cpp @@ -58,6 +58,14 @@ # pragma GCC diagnostic ignored "-Wold-style-cast" #endif +// +// Avoid clang conversion warnings +// +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wconversion" +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ #ifdef ARCH_IS_BIG_ENDIAN # define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index 30430304020..958facf5f34 100644 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -469,7 +469,8 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons { if(file.compare(0, p->length(), *p) == 0) { - string s = includePaths[p - fullIncludePaths.begin()] + file.substr(p->length()); + string s = includePaths[static_cast<size_t>(p - fullIncludePaths.begin())] + + file.substr(p->length()); if(IceUtilInternal::isAbsolutePath(newFile) || s.size() < newFile.size()) { newFile = s; diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 8e95f47b753..83d8a8341d3 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -2486,10 +2486,10 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c) // string name; bool inParam = false, inException = false, inReturn = false; - vector<string>::size_type i = 0; - while(i < lines.size()) + vector<string>::iterator i = lines.begin(); + while(i != lines.end()) { - string l = lines[i]; + string l = *i; string::size_type paramTag = l.find("@param"); string::size_type throwTag = l.find("@throw"); string::size_type returnTag = l.find("@return"); @@ -2533,7 +2533,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c) } } } - lines.erase(lines.begin() + i); + i = lines.erase(i); continue; } else if(throwTag != string::npos) @@ -2575,7 +2575,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c) } } } - lines.erase(lines.begin() + i); + i = lines.erase(i); continue; } else if(returnTag != string::npos) @@ -2592,7 +2592,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c) inParam = false; c.returns = l.substr(pos); } - lines.erase(lines.begin() + i); + i = lines.erase(i); continue; } else @@ -2612,7 +2612,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c) c.params[name] += " "; } c.params[name] += l.substr(pos); - lines.erase(lines.begin() + i); + i = lines.erase(i); continue; } else if(inException) @@ -2623,7 +2623,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c) c.exceptions[name] += " "; } c.exceptions[name] += l.substr(pos); - lines.erase(lines.begin() + i); + i = lines.erase(i); continue; } else if(inReturn) @@ -2633,7 +2633,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c) c.returns += " "; } c.returns += l.substr(pos); - lines.erase(lines.begin() + i); + i = lines.erase(i); continue; } } diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp index 0da441603bf..f9bb314f518 100644 --- a/cpp/src/Slice/Scanner.cpp +++ b/cpp/src/Slice/Scanner.cpp @@ -578,6 +578,14 @@ char *slice_text; # pragma GCC diagnostic ignored "-Wsign-compare" #endif +// +// Avoid clang conversion warnings +// +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wconversion" +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + #ifdef _MSC_VER # ifdef slice_wrap # undef slice_wrap diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l index b93f13eb51b..0afdfebd34e 100644 --- a/cpp/src/Slice/Scanner.l +++ b/cpp/src/Slice/Scanner.l @@ -32,6 +32,14 @@ # pragma GCC diagnostic ignored "-Wsign-compare" #endif +// +// Avoid clang conversion warnings +// +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wconversion" +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + #ifdef _MSC_VER # ifdef slice_wrap # undef slice_wrap |