Update C++ version to 23, add new warnings and the fix them

This commit is contained in:
Alexander Bock
2025-03-01 15:49:38 +01:00
parent cd8924ed22
commit cc395ce340
28 changed files with 89 additions and 81 deletions

View File

@@ -796,7 +796,7 @@ RenderablePointCloud::RenderablePointCloud(const ghoul::Dictionary& dictionary)
}
bool RenderablePointCloud::isReady() const {
bool isReady = _program;
bool isReady = _program != nullptr;
if (_hasLabels) {
isReady = isReady && _labels->isReady();
}

View File

@@ -251,7 +251,7 @@ namespace {
std::optional<float> width [[codegen::greaterequal(0.f)]];
// [[codegen::verbatim(ShadingEnabledInfo.description)]]
std::optional<float> performShading;
std::optional<bool> performShading;
// [[codegen::verbatim(AmbientIntensityInfo.description)]]
std::optional<float> ambientIntensity [[codegen::greaterequal(0.f)]];
@@ -385,7 +385,7 @@ void RenderableNodeArrow::deinitializeGL() {
}
bool RenderableNodeArrow::isReady() const {
return _shaderProgram;
return _shaderProgram != nullptr;
}
void RenderableNodeArrow::updateShapeTransforms(const RenderData& data) {

View File

@@ -195,13 +195,13 @@ RenderablePlaneImageOnline::downloadImageToMemory(const std::string& url)
{
return global::downloadManager->fetchFile(
url,
[url](const DownloadManager::MemoryFile&) {
[](const DownloadManager::MemoryFile&) {
LDEBUGC(
"ScreenSpaceImageOnline",
"Download to memory finished for screen space image"
);
},
[url](const std::string& err) {
[](const std::string& err) {
LDEBUGC(
"ScreenSpaceImageOnline",
"Download to memory failer for screen space image: " + err

View File

@@ -143,7 +143,7 @@ namespace {
std::optional<int> sweepChunkSize;
// [[codegen::verbatim(SweepChunkSizeInfo.description)]]
std::optional<int> enableSweepChunking;
std::optional<bool> enableSweepChunking;
// [[codegen::verbatim(AccurateTrailPositionsInfo.description)]]
std::optional<int> accurateTrailPositions;

View File

@@ -152,10 +152,10 @@ std::future<DownloadManager::MemoryFile> ScreenSpaceImageOnline::downloadImageTo
{
return global::downloadManager->fetchFile(
url,
[url](const DownloadManager::MemoryFile&) {
[](const DownloadManager::MemoryFile&) {
LDEBUG("Download to memory finished for screen space image");
},
[url](const std::string& err) {
[](const std::string& err) {
LDEBUG(std::format(
"Download to memory failed for screen space image: {}", err
));

View File

@@ -142,7 +142,7 @@ double GeodeticPatch::edgeLatitudeNearestEquator() const {
return _center.lat + _halfSize.lat * (isNorthern() ? -1.0 : 1.0);
}
double GeodeticPatch::isNorthern() const {
bool GeodeticPatch::isNorthern() const {
return _center.lat > 0.0;
}

View File

@@ -53,7 +53,7 @@ public:
/**
* Returns `true` if the center above the equator.
*/
double isNorthern() const;
bool isNorthern() const;
Geodetic2 corner(Quad q) const;

View File

@@ -177,9 +177,9 @@ void LocalTfBrickSelector::selectBricks(int timestep, std::vector<int>& bricks)
childSplitType
);
BrickSelection childSelection = bs.splitSpatially(
i % 2,
(i/2) % 2,
i/4,
i % 2 != 0,
(i/2) % 2 != 0,
i/4 != 0,
childBrickIndex,
childSplitType,
childSplitPoints

View File

@@ -59,7 +59,7 @@ void ShenBrickSelector::traverseOT(int timestep, unsigned int brickIndex,
int numTimeSteps = _tsp->header().numTimesteps;
for (unsigned int i = 0; i < 8; i++) {
unsigned int child = firstChild + i;
BrickCover cover = coveredBricks.split(i % 2, (i/2) % 2, (i/4));
BrickCover cover = coveredBricks.split(i % 2 != 0, (i/2) % 2 != 0, (i/4) != 0);
selectBricks(timestep, child, child, 0, numTimeSteps, cover, bricks);
}
}

View File

@@ -175,9 +175,9 @@ void SimpleTfBrickSelector::selectBricks(int timestep, std::vector<int>& bricks)
BrickSelection::SplitType childSplitType;
float childSplitPoints = splitPoints(childBrickIndex, childSplitType);
BrickSelection childSelection = bs.splitSpatially(
i % 2,
(i / 2) % 2, // abock: this is always 0?
i / 4,
i % 2 != 0,
(i / 2) % 2 != 0, // abock: this is always 0?
i / 4 != 0,
childBrickIndex,
childSplitType,
childSplitPoints

View File

@@ -187,9 +187,9 @@ void TfBrickSelector::selectBricks(int timestep, std::vector<int>& bricks) {
float childSplitPoints = splitPoints(childBrickIndex, childSplitType);
//std::cout << "Splitting spatially" << std::endl;
BrickSelection childSelection = bs.splitSpatially(
i % 2,
(i / 2) % 2, // abock: isn't this always 0?
i / 4,
i % 2 != 0,
(i / 2) % 2 != 0, // abock: isn't this always 0?
i / 4 != 0,
childBrickIndex,
childSplitType,
childSplitPoints

View File

@@ -178,7 +178,7 @@ void Browser::update() {
}
bool Browser::isReady() const {
return _texture.get();
return _texture != nullptr;
}
// Updates the browser size to match the size of the texture

View File

@@ -51,7 +51,7 @@ namespace {
bool hasAttribute(const tinyxml2::XMLElement* element, std::string_view name) {
const std::string n = std::string(name);
return element->FindAttribute(n.c_str());
return element->FindAttribute(n.c_str()) != nullptr;
}
std::string attribute(const tinyxml2::XMLElement* element, std::string_view name) {

View File

@@ -290,7 +290,7 @@ void RenderableEclipseCone::deinitializeGL() {
}
bool RenderableEclipseCone::isReady() const {
return _shader;
return _shader != nullptr;
}
void RenderableEclipseCone::render(const RenderData& data, RendererTasks&) {

View File

@@ -257,7 +257,7 @@ void RenderableShadowCylinder::deinitializeGL() {
}
bool RenderableShadowCylinder::isReady() const {
return _shader;
return _shader != nullptr;
}
void RenderableShadowCylinder::render(const RenderData& data, RendererTasks&) {

View File

@@ -40,22 +40,6 @@ namespace {
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo SelectionInfo = {
"SpoutSelection",
"Spout Selection",
"This property displays all available Spout sender on the system. If one them is "
"selected, its value is stored in the 'SpoutName' property, overwriting its "
"previous value.",
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo UpdateInfo = {
"UpdateSelection",
"Update Selection",
"If this property is trigged, the 'SpoutSelection' options will be refreshed.",
openspace::properties::Property::Visibility::AdvancedUser
};
struct [[codegen::Dictionary(ScreenSpaceSpout)]] Parameters {
// [[codegen::verbatim(NameInfo.description)]]
std::optional<std::string> spoutName;

View File

@@ -402,7 +402,7 @@ HttpSynchronization::trySyncFromUrl(std::string url) {
originalName.replace_extension().string();
struct zip_t* z = zip_open(source.c_str(), 0, 'r');
const bool is64 = zip_is64(z);
const bool is64 = zip_is64(z) == 1;
zip_close(z);
if (is64) {

View File

@@ -90,7 +90,9 @@ add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper SYSTEM)
mark_as_advanced(CEF_DEBUG_INFO_FLAG USE_ATL USE_OFFICIAL_BUILD_SANDBOX USE_SANDBOX)
if (UNIX)
if (WIN32)
target_compile_options(libcef_dll_wrapper PRIVATE "/W0")
elseif (UNIX)
target_compile_options(libcef_dll_wrapper PRIVATE "-w")
endif ()
@@ -207,6 +209,13 @@ else()
message(STATUS "Setting up WebBrowser CEF helper executable: ${CEF_HELPER_TARGET}")
set_openspace_cef_target_out_dir()
add_executable(${CEF_HELPER_TARGET} ${WEBBROWSER_HELPER_SOURCES})
if (WIN32)
target_compile_options(${CEF_HELPER_TARGET} PRIVATE "/W0")
elseif (UNIX)
target_compile_options(${CEF_HELPER_TARGET} PRIVATE "-w")
endif ()
set_executable_target_properties(${CEF_HELPER_TARGET})
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
# Logical target used to link the libcef library.

View File

@@ -124,6 +124,7 @@ function(run_cef_windows_config CEF_TARGET CEF_ROOT MODULE_PATH)
# Executable target.
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_TARGET} PUBLIC libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
include_directories(${CEF_ROOT})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")

View File

@@ -25,33 +25,9 @@
#ifndef __OPENSPACE_MODULE_WEBBROWSER___WEBBROWSERAPP___H__
#define __OPENSPACE_MODULE_WEBBROWSER___WEBBROWSERAPP___H__
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4100)
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wshadow-field"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
#include <include/cef_app.h>
#include <include/wrapper/cef_helpers.h>
#ifdef _MSC_VER
#pragma warning (pop)
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
namespace openspace {
/**

View File

@@ -289,7 +289,7 @@ bool WebRenderHandler::hasContent(int x, int y) {
}
int index = x + _browserBufferSize.x * (_browserBufferSize.y - y - 1);
index = glm::clamp(index, 0, static_cast<int>(_browserBuffer.size() - 1));
return _browserBuffer[index].a;
return _browserBuffer[index].a != 0;
}
}