build: Treat warnings as errors (#923)

* squash and rebase andronov-alexey:treat_warnings_as_errors from pull request #850
* fix remaining warnings in java lib
This commit is contained in:
Malte Langkabel
2020-02-14 16:34:04 +01:00
committed by GitHub
parent e5c1a118d7
commit a30f47e27f
112 changed files with 634 additions and 430 deletions
+22 -17
View File
@@ -381,7 +381,9 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message)
if (message->inIDE)
{
MessageMoveIDECursor(filePath, lineNumber, columnNumber).dispatch();
MessageMoveIDECursor(
filePath, static_cast<unsigned int>(lineNumber), static_cast<unsigned int>(columnNumber))
.dispatch();
return;
}
@@ -471,10 +473,10 @@ void CodeController::handleMessage(MessageShowError* message)
void CodeController::handleMessage(MessageShowReference* message)
{
m_referenceIndex = message->refIndex;
m_referenceIndex = static_cast<int>(message->refIndex);
bool replayed = message->isReplayed();
if (m_referenceIndex >= 0 && m_referenceIndex < m_references.size())
if (m_referenceIndex >= 0 && m_referenceIndex < static_cast<int>(m_references.size()))
{
const Reference& ref = m_references[m_referenceIndex];
m_codeParams.activeLocationIds = {ref.locationId};
@@ -641,7 +643,7 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
activeSourceLocations->getFilePath(), showsErrors);
size_t lineCount = textAccess->getLineCount();
SnippetMerger fileScopedMerger(1, lineCount);
SnippetMerger fileScopedMerger(1, static_cast<int>(lineCount));
std::map<int, std::shared_ptr<SnippetMerger>> mergers;
std::shared_ptr<SourceLocationFile> scopeLocations =
@@ -657,8 +659,9 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
activeSourceLocations->getFilePath(), LOCATION_COMMENT);
commentLocations->forEachStartSourceLocation([&](SourceLocation* location) {
atomicRanges.push_back(SnippetMerger::Range(
SnippetMerger::Border(location->getLineNumber(), false),
SnippetMerger::Border(location->getOtherLocation()->getLineNumber(), false)));
SnippetMerger::Border(static_cast<int>(location->getLineNumber()), false),
SnippetMerger::Border(
static_cast<int>(location->getOtherLocation()->getLineNumber()), false)));
});
atomicRanges = SnippetMerger::Range::mergeAdjacent(atomicRanges);
@@ -673,7 +676,7 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
params.startLineNumber = std::max<int>(
1, range.start.row - (range.start.strong ? 0 : snippetExpandRange));
params.endLineNumber = std::min<int>(
lineCount, range.end.row + (range.end.strong ? 0 : snippetExpandRange));
static_cast<int>(lineCount), range.end.row + (range.end.strong ? 0 : snippetExpandRange));
params.locationFile = activeSourceLocations->getFilteredByLines(
params.startLineNumber, params.endLineNumber);
@@ -712,8 +715,9 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
params.footer = activeSourceLocations->getFilePath().wstr();
}
for (const std::string& line:
textAccess->getLines(params.startLineNumber, params.endLineNumber))
for (const std::string& line: textAccess->getLines(
static_cast<unsigned int>(params.startLineNumber),
static_cast<unsigned int>(params.endLineNumber)))
{
params.code += line;
}
@@ -731,7 +735,8 @@ std::shared_ptr<SnippetMerger> CodeController::buildMergerHierarchy(
std::map<int, std::shared_ptr<SnippetMerger>>& mergers) const
{
std::shared_ptr<SnippetMerger> currentMerger = std::make_shared<SnippetMerger>(
location->getStartLocation()->getLineNumber(), location->getEndLocation()->getLineNumber());
static_cast<int>(location->getStartLocation()->getLineNumber()),
static_cast<int>(location->getEndLocation()->getLineNumber()));
const SourceLocation* scopeLocation = getSourceLocationOfParentScope(
location->getLineNumber(), scopeLocations);
@@ -743,11 +748,11 @@ std::shared_ptr<SnippetMerger> CodeController::buildMergerHierarchy(
std::shared_ptr<SnippetMerger> nextMerger;
std::map<int, std::shared_ptr<SnippetMerger>>::iterator it = mergers.find(
scopeLocation->getLocationId());
static_cast<int>(scopeLocation->getLocationId()));
if (it == mergers.end())
{
nextMerger = buildMergerHierarchy(scopeLocation, scopeLocations, fileScopedMerger, mergers);
mergers[scopeLocation->getLocationId()] = nextMerger;
mergers[static_cast<int>(scopeLocation->getLocationId())] = nextMerger;
}
else
{
@@ -986,7 +991,7 @@ void CodeController::iterateReference(bool next)
{
if (m_referenceIndex < 1)
{
m_referenceIndex = m_references.size() - 1;
m_referenceIndex = static_cast<int>(m_references.size()) - 1;
}
else
{
@@ -1009,7 +1014,7 @@ void CodeController::iterateLocalReference(bool next, bool updateView)
{
m_localReferenceIndex++;
if (m_localReferenceIndex == m_localReferences.size())
if (m_localReferenceIndex == static_cast<int>(m_localReferences.size()))
{
m_localReferenceIndex = 0;
}
@@ -1018,7 +1023,7 @@ void CodeController::iterateLocalReference(bool next, bool updateView)
{
if (m_localReferenceIndex < 1)
{
m_localReferenceIndex = m_localReferences.size() - 1;
m_localReferenceIndex = static_cast<int>(m_localReferences.size()) - 1;
}
else
{
@@ -1036,7 +1041,7 @@ void CodeController::iterateLocalReference(bool next, bool updateView)
{
if (m_references[i].locationId == ref.locationId)
{
m_referenceIndex = i;
m_referenceIndex = static_cast<int>(i);
}
}
}
@@ -1382,7 +1387,7 @@ void CodeController::showFirstActiveReference(Id tokenId, bool updateView)
if (!firstReference.tokenId)
{
firstReference = ref;
referenceIndex = i;
referenceIndex = static_cast<int>(i);
}
}