Skip to content

Commit

Permalink
Merge pull request #147 from qudix/dev-clang-cl
Browse files Browse the repository at this point in the history
fix: clang-cl
  • Loading branch information
powerof3 authored Nov 11, 2024
2 parents e63d67c + 35b13c8 commit 99cc220
Show file tree
Hide file tree
Showing 28 changed files with 66 additions and 49 deletions.
4 changes: 2 additions & 2 deletions include/RE/B/BSFixedString.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace RE
try_acquire();
}

inline BSFixedString(BSFixedString&& a_rhs) :
inline BSFixedString(BSFixedString&& a_rhs) noexcept :
_data(a_rhs._data)
{
a_rhs._data = nullptr;
Expand Down Expand Up @@ -136,7 +136,7 @@ namespace RE

[[nodiscard]] inline friend bool operator==(const BSFixedString& a_lhs, const BSFixedString& a_rhs) noexcept
{
return a_lhs._data == a_rhs._data || a_lhs.empty() && a_rhs.empty();
return (a_lhs._data == a_rhs._data) || (a_lhs.empty() && a_rhs.empty());
}

[[nodiscard]] inline friend bool operator!=(const BSFixedString& a_lhs, const BSFixedString& a_rhs) noexcept { return !(a_lhs == a_rhs); }
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BSTSmartPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace RE
template <class T>
struct BSTSmartPointerAutoPtr
{
constexpr static void Acquire(T* a_ptr)
constexpr static void Acquire(T*)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/ButtonEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace RE
static ButtonEvent* Create(INPUT_DEVICE a_inputDevice, const BSFixedString& a_userEvent, uint32_t a_idCode, float a_value, float a_heldDownSecs)
{
auto buttonEvent = malloc<ButtonEvent>(sizeof(ButtonEvent));
std::memset(buttonEvent, 0, sizeof(ButtonEvent));
std::memset((void*)buttonEvent, 0, sizeof(ButtonEvent));
if (buttonEvent) {
stl::emplace_vtable<ButtonEvent>(buttonEvent);
buttonEvent->device = a_inputDevice;
Expand Down
2 changes: 1 addition & 1 deletion include/RE/C/ConcreteFormFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ namespace RE
auto factory = IFormFactory::GetConcreteFormFactoryByType<T>();
auto form = factory ? factory->Create() : nullptr;

return form ? form->As<T>() : nullptr;
return form ? form->template As<T>() : nullptr;
}
}
3 changes: 2 additions & 1 deletion include/RE/G/GFxResourceWeakLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace RE

bool operator!=(const GFxResourceKey& a_src) const
{
return operator!=(a_src);
return !operator==(a_src);
}

struct HashOp
Expand All @@ -49,6 +49,7 @@ namespace RE
assert(a_node.resource);
GFxResourceKey key =
(a_node.type == NodeType::kResource) ? a_node.resource->GetKey() : a_node.resolver->GetKey();
return GFxResourceKey::HashOp()(key);
}

UPInt operator()(const GFxResourceKey& a_key) const
Expand Down
6 changes: 6 additions & 0 deletions include/RE/G/GHashNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ namespace RE
second(*a_src.second)
{}

void operator=(const GHashNode& a_src)
{
first = a_src.first;
second = a_src.second;
}

void operator=(const NodeRef& a_src)
{
first = *a_src.first;
Expand Down
2 changes: 1 addition & 1 deletion include/RE/G/GHashSetBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ namespace RE
SetCapacity(this, a_sizeHint);
}

explicit GHashSetBase(void* a_memAddr) :
explicit GHashSetBase(void*) :
table(0)
{}

Expand Down
6 changes: 2 additions & 4 deletions include/RE/G/GMatrix3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ namespace RE
class GMatrix3D
{
public:
GMatrix3D() :
data{ 0.0 }
{}
GMatrix3D() = default;

GMatrix3D& operator=(const GMatrix3D& a_rhs)
{
Expand All @@ -19,7 +17,7 @@ namespace RE
return *this;
}

float data[4][4]; // 00
float data[4][4]{}; // 00
};
static_assert(sizeof(GMatrix3D) == 0x40);
}
2 changes: 1 addition & 1 deletion include/RE/H/hkpContactPointEvent.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "RE/H/hkpCollisionEvent.h"
#include "RE/h/hkpRigidBody.h"
#include "RE/H/hkpRigidBody.h"

namespace RE
{
Expand Down
2 changes: 1 addition & 1 deletion include/RE/H/hkpMotion.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace RE

float GetMass() const
{
float massInv = inertiaAndMassInv.quad.m128_f32[3];
float massInv = _mm_cvtss_f32(_mm_shuffle_ps(inertiaAndMassInv.quad, inertiaAndMassInv.quad, 3));
return massInv != 0.0f ? 1.0f / massInv : 0.0f;
}

Expand Down
1 change: 1 addition & 0 deletions include/RE/I/IVirtualMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "RE/B/BSTSmartPointer.h"
#include "RE/E/ErrorLogger.h"
#include "RE/T/TypeInfo.h"
#include "RE/T/TypeTraits.h"

namespace RE
{
Expand Down
2 changes: 1 addition & 1 deletion include/RE/N/NativeLatentFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace RE
requires is_return_convertible_v<V>
void IVirtualMachine::ReturnLatentResult(VMStackID a_stackID, V a_result)
{
auto var = RE::BSScript::Variable::Variable();
auto var = RE::BSScript::Variable();
var.Pack(a_result);
ReturnFromLatent(a_stackID, var);
}
Expand Down
2 changes: 1 addition & 1 deletion include/RE/N/NiBillboardNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace RE

void SetMode(FaceMode a_mode)
{
userFlags = static_cast<uint16_t>((std::to_underlying(a_mode) << FACE_MODE_POS) | userFlags & ~FACE_MODE_MASK);
userFlags = static_cast<uint16_t>((std::to_underlying(a_mode) << FACE_MODE_POS) | (userFlags & ~FACE_MODE_MASK));
}

// members
Expand Down
2 changes: 1 addition & 1 deletion include/RE/N/NiPointLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace RE
static NiPointLight* Create()
{
auto light = malloc<NiPointLight>();
std::memset(light, 0, sizeof(NiPointLight));
std::memset((void*)light, 0, sizeof(NiPointLight));
if (light) {
light->Ctor();
}
Expand Down
2 changes: 1 addition & 1 deletion include/RE/T/TESActionData.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace RE
static TESActionData* Create()
{
auto tesActionData = malloc<TESActionData>();
std::memset(tesActionData, 0, sizeof(TESActionData));
std::memset((void*)tesActionData, 0, sizeof(TESActionData));
if (tesActionData) {
tesActionData->Ctor();
}
Expand Down
4 changes: 2 additions & 2 deletions include/RE/T/TESForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace RE
[[nodiscard]] static TESForm* LookupByID(FormID a_formID)
{
const auto& [map, lock] = GetAllForms();
const BSReadWriteLock l{ lock };
[[maybe_unused]] const BSReadWriteLock l{ lock };
if (map) {
const auto it = map->find(a_formID);
return it != map->end() ? it->second : nullptr;
Expand All @@ -230,7 +230,7 @@ namespace RE
[[nodiscard]] static TESForm* LookupByEditorID(const std::string_view& a_editorID)
{
const auto& [map, lock] = GetAllFormsByEditorID();
const BSReadWriteLock l{ lock };
[[maybe_unused]] const BSReadWriteLock l{ lock };
if (map) {
const auto it = map->find(a_editorID);
return it != map->end() ? it->second : nullptr;
Expand Down
8 changes: 4 additions & 4 deletions include/SKSE/Impl/PCH.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ static_assert(
std::is_integral_v<std::time_t> && sizeof(std::time_t) == sizeof(std::size_t),
"wrap std::time_t instead");

#include "REX/REX.h"
#include "REX/W32/KERNEL32.h"
#include "REX/W32/USER32.h"

#pragma warning(push)
#include <binary_io/file_stream.hpp>
#include <spdlog/spdlog.h>
#pragma warning(pop)

#include "REX/REX.h"
#include "REX/W32/KERNEL32.h"
#include "REX/W32/USER32.h"

namespace SKSE
{
using namespace std::literals;
Expand Down
2 changes: 1 addition & 1 deletion src/RE/B/BSLightingShaderMaterialBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace RE
case Feature::kDefault:
{
auto material = malloc<BSLightingShaderMaterial>();
std::memset(material, 0, sizeof(BSLightingShaderMaterial));
std::memset((void*)material, 0, sizeof(BSLightingShaderMaterial));
if (material) {
material->Ctor();
stl::emplace_vtable<BSLightingShaderMaterial>(material);
Expand Down
2 changes: 1 addition & 1 deletion src/RE/B/BSShaderTextureSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace RE
return func();
#else
auto textureset = malloc<BSShaderTextureSet>();
std::memset(textureset, 0, sizeof(BSShaderTextureSet));
std::memset((void*)textureset, 0, sizeof(BSShaderTextureSet));
if (textureset) {
textureset->Ctor();
}
Expand Down
4 changes: 1 addition & 3 deletions src/RE/F/FindMaxMagnitudeVisitor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

#include "RE/F/FindMaxMagnitudeVisitor.h"

namespace RE
Expand All @@ -10,4 +8,4 @@ namespace RE
static REL::Relocation<func_t> func{ reinterpret_cast<std::uintptr_t*>(RELOCATION_ID(257550, 205805).address())[0x1] }; // AE address/ID untested
return func(this, a_effect);
}
} // namespace RE
}
2 changes: 1 addition & 1 deletion src/RE/N/NiAVObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
#include "RE/B/BSXFlags.h"
#include "RE/B/bhkNiCollisionObject.h"
#include "RE/B/bhkRigidBody.h"
#include "RE/H/hkpRigidBody.h"
#include "RE/N/NiColor.h"
#include "RE/N/NiNode.h"
#include "RE/N/NiProperty.h"
#include "RE/N/NiRTTI.h"
#include "RE/S/State.h"
#include "RE/h/hkpRigidBody.h"

namespace RE
{
Expand Down
2 changes: 1 addition & 1 deletion src/RE/N/NiNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace RE
NiNode* NiNode::Create(std::uint16_t a_arrBufLen)
{
auto node = malloc<NiNode>();
std::memset(node, 0, sizeof(NiNode));
std::memset((void*)node, 0, sizeof(NiNode));
node->Ctor(a_arrBufLen);
return node;
}
Expand Down
8 changes: 4 additions & 4 deletions src/RE/S/Sky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ namespace RE

bool Sky::IsRaining() const
{
return currentWeather && currentWeather->data.flags.any(TESWeather::WeatherDataFlag::kRainy) && currentWeather->data.precipitationBeginFadeIn * (1.0f / 255.0f) < currentWeatherPct ||
lastWeather && lastWeather->data.flags.any(TESWeather::WeatherDataFlag::kRainy) && (lastWeather->data.precipitationEndFadeOut * (1.0f / 255.0f) + 0.001f) > currentWeatherPct;
return (currentWeather && currentWeather->data.flags.any(TESWeather::WeatherDataFlag::kRainy) && (currentWeather->data.precipitationBeginFadeIn * (1.0f / 255.0f) < currentWeatherPct)) ||
(lastWeather && lastWeather->data.flags.any(TESWeather::WeatherDataFlag::kRainy) && (lastWeather->data.precipitationEndFadeOut * (1.0f / 255.0f) + 0.001f > currentWeatherPct));
}

bool Sky::IsSnowing() const
{
return currentWeather && currentWeather->data.flags.any(TESWeather::WeatherDataFlag::kSnow) && currentWeather->data.precipitationBeginFadeIn * (1.0f / 255.0f) < currentWeatherPct ||
lastWeather && lastWeather->data.flags.any(TESWeather::WeatherDataFlag::kSnow) && (lastWeather->data.precipitationEndFadeOut * (1.0f / 255.0f) + 0.001f) > currentWeatherPct;
return (currentWeather && currentWeather->data.flags.any(TESWeather::WeatherDataFlag::kSnow) && (currentWeather->data.precipitationBeginFadeIn * (1.0f / 255.0f) < currentWeatherPct)) ||
(lastWeather && lastWeather->data.flags.any(TESWeather::WeatherDataFlag::kSnow) && (lastWeather->data.precipitationEndFadeOut * (1.0f / 255.0f) + 0.001f > currentWeatherPct));
}

void Sky::ReleaseWeatherOverride()
Expand Down
4 changes: 2 additions & 2 deletions src/RE/T/TESForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace RE

for (const auto& keyword : a_keywords) {
hasKeyword = keyword && keywordForm->HasKeyword(keyword);
if (a_matchAll && !hasKeyword || hasKeyword) {
if ((a_matchAll && !hasKeyword) || hasKeyword) {
break;
}
}
Expand All @@ -125,7 +125,7 @@ namespace RE
a_keywordList->ForEachForm([&](const TESForm* a_form) {
const auto keyword = a_form->As<BGSKeyword>();
hasKeyword = keyword && keywordForm->HasKeyword(keyword);
if (a_matchAll && !hasKeyword || hasKeyword) {
if ((a_matchAll && !hasKeyword) || hasKeyword) {
return BSContainer::ForEachResult::kStop;
}
return BSContainer::ForEachResult::kContinue;
Expand Down
4 changes: 2 additions & 2 deletions src/RE/T/TESObjectREFR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ namespace RE

for (const auto& keyword : a_keywords) {
hasKeyword = keyword && HasKeyword(keyword);
if (a_matchAll && !hasKeyword || hasKeyword) {
if ((a_matchAll && !hasKeyword) || hasKeyword) {
break;
}
}
Expand All @@ -617,7 +617,7 @@ namespace RE
a_keywordList->ForEachForm([&](TESForm* a_form) {
const auto keyword = a_form->As<BGSKeyword>();
hasKeyword = keyword && HasKeyword(keyword);
if (a_matchAll && !hasKeyword || hasKeyword) {
if ((a_matchAll && !hasKeyword) || hasKeyword) {
return BSContainer::ForEachResult::kStop;
}
return BSContainer::ForEachResult::kContinue;
Expand Down
2 changes: 0 additions & 2 deletions src/RE/U/UnlinkedTypes.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

#include "RE/U/UnlinkedTypes.h"

#include "RE/M/MemoryManager.h"
Expand Down
File renamed without changes.
33 changes: 24 additions & 9 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ set_encodings("utf-8")
-- add rules
add_rules("mode.debug", "mode.releasedbg")

-- make extras available
includes("xmake-extra.lua")
-- make custom rules available
includes("xmake-rules.lua")

-- define options
option("skyrim_ae")
option("skyrim_ae", function()
set_default(false)
set_description("Enable support for Skyrim AE")
add_defines("SKYRIM_SUPPORT_AE=1")
option_end()
end)

option("skse_xbyak")
option("skse_xbyak", function()
set_default(false)
set_description("Enable trampoline support for Xbyak")
add_defines("SKSE_SUPPORT_XBYAK=1")
option_end()
end)

-- require packages
add_requires("rsm-binary-io")
Expand All @@ -36,7 +36,7 @@ if has_config("skse_xbyak") then
end

-- define targets
target("commonlibsse")
target("commonlibsse", function()
-- set target kind
set_kind("static")

Expand Down Expand Up @@ -123,11 +123,26 @@ target("commonlibsse")
"cl::/wd5220" -- 'member': a non-static data member with a volatile qualified type no longer implies that compiler generated copy / move constructors and copy / move assignment operators are not trivial
)

-- add flags (clang-cl)
add_cxxflags(
"clang_cl::-fms-compatibility",
"clang_cl::-fms-extensions",
{ public = true }
)

-- add flags (clang-cl: disable warnings)
add_cxxflags(
"clang_cl::-Wno-delete-non-abstract-non-virtual-dtor",
"clang_cl::-Wno-deprecated-volatile",
"clang_cl::-Wno-ignored-qualifiers",
"clang_cl::-Wno-inconsistent-missing-override",
"clang_cl::-Wno-invalid-offsetof",
"clang_cl::-Wno-microsoft-include",
"clang_cl::-Wno-overloaded-virtual",
"clang_cl::-Wno-reinterpret-base-class"
"clang_cl::-Wno-pragma-system-header-outside-header",
"clang_cl::-Wno-reinterpret-base-class",
"clang_cl::-Wno-switch",
"clang_cl::-Wno-unused-private-field",
{ public = true }
)
target_end()
end)

0 comments on commit 99cc220

Please sign in to comment.