mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
C-style cast cleanup III
This commit is contained in:
parent
ad9c9f0183
commit
28eacc616a
18 changed files with 143 additions and 94 deletions
|
|
@ -252,6 +252,11 @@ void asmjit::build_transaction_abort(asmjit::X86Assembler& c, unsigned char code
|
|||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
|
|
@ -261,6 +266,8 @@ void asmjit::build_transaction_abort(asmjit::X86Assembler& c, unsigned char code
|
|||
#include "llvm/ExecutionEngine/ObjectCache.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
|
|
@ -1,9 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
// Include asmjit with warnings ignored
|
||||
#define ASMJIT_EMBED
|
||||
#define ASMJIT_DEBUG
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#include <asmjit/asmjit.h>
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#include <asmjit/asmjit.h>
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <functional>
|
||||
|
||||
|
|
@ -100,12 +113,19 @@ FT build_function_asm(F&& builder)
|
|||
#include "restore_new.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#include "define_new_memleakdetect.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -140,12 +140,12 @@ namespace utils
|
|||
// other after this
|
||||
if (other.start > end)
|
||||
{
|
||||
return (s32)(other.start - end - 1);
|
||||
return static_cast<s32>(other.start - end - 1);
|
||||
}
|
||||
|
||||
// this after other
|
||||
AUDIT(start > other.end);
|
||||
return -((s32)(start - other.end - 1));
|
||||
return -static_cast<s32>(start - other.end - 1);
|
||||
}
|
||||
|
||||
u32 distance(const address_range &other) const
|
||||
|
|
@ -577,7 +577,8 @@ namespace utils
|
|||
} // namespace utils
|
||||
|
||||
|
||||
namespace std {
|
||||
namespace std
|
||||
{
|
||||
static_assert(sizeof(size_t) >= 2 * sizeof(u32), "size_t must be at least twice the size of u32");
|
||||
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ struct size2_base
|
|||
template<typename NT>
|
||||
constexpr operator size2_base<NT>() const
|
||||
{
|
||||
return{ (NT)width, (NT)height };
|
||||
return{ static_cast<NT>(width), static_cast<NT>(height) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -142,11 +142,11 @@ struct position1_base
|
|||
template<typename RhsT>
|
||||
position1_base operator *(RhsT rhs) const
|
||||
{
|
||||
return{ T(x * rhs) };
|
||||
return{ static_cast<T>(x * rhs) };
|
||||
}
|
||||
position1_base operator *(const position1_base& rhs) const
|
||||
{
|
||||
return{ T(x * rhs.x) };
|
||||
return{ static_cast<T>(x * rhs.x) };
|
||||
}
|
||||
template<typename RhsT>
|
||||
position1_base operator /(RhsT rhs) const
|
||||
|
|
@ -225,7 +225,7 @@ struct position1_base
|
|||
template<typename NT>
|
||||
operator position1_base<NT>() const
|
||||
{
|
||||
return{ (NT)x };
|
||||
return{ static_cast<NT>(x) };
|
||||
}
|
||||
|
||||
double distance(const position1_base& to)
|
||||
|
|
@ -303,11 +303,11 @@ struct position2_base
|
|||
template<typename RhsT>
|
||||
constexpr position2_base operator *(RhsT rhs) const
|
||||
{
|
||||
return{ T(x * rhs), T(y * rhs) };
|
||||
return{ static_cast<T>(x * rhs), static_cast<T>(y * rhs) };
|
||||
}
|
||||
constexpr position2_base operator *(const position2_base& rhs) const
|
||||
{
|
||||
return{ T(x * rhs.x), T(y * rhs.y) };
|
||||
return{ static_cast<T>(x * rhs.x), static_cast<T>(y * rhs.y) };
|
||||
}
|
||||
template<typename RhsT>
|
||||
constexpr position2_base operator /(RhsT rhs) const
|
||||
|
|
@ -398,12 +398,12 @@ struct position2_base
|
|||
template<typename NT>
|
||||
constexpr operator position2_base<NT>() const
|
||||
{
|
||||
return{ (NT)x, (NT)y };
|
||||
return{ static_cast<NT>(x), static_cast<NT>(y) };
|
||||
}
|
||||
|
||||
double distance(const position2_base& to) const
|
||||
{
|
||||
return std::sqrt(double((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y)));
|
||||
return std::sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ struct position3_base
|
|||
template<typename NT>
|
||||
operator position3_base<NT>() const
|
||||
{
|
||||
return{ (NT)x, (NT)y, (NT)z };
|
||||
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -580,7 +580,7 @@ struct position4_base
|
|||
template<typename NT>
|
||||
constexpr operator position4_base<NT>() const
|
||||
{
|
||||
return{ (NT)x, (NT)y, (NT)z, (NT)w };
|
||||
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z), static_cast<NT>(w) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -652,7 +652,7 @@ struct coord_base
|
|||
template<typename NT>
|
||||
constexpr operator coord_base<NT>() const
|
||||
{
|
||||
return{ (NT)x, (NT)y, (NT)width, (NT)height };
|
||||
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(width), static_cast<NT>(height) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -755,13 +755,13 @@ struct area_base
|
|||
}
|
||||
constexpr area_base operator * (const f32& value) const
|
||||
{
|
||||
return{ (T)(x1 * value), (T)(y1 * value), (T)(x2 * value), (T)(y2 * value) };
|
||||
return{ static_cast<T>(x1 * value), static_cast<T>(y1 * value), static_cast<T>(x2 * value), static_cast<T>(y2 * value) };
|
||||
}
|
||||
|
||||
template<typename NT>
|
||||
constexpr operator area_base<NT>() const
|
||||
{
|
||||
return{ (NT)x1, (NT)y1, (NT)x2, (NT)y2 };
|
||||
return{ static_cast<NT>(x1), static_cast<NT>(y1), static_cast<NT>(x2), static_cast<NT>(y2) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -824,7 +824,7 @@ struct coord3_base
|
|||
template<typename NT>
|
||||
constexpr operator coord3_base<NT>() const
|
||||
{
|
||||
return{ (NT)x, (NT)y, (NT)z, (NT)width, (NT)height, (NT)depth };
|
||||
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z), static_cast<NT>(width), static_cast<NT>(height), static_cast<NT>(depth) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -877,7 +877,7 @@ struct color4_base
|
|||
template<typename NT>
|
||||
constexpr operator color4_base<NT>() const
|
||||
{
|
||||
return{ (NT)x, (NT)y, (NT)z, (NT)w };
|
||||
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z), static_cast<NT>(w) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -920,7 +920,7 @@ struct color3_base
|
|||
template<typename NT>
|
||||
constexpr operator color3_base<NT>() const
|
||||
{
|
||||
return{ (NT)x, (NT)y, (NT)z };
|
||||
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -962,7 +962,7 @@ struct color2_base
|
|||
template<typename NT>
|
||||
constexpr operator color2_base<NT>() const
|
||||
{
|
||||
return{ (NT)x, (NT)y };
|
||||
return{ static_cast<NT>(x), static_cast<NT>(y) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -993,7 +993,7 @@ struct color1_base
|
|||
template<typename NT>
|
||||
constexpr operator color1_base<NT>() const
|
||||
{
|
||||
return{ (NT)x };
|
||||
return{ static_cast<NT>(x) };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue