mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-31 06:48:22 -04:00
kern: build with -Wextra
This commit is contained in:
parent
d3014f6ed9
commit
73798cb812
32 changed files with 100 additions and 30 deletions
|
@ -16,15 +16,6 @@
|
|||
#pragma once
|
||||
#include <vapours/common.hpp>
|
||||
|
||||
namespace ams::impl {
|
||||
|
||||
template<typename... ArgTypes>
|
||||
constexpr ALWAYS_INLINE void UnusedImpl(ArgTypes... args) {
|
||||
(static_cast<void>(args), ...);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace ams::diag {
|
||||
|
||||
NORETURN NOINLINE void AssertionFailureImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) __attribute__((format(printf, 6, 7)));
|
||||
|
@ -36,8 +27,6 @@ namespace ams::diag {
|
|||
|
||||
}
|
||||
|
||||
#define AMS_UNUSED(...) ::ams::impl::UnusedImpl(__VA_ARGS__)
|
||||
|
||||
#ifdef AMS_ENABLE_DEBUG_PRINT
|
||||
#define AMS_CALL_ASSERT_FAIL_IMPL(cond, ...) ::ams::diag::AssertionFailureImpl(__FILE__, __LINE__, __PRETTY_FUNCTION__, cond, 0, ## __VA_ARGS__)
|
||||
#define AMS_CALL_ABORT_IMPL(cond, ...) ::ams::diag::AbortImpl(__FILE__, __LINE__, __PRETTY_FUNCTION__, cond, 0, ## __VA_ARGS__)
|
||||
|
|
|
@ -66,4 +66,19 @@
|
|||
|
||||
#define AMS_CURRENT_FUNCTION_NAME __FUNCTION__
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
namespace ams::impl {
|
||||
|
||||
template<typename... ArgTypes>
|
||||
constexpr ALWAYS_INLINE void UnusedImpl(ArgTypes &&... args) {
|
||||
(static_cast<void>(args), ...);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define AMS_UNUSED(...) ::ams::impl::UnusedImpl(__VA_ARGS__)
|
||||
|
||||
#define AMS_INFINITE_LOOP() do { __asm__ __volatile__("" ::: "memory"); } while (1)
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace ams {
|
|||
constexpr Result(typename Base::BaseType v) : value(v) { static_assert(std::is_same<typename Base::BaseType, ::Result>::value); }
|
||||
|
||||
constexpr ALWAYS_INLINE operator ResultSuccess() const;
|
||||
NX_CONSTEXPR bool CanAccept(Result result) { return true; }
|
||||
NX_CONSTEXPR bool CanAccept(Result) { return true; }
|
||||
|
||||
constexpr ALWAYS_INLINE bool IsSuccess() const { return this->GetValue() == Base::SuccessValue; }
|
||||
constexpr ALWAYS_INLINE bool IsFailure() const { return !this->IsSuccess(); }
|
||||
|
|
|
@ -353,7 +353,7 @@ namespace ams::svc::codegen::impl {
|
|||
};
|
||||
|
||||
template<auto Allocator, typename FirstOperation, typename...OtherOperations>
|
||||
static constexpr auto GetModifiedOperations(std::tuple<FirstOperation, OtherOperations...> ops) {
|
||||
static constexpr auto GetModifiedOperations(std::tuple<FirstOperation, OtherOperations...>) {
|
||||
constexpr size_t ModifyRegister = [] {
|
||||
auto allocator = Allocator;
|
||||
return allocator.AllocateFirstFree();
|
||||
|
@ -535,7 +535,11 @@ namespace ams::svc::codegen::impl {
|
|||
GenerateCodeForMetaCode<CodeGenerator, BeforeMetaCode>();
|
||||
ON_SCOPE_EXIT { GenerateCodeForMetaCode<CodeGenerator, AfterMetaCode>(); };
|
||||
|
||||
/* Cast the generated function to the generic funciton pointer type. */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
return reinterpret_cast<ReturnType (*)()>(Function)();
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
#pragma GCC pop_options
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace ams::svc::codegen::impl {
|
|||
template<typename Operation>
|
||||
static constexpr void GenerateCodeForPrepareForKernelProcedureToSvcInvocation(MetaCodeGenerator &mcg) {
|
||||
static_assert(Operation::Kind == OperationKind::PackAndUnpack);
|
||||
/* ... */
|
||||
AMS_UNUSED(mcg);
|
||||
}
|
||||
|
||||
template<typename Operation>
|
||||
|
|
|
@ -498,6 +498,7 @@ namespace ams::svc::ipc {
|
|||
}
|
||||
|
||||
static constexpr ALWAYS_INLINE s32 GetSpecialDataIndex(const MessageHeader &hdr, const SpecialHeader &spc) {
|
||||
AMS_UNUSED(hdr);
|
||||
return (MessageHeader::GetDataSize() / sizeof(util::BitPack32)) + (spc.GetHeaderSize() / sizeof(util::BitPack32));
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace ams {
|
|||
private:
|
||||
TimeSpanType ts;
|
||||
public:
|
||||
constexpr ALWAYS_INLINE TimeSpan(ZeroTag z = nullptr) : ts(TimeSpanType::FromNanoSeconds(0)) { /* ... */ }
|
||||
constexpr ALWAYS_INLINE TimeSpan(ZeroTag z = nullptr) : ts(TimeSpanType::FromNanoSeconds(0)) { AMS_UNUSED(z); /* ... */ }
|
||||
constexpr ALWAYS_INLINE TimeSpan(const TimeSpanType &t) : ts(t) { /* ... */ }
|
||||
|
||||
template<typename R, typename P>
|
||||
|
|
|
@ -267,12 +267,14 @@ namespace ams::util {
|
|||
}
|
||||
|
||||
void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first) {
|
||||
AMS_UNUSED(o);
|
||||
const_iterator last(first);
|
||||
std::advance(last, 1);
|
||||
splice_impl(pos, first, last);
|
||||
}
|
||||
|
||||
void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first, const_iterator last) {
|
||||
AMS_UNUSED(o);
|
||||
splice_impl(pos, first, last);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace ams::crypto::impl {
|
|||
|
||||
size_t XtsModeImpl::FinalizeEncryption(void *dst, size_t dst_size) {
|
||||
AMS_ASSERT(this->state == State_Processing);
|
||||
AMS_UNUSED(dst_size);
|
||||
|
||||
u8 *dst_u8 = static_cast<u8 *>(dst);
|
||||
size_t processed = 0;
|
||||
|
@ -80,6 +81,7 @@ namespace ams::crypto::impl {
|
|||
|
||||
size_t XtsModeImpl::FinalizeDecryption(void *dst, size_t dst_size) {
|
||||
AMS_ASSERT(this->state == State_Processing);
|
||||
AMS_UNUSED(dst_size);
|
||||
|
||||
u8 *dst_u8 = static_cast<u8 *>(dst);
|
||||
size_t processed = 0;
|
||||
|
@ -131,6 +133,8 @@ namespace ams::crypto::impl {
|
|||
}
|
||||
|
||||
size_t XtsModeImpl::ProcessRemainingData(u8 *dst, const u8 *src, size_t size) {
|
||||
AMS_UNUSED(dst);
|
||||
|
||||
std::memcpy(this->buffer, src, size);
|
||||
this->num_buffered = size;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue