Qt: Warning fixes for clang-cl

This commit is contained in:
Stenzek 2022-12-25 18:20:28 +10:00 committed by refractionpcsx2
parent 07789f5dad
commit 7aa3322a04
7 changed files with 37 additions and 26 deletions

View File

@ -247,9 +247,9 @@ void MemoryViewTable::KeyPress(int key, QChar keychar)
{
case Qt::Key::Key_Backspace:
case Qt::Key::Key_Escape:
Host::RunOnCPUThread([this, address = selectedAddress, cpu = m_cpu, key] {
Host::RunOnCPUThread([this, address = selectedAddress, cpu = m_cpu] {
cpu->write8(address, 0);
QtHost::RunOnUIThread([this, key] { UpdateSelectedAddress(selectedAddress - 1); parent->update(); });
QtHost::RunOnUIThread([this] { UpdateSelectedAddress(selectedAddress - 1); parent->update(); });
});
break;
case Qt::Key::Key_Right:
@ -268,7 +268,7 @@ void MemoryViewTable::KeyPress(int key, QChar keychar)
{
InsertIntoSelectedHexView(((u8)QString(QChar(key)).toInt(nullptr, 16)));
// Increment to the next nibble or byte
if (selectedNibbleHI = !selectedNibbleHI)
if ((selectedNibbleHI = !selectedNibbleHI))
UpdateSelectedAddress(selectedAddress + 1);
}
@ -282,7 +282,7 @@ void MemoryViewTable::KeyPress(int key, QChar keychar)
UpdateSelectedAddress(selectedAddress - 1);
break;
case Qt::Key::Key_Right:
if (selectedNibbleHI = !selectedNibbleHI)
if ((selectedNibbleHI = !selectedNibbleHI))
UpdateSelectedAddress(selectedAddress + 1);
break;
case Qt::Key::Key_Left:

View File

@ -183,7 +183,7 @@ void RegisterWidget::paintEvent(QPaintEvent* event)
void RegisterWidget::mousePressEvent(QMouseEvent* event)
{
const int categoryIndex = ui.registerTabs->currentIndex();
m_selectedRow = ((event->y() - m_renderStart.y()) / m_rowHeight) + m_rowStart;
m_selectedRow = static_cast<int>(((event->position().y() - m_renderStart.y()) / m_rowHeight)) + m_rowStart;
// For 128 bit types, support selecting segments
if (m_cpu->getRegisterSize(categoryIndex) == 128)
@ -194,7 +194,7 @@ void RegisterWidget::mousePressEvent(QMouseEvent* event)
for (int i = 0; i < 4; i++)
{
if (inRange(m_fieldStartX[i], m_fieldStartX[i] + m_fieldWidth, event->x()))
if (inRange(m_fieldStartX[i], m_fieldStartX[i] + m_fieldWidth, event->position().x()))
{
m_selected128Field = i;
}

View File

@ -21,13 +21,14 @@
#include "common/RedtapeWindows.h"
#pragma optimize("", off)
// The problem with AVX2 builds on Windows, is that MSVC generates AVX instructions for zeroing memory,
// which is pretty common in our global object constructors. So, we have to use a special object which
// gets initialized before all other global objects, that does the hardware check, and terminates the
// process before main() or any of the other objects are constructed (which would subsequently crash).
struct EarlyHardwareCheckObject
{
#pragma optimize("", off)
EarlyHardwareCheckObject()
{
const char* error;
@ -50,10 +51,11 @@ struct EarlyHardwareCheckObject
TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF);
}
#pragma optimize("", on)
};
#pragma warning(disable : 4075) // warning C4075: initializers put in unrecognized initialization area
#pragma init_seg(".CRT$XCT")
EarlyHardwareCheckObject s_hardware_checker;
#pragma optimize("", on)
#endif

View File

@ -18,4 +18,18 @@
// Needed because of moc shenanigans with pch.
#include <memory>
#include <QtCore/QtCore>
// Silence these warnings in the PCH, that way it happens before any of our headers are included.
// warning : variable 's_hrErrorLast' set but not used [-Wunused-but-set-variable]
#if defined(_WIN32) && defined(__clang__)
#pragma clang diagnostic push
// warning : known but unsupported action 'shared' for '#pragma section' - ignored [-Wignored-pragmas]
#pragma clang diagnostic ignored "-Wignored-pragmas"
// warning : dynamic_cast will not work since RTTI data is disabled by /GR- [-Wrtti]
#pragma clang diagnostic ignored "-Wrtti"
#endif
#include <QtCore/QtCore>
#if defined(_WIN32) && defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@ -503,6 +503,8 @@ static std::tuple<QString, QString> getPrefixAndSuffixForIntFormat(const QString
return std::tie(prefix, suffix);
}
#if 0
// Unused until we handle multiplier below.
static std::tuple<QString, QString, int> getPrefixAndSuffixForFloatFormat(const QString& format)
{
QString prefix, suffix;
@ -530,6 +532,7 @@ static std::tuple<QString, QString, int> getPrefixAndSuffixForFloatFormat(const
return std::tie(prefix, suffix, decimals);
}
#endif
void ControllerCustomSettingsWidget::createSettingWidgets(const char* translation_ctx, QWidget* widget_parent, QGridLayout* layout)
{

View File

@ -45,30 +45,22 @@ struct RendererInfo
};
static constexpr RendererInfo s_renderer_info[] = {
QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Automatic (Default)"),
GSRendererType::Auto,
{QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Automatic (Default)"), GSRendererType::Auto},
#ifdef _WIN32
QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Direct3D 11"),
GSRendererType::DX11,
QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Direct3D 12"),
GSRendererType::DX12,
{QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Direct3D 11"), GSRendererType::DX11},
{QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Direct3D 12"), GSRendererType::DX12},
#endif
#ifdef ENABLE_OPENGL
QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "OpenGL"),
GSRendererType::OGL,
{QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "OpenGL"), GSRendererType::OGL},
#endif
#ifdef ENABLE_VULKAN
QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Vulkan"),
GSRendererType::VK,
{QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Vulkan"), GSRendererType::VK},
#endif
#ifdef __APPLE__
QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Metal"),
GSRendererType::Metal,
{QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Metal"), GSRendererType::Metal},
#endif
QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Software"),
GSRendererType::SW,
QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Null"),
GSRendererType::Null,
{QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Software"), GSRendererType::SW},
{QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Null"), GSRendererType::Null},
};
static const char* s_anisotropic_filtering_entries[] = {QT_TRANSLATE_NOOP("GraphicsSettingsWidget", "Off (Default)"),

View File

@ -21,6 +21,7 @@
#include "common/StringUtil.h"
#include "common/ProgressCallback.h"
#include "common/RedtapeWindows.h"
#include "common/RedtapeWilCom.h"
#include <CommCtrl.h>
#include <shellapi.h>
@ -28,7 +29,6 @@
#include <thread>
#include <wil/com.h>
#include <wil/resource.h>
#include <wil/win32_helpers.h>