Skip to content

Commit

Permalink
fix: clang-cl & msvc warnings (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix authored Nov 4, 2024
1 parent 78d829e commit 1abb4bf
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 33 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main_ci_xmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
strategy:
fail-fast: false
matrix:
mode:
- debug
- release
toolchain:
- msvc
- clang-cl
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -30,7 +30,7 @@ jobs:
xmake-version: "latest"

- name: Configure
run: xmake config -y --mode=${{ matrix.mode }} --vs_toolset=14.41
run: xmake config -y --mode=releasedbg --toolchain=${{ matrix.toolchain }} --vs_toolset=14.41

- name: Build
run: xmake build -y -vD
1 change: 0 additions & 1 deletion include/RE/B/BSScriptUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ namespace RE::BSScript
void PackVariable(Variable& a_var, T&& a_val) //
requires(detail::array<std::remove_reference_t<T>>)
{
using value_type = detail::decay_t<typename std::remove_cvref_t<T>::value_type>;
using reference_type =
std::conditional_t<
std::is_lvalue_reference_v<T>,
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 @@ -20,7 +20,7 @@ namespace RE
struct BSTSmartPointerAutoPtr
{
public:
constexpr static void Acquire(stl::not_null<T*> a_ptr) { return; }
constexpr static void Acquire(stl::not_null<T*>) { return; }
static void Release(stl::not_null<T*> a_ptr) { delete a_ptr; }
};

Expand Down
12 changes: 11 additions & 1 deletion include/RE/E/Events.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "RE/B/BSCoreTypes.h"
#include "RE/B/BSFixedString.h"
#include "RE/B/BSPointerHandle.h"
#include "RE/B/BSTEvent.h"
#include "RE/N/NiSmartPointer.h"
Expand Down Expand Up @@ -1705,6 +1706,14 @@ namespace RE
}
};

struct MenuOpenCloseEvent
{
// members
BSFixedString menuName; // 00
bool opening; // 08
};
static_assert(sizeof(MenuOpenCloseEvent) == 0x10);

struct MessageBoxMenu_OnBackOut
{
[[nodiscard]] static BSTEventSource<MessageBoxMenu_OnBackOut>* GetEventSource()
Expand Down Expand Up @@ -2253,7 +2262,8 @@ namespace RE
enum class Type : std::uint32_t
{
kNone = static_cast<std::underlying_type_t<Type>>(-1),
kSteal,

kSteal = 0,
kPickpocket,
kTrespass,
kAttack,
Expand Down
2 changes: 1 addition & 1 deletion include/RE/I/IMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace RE
virtual std::uint64_t Unk10() // 10
{
using func_t = decltype(&IMenu::Unk10);
static REL::Relocation<uint64_t(IMenu*)> func(REL::ID(187241));
static REL::Relocation<func_t> func(REL::ID(187241));
return func(this);
};

Expand Down
2 changes: 1 addition & 1 deletion include/RE/I/idLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace RE
}
};

[[nodiscard]] static ILogger* GetLoggerSingleton()
[[nodiscard]] inline ILogger* GetLoggerSingleton()
{
static REL::Relocation<ILogger**> singleton{ ID::idLogging::Singleton };
return *singleton;
Expand Down
15 changes: 0 additions & 15 deletions include/RE/M/MenuOpenCloseEvent.h

This file was deleted.

6 changes: 3 additions & 3 deletions include/RE/P/PlayerCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

namespace RE
{
class MenuModeChangeEvent;
class MenuOpenCloseEvent;
class OtherEventEnabledEvent;
class TESHitEvent;
class UserEventEnabledEvent;

struct AnimationGraphDependentEvent;
struct BGSActorCellEvent;
struct BGSActorDeathEvent;
struct MenuModeChangeEvent;
struct MenuOpenCloseEvent;
struct PickRefUpdateEvent;
struct PositionPlayerEvent;
struct TargetHitEvent;
struct TESHitEvent;
struct TESFormDeleteEvent;

struct QuestStatus
Expand Down
1 change: 0 additions & 1 deletion include/RE/Starfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@
#include "RE/M/MagicTarget.h"
#include "RE/M/Main.h"
#include "RE/M/MemoryManager.h"
#include "RE/M/MenuOpenCloseEvent.h"
#include "RE/M/MenuPaperDoll.h"
#include "RE/M/MenuTopicManager.h"
#include "RE/M/Misc.h"
Expand Down
3 changes: 2 additions & 1 deletion include/RE/T/TESNPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ namespace RE
class BGSListForm;
class BGSOutfit;
class BGSRelationship;
class MenuOpenCloseEvent;
class TESClass;
class TESCombatStyle;
class TESFaction;
class TESFurniture;

struct MenuOpenCloseEvent;

class __declspec(novtable) TESNPC :
public TESActorBase, // 000
public TESRaceForm, // 278
Expand Down
7 changes: 6 additions & 1 deletion include/RE/T/TESPackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ namespace RE

struct PackageTarget
{
// members
std::uint8_t type;
// TODO: warning C4624: 'PackageTarget': destructor was implicitly defined as deleted
/*
union
{
BSPointerHandle<TESObjectREFR> refHandle;
TESForm* object;
};
std::int32_t value;
*/
};
static_assert(sizeof(PackageTarget) == 0x18);
//static_assert(sizeof(PackageTarget) == 0x18);


class __declspec(novtable) TESPackage :
public TESForm // 00
Expand Down
4 changes: 2 additions & 2 deletions include/RE/U/UI.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
namespace RE
{
class IMenu;
class MenuOpenCloseEvent;
class MenuModeChangeEvent;

namespace Scaleform
{
Expand All @@ -21,6 +19,8 @@ namespace RE
struct BIUIMenuVisiblePausedEndEvent;
struct BSCursorRotationChange;
struct BSCursorTypeChange;
struct MenuModeChangeEvent;
struct MenuOpenCloseEvent;
struct MenuPauseChangeEvent;
struct MenuPauseCounterChangeEvent;
struct TutorialEvent;
Expand Down
19 changes: 19 additions & 0 deletions src/RE/Starfield.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "RE/Starfield.h"

namespace RE
{
namespace detail
{
template class BSFixedString<char, false>;
static_assert(sizeof(BSFixedString<char, false>) == 0x8);

template class BSFixedString<char, true>;
static_assert(sizeof(BSFixedString<char, true>) == 0x8);

template class BSFixedString<wchar_t, false>;
static_assert(sizeof(BSFixedString<wchar_t, false>) == 0x8);

template class BSFixedString<wchar_t, true>;
static_assert(sizeof(BSFixedString<wchar_t, true>) == 0x8);
}
}
17 changes: 16 additions & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,25 @@ target("commonlibsf")
"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 }
)

0 comments on commit 1abb4bf

Please sign in to comment.