From 9a7eba16bd828216ce578e35d546ec62df3fbc47 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 8 Jun 2017 00:07:51 -0400 Subject: [PATCH] Remove warnings Update Ghoul repository Fix spelling mistake in openspace.cfg --- apps/OpenSpace/main.cpp | 8 ++++++- ext/ghoul | 2 +- include/openspace/network/messagestructures.h | 2 +- include/openspace/util/timeline.h | 2 +- .../rendering/renderablefieldlines.cpp | 2 +- .../globebrowsing/geometry/geodeticpatch.cpp | 2 +- modules/globebrowsing/tile/pixelregion.cpp | 15 +++++-------- .../newhorizons/rendering/renderablefov.cpp | 10 +-------- modules/onscreengui/src/gui.cpp | 3 ++- modules/onscreengui/src/guiiswacomponent.cpp | 4 ++-- .../rendering/renderabletoyvolume.cpp | 4 ++-- openspace.cfg | 2 +- src/documentation/documentation.cpp | 5 +++-- src/documentation/documentationengine.cpp | 1 + src/documentation/documentationgenerator.cpp | 1 + src/engine/downloadmanager.cpp | 22 ++++++++++--------- src/engine/logfactory.cpp | 4 +++- src/engine/openspaceengine.cpp | 4 ++-- src/engine/wrapper/sgctwindowwrapper.cpp | 1 + src/network/parallelconnection.cpp | 6 ++--- src/rendering/renderable.cpp | 8 ++++--- src/scene/scene_lua.inl | 6 +++-- src/util/keys.cpp | 2 +- src/util/spicemanager.cpp | 8 ++++--- 24 files changed, 66 insertions(+), 58 deletions(-) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index ec55894de0..d816e22ed1 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -42,10 +42,16 @@ #include #include -#include #include #include +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4091) +#include +#pragma warning (pop) +#endif // _MSC_VER + #endif // WIN32 #ifdef OPENVR_SUPPORT diff --git a/ext/ghoul b/ext/ghoul index 16af15c4ee..b362a77feb 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 16af15c4ee8f860542fc59050739d600c2a3c895 +Subproject commit b362a77feb81c751519386d42615ba04e0c92d1c diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index ee2ffc71a9..b3943d7fed 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -66,7 +66,7 @@ struct CameraKeyframe { // Follow focus node rotation? buffer.insert(buffer.end(), reinterpret_cast(&_followNodeRotation), reinterpret_cast(&_followNodeRotation) + sizeof(_followNodeRotation)); - int nodeNameLength = _focusNode.size(); + int nodeNameLength = static_cast(_focusNode.size()); // Add focus node buffer.insert(buffer.end(), reinterpret_cast(&nodeNameLength), reinterpret_cast(&nodeNameLength) + sizeof(nodeNameLength)); diff --git a/include/openspace/util/timeline.h b/include/openspace/util/timeline.h index 794aecf96a..9c96f0b582 100644 --- a/include/openspace/util/timeline.h +++ b/include/openspace/util/timeline.h @@ -91,6 +91,6 @@ bool compareKeyframeTimeWithTime(const KeyframeBase& a, double b); } // namespace openspace -#include ; +#include #endif // __OPENSPACE_CORE___TIMELINE___H__ diff --git a/modules/fieldlines/rendering/renderablefieldlines.cpp b/modules/fieldlines/rendering/renderablefieldlines.cpp index 9a61c48b46..a6dc9e6f52 100644 --- a/modules/fieldlines/rendering/renderablefieldlines.cpp +++ b/modules/fieldlines/rendering/renderablefieldlines.cpp @@ -325,7 +325,7 @@ void RenderableFieldlines::loadSeedPoints() { loadSeedPointsFromTable(); break; default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); } } diff --git a/modules/globebrowsing/geometry/geodeticpatch.cpp b/modules/globebrowsing/geometry/geodeticpatch.cpp index f1e04122ab..72f515d91b 100644 --- a/modules/globebrowsing/geometry/geodeticpatch.cpp +++ b/modules/globebrowsing/geometry/geodeticpatch.cpp @@ -92,7 +92,7 @@ Geodetic2 GeodeticPatch::getCorner(Quad q) const { case NORTH_EAST: return Geodetic2(maxLat(), maxLon());// northEastCorner(); case SOUTH_WEST: return Geodetic2(minLat(), minLon());// southWestCorner(); case SOUTH_EAST: return Geodetic2(minLat(), maxLon());// southEastCorner(); - default: ghoul_assert(false, "Missing case label"); + default: throw ghoul::MissingCaseException(); } } diff --git a/modules/globebrowsing/tile/pixelregion.cpp b/modules/globebrowsing/tile/pixelregion.cpp index b24d7b263d..4375afd19a 100644 --- a/modules/globebrowsing/tile/pixelregion.cpp +++ b/modules/globebrowsing/tile/pixelregion.cpp @@ -240,16 +240,11 @@ int PixelRegion::area() const { int PixelRegion::edge(Side side) const { switch (side) { - case Side::LEFT: - return start.x; - case Side::TOP: - return start.y; - case Side::RIGHT: - return start.x + numPixels.x; - case Side::BOTTOM: - return start.y + numPixels.y; - default: - ghoul_assert(false, "Missing case label"); + case Side::LEFT: return start.x; + case Side::TOP: return start.y; + case Side::RIGHT: return start.x + numPixels.x; + case Side::BOTTOM: return start.y + numPixels.y; + default: throw ghoul::MissingCaseException(); } } diff --git a/modules/newhorizons/rendering/renderablefov.cpp b/modules/newhorizons/rendering/renderablefov.cpp index 33d7e51270..6e1f64d90a 100644 --- a/modules/newhorizons/rendering/renderablefov.cpp +++ b/modules/newhorizons/rendering/renderablefov.cpp @@ -653,19 +653,11 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string& break; } case ThisIntersect: - { - break; - } case NextIntersect: - { - break; - } case BothIntersect: - { break; - } default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); } } } diff --git a/modules/onscreengui/src/gui.cpp b/modules/onscreengui/src/gui.cpp index c3e520fa33..5f91a7bfd6 100644 --- a/modules/onscreengui/src/gui.cpp +++ b/modules/onscreengui/src/gui.cpp @@ -364,7 +364,8 @@ void GUI::initializeGL() { _fontTexture->setDataOwnership(ghoul::opengl::Texture::TakeOwnership::No); _fontTexture->uploadTexture(); GLuint id = *_fontTexture; - ImGui::GetIO().Fonts->TexID = reinterpret_cast(id); + uint64_t tmp = id; + ImGui::GetIO().Fonts->TexID = reinterpret_cast(tmp); glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); diff --git a/modules/onscreengui/src/guiiswacomponent.cpp b/modules/onscreengui/src/guiiswacomponent.cpp index b0a36ebb91..35e29c7a1d 100644 --- a/modules/onscreengui/src/guiiswacomponent.cpp +++ b/modules/onscreengui/src/guiiswacomponent.cpp @@ -38,7 +38,7 @@ namespace { using json = nlohmann::json; - const ImVec2 size = ImVec2(350, 500); + const ImVec2 WindowSize = ImVec2(350, 500); } // namespace namespace openspace { @@ -59,7 +59,7 @@ void GuiIswaComponent::render() { bool e = _isEnabled; - ImGui::Begin("ISWA", &e, size, 0.5f); + ImGui::Begin("ISWA", &e, WindowSize, 0.5f); _isEnabled = e; diff --git a/modules/toyvolume/rendering/renderabletoyvolume.cpp b/modules/toyvolume/rendering/renderabletoyvolume.cpp index e5df97b9cf..8086a47ac5 100644 --- a/modules/toyvolume/rendering/renderabletoyvolume.cpp +++ b/modules/toyvolume/rendering/renderabletoyvolume.cpp @@ -41,8 +41,8 @@ RenderableToyVolume::RenderableToyVolume(const ghoul::Dictionary& dictionary) , _stepSize("stepSize", "Step Size", 0.02, 0.01, 1) , _scaling("scaling", "Scaling", glm::vec3(1.0, 1.0, 1.0), glm::vec3(0.0), glm::vec3(10.0)) , _translation("translation", "Translation", glm::vec3(0.0, 0.0, 0.0), glm::vec3(0.0), glm::vec3(10.0)) - , _rotation("rotation", "Euler rotation", glm::vec3(0.0, 0.0, 0.0), glm::vec3(0), glm::vec3(6.28)) - , _color("color", "Color", glm::vec4(1.0, 0.0, 0.0, 0.1), glm::vec4(0.0), glm::vec4(1.0)) { + , _rotation("rotation", "Euler rotation", glm::vec3(0.f, 0.f, 0.f), glm::vec3(0), glm::vec3(6.28f)) + , _color("color", "Color", glm::vec4(1.f, 0.f, 0.f, 0.1f), glm::vec4(0.f), glm::vec4(1.f)) { float scalingExponent, stepSize; glm::vec3 scaling, translation, rotation; diff --git a/openspace.cfg b/openspace.cfg index 4736a0e50e..75326922e7 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -79,7 +79,7 @@ return { -- OnScreenTextScaling = "framebuffer", -- PerSceneCache = true, -- DisableRenderingOnMaster = true, - KeyDisableSceneOnMaster = true, + -- DisableSceneOnMaster = true, DownloadRequestURL = "http://data.openspaceproject.com/request.cgi", RenderingMethod = "Framebuffer", OpenGLDebugContext = { diff --git a/src/documentation/documentation.cpp b/src/documentation/documentation.cpp index bef1b621d4..e82cea9388 100644 --- a/src/documentation/documentation.cpp +++ b/src/documentation/documentation.cpp @@ -80,7 +80,8 @@ std::string to_string(openspace::documentation::TestResult::Offense::Reason reas case openspace::documentation::TestResult::Offense::Reason::WrongType: return "Wrong type"; default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); + } } @@ -89,7 +90,7 @@ std::string to_string(openspace::documentation::TestResult::Warning::Reason reas case openspace::documentation::TestResult::Warning::Reason::Deprecated: return "Deprecated"; default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); } } diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index 92f48e26ae..4f862869fc 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -298,6 +298,7 @@ std::string DocumentationEngine::generateJson() const { void DocumentationEngine::addDocumentation(Documentation doc) { for (const DocumentationEntry& e : doc.entries) { + (void)e; // Unused variable in Release mode ghoul_assert( e.documentation.find('"') == std::string::npos, "Documentation cannot contain \" character" diff --git a/src/documentation/documentationgenerator.cpp b/src/documentation/documentationgenerator.cpp index ac27f90b67..3f11f02563 100644 --- a/src/documentation/documentationgenerator.cpp +++ b/src/documentation/documentationgenerator.cpp @@ -52,6 +52,7 @@ DocumentationGenerator::DocumentationGenerator(std::string name, ghoul_precondition(!_name.empty(), "name must not be empty"); ghoul_precondition(!_jsonName.empty(), "jsonName must not be empty"); for (const HandlebarTemplate& t : _handlebarTemplates) { + (void)t; // Unused variable in Release mode ghoul_precondition(!t.name.empty(), "name must not be empty"); ghoul_precondition(!t.filename.empty(), "filename must not be empty"); } diff --git a/src/engine/downloadmanager.cpp b/src/engine/downloadmanager.cpp index 51ab4e8580..d1e205788a 100644 --- a/src/engine/downloadmanager.cpp +++ b/src/engine/downloadmanager.cpp @@ -169,19 +169,21 @@ std::shared_ptr DownloadManager::downloadFile( #ifdef WIN32 FILE* fp; errno_t error = fopen_s(&fp, file.path().c_str(), "wb"); - ghoul_assert( - error == 0, - "Could not open/create file:" + file.path() + ". Errno: " + std::to_string(errno) - ); + if (error != 0) { + LERROR( + "Could not open/create file:" + file.path() + + ". Errno: " + std::to_string(errno) + ); + } #else FILE* fp = fopen(file.path().c_str(), "wb"); // write binary #endif // WIN32 - ghoul_assert( - fp != nullptr, - "Could not open/create file:" + file.path() + ". Errno: " + std::to_string(errno) - ); - - //LDEBUG("Start downloading file: '" << url << "' into file '" << file.path() << "'"); + if (!fp) { + LERROR( + "Could not open/create file:" + file.path() + + ". Errno: " + std::to_string(errno) + ); + } auto downloadFunction = [url, failOnError, diff --git a/src/engine/logfactory.cpp b/src/engine/logfactory.cpp index cddfd946b2..01366f9c21 100644 --- a/src/engine/logfactory.cpp +++ b/src/engine/logfactory.cpp @@ -212,7 +212,9 @@ std::unique_ptr createLog(const ghoul::Dictionary& dictiona ); } } - ghoul_assert(false, "Missing case in the documentation for LogFactory"); + else { + throw ghoul::MissingCaseException(); + } } } // namespace openspace diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index b92582582a..81318c1d5a 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -953,7 +953,7 @@ void OpenSpaceEngine::initializeGL() { LDEBUGC(category, std::string(message)); break; default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); } }; ghoul::opengl::debug::setDebugCallback(callback); @@ -1308,7 +1308,7 @@ void OpenSpaceEngine::registerModuleCallback(OpenSpaceEngine::CallbackOption opt _moduleCallbacks.postDraw.push_back(std::move(function)); break; default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); } } diff --git a/src/engine/wrapper/sgctwindowwrapper.cpp b/src/engine/wrapper/sgctwindowwrapper.cpp index 2ea95e707a..8d04c9aa98 100644 --- a/src/engine/wrapper/sgctwindowwrapper.cpp +++ b/src/engine/wrapper/sgctwindowwrapper.cpp @@ -158,6 +158,7 @@ int SGCTWindowWrapper::currentNumberOfAaSamples() const { bool SGCTWindowWrapper::isRegularRendering() const { sgct::SGCTWindow* w = sgct::Engine::instance()->getCurrentWindowPtr(); std::size_t nViewports = w->getNumberOfViewports(); + (void)nViewports; // Unused in Release mode ghoul_assert(nViewports > 0, "At least one viewport must exist at this time"); sgct_core::Viewport* vp = w->getViewport(0); sgct_core::NonLinearProjection* nlp = vp->getNonLinearProjectionPtr(); diff --git a/src/network/parallelconnection.cpp b/src/network/parallelconnection.cpp index 0a73c4eb12..85db183e4f 100644 --- a/src/network/parallelconnection.cpp +++ b/src/network/parallelconnection.cpp @@ -94,9 +94,9 @@ ParallelConnection::ParallelConnection() , _address("address", "Address", "localhost") , _name("name", "Connection name", "Anonymous") , _bufferTime("bufferTime", "Buffer Time", 1, 0.5, 10) - , _timeKeyframeInterval("timeKeyframeInterval", "Time keyframe interval", 0.1, 0, 1) - , _cameraKeyframeInterval("cameraKeyframeInterval", "Camera Keyframe interval", 0.1, 0, 1) - , _timeTolerance("timeTolerance", "Time tolerance", 1, 0.5, 5) + , _timeKeyframeInterval("timeKeyframeInterval", "Time keyframe interval", 0.1f, 0.f, 1.f) + , _cameraKeyframeInterval("cameraKeyframeInterval", "Camera Keyframe interval", 0.1f, 0.f, 1.f) + , _timeTolerance("timeTolerance", "Time tolerance", 1.f, 0.5f, 5.f) , _lastTimeKeyframeTimestamp(0) , _lastCameraKeyframeTimestamp(0) , _clientSocket(INVALID_SOCKET) diff --git a/src/rendering/renderable.cpp b/src/rendering/renderable.cpp index 231bbcbb0f..b8b926a5fa 100644 --- a/src/rendering/renderable.cpp +++ b/src/rendering/renderable.cpp @@ -70,9 +70,11 @@ std::unique_ptr Renderable::createFromDictionary( const ghoul::Dictionary& dictionary) { // The name is passed down from the SceneGraphNode - std::string name; - bool success = dictionary.getValue(SceneGraphNode::KeyName, name); - ghoul_assert(success, "The SceneGraphNode did not set the 'name' key"); + ghoul_assert( + dictionary.hasKeyAndValue(SceneGraphNode::KeyName), + "The SceneGraphNode did not set the 'name' key" + ); + std::string name = dictionary.value(SceneGraphNode::KeyName); documentation::testSpecificationAndThrow(Documentation(), dictionary, "Renderable"); diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index 31554ac1af..ee86083384 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -179,7 +179,9 @@ int property_setValueSingle(lua_State* L) { for (properties::Property* prop : allProperties()) { std::string propFullId = prop->fullyQualifiedIdentifier(); //Look for a match in the uri with the group name (first term) removed - int propMatchLength = propFullId.length() - pathRemainderToMatch.length(); + int propMatchLength = + static_cast(propFullId.length()) - + static_cast(pathRemainderToMatch.length()); if (propMatchLength >= 0) { std::string thisPropMatchId = propFullId.substr(propMatchLength); @@ -289,7 +291,7 @@ int property_setValueRegex(lua_State* L) { } catch (const std::regex_error& e) { LERRORC("property_setValueRegex", "Malformed regular expression: '" - << regex << "'"); + << regex << "':" << e.what()); } return 0; diff --git a/src/util/keys.cpp b/src/util/keys.cpp index 056bd85bd9..ab02ed8bc4 100644 --- a/src/util/keys.cpp +++ b/src/util/keys.cpp @@ -129,7 +129,7 @@ std::string to_string(openspace::Key key) { return p.first; } } - ghoul_assert(false, "Missing key in KeyMapping"); + throw ghoul::MissingCaseException(); } std::string to_string(openspace::KeyModifier mod) { diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index 05fb0cc8f2..d73edaec64 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -75,7 +75,8 @@ namespace { case openspace::SpiceManager::FieldOfViewMethod::Point: return "POINT"; default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); + } } @@ -86,7 +87,8 @@ namespace { case openspace::SpiceManager::TerminatorType::Penumbral: return "PENUMBRAL"; default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); + } } } @@ -148,7 +150,7 @@ SpiceManager::AberrationCorrection::operator const char*() const { case Type::ConvergedNewtonianStellar: return (direction == Direction::Reception) ? "CN+S" : "XCN+S"; default: - ghoul_assert(false, "Missing case label"); + throw ghoul::MissingCaseException(); } }