mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-31 12:31:45 +01:00
Enable most warnings in GCC
This commit is contained in:
parent
7492f335e9
commit
5d33d9a3d9
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <cstring>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@ -365,6 +366,9 @@ struct alignas(16) s128
|
|||||||
CHECK_SIZE_ALIGN(u128, 16, 16);
|
CHECK_SIZE_ALIGN(u128, 16, 16);
|
||||||
CHECK_SIZE_ALIGN(s128, 16, 16);
|
CHECK_SIZE_ALIGN(s128, 16, 16);
|
||||||
|
|
||||||
|
using f32 = float;
|
||||||
|
using f64 = double;
|
||||||
|
|
||||||
union alignas(2) f16
|
union alignas(2) f16
|
||||||
{
|
{
|
||||||
u16 _u16;
|
u16 _u16;
|
||||||
@ -375,22 +379,28 @@ union alignas(2) f16
|
|||||||
_u16 = raw;
|
_u16 = raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator float() const
|
explicit operator f32() const
|
||||||
{
|
{
|
||||||
// See http://stackoverflow.com/a/26779139
|
// See http://stackoverflow.com/a/26779139
|
||||||
// The conversion doesn't handle NaN/Inf
|
// The conversion doesn't handle NaN/Inf
|
||||||
u32 raw = ((_u16 & 0x8000) << 16) | // Sign (just moved)
|
u32 raw = ((_u16 & 0x8000) << 16) | // Sign (just moved)
|
||||||
(((_u16 & 0x7c00) + 0x1C000) << 13) | // Exponent ( exp - 15 + 127)
|
(((_u16 & 0x7c00) + 0x1C000) << 13) | // Exponent ( exp - 15 + 127)
|
||||||
((_u16 & 0x03FF) << 13); // Mantissa
|
((_u16 & 0x03FF) << 13); // Mantissa
|
||||||
return (float&)raw;
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
char data[4];
|
||||||
|
u32 data32;
|
||||||
|
f32 res;
|
||||||
|
};
|
||||||
|
|
||||||
|
data32 = raw;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CHECK_SIZE_ALIGN(f16, 2, 2);
|
CHECK_SIZE_ALIGN(f16, 2, 2);
|
||||||
|
|
||||||
using f32 = float;
|
|
||||||
using f64 = double;
|
|
||||||
|
|
||||||
template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
|
template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
|
||||||
constexpr T align(const T& value, ullong align)
|
constexpr T align(const T& value, ullong align)
|
||||||
{
|
{
|
||||||
@ -400,12 +410,21 @@ constexpr T align(const T& value, ullong align)
|
|||||||
template <typename T, typename T2>
|
template <typename T, typename T2>
|
||||||
inline u32 offset32(T T2::*const mptr)
|
inline u32 offset32(T T2::*const mptr)
|
||||||
{
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
char data[sizeof(std::size_t)];
|
||||||
|
std::size_t data_;
|
||||||
|
u32 data32;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
static_assert(sizeof(mptr) == sizeof(u32), "Invalid pointer-to-member size");
|
static_assert(sizeof(mptr) == sizeof(u32), "Invalid pointer-to-member size");
|
||||||
return reinterpret_cast<const u32&>(mptr);
|
std::memcpy(data, &mptr, sizeof(u32));
|
||||||
|
return data32;
|
||||||
#elif __GNUG__
|
#elif __GNUG__
|
||||||
static_assert(sizeof(mptr) == sizeof(std::size_t), "Invalid pointer-to-member size");
|
static_assert(sizeof(mptr) == sizeof(std::size_t), "Invalid pointer-to-member size");
|
||||||
return static_cast<u32>(reinterpret_cast<const std::size_t&>(mptr));
|
std::memcpy(data, &mptr, sizeof(std::size_t));
|
||||||
|
return data_;
|
||||||
#else
|
#else
|
||||||
static_assert(sizeof(mptr) == 0, "Invalid pointer-to-member size");
|
static_assert(sizeof(mptr) == 0, "Invalid pointer-to-member size");
|
||||||
#endif
|
#endif
|
||||||
|
@ -12,5 +12,13 @@ enum FPSCR_RN
|
|||||||
// Get the exponent of a float
|
// Get the exponent of a float
|
||||||
inline int fexpf(float x)
|
inline int fexpf(float x)
|
||||||
{
|
{
|
||||||
return ((u32&)x >> 23) & 0xFF;
|
union
|
||||||
|
{
|
||||||
|
char data[4];
|
||||||
|
u32 data32;
|
||||||
|
float arg;
|
||||||
|
};
|
||||||
|
|
||||||
|
arg = x;
|
||||||
|
return (data32 >> 23) & 0xFF;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "PPUThread.h"
|
#include "PPUThread.h"
|
||||||
#include "PPUInterpreter.h"
|
#include "PPUInterpreter.h"
|
||||||
#include "Utilities/asm.h"
|
#include "Utilities/asm.h"
|
||||||
|
#include "Emu/Cell/Common.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Common.h"
|
|
||||||
#include "../CPU/CPUThread.h"
|
#include "../CPU/CPUThread.h"
|
||||||
#include "../Memory/vm.h"
|
#include "../Memory/vm.h"
|
||||||
#include "Utilities/lockless.h"
|
#include "Utilities/lockless.h"
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "Utilities/asm.h"
|
#include "Utilities/asm.h"
|
||||||
#include "SPUThread.h"
|
#include "SPUThread.h"
|
||||||
#include "SPUInterpreter.h"
|
#include "SPUInterpreter.h"
|
||||||
|
#include "Emu/Cell/Common.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cfenv>
|
#include <cfenv>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Emu/Cell/Common.h"
|
|
||||||
#include "Emu/CPU/CPUThread.h"
|
#include "Emu/CPU/CPUThread.h"
|
||||||
#include "Emu/Cell/SPUInterpreter.h"
|
#include "Emu/Cell/SPUInterpreter.h"
|
||||||
#include "Emu/Memory/vm.h"
|
#include "Emu/Memory/vm.h"
|
||||||
|
@ -9,7 +9,9 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
# Set compiler options here
|
# Set compiler options here
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
|
add_compile_options(-Wall)
|
||||||
add_compile_options(-Wno-attributes -Wno-enum-compare -Wno-invalid-offsetof)
|
add_compile_options(-Wno-attributes -Wno-enum-compare -Wno-invalid-offsetof)
|
||||||
|
add_compile_options(-Wno-unknown-pragmas -Wno-unused-variable -Wno-reorder -Wno-comment)
|
||||||
|
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||||
# Clang 5.0 or latter is required
|
# Clang 5.0 or latter is required
|
||||||
@ -20,6 +22,7 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
|||||||
# Set compiler options here
|
# Set compiler options here
|
||||||
|
|
||||||
add_compile_options(-ftemplate-depth=1024)
|
add_compile_options(-ftemplate-depth=1024)
|
||||||
|
add_compile_options(-Wunused-value -Wunused-comparison)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_compile_options(-stdlib=libc++)
|
add_compile_options(-stdlib=libc++)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user