[LINT] Linted files + Added lint job to CI
This commit is contained in:
committed by
Radosław Gliński
parent
e8afad8f8a
commit
b9061e6292
@@ -39,8 +39,8 @@ class Clock {
|
||||
// Host tick count. Generally QueryHostTickCount() should be used.
|
||||
static uint64_t host_tick_count_platform();
|
||||
#if XE_CLOCK_RAW_AVAILABLE
|
||||
//chrispy: the way msvc was ordering the branches was causing rdtsc to be speculatively executed each time
|
||||
//the branch history was lost
|
||||
// chrispy: the way msvc was ordering the branches was causing rdtsc to be
|
||||
// speculatively executed each time the branch history was lost
|
||||
XE_NOINLINE
|
||||
static uint64_t host_tick_count_raw();
|
||||
#endif
|
||||
|
||||
@@ -41,9 +41,6 @@
|
||||
"\n" \
|
||||
"Set the cvar 'clock_source_raw' to 'false'.");
|
||||
|
||||
|
||||
|
||||
|
||||
namespace xe {
|
||||
// Getting the TSC frequency can be a bit tricky. This method here only works on
|
||||
// Intel as it seems. There is no easy way to get the frequency outside of ring0
|
||||
@@ -75,8 +72,6 @@ uint64_t Clock::host_tick_frequency_raw() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (max_cpuid >= 0x15) {
|
||||
// 15H Get TSC/Crystal ratio and Crystal Hz.
|
||||
xe_cpu_cpuid(0x15, eax, ebx, ecx, edx);
|
||||
@@ -98,7 +93,6 @@ uint64_t Clock::host_tick_frequency_raw() {
|
||||
return cpu_base_freq;
|
||||
}
|
||||
|
||||
|
||||
CLOCK_FATAL("The clock frequency could not be determined.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,15 +35,14 @@ static bool has_shell_environment_variable() {
|
||||
}
|
||||
|
||||
void AttachConsole() {
|
||||
|
||||
bool has_console = ::AttachConsole(ATTACH_PARENT_PROCESS) == TRUE;
|
||||
bool has_console = ::AttachConsole(ATTACH_PARENT_PROCESS) == TRUE;
|
||||
#if 0
|
||||
if (!has_console || !has_shell_environment_variable()) {
|
||||
// We weren't launched from a console, so just return.
|
||||
has_console_attached_ = false;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
AllocConsole();
|
||||
|
||||
has_console_attached_ = true;
|
||||
|
||||
@@ -172,8 +172,7 @@ CommandVar<T>::CommandVar(const char* name, T* default_value,
|
||||
default_value_(*default_value),
|
||||
current_value_(default_value),
|
||||
commandline_value_(),
|
||||
description_(description)
|
||||
{}
|
||||
description_(description) {}
|
||||
|
||||
template <class T>
|
||||
ConfigVar<T>::ConfigVar(const char* name, T* default_value,
|
||||
|
||||
@@ -457,7 +457,7 @@ static ArchFloatMask ArchANDFloatMask(ArchFloatMask x, ArchFloatMask y) {
|
||||
|
||||
XE_FORCEINLINE
|
||||
static uint32_t ArchFloatMaskSignbit(ArchFloatMask x) {
|
||||
return static_cast<uint32_t>(_mm_movemask_ps(x) &1);
|
||||
return static_cast<uint32_t>(_mm_movemask_ps(x) & 1);
|
||||
}
|
||||
|
||||
constexpr ArchFloatMask floatmask_zero{.0f};
|
||||
@@ -606,12 +606,13 @@ union IDivExtraInfo {
|
||||
} info;
|
||||
};
|
||||
// returns magicnum multiplier
|
||||
static constexpr uint32_t PregenerateUint32Div(uint32_t _denom, uint32_t& out_extra) {
|
||||
static constexpr uint32_t PregenerateUint32Div(uint32_t _denom,
|
||||
uint32_t& out_extra) {
|
||||
IDivExtraInfo extra{};
|
||||
|
||||
uint32_t d = _denom;
|
||||
int p=0;
|
||||
uint32_t nc=0, delta=0, q1=0, r1=0, q2=0, r2=0;
|
||||
int p = 0;
|
||||
uint32_t nc = 0, delta = 0, q1 = 0, r1 = 0, q2 = 0, r2 = 0;
|
||||
struct {
|
||||
unsigned M;
|
||||
int a;
|
||||
@@ -662,7 +663,8 @@ static constexpr uint32_t ApplyUint32Div(uint32_t num, uint32_t mul,
|
||||
|
||||
extra.value_ = extradata;
|
||||
|
||||
uint32_t result = static_cast<uint32_t>((static_cast<uint64_t>(num) * static_cast<uint64_t>(mul)) >> 32);
|
||||
uint32_t result = static_cast<uint32_t>(
|
||||
(static_cast<uint64_t>(num) * static_cast<uint64_t>(mul)) >> 32);
|
||||
if (extra.info.add_) {
|
||||
uint32_t addend = result + num;
|
||||
addend = ((addend < result ? 0x80000000 : 0) | addend);
|
||||
@@ -672,7 +674,8 @@ static constexpr uint32_t ApplyUint32Div(uint32_t num, uint32_t mul,
|
||||
}
|
||||
|
||||
static constexpr uint32_t ApplyUint32UMod(uint32_t num, uint32_t mul,
|
||||
uint32_t extradata, uint32_t original) {
|
||||
uint32_t extradata,
|
||||
uint32_t original) {
|
||||
uint32_t dived = ApplyUint32Div(num, mul, extradata);
|
||||
unsigned result = num - (dived * original);
|
||||
|
||||
@@ -701,8 +704,7 @@ struct MagicDiv {
|
||||
return extra.info.shift_;
|
||||
}
|
||||
|
||||
constexpr uint32_t GetMultiplier() const { return multiplier_;
|
||||
}
|
||||
constexpr uint32_t GetMultiplier() const { return multiplier_; }
|
||||
constexpr uint32_t Apply(uint32_t numerator) const {
|
||||
return ApplyUint32Div(numerator, multiplier_, extradata_);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,8 @@ static void vastcpy_impl_repmovs(CacheLine* XE_RESTRICT physaddr,
|
||||
__movsq((unsigned long long*)physaddr, (unsigned long long*)rdmapping,
|
||||
written_length / 8);
|
||||
#else
|
||||
memcpy((unsigned char*)physaddr, (const unsigned char*)rdmapping, written_length);
|
||||
memcpy((unsigned char*)physaddr, (const unsigned char*)rdmapping,
|
||||
written_length);
|
||||
#endif
|
||||
}
|
||||
XE_COLD
|
||||
@@ -331,17 +332,17 @@ void copy_and_swap_32_unaligned(void* dest_ptr, const void* src_ptr,
|
||||
|
||||
__m256i output1 = _mm256_shuffle_epi8(input1, shufmask);
|
||||
__m256i output2 = _mm256_shuffle_epi8(input2, shufmask);
|
||||
//chrispy: todo, benchmark this w/ and w/out these prefetches here on multiple machines
|
||||
//finding a good distance for prefetchw in particular is probably important
|
||||
//for when we're writing across 2 cachelines
|
||||
#if 0
|
||||
// chrispy: todo, benchmark this w/ and w/out these prefetches here on multiple
|
||||
// machines finding a good distance for prefetchw in particular is probably
|
||||
// important for when we're writing across 2 cachelines
|
||||
#if 0
|
||||
if (i + 48 <= count) {
|
||||
swcache::PrefetchNTA(&src[i + 32]);
|
||||
if (amd64::GetFeatureFlags() & amd64::kX64EmitPrefetchW) {
|
||||
swcache::PrefetchW(&dest[i + 32]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
_mm256_storeu_si256(reinterpret_cast<__m256i*>(&dest[i]), output1);
|
||||
_mm256_storeu_si256(reinterpret_cast<__m256i*>(&dest[i + 8]), output2);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
#include "xenia/base/byte_order.h"
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace memory {
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#ifndef XENIA_BASE_MUTEX_H_
|
||||
#define XENIA_BASE_MUTEX_H_
|
||||
#include <mutex>
|
||||
#include "platform.h"
|
||||
#include "memory.h"
|
||||
#include "platform.h"
|
||||
#define XE_ENABLE_FAST_WIN32_MUTEX 1
|
||||
namespace xe {
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace xe {
|
||||
*/
|
||||
|
||||
class alignas(4096) xe_global_mutex {
|
||||
XE_MAYBE_UNUSED
|
||||
XE_MAYBE_UNUSED
|
||||
char detail[64];
|
||||
|
||||
public:
|
||||
@@ -39,7 +39,7 @@ class alignas(4096) xe_global_mutex {
|
||||
using global_mutex_type = xe_global_mutex;
|
||||
|
||||
class alignas(64) xe_fast_mutex {
|
||||
XE_MAYBE_UNUSED
|
||||
XE_MAYBE_UNUSED
|
||||
char detail[64];
|
||||
|
||||
public:
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
#if XE_COMPILER_HAS_GNU_EXTENSIONS == 1
|
||||
#define XE_LIKELY_IF(...) if (XE_LIKELY(__VA_ARGS__))
|
||||
#define XE_UNLIKELY_IF(...) if (XE_UNLIKELY(__VA_ARGS__))
|
||||
#define XE_MAYBE_UNUSED __attribute__((unused))
|
||||
#define XE_MAYBE_UNUSED __attribute__((unused))
|
||||
#else
|
||||
#if __cplusplus >= 202002
|
||||
#define XE_LIKELY_IF(...) if (!!(__VA_ARGS__)) [[likely]]
|
||||
@@ -157,7 +157,7 @@
|
||||
#define XE_LIKELY_IF(...) if (!!(__VA_ARGS__))
|
||||
#define XE_UNLIKELY_IF(...) if (!!(__VA_ARGS__))
|
||||
#endif
|
||||
#define XE_MAYBE_UNUSED
|
||||
#define XE_MAYBE_UNUSED
|
||||
#endif
|
||||
// only use __restrict if MSVC, for clang/gcc we can use -fstrict-aliasing which
|
||||
// acts as __restrict across the board todo: __restrict is part of the type
|
||||
|
||||
@@ -44,21 +44,21 @@
|
||||
ntdll versions of functions often skip through a lot of extra garbage in
|
||||
KernelBase
|
||||
*/
|
||||
#define XE_NTDLL_IMPORT(name, cls, clsvar) \
|
||||
static class cls { \
|
||||
public: \
|
||||
FARPROC fn; \
|
||||
cls() : fn(nullptr) { \
|
||||
auto ntdll = GetModuleHandleA("ntdll.dll"); \
|
||||
if (ntdll) { \
|
||||
fn = GetProcAddress(ntdll, #name); \
|
||||
} \
|
||||
} \
|
||||
template <typename TRet = void, typename... TArgs> \
|
||||
inline TRet invoke(TArgs... args) { \
|
||||
return reinterpret_cast<TRet(NTAPI*)(TArgs...)>(fn)(args...); \
|
||||
} \
|
||||
inline operator bool() const { return fn != nullptr; } \
|
||||
#define XE_NTDLL_IMPORT(name, cls, clsvar) \
|
||||
static class cls { \
|
||||
public: \
|
||||
FARPROC fn; \
|
||||
cls() : fn(nullptr) { \
|
||||
auto ntdll = GetModuleHandleA("ntdll.dll"); \
|
||||
if (ntdll) { \
|
||||
fn = GetProcAddress(ntdll, #name); \
|
||||
} \
|
||||
} \
|
||||
template <typename TRet = void, typename... TArgs> \
|
||||
inline TRet invoke(TArgs... args) { \
|
||||
return reinterpret_cast<TRet(NTAPI*)(TArgs...)>(fn)(args...); \
|
||||
} \
|
||||
inline operator bool() const { return fn != nullptr; } \
|
||||
} clsvar
|
||||
#else
|
||||
#define XE_NTDLL_IMPORT(name, cls, clsvar) static constexpr bool clsvar = false
|
||||
|
||||
@@ -68,7 +68,6 @@ class RingBuffer {
|
||||
ring_size_t offset_delta = write_offs - read_offs;
|
||||
ring_size_t wrap_read_count = (cap - read_offs) + write_offs;
|
||||
|
||||
|
||||
if (XE_LIKELY(read_offs <= write_offs)) {
|
||||
return offset_delta; // will be 0 if they are equal, semantically
|
||||
// identical to old code (i checked the asm, msvc
|
||||
|
||||
@@ -34,7 +34,6 @@ struct SimpleFreelist {
|
||||
node->next_ = head_;
|
||||
head_ = node;
|
||||
}
|
||||
void Reset() { head_ = nullptr;
|
||||
}
|
||||
void Reset() { head_ = nullptr; }
|
||||
};
|
||||
} // namespace xe
|
||||
@@ -906,9 +906,9 @@ class PosixEvent : public PosixConditionHandle<Event> {
|
||||
void Set() override { handle_.Signal(); }
|
||||
void Reset() override { handle_.Reset(); }
|
||||
EventInfo Query() {
|
||||
EventInfo result{};
|
||||
assert_always();
|
||||
return result;
|
||||
EventInfo result{};
|
||||
assert_always();
|
||||
return result;
|
||||
}
|
||||
void Pulse() override {
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -33,7 +33,9 @@ using WaitItem = TimerQueueWaitItem;
|
||||
*/
|
||||
|
||||
/*
|
||||
edit: actually had to change it back, when i was testing it only worked because i fixed disruptorplus' code to compile (it gives wrong args to condition_variable::wait_until) but now builds
|
||||
edit: actually had to change it back, when i was testing it only worked
|
||||
because i fixed disruptorplus' code to compile (it gives wrong args to
|
||||
condition_variable::wait_until) but now builds
|
||||
|
||||
*/
|
||||
using WaitStrat = dp::blocking_wait_strategy;
|
||||
@@ -205,7 +207,7 @@ void TimerQueueWaitItem::Disarm() {
|
||||
spinner.spin_once();
|
||||
}
|
||||
}
|
||||
//unused
|
||||
// unused
|
||||
std::weak_ptr<WaitItem> QueueTimerOnce(std::function<void(void*)> callback,
|
||||
void* userdata,
|
||||
WaitItem::clock::time_point due) {
|
||||
|
||||
Reference in New Issue
Block a user