Remove compiler warnings on Clang/GCC (#3546)

This commit is contained in:
Alexander Bock
2025-02-28 23:29:38 +01:00
committed by GitHub
parent 1260ebf309
commit cd8924ed22
45 changed files with 140 additions and 138 deletions

View File

@@ -49,7 +49,7 @@ if (WIN32)
elseif (UNIX)
set(SOLOUD_BACKEND_ALSA ON CACHE BOOL "")
endif ()
add_subdirectory(ext/soloud/contrib)
add_subdirectory(ext/soloud/contrib SYSTEM)
# Unfortunately, the soloud cmake tarket doesn't set the include directories correctly
target_include_directories(openspace-module-audio SYSTEM PRIVATE ext/soloud/include)

View File

@@ -55,8 +55,6 @@ void DashboardItemParallelConnection::update() {
const size_t nConnections = global::parallelPeer->nConnections();
const std::string& hostName = global::parallelPeer->hostName();
int nLines = 1;
int nClients = static_cast<int>(nConnections);
if (status == ParallelConnection::Status::Host) {
nClients--;
@@ -92,8 +90,6 @@ void DashboardItemParallelConnection::update() {
else if (nClients == 1) {
_buffer += "You are the only client";
}
nLines = 2;
}
}

View File

@@ -54,7 +54,7 @@ namespace {
.synchronized = scripting::ScriptEngine::Script::ShouldBeSynchronized::No,
.sendToRemote = scripting::ScriptEngine::Script::ShouldSendToRemote::No
});
};
}
constexpr openspace::properties::Property::PropertyInfo InterpolationValueInfo = {
"Value",

View File

@@ -253,11 +253,11 @@ documentation::Documentation RenderableLabel::Documentation() {
RenderableLabel::RenderableLabel(const ghoul::Dictionary& dictionary)
: Renderable(dictionary, { .automaticallyUpdateRenderBin = false })
, _blendMode(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown)
, _text(TextInfo, "")
, _color(ColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
, _fontSize(FontSizeInfo, 50.f, 1.f, 100.f)
, _size(SizeInfo, 8.f, 0.5f, 30.f)
, _minMaxSize(MinMaxSizeInfo, glm::ivec2(8, 20), glm::ivec2(0), glm::ivec2(100))
, _text(TextInfo, "")
, _enableFadingEffect(EnableFadingEffectInfo, false)
, _fadeWidths(FadeWidthsInfo, glm::vec2(1.f), glm::vec2(0.f), glm::vec2(100.f))
, _fadeDistances(FadeDistancesInfo, glm::vec2(1.f), glm::vec2(0.f), glm::vec2(100.f))

View File

@@ -38,7 +38,6 @@
#include <optional>
namespace {
constexpr std::string_view KeyLazyLoading = "LazyLoading";
constexpr std::string_view _loggerCat = "RenderablePlaneTimeVaryingImage";
constexpr openspace::properties::Property::PropertyInfo SourceFolderInfo = {

View File

@@ -1201,7 +1201,7 @@ void RenderableFieldlinesSequence::updateVertexPositionBuffer() {
);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
unbindGL();
}
@@ -1226,7 +1226,7 @@ void RenderableFieldlinesSequence::updateVertexColorBuffer() {
);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
unbindGL();
}
@@ -1252,7 +1252,7 @@ void RenderableFieldlinesSequence::updateVertexMaskingBuffer() {
);
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
unbindGL();
}

View File

@@ -38,8 +38,6 @@
#include <optional>
namespace {
constexpr std::string_view KeyFilterColumnNames = "FilterColumnNames";
constexpr std::string_view _loggerCat = "ReadFitsTask";
struct [[codegen::Dictionary(ReadFitsTask)]] Parameters {

View File

@@ -93,7 +93,9 @@ void MilkywayPointsConversionTask::perform(const Task::ProgressCallback& progres
documentation::Documentation MilkywayPointsConversionTask::Documentation() {
return {
"MilkywayPointsConversionTask",
"galaxy_milkywaypointsconversiontask"
"galaxy_milkywaypointsconversiontask",
"",
{}
};
}

View File

@@ -51,12 +51,11 @@ private:
void internalDeinitialize() override final;
std::array<std::unique_ptr<ghoul::opengl::Texture>, 2> tileTexture;
std::array<GLuint, 2> fbo = { 0, 0 };
std::array<Tile, 2> tiles;
#ifdef OPENSPACE_HAS_SPOUT
std::array<GLuint, 2> fbo = { 0, 0 };
std::unique_ptr<spout::SpoutReceiverPropertyProxy> spoutReceiver;
#endif
#endif // OPENSPACE_HAS_SPOUT
bool spoutUpdate = false;
};

View File

@@ -66,7 +66,6 @@ TileProviderByDate::TileProviderByDate(const ghoul::Dictionary& dictionary) {
if (dictionary.hasValue<std::string>("GlobeName")) {
prov.second.setValue("GlobeName", dictionary.value<std::string>("GlobeName"));
}
layers::Layer::ID typeID = layers::Layer::ID::DefaultTileProvider;
std::unique_ptr<TileProvider> tp = createFromDictionary(prov.second);
const std::string provId = prov.second.value<std::string>("Identifier");

View File

@@ -67,9 +67,9 @@ void GuiMemoryComponent::render() {
_isCollapsed = ImGui::IsWindowCollapsed();
uint64_t ram = global::openSpaceEngine->ramInUse();
ImGui::Text("RAM: %u (%f MiB)", ram, ram / (1024.f * 1024.f));
ImGui::Text("RAM: %lu (%f MiB)", ram, ram / (1024.f * 1024.f));
uint64_t vram = global::openSpaceEngine->vramInUse();
ImGui::Text("VRAM: %u (%f MiB)", vram, vram / (1024.f * 1024.f));
ImGui::Text("VRAM: %lu (%f MiB)", vram, vram / (1024.f * 1024.f));
ImGui::Spacing();

View File

@@ -60,7 +60,7 @@ IswaBaseGroup::IswaBaseGroup(std::string name, std::string type)
, _enabled(EnabledInfo, true)
, _alpha(AlphaInfo, 0.9f, 0.f, 1.f)
, _delete(DeleteInfo)
, _type(std::move(type))
, _iswaType(std::move(type))
{
addProperty(_enabled);
addProperty(_alpha);
@@ -72,7 +72,7 @@ IswaBaseGroup::IswaBaseGroup(std::string name, std::string type)
IswaBaseGroup::~IswaBaseGroup() {}
bool IswaBaseGroup::isType(const std::string& type) const {
return (_type == type);
return (_iswaType == type);
}
void IswaBaseGroup::updateGroup() {

View File

@@ -61,7 +61,8 @@ protected:
std::shared_ptr<DataProcessor> _dataProcessor;
bool _registered = false;
std::string _type;
private:
std::string _iswaType;
};
} //namespace openspace

View File

@@ -101,9 +101,9 @@ IswaManager::IswaManager()
: properties::PropertyOwner({ "IswaManager", "Iswa Manager" })
, _baseUrl("https://iswa-demo-server.herokuapp.com/")
{
_type[CygnetType::Texture] = "Texture";
_type[CygnetType::Data] = "Data";
_type[CygnetType::Kameleon] = "Kameleon";
_cygnetType[CygnetType::Texture] = "Texture";
_cygnetType[CygnetType::Data] = "Data";
_cygnetType[CygnetType::Kameleon] = "Kameleon";
_geom[CygnetGeometry::Plane] = "Plane";
_geom[CygnetGeometry::Sphere] = "Sphere";
@@ -124,7 +124,6 @@ IswaManager::~IswaManager() {
_cygnetInformation.clear();
}
void IswaManager::initialize() {
ghoul_assert(!isInitialized(), "IswaManager is already initialized");
_instance = new IswaManager;
@@ -156,10 +155,10 @@ void IswaManager::addIswaCygnet(int id, const std::string& type, std::string gro
metaFuture.group = std::move(group);
// Assign type of cygnet Texture/Data
if (type == _type[CygnetType::Texture]) {
if (type == _cygnetType[CygnetType::Texture]) {
metaFuture.type = CygnetType::Texture;
}
else if (type == _type[CygnetType::Data]) {
else if (type == _cygnetType[CygnetType::Data]) {
metaFuture.type = CygnetType::Data;
}
else {
@@ -389,7 +388,7 @@ std::string IswaManager::jsonPlaneToLuaTable(MetadataFuture& data) {
"Name = '" + data.name +"' , "
"Parent = '" + parent + "', "
"Renderable = {"
"Type = '" + _type[data.type] + _geom[data.geom] + "', "
"Type = '" + _cygnetType[data.type] + _geom[data.geom] + "', "
"Id = " + ghoul::to_string(data.id) + ", "
"Frame = '" + frame + "' , "
"GridMin = " + ghoul::to_string(min) + ", "
@@ -496,7 +495,7 @@ std::string IswaManager::jsonSphereToLuaTable(MetadataFuture& data) {
"Name = '" + data.name +"' , "
"Parent = '" + parent + "', "
"Renderable = {"
"Type = '" + _type[data.type] + _geom[data.geom] + "', "
"Type = '" + _cygnetType[data.type] + _geom[data.geom] + "', "
"Id = " + std::to_string(data.id) + ", "
"Frame = '" + frame + "' , "
"GridMin = " + ghoul::to_string(min) + ", "
@@ -513,7 +512,9 @@ std::string IswaManager::jsonSphereToLuaTable(MetadataFuture& data) {
void IswaManager::createPlane(MetadataFuture& data) {
// check if this plane already exist
std::string name = _type[data.type] + _geom[data.geom] + std::to_string(data.id);
std::string name = std::format(
"{}{}{}", _cygnetType[data.type], _geom[data.geom], data.id
);
if (!data.group.empty()) {
std::string type;
@@ -551,7 +552,9 @@ void IswaManager::createPlane(MetadataFuture& data) {
void IswaManager::createSphere(MetadataFuture& data) {
// check if this sphere already exist
std::string name = _type[data.type] + _geom[data.geom] + std::to_string(data.id);
std::string name = std::format(
"{}{}{}", _cygnetType[data.type], _geom[data.geom], data.id
);
if (!data.group.empty()) {
std::string type = typeid(DataSphere).name();

View File

@@ -116,7 +116,7 @@ private:
void fillCygnetInfo(std::string jsonString);
void registerGroup(std::string groupName, std::string type);
std::map<int, std::string> _type;
std::map<int, std::string> _cygnetType;
std::map<int, std::string> _geom;
std::shared_ptr<ccmc::Kameleon> _kameleon;

View File

@@ -54,8 +54,6 @@
#endif // WIN32
namespace {
constexpr std::string_view _loggerCat = "KameleonVolumeReader";
template <typename T>
T globalAttribute(ccmc::Model&, const std::string&) {
static_assert(sizeof(T) == 0);

View File

@@ -162,21 +162,21 @@ bool BrickManager::buildBrickList(BUFFER_INDEX bufferIndex,
{
// Keep track of number bricks used and number of bricks cached
// (for benchmarking)
int numBricks = 0;
int numCached = 0;
//int numBricks = 0;
//int numCached = 0;
// For every non-zero entry in the request list, assign a texture atlas
// coordinate. For zero entries, signal "no brick" using -1.
for (unsigned int i = 0; i < brickRequest.size(); i++) {
if (brickRequest[i] > 0) {
numBricks++;
//numBricks++;
//INFO("Checking brick " << i);
// If the brick is already in the atlas, keep the coordinate
if (_bricksInPBO[bufferIndex][i] != -1) {
numCached++;
//numCached++;
// Get the corresponding coordinates from index
int x, y, z;

View File

@@ -31,8 +31,8 @@ namespace openspace {
class BrickSelector {
public:
virtual ~BrickSelector() {};
virtual bool initialize() { return true; };
virtual ~BrickSelector() {}
virtual bool initialize() { return true; }
virtual void selectBricks(int timestep, std::vector<int>& bricks) = 0;
};

View File

@@ -96,7 +96,7 @@ bool ErrorHistogramManager::buildFromLeaf(unsigned int bstOffset,
int bstNode = bstOffset;
bool bstRightOnly = true;
unsigned int bstLevel = 0;
//unsigned int bstLevel = 0;
do {
glm::vec3 leafOffset(0.f); // Leaf offset in leaf sized voxels
@@ -173,7 +173,7 @@ bool ErrorHistogramManager::buildFromLeaf(unsigned int bstOffset,
bstRightOnly &= (bstNode % 2 == 0);
bstNode = parentOffset(bstNode, 2);
bstLevel++;
//bstLevel++;
} while (bstNode != -1);
return true;

View File

@@ -152,7 +152,7 @@ bool MultiresVolumeRaycaster::isCameraInside(const RenderData& data,
float divisor = 1.0;
for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) {
if (abs(modelTransform[i][j]) > divisor) {
if (std::abs(modelTransform[i][j]) > divisor) {
divisor = modelTransform[i][j];
}
}

View File

@@ -67,20 +67,20 @@ bool TSP::load() {
return false;
}
if (false) {
if (!calculateSpatialError()) {
LERROR("Could not calculate spatial error");
return false;
}
if (!calculateTemporalError()) {
LERROR("Could not calculate temporal error");
return false;
}
if (!writeCache()) {
LERROR("Could not write cache");
return false;
}
#if 0
if (!calculateSpatialError()) {
LERROR("Could not calculate spatial error");
return false;
}
if (!calculateTemporalError()) {
LERROR("Could not calculate temporal error");
return false;
}
if (!writeCache()) {
LERROR("Could not write cache");
return false;
}
#endif
}
initalizeSSO();

View File

@@ -95,7 +95,7 @@ HorizonsTranslation::HorizonsTranslation(const ghoul::Dictionary& dictionary)
files.cbegin(),
files.cend(),
std::back_inserter(f),
[](const std::filesystem::path& p) { return p.string(); }
[](const std::filesystem::path& path) { return path.string(); }
);
_horizonsFiles = f;
}

View File

@@ -323,13 +323,13 @@ TouchInteraction::TouchInteraction()
glm::vec4(0.2f)
)
, _constTimeDecay_secs(ConstantTimeDecaySecsInfo, 1.75f, 0.1f, 4.f)
, _pinchInputs({ TouchInput(0, 0, 0.f, 0.f, 0.0), TouchInput(0, 0, 0.f, 0.f, 0.0) })
, _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) }
, _sensitivity{ glm::dvec2(0.08, 0.045), 12.0, 2.75, glm::dvec2(0.08, 0.045) }
// Calculated with two vectors with known diff in length, then
// projDiffLength/diffLength.
, _enableDirectManipulation(EnableDirectManipulationInfo, true)
, _directTouchDistanceThreshold(DirectManipulationThresholdInfo, 5.f, 0.f, 10.f)
, _pinchInputs({ TouchInput(0, 0, 0.f, 0.f, 0.0), TouchInput(0, 0, 0.f, 0.f, 0.0) })
, _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) }
, _sensitivity{ glm::dvec2(0.08, 0.045), 12.0, 2.75, glm::dvec2(0.08, 0.045) }
{
addProperty(_disableZoom);
addProperty(_disableRoll);
@@ -796,17 +796,17 @@ void TouchInteraction::computeVelocities(const std::vector<TouchInputHolder>& li
list.begin(),
list.end(),
0.0,
[this, &lastProcessed](double diff, const TouchInputHolder& inputHolder) {
[this, &lastProcessed](double diff, const TouchInputHolder& holder) {
TouchInput point = *std::find_if(
lastProcessed.begin(),
lastProcessed.end(),
[&inputHolder](const TouchInput& input) {
return inputHolder.holdsInput(input);
[&holder](const TouchInput& input) {
return holder.holdsInput(input);
}
);
double res = diff;
float lastAngle = point.angleToPos(_centroid.x, _centroid.y);
float currentAngle = inputHolder.latestInput().angleToPos(
float currentAngle = holder.latestInput().angleToPos(
_centroid.x,
_centroid.y
);
@@ -1210,7 +1210,11 @@ double FrameTimeAverage::averageFrameTime() const {
return 1.0 / 60.0;
}
else {
return std::accumulate(_samples, _samples + _nSamples, 0.0) / (double)(_nSamples);
return std::accumulate(
_samples,
_samples + _nSamples,
0.0
) / static_cast<double>(_nSamples);
}
}

View File

@@ -33,8 +33,6 @@
#include <ghoul/logging/logmanager.h>
namespace {
constexpr std::string_view _loggerCat = "RenderableToyVolume";
constexpr openspace::properties::Property::PropertyInfo SizeInfo = {
"Size",
"Size",

View File

@@ -405,7 +405,9 @@ void VideoPlayer::initializeMpv() {
LINFO("mpv init failed");
}
mpv_opengl_init_params gl_init_params { getOpenGLProcAddress, nullptr };
mpv_opengl_init_params glInitParams;
glInitParams.get_proc_address = getOpenGLProcAddress;
glInitParams.get_proc_address_ctx = nullptr;
int adv = 1; // Use libmpv advanced mode since we will use the update callback
// Decouple mpv from waiting to get the correct fps. Use with flag video-timing-offset
// set to 0
@@ -413,7 +415,7 @@ void VideoPlayer::initializeMpv() {
mpv_render_param params[] = {
{ MPV_RENDER_PARAM_API_TYPE, const_cast<char*>(MPV_RENDER_API_TYPE_OPENGL) },
{ MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &gl_init_params },
{ MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &glInitParams },
{ MPV_RENDER_PARAM_ADVANCED_CONTROL, &adv },
{ MPV_RENDER_PARAM_BLOCK_FOR_TARGET_TIME, &blockTime },
{ MPV_RENDER_PARAM_INVALID, nullptr }

View File

@@ -144,7 +144,6 @@ void GenerateRawVolumeFromFileTask::perform(const ProgressCallback& progressCall
progressCallback(0.5f);
// Write data into volume data structure
int k = 0;
for (const dataloader::Dataset::Entry& entry : data.entries) {
// Get the closest i, j , k voxel that should contain this data
glm::vec3 normalizedPos = (entry.position - _lowerDomainBound) /
@@ -163,7 +162,6 @@ void GenerateRawVolumeFromFileTask::perform(const ProgressCallback& progressCall
size_t index = rawVolume.coordsToIndex(cell);
rawVolume.set(index, value);
k++;
}
progressCallback(0.75f);

View File

@@ -28,14 +28,29 @@
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4100)
#endif // _MSC_VER
#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)
#endif // _MSC_VER
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
namespace openspace {

View File

@@ -26,9 +26,27 @@
// reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
#ifdef __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/webbrowserapp.h"
#ifdef __clang__
#pragma clang diagnostic pop
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
// Entry point function for all processes.
int main(int argc, char* argv[]) {
// Provide CEF with command-line arguments.