Skip to content

Commit

Permalink
Fix most build warnings in Linux
Browse files Browse the repository at this point in the history
Signed-off-by: ToKiNoBug <tokinobug@163.com>
  • Loading branch information
ToKiNoBug committed Dec 7, 2023
1 parent d861683 commit 52b434e
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 20 deletions.
20 changes: 14 additions & 6 deletions SlopeCraft/SCWind_slots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void SCWind::on_pb_preview_materials_clicked() noexcept {

cvt_task &task = *taskopt.value();
const ptrdiff_t index = &task - this->tasks.data();
assert(index >= 0 && index < this->tasks.size());
assert(index >= 0 && index < ptrdiff_t(this->tasks.size()));
if (!task.is_converted) [[unlikely]] {
QMessageBox::warning(this, tr("该图像尚未被转化"),
tr("必须先转化一个图像,然后再为它构建三维结构"));
Expand Down Expand Up @@ -868,20 +868,28 @@ void SCWind::on_ac_about_triggered() noexcept {
QString info;
info += QStringLiteral("SlopeCraft %1").arg(SlopeCraft::SCL_getSCLVersion());
info += "\n\n";
info += tr("SlopeCraft 是一款由 ToKiNoBug 开发的立体地图画生成器,主要用于"
"在 Minecraft 中制造可以生存实装的立体地图画(但同样支持传统的平板地图画)。");
info +=
tr("SlopeCraft 是一款由 ToKiNoBug 开发的立体地图画生成器,主要用于"
"在 Minecraft "
"中制造可以生存实装的立体地图画(但同样支持传统的平板地图画)。");
info += "\n";
info += tr("本软件的开发持续集成与 macOS 软件适配由 iXOR Technology (Cubik65536 以及贡献者) 提供");
info +=
tr("本软件的开发持续集成与 macOS 软件适配由 iXOR Technology (Cubik65536 "
"以及贡献者) 提供");
info += "\n\n";
info += tr("感谢 AbrasiveBoar902 为本软件的设计和优化贡献的力量");
info += "\n";
info += tr("感谢 67au 为本软件的 macOS 与 Linux 适配做出的贡献");
info += "\n";
info += tr("SlopeCraft 在开发时使用了 Qt,zlib 和 eigen 等开源库,对上述库的开发者表示感谢。");
info +=
tr("SlopeCraft 在开发时使用了 Qt,zlib 和 eigen "
"等开源库,对上述库的开发者表示感谢。");
info += "\n\n";
info += tr("本软件遵循 GPL-3.0 及以后版本 (GPL-3.0 or later) 协议开放源码。");
info += "\n\n";
info += tr("Copyright © 2021-2023 SlopeCraft 开发者 (TokiNoBug, AbrasiveBoar, iXOR Technology, Mifan-T, 以及贡献者). 版权所有");
info +=
tr("Copyright © 2021-2023 SlopeCraft 开发者 (TokiNoBug, AbrasiveBoar, "
"iXOR Technology, Mifan-T, 以及贡献者). 版权所有");
QMessageBox::information(this, tr("关于 SlopeCraft"), info);
}

Expand Down
15 changes: 11 additions & 4 deletions SlopeCraftL/SlopeCraftL_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ This file is part of SlopeCraft.
#ifndef SLOPECRAFTL_GLOBAL_H
#define SLOPECRAFTL_GLOBAL_H

#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || \
defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || \
#ifdef Q_DECL_EXPORT
#undef Q_DECL_EXPORT
#endif
#ifdef Q_DECL_IMPORT
#undef Q_DECL_IMPORT
#endif

#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || \
defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || \
defined(__WIN32__) || defined(__NT__)
#define Q_DECL_EXPORT __declspec(dllexport)
#define Q_DECL_IMPORT __declspec(dllimport)
Expand Down Expand Up @@ -53,6 +60,6 @@ This file is part of SlopeCraft.
#include <SC_version_buildtime.h>
#else
#include "SC_version_buildtime.h"
#endif // SLOPECRAFTL_NOT_INSTALLED
#endif // SLOPECRAFTL_NOT_INSTALLED

#endif // SLOPECRAFTL_GLOBAL_H
#endif // SLOPECRAFTL_GLOBAL_H
3 changes: 2 additions & 1 deletion SlopeCraftL/TokiSlopeCraft_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ void TokiSlopeCraft::save_build_cache(std::string &err) const noexcept {
}

bool TokiSlopeCraft::examine_build_cache(
const build_options &opt, std::span<const uint8_t> expected_sha3_512,
[[maybe_unused]] const build_options &opt,
std::span<const uint8_t> expected_sha3_512,
build_cache_ir *ir) const noexcept {
assert(this->kernelStep >= SCL_step::converted);

Expand Down
6 changes: 1 addition & 5 deletions VisualCraft/ColorBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void compose_blocks(QImage &dst, const QImage &src, int idx,
const int rows = src.height();

const int col_begin = idx * (rows + margin);
const int col_end = col_begin + rows;
[[maybe_unused]] const int col_end = col_begin + rows;

assert(dst.width() >= col_end);

Expand Down Expand Up @@ -131,7 +131,6 @@ void ColorBrowser::setup_table(const uint16_t *const color_id_list,
color_id_list[idx], pair.first.data(), &pair.second);

if (num <= 0) {

const auto ret = QMessageBox::warning(
this, ColorBrowser::tr("获取颜色表失败"),
ColorBrowser::tr(
Expand All @@ -149,7 +148,6 @@ void ColorBrowser::setup_table(const uint16_t *const color_id_list,
abort();
return;
} else {

// ignore the error
pair.first.resize(0);
continue;
Expand All @@ -171,7 +169,6 @@ void ColorBrowser::setup_table(const uint16_t *const color_id_list,
VCL_model *const model =
VCL_get_block_model(pair.first, VCL_get_resource_pack());
if (model == nullptr) {

const auto ret = QMessageBox::warning(
this, ColorBrowser::tr("计算投影图像失败"),
ColorBrowser::tr("在尝试获取方块 \"%1\" 的方块模型时出现错误。")
Expand All @@ -194,7 +191,6 @@ void ColorBrowser::setup_table(const uint16_t *const color_id_list,
reinterpret_cast<uint32_t *>(proj.scanLine(0)), proj.sizeInBytes());

if (!ok) {

const auto ret = QMessageBox::warning(
this, ColorBrowser::tr("计算投影图像失败"),
ColorBrowser::tr(
Expand Down
7 changes: 6 additions & 1 deletion VisualCraftL/VisualCraftL_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ This file is part of SlopeCraft.
#ifndef SLOPECRAFT_VISUALCRAFT_VISUALCRAFTL_GLOBAL_H
#define SLOPECRAFT_VISUALCRAFT_VISUALCRAFTL_GLOBAL_H

// #ifdef VISUALCRAFTL_BUILD
#ifdef Q_DECL_EXPORT
#undef Q_DECL_EXPORT
#endif
#ifdef Q_DECL_IMPORT
#undef Q_DECL_IMPORT
#endif

#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || \
defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || \
Expand Down
2 changes: 1 addition & 1 deletion utilities/ColorManip/ColorDiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void colordiff_RGB_batch(std::span<const float> r1p, std::span<const float> g1p,
}
}

inline void assert_if_nan(batch_t val) noexcept {
inline void assert_if_nan([[maybe_unused]] batch_t val) noexcept {
for (size_t i = 0; i < batch_size; i++) {
assert(!std::isnan(val.get(i)));
}
Expand Down
4 changes: 2 additions & 2 deletions utilities/GPUWrapper/OpenCL/OCLWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ void ocl_warpper::ocl_resource::init_resource() noexcept {
return;
}

this->queue =
cl::CommandQueue(this->context, this->device, NULL, &this->error);
this->queue = cl::CommandQueue(this->context, this->device,
cl::QueueProperties::None, &this->error);

if (!this->ok()) {
this->err_msg = "Failed to create command queue.";
Expand Down

0 comments on commit 52b434e

Please sign in to comment.