Everywhere: Run clang-format

The following command was used to clang-format these files:

    clang-format-20 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Base/*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -not \( -path "./Ports/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")
This commit is contained in:
Lucas CHOLLET
2025-10-08 15:24:03 +02:00
committed by Tim Schumacher
parent 8a3f29fe9e
commit 0ff1f39b8b
121 changed files with 471 additions and 412 deletions

View File

@@ -46,13 +46,13 @@ namespace AK {
*/
namespace DistinctNumericFeature {
enum Arithmetic {};
enum CastToBool {};
enum CastToUnderlying {};
enum Comparison {};
enum Flags {};
enum Increment {};
enum Shift {};
enum Arithmetic { };
enum CastToBool { };
enum CastToUnderlying { };
enum Comparison { };
enum Flags { };
enum Increment { };
enum Shift { };
};
template<typename T, typename X, typename... Opts>

View File

@@ -24,9 +24,9 @@ class IntrusiveListNode;
struct ExtractIntrusiveListTypes {
template<typename V, typename Container, typename T>
static V value(IntrusiveListNode<V, Container> T::*x);
static V value(IntrusiveListNode<V, Container> T::* x);
template<typename V, typename Container, typename T>
static Container container(IntrusiveListNode<V, Container> T::*x);
static Container container(IntrusiveListNode<V, Container> T::* x);
};
template<typename T, typename Container = RawPtr<T>>
@@ -37,14 +37,14 @@ class IntrusiveListStorage {
private:
friend class IntrusiveListNode<T, Container>;
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::*member>
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::* member>
friend class IntrusiveList;
SubstitutedIntrusiveListNode<T, Container>* m_first { nullptr };
SubstitutedIntrusiveListNode<T, Container>* m_last { nullptr };
};
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
class IntrusiveList {
AK_MAKE_NONCOPYABLE(IntrusiveList);
AK_MAKE_NONMOVABLE(IntrusiveList);
@@ -166,7 +166,7 @@ public:
// to be of equal types. so for now, just make the members public on clang.
#if !defined(AK_COMPILER_CLANG)
private:
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::*member>
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::* member>
friend class ::AK::Detail::IntrusiveList;
#endif
@@ -176,7 +176,7 @@ private:
[[no_unique_address]] SelfReferenceIfNeeded<Container, IsRaw> m_self;
};
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline typename IntrusiveList<T, Container, member>::Iterator& IntrusiveList<T, Container, member>::Iterator::erase()
{
auto old = m_value;
@@ -185,26 +185,26 @@ inline typename IntrusiveList<T, Container, member>::Iterator& IntrusiveList<T,
return *this;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline IntrusiveList<T, Container, member>::~IntrusiveList()
{
clear();
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::clear()
{
while (m_storage.m_first)
m_storage.m_first->remove();
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline bool IntrusiveList<T, Container, member>::is_empty() const
{
return m_storage.m_first == nullptr;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline size_t IntrusiveList<T, Container, member>::size_slow() const
{
size_t size = 0;
@@ -215,7 +215,7 @@ inline size_t IntrusiveList<T, Container, member>::size_slow() const
return size;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::append(T& n)
{
remove(n);
@@ -234,7 +234,7 @@ inline void IntrusiveList<T, Container, member>::append(T& n)
m_storage.m_first = &nnode;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::prepend(T& n)
{
remove(n);
@@ -253,7 +253,7 @@ inline void IntrusiveList<T, Container, member>::prepend(T& n)
m_storage.m_last = &nnode;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::insert_before(T& bn, T& n)
{
remove(n);
@@ -275,7 +275,7 @@ inline void IntrusiveList<T, Container, member>::insert_before(T& bn, T& n)
new_node.m_self.reference = &n;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::remove(T& n)
{
auto& nnode = n.*member;
@@ -283,20 +283,20 @@ inline void IntrusiveList<T, Container, member>::remove(T& n)
nnode.remove();
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline bool IntrusiveList<T, Container, member>::contains(T const& n) const
{
auto& nnode = n.*member;
return nnode.m_storage == &m_storage;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline Container IntrusiveList<T, Container, member>::first() const
{
return m_storage.m_first ? node_to_value(*m_storage.m_first) : nullptr;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline Container IntrusiveList<T, Container, member>::take_first()
{
if (Container ptr = first()) {
@@ -306,7 +306,7 @@ inline Container IntrusiveList<T, Container, member>::take_first()
return nullptr;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline Container IntrusiveList<T, Container, member>::take_last()
{
if (Container ptr = last()) {
@@ -316,13 +316,13 @@ inline Container IntrusiveList<T, Container, member>::take_last()
return nullptr;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline Container IntrusiveList<T, Container, member>::last() const
{
return m_storage.m_last ? node_to_value(*m_storage.m_last) : nullptr;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T const* IntrusiveList<T, Container, member>::next(T const* current)
{
auto& nextnode = (current->*member).m_next;
@@ -330,7 +330,7 @@ inline T const* IntrusiveList<T, Container, member>::next(T const* current)
return nextstruct;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T const* IntrusiveList<T, Container, member>::prev(T const* current)
{
auto& prevnode = (current->*member).m_prev;
@@ -338,7 +338,7 @@ inline T const* IntrusiveList<T, Container, member>::prev(T const* current)
return prevstruct;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T* IntrusiveList<T, Container, member>::next(T* current)
{
auto& nextnode = (current->*member).m_next;
@@ -346,7 +346,7 @@ inline T* IntrusiveList<T, Container, member>::next(T* current)
return nextstruct;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T* IntrusiveList<T, Container, member>::prev(T* current)
{
auto& prevnode = (current->*member).m_prev;
@@ -354,25 +354,25 @@ inline T* IntrusiveList<T, Container, member>::prev(T* current)
return prevstruct;
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline typename IntrusiveList<T, Container, member>::Iterator IntrusiveList<T, Container, member>::begin()
{
return m_storage.m_first ? Iterator(node_to_value(*m_storage.m_first)) : Iterator();
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline typename IntrusiveList<T, Container, member>::ReverseIterator IntrusiveList<T, Container, member>::rbegin()
{
return m_storage.m_last ? ReverseIterator(node_to_value(*m_storage.m_last)) : ReverseIterator();
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline typename IntrusiveList<T, Container, member>::ConstIterator IntrusiveList<T, Container, member>::begin() const
{
return m_storage.m_first ? ConstIterator(node_to_value(*m_storage.m_first)) : ConstIterator();
}
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T* IntrusiveList<T, Container, member>::node_to_value(SubstitutedIntrusiveListNode<T, Container>& node)
{
// Note: A data member pointer is a 32-bit offset in the Windows ABI (both x86 and x86_64),
@@ -426,7 +426,7 @@ inline bool IntrusiveListNode<T, Container>::is_in_list() const
// By default, intrusive lists cannot contain null entries anyway, so switch to RefPtr
// and just make the user-facing functions deref the pointers.
template<class T, SubstitutedIntrusiveListNode<T, NonnullRefPtr<T>> T::*member>
template<class T, SubstitutedIntrusiveListNode<T, NonnullRefPtr<T>> T::* member>
class IntrusiveList<T, NonnullRefPtr<T>, member> : public IntrusiveList<T, RefPtr<T>, member> {
public:
[[nodiscard]] NonnullRefPtr<T> first() const { return *IntrusiveList<T, RefPtr<T>, member>::first(); }
@@ -441,7 +441,7 @@ public:
// By default, intrusive lists cannot contain null entries anyway, so switch to LockRefPtr
// and just make the user-facing functions deref the pointers.
template<class T, SubstitutedIntrusiveListNode<T, NonnullLockRefPtr<T>> T::*member>
template<class T, SubstitutedIntrusiveListNode<T, NonnullLockRefPtr<T>> T::* member>
class IntrusiveList<T, NonnullLockRefPtr<T>, member> : public IntrusiveList<T, LockRefPtr<T>, member> {
public:
[[nodiscard]] NonnullLockRefPtr<T> first() const { return *IntrusiveList<T, LockRefPtr<T>, member>::first(); }

View File

@@ -11,7 +11,7 @@
namespace AK {
namespace Detail {
template<class T, typename Container, IntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, IntrusiveListNode<T, Container> T::* member>
class IntrusiveListRelaxedConst : public IntrusiveList<T, Container, member> {
AK_MAKE_NONCOPYABLE(IntrusiveListRelaxedConst);
AK_MAKE_NONMOVABLE(IntrusiveListRelaxedConst);

View File

@@ -16,17 +16,17 @@ class IntrusiveRedBlackTreeNode;
struct ExtractIntrusiveRedBlackTreeTypes {
template<typename K, typename V, typename Container, typename T>
static K key(IntrusiveRedBlackTreeNode<K, V, Container> T::*x);
static K key(IntrusiveRedBlackTreeNode<K, V, Container> T::* x);
template<typename K, typename V, typename Container, typename T>
static V value(IntrusiveRedBlackTreeNode<K, V, Container> T::*x);
static V value(IntrusiveRedBlackTreeNode<K, V, Container> T::* x);
template<typename K, typename V, typename Container, typename T>
static Container container(IntrusiveRedBlackTreeNode<K, V, Container> T::*x);
static Container container(IntrusiveRedBlackTreeNode<K, V, Container> T::* x);
};
template<Integral K, typename V, typename Container = RawPtr<V>>
using SubstitutedIntrusiveRedBlackTreeNode = IntrusiveRedBlackTreeNode<K, V, typename SubstituteIntrusiveContainerType<V, Container>::Type>;
template<Integral K, typename V, typename Container, SubstitutedIntrusiveRedBlackTreeNode<K, V, Container> V::*member>
template<Integral K, typename V, typename Container, SubstitutedIntrusiveRedBlackTreeNode<K, V, Container> V::* member>
class IntrusiveRedBlackTree : public BaseRedBlackTree<K> {
public:
@@ -200,7 +200,7 @@ public:
#if !defined(AK_COMPILER_CLANG)
private:
template<Integral TK, typename TV, typename TContainer, SubstitutedIntrusiveRedBlackTreeNode<TK, TV, TContainer> TV::*member>
template<Integral TK, typename TV, typename TContainer, SubstitutedIntrusiveRedBlackTreeNode<TK, TV, TContainer> TV::* member>
friend class ::AK::Detail::IntrusiveRedBlackTree;
#endif
@@ -211,7 +211,7 @@ private:
// Specialise IntrusiveRedBlackTree for NonnullRefPtr
// By default, red black trees cannot contain null entries anyway, so switch to RefPtr
// and just make the user-facing functions deref the pointers.
template<Integral K, typename V, SubstitutedIntrusiveRedBlackTreeNode<K, V, NonnullRefPtr<V>> V::*member>
template<Integral K, typename V, SubstitutedIntrusiveRedBlackTreeNode<K, V, NonnullRefPtr<V>> V::* member>
class IntrusiveRedBlackTree<K, V, NonnullRefPtr<V>, member> : public IntrusiveRedBlackTree<K, V, RefPtr<V>, member> {
public:
[[nodiscard]] NonnullRefPtr<V> find(K key) const { return IntrusiveRedBlackTree<K, V, RefPtr<V>, member>::find(key).release_nonnull(); }

View File

@@ -49,7 +49,7 @@ inline void secure_zero(void* ptr, size_t size)
// The memory barrier is here to avoid the compiler optimizing
// away the memset when we rely on it for wiping secrets.
asm volatile("" ::
: "memory");
: "memory");
}
// Naive implementation of a constant time buffer comparison function.

View File

@@ -94,8 +94,8 @@ public:
~Result() = default;
// For compatibility with TRY().
void value() {};
void release_value() {};
void value() { }
void release_value() { }
ErrorType& error()
{

View File

@@ -110,9 +110,9 @@ inline constexpr bool IsFunction<Ret(Args...) const volatile> = true;
template<class Ret, class... Args>
inline constexpr bool IsFunction<Ret(Args..., ...) const volatile> = true;
template<class Ret, class... Args>
inline constexpr bool IsFunction<Ret(Args...)&> = true;
inline constexpr bool IsFunction<Ret(Args...) &> = true;
template<class Ret, class... Args>
inline constexpr bool IsFunction<Ret(Args..., ...)&> = true;
inline constexpr bool IsFunction<Ret(Args..., ...) &> = true;
template<class Ret, class... Args>
inline constexpr bool IsFunction<Ret(Args...) const&> = true;
template<class Ret, class... Args>

View File

@@ -155,7 +155,7 @@ requires(IsIntegral<T>)
{
if (!is_constant_evaluated()) {
asm volatile(""
: "+r"(value));
: "+r"(value));
}
}
@@ -165,9 +165,9 @@ requires(!IsIntegral<T>)
{
if (!is_constant_evaluated()) {
asm volatile(""
:
: "m"(value)
: "memory");
:
: "m"(value)
: "memory");
}
}

View File

@@ -577,25 +577,25 @@ inline uintptr_t invoke(Function function)
# if ARCH(X86_64)
uintptr_t result;
asm volatile("syscall"
: "=a"(result)
: "a"(function)
: "rcx", "r11", "memory");
: "=a"(result)
: "a"(function)
: "rcx", "r11", "memory");
# elif ARCH(AARCH64)
uintptr_t result;
register uintptr_t x0 asm("x0");
register uintptr_t x8 asm("x8") = function;
asm volatile("svc #0"
: "=r"(x0)
: "r"(x8)
: "memory");
: "=r"(x0)
: "r"(x8)
: "memory");
result = x0;
# elif ARCH(RISCV64)
register uintptr_t a7 asm("a7") = function;
register uintptr_t result asm("a0");
asm volatile("ecall"
: "=r"(result)
: "r"(a7)
: "memory");
: "=r"(result)
: "r"(a7)
: "memory");
# endif
return result;
}
@@ -606,27 +606,27 @@ inline uintptr_t invoke(Function function, T1 arg1)
# if ARCH(X86_64)
uintptr_t result;
asm volatile("syscall"
: "=a"(result)
: "a"(function), "d"((uintptr_t)arg1)
: "rcx", "r11", "memory");
: "=a"(result)
: "a"(function), "d"((uintptr_t)arg1)
: "rcx", "r11", "memory");
# elif ARCH(AARCH64)
uintptr_t result;
register uintptr_t x0 asm("x0");
register uintptr_t x1 asm("x1") = arg1;
register uintptr_t x8 asm("x8") = function;
asm volatile("svc #0"
: "=r"(x0)
: "r"(x1), "r"(x8)
: "memory");
: "=r"(x0)
: "r"(x1), "r"(x8)
: "memory");
result = x0;
# elif ARCH(RISCV64)
register uintptr_t a0 asm("a0") = arg1;
register uintptr_t a7 asm("a7") = function;
register uintptr_t result asm("a0");
asm volatile("ecall"
: "=r"(result)
: "0"(a0), "r"(a7)
: "memory");
: "=r"(result)
: "0"(a0), "r"(a7)
: "memory");
# endif
return result;
}
@@ -637,9 +637,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2)
# if ARCH(X86_64)
uintptr_t result;
asm volatile("syscall"
: "=a"(result)
: "a"(function), "d"((uintptr_t)arg1), "D"((uintptr_t)arg2)
: "rcx", "r11", "memory");
: "=a"(result)
: "a"(function), "d"((uintptr_t)arg1), "D"((uintptr_t)arg2)
: "rcx", "r11", "memory");
# elif ARCH(AARCH64)
uintptr_t result;
register uintptr_t x0 asm("x0");
@@ -647,9 +647,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2)
register uintptr_t x2 asm("x2") = arg2;
register uintptr_t x8 asm("x8") = function;
asm volatile("svc #0"
: "=r"(x0)
: "r"(x1), "r"(x2), "r"(x8)
: "memory");
: "=r"(x0)
: "r"(x1), "r"(x2), "r"(x8)
: "memory");
result = x0;
# elif ARCH(RISCV64)
register uintptr_t a0 asm("a0") = arg1;
@@ -657,9 +657,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2)
register uintptr_t a7 asm("a7") = function;
register uintptr_t result asm("a0");
asm volatile("ecall"
: "=r"(result)
: "0"(a0), "r"(a1), "r"(a7)
: "memory");
: "=r"(result)
: "0"(a0), "r"(a1), "r"(a7)
: "memory");
# endif
return result;
}
@@ -670,9 +670,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2, T3 arg3)
# if ARCH(X86_64)
uintptr_t result;
asm volatile("syscall"
: "=a"(result)
: "a"(function), "d"((uintptr_t)arg1), "D"((uintptr_t)arg2), "b"((uintptr_t)arg3)
: "rcx", "r11", "memory");
: "=a"(result)
: "a"(function), "d"((uintptr_t)arg1), "D"((uintptr_t)arg2), "b"((uintptr_t)arg3)
: "rcx", "r11", "memory");
# elif ARCH(AARCH64)
uintptr_t result;
register uintptr_t x0 asm("x0");
@@ -681,9 +681,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2, T3 arg3)
register uintptr_t x3 asm("x3") = arg3;
register uintptr_t x8 asm("x8") = function;
asm volatile("svc #0"
: "=r"(x0)
: "r"(x1), "r"(x2), "r"(x3), "r"(x8)
: "memory");
: "=r"(x0)
: "r"(x1), "r"(x2), "r"(x3), "r"(x8)
: "memory");
result = x0;
# elif ARCH(RISCV64)
register uintptr_t a0 asm("a0") = arg1;
@@ -692,9 +692,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2, T3 arg3)
register uintptr_t a7 asm("a7") = function;
register uintptr_t result asm("a0");
asm volatile("ecall"
: "=r"(result)
: "0"(a0), "r"(a1), "r"(a2), "r"(a7)
: "memory");
: "=r"(result)
: "0"(a0), "r"(a1), "r"(a2), "r"(a7)
: "memory");
# endif
return result;
}
@@ -705,9 +705,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
# if ARCH(X86_64)
uintptr_t result;
asm volatile("syscall"
: "=a"(result)
: "a"(function), "d"((uintptr_t)arg1), "D"((uintptr_t)arg2), "b"((uintptr_t)arg3), "S"((uintptr_t)arg4)
: "rcx", "r11", "memory");
: "=a"(result)
: "a"(function), "d"((uintptr_t)arg1), "D"((uintptr_t)arg2), "b"((uintptr_t)arg3), "S"((uintptr_t)arg4)
: "rcx", "r11", "memory");
# elif ARCH(AARCH64)
uintptr_t result;
register uintptr_t x0 asm("x0");
@@ -717,9 +717,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
register uintptr_t x4 asm("x4") = arg4;
register uintptr_t x8 asm("x8") = function;
asm volatile("svc #0"
: "=r"(x0)
: "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x8)
: "memory");
: "=r"(x0)
: "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x8)
: "memory");
result = x0;
# elif ARCH(RISCV64)
register uintptr_t a0 asm("a0") = arg1;
@@ -729,9 +729,9 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
register uintptr_t a7 asm("a7") = function;
register uintptr_t result asm("a0");
asm volatile("ecall"
: "=r"(result)
: "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a7)
: "memory");
: "=r"(result)
: "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a7)
: "memory");
# endif
return result;
}

View File

@@ -37,7 +37,7 @@ inline FlatPtr get_ttbr0_el1()
{
FlatPtr ttbr0_el1;
asm volatile("mrs %[value], ttbr0_el1\n"
: [value] "=r"(ttbr0_el1));
: [value] "=r"(ttbr0_el1));
return ttbr0_el1;
}
@@ -76,7 +76,7 @@ inline ExceptionLevel get_current_exception_level()
u64 current_exception_level;
asm volatile("mrs %[value], CurrentEL"
: [value] "=r"(current_exception_level));
: [value] "=r"(current_exception_level));
current_exception_level = (current_exception_level >> 2) & 0x3;
return static_cast<ExceptionLevel>(current_exception_level);
@@ -140,7 +140,7 @@ inline FlatPtr get_cache_line_size()
{
FlatPtr ctr_el0;
asm volatile("mrs %[value], ctr_el0"
: [value] "=r"(ctr_el0));
: [value] "=r"(ctr_el0));
auto log2_size = (ctr_el0 >> 16) & 0xF;
return 1 << log2_size;
}
@@ -150,16 +150,16 @@ inline void flush_data_cache(FlatPtr start, size_t size)
auto const cache_size = get_cache_line_size();
for (FlatPtr addr = align_down_to(start, cache_size); addr < start + size; addr += cache_size)
asm volatile("dc civac, %[addr]" ::[addr] "r"(addr)
: "memory");
: "memory");
asm volatile("dsb sy" ::
: "memory");
: "memory");
}
inline FlatPtr get_mdscr_el1()
{
FlatPtr mdscr_el1;
asm volatile("mrs %[value], mdscr_el1\n"
: [value] "=r"(mdscr_el1));
: [value] "=r"(mdscr_el1));
return mdscr_el1;
}

View File

@@ -12,7 +12,7 @@ MainIdRegister::MainIdRegister()
{
unsigned int mrs;
asm volatile("mrs %x0, MIDR_EL1"
: "=r"(mrs));
: "=r"(mrs));
m_value = mrs;
}

View File

@@ -39,7 +39,7 @@ struct alignas(u64) ID_AA64ISAR0_EL1 {
ID_AA64ISAR0_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64ISAR0_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -71,7 +71,7 @@ struct alignas(u64) ID_AA64ISAR1_EL1 {
ID_AA64ISAR1_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64ISAR1_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -102,7 +102,7 @@ struct alignas(u64) ID_AA64ISAR2_EL1 {
ID_AA64ISAR2_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64ISAR2_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -134,7 +134,7 @@ struct alignas(u64) ID_AA64PFR0_EL1 {
ID_AA64PFR0_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64PFR0_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -166,7 +166,7 @@ struct alignas(u64) ID_AA64PFR1_EL1 {
ID_AA64PFR1_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64PFR1_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -187,7 +187,7 @@ struct alignas(u64) ID_AA64PFR2_EL1 {
ID_AA64PFR2_EL1 feature_register;
asm volatile("mrs %[value], s3_0_c0_c4_2" // encoded ID_AA64PFR2_EL1 register
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -212,7 +212,7 @@ struct alignas(u64) MPIDR_EL1 {
MPIDR_EL1 affinity_register;
asm volatile("mrs %[value], MPIDR_EL1"
: [value] "=r"(affinity_register));
: [value] "=r"(affinity_register));
return affinity_register;
}
@@ -243,7 +243,7 @@ struct alignas(u64) ID_AA64MMFR0_EL1 {
ID_AA64MMFR0_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64MMFR0_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -275,7 +275,7 @@ struct alignas(u64) ID_AA64MMFR1_EL1 {
ID_AA64MMFR1_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64MMFR1_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -307,7 +307,7 @@ struct alignas(u64) ID_AA64MMFR2_EL1 {
ID_AA64MMFR2_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64MMFR2_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -339,7 +339,7 @@ struct alignas(u64) ID_AA64MMFR3_EL1 {
ID_AA64MMFR3_EL1 feature_register;
asm volatile("mrs %[value], s3_0_c0_c7_3" // encoded ID_AA64MMFR3_EL1 register
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -359,7 +359,7 @@ struct alignas(u64) ID_AA64MMFR4_EL1 {
ID_AA64MMFR4_EL1 feature_register;
asm volatile("mrs %[value], s3_0_c0_c7_4" // encoded ID_AA64MMFR4_EL1 register
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -391,7 +391,7 @@ struct alignas(u64) ID_AA64SMFR0_EL1 {
ID_AA64SMFR0_EL1 feature_register;
asm volatile("mrs %[value], s3_0_c0_c4_5" // encoded ID_AA64SMFR0_EL1 register
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -422,7 +422,7 @@ struct alignas(u64) ID_AA64ZFR0_EL1 {
ID_AA64ZFR0_EL1 feature_register;
asm volatile("mrs %[value], s3_0_c0_c4_4" // encoded ID_AA64ZFR0_EL1 register
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -454,7 +454,7 @@ struct alignas(u64) ID_AA64DFR0_EL1 {
ID_AA64DFR0_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64DFR0_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -481,7 +481,7 @@ struct alignas(u64) ID_AA64DFR1_EL1 {
ID_AA64DFR1_EL1 feature_register;
asm volatile("mrs %[value], ID_AA64DFR1_EL1"
: [value] "=r"(feature_register));
: [value] "=r"(feature_register));
return feature_register;
}
@@ -499,7 +499,7 @@ struct alignas(u64) CNTFRQ_EL0 {
CNTFRQ_EL0 frequency;
asm volatile("mrs %[value], CNTFRQ_EL0"
: [value] "=r"(frequency));
: [value] "=r"(frequency));
return frequency;
}
@@ -517,7 +517,7 @@ struct alignas(u64) CNTP_TVAL_EL0 {
CNTP_TVAL_EL0 timer_value;
asm volatile("mrs %[value], CNTP_TVAL_EL0"
: [value] "=r"(timer_value));
: [value] "=r"(timer_value));
return timer_value;
}
@@ -542,7 +542,7 @@ struct alignas(u64) CNTP_CTL_EL0 {
CNTP_CTL_EL0 control_register;
asm volatile("mrs %[value], CNTP_CTL_EL0"
: [value] "=r"(control_register));
: [value] "=r"(control_register));
return control_register;
}
@@ -564,7 +564,7 @@ struct alignas(u64) CNTPCT_EL0 {
CNTPCT_EL0 physical_count;
asm volatile("mrs %[value], CNTPCT_EL0"
: [value] "=r"(physical_count));
: [value] "=r"(physical_count));
return physical_count;
}
@@ -582,7 +582,7 @@ struct alignas(u64) CNTV_TVAL_EL0 {
CNTV_TVAL_EL0 timer_value;
asm volatile("mrs %[value], CNTV_TVAL_EL0"
: [value] "=r"(timer_value));
: [value] "=r"(timer_value));
return timer_value;
}
@@ -607,7 +607,7 @@ struct alignas(u64) CNTV_CTL_EL0 {
CNTV_CTL_EL0 control_register;
asm volatile("mrs %[value], CNTV_CTL_EL0"
: [value] "=r"(control_register));
: [value] "=r"(control_register));
return control_register;
}
@@ -629,7 +629,7 @@ struct alignas(u64) CNTVCT_EL0 {
CNTVCT_EL0 virtual_count;
asm volatile("mrs %[value], CNTVCT_EL0"
: [value] "=r"(virtual_count));
: [value] "=r"(virtual_count));
return virtual_count;
}
@@ -735,7 +735,7 @@ struct alignas(u64) TCR_EL1 {
TCR_EL1 tcr_el1;
asm volatile("mrs %[value], tcr_el1"
: [value] "=r"(tcr_el1));
: [value] "=r"(tcr_el1));
return tcr_el1;
}
@@ -805,7 +805,7 @@ struct alignas(u64) SCTLR_EL1 {
SCTLR_EL1 sctlr;
asm volatile("mrs %[value], sctlr_el1"
: [value] "=r"(sctlr));
: [value] "=r"(sctlr));
return sctlr;
}
@@ -907,7 +907,7 @@ struct alignas(u64) SCTLR_EL2 {
SCTLR_EL2 sctlr;
asm volatile("mrs %[value], sctlr_el2"
: [value] "=r"(sctlr));
: [value] "=r"(sctlr));
return sctlr;
}
@@ -951,7 +951,7 @@ struct alignas(u64) MIDR_EL1 {
MIDR_EL1 main_id_register;
asm volatile("mrs %[value], MIDR_EL1"
: [value] "=r"(main_id_register));
: [value] "=r"(main_id_register));
return main_id_register;
}
@@ -968,7 +968,7 @@ struct alignas(u64) AIDR_EL1 {
AIDR_EL1 auxiliary_id_register;
asm volatile("mrs %[value], AIDR_EL1"
: [value] "=r"(auxiliary_id_register));
: [value] "=r"(auxiliary_id_register));
return auxiliary_id_register;
}
@@ -1033,7 +1033,7 @@ struct alignas(u64) HCR_EL2 {
HCR_EL2 spsr;
asm volatile("mrs %[value], hcr_el2"
: [value] "=r"(spsr));
: [value] "=r"(spsr));
return spsr;
}
@@ -1089,7 +1089,7 @@ struct alignas(u64) SCR_EL3 {
SCR_EL3 scr;
asm volatile("mrs %[value], scr_el3"
: [value] "=r"(scr));
: [value] "=r"(scr));
return scr;
}
@@ -1137,7 +1137,7 @@ struct alignas(u64) SPSR_EL1 {
SPSR_EL1 spsr;
asm volatile("mrs %[value], spsr_el1"
: [value] "=r"(spsr));
: [value] "=r"(spsr));
return spsr;
}
@@ -1186,7 +1186,7 @@ struct alignas(u64) SPSR_EL2 {
SPSR_EL2 spsr;
asm volatile("mrs %[value], spsr_el2"
: [value] "=r"(spsr));
: [value] "=r"(spsr));
return spsr;
}
@@ -1235,7 +1235,7 @@ struct alignas(u64) SPSR_EL3 {
SPSR_EL3 spsr;
asm volatile("mrs %[value], spsr_el3"
: [value] "=r"(spsr));
: [value] "=r"(spsr));
return spsr;
}
@@ -1269,7 +1269,7 @@ struct ESR_EL1 {
ESR_EL1 esr_el1;
asm volatile("mrs %[value], esr_el1"
: [value] "=r"(esr_el1));
: [value] "=r"(esr_el1));
return esr_el1;
}
@@ -1285,7 +1285,7 @@ struct FAR_EL1 {
FAR_EL1 far_el1;
asm volatile("mrs %[value], far_el1"
: [value] "=r"(far_el1));
: [value] "=r"(far_el1));
return far_el1;
}
@@ -1537,7 +1537,7 @@ struct DAIF {
DAIF daif;
asm volatile("mrs %[value], daif"
: [value] "=r"(daif));
: [value] "=r"(daif));
return daif;
}
@@ -1546,14 +1546,14 @@ struct DAIF {
static inline void clear_I()
{
asm volatile("msr daifclr, #2" ::
:);
:);
}
// Setting the I bit, causes interrupts to be disabled.
static inline void set_I()
{
asm volatile("msr daifset, #2" ::
:);
:);
}
};
static_assert(sizeof(DAIF) == 8);
@@ -1572,7 +1572,7 @@ struct alignas(u64) NZCV {
{
NZCV nzcv;
asm volatile("mrs %[value], nzcv"
: [value] "=r"(nzcv));
: [value] "=r"(nzcv));
return nzcv;
}
};
@@ -1587,7 +1587,7 @@ struct alignas(u64) PMCCNTR_EL0 {
{
PMCCNTR_EL0 pmccntr_el0;
asm volatile("mrs %[value], pmccntr_el0"
: [value] "=r"(pmccntr_el0));
: [value] "=r"(pmccntr_el0));
return pmccntr_el0;
}
};

View File

@@ -70,9 +70,9 @@ safe_memset_ins:
.global safe_memset_faulted
safe_memset_faulted:
)"
: [dest_ptr] "+&r"(dest_ptr), [result] "+&r"(result), "+&r"(fault_at_in_x3)
: [n] "r"(n), [c] "r"(c)
: "memory", "x4", "cc");
: [dest_ptr] "+&r"(dest_ptr), [result] "+&r"(result), "+&r"(fault_at_in_x3)
: [n] "r"(n), [c] "r"(c)
: "memory", "x4", "cc");
return result != 0;
}
@@ -98,9 +98,9 @@ safe_strnlen_ins:
.global safe_strnlen_faulted
safe_strnlen_faulted:
)"
: [result] "+&r"(result), "+&r"(fault_at_in_x2)
: [str] "r"(str), [max_n] "r"(max_n)
: "memory", "w3", "cc");
: [result] "+&r"(result), "+&r"(fault_at_in_x2)
: [str] "r"(str), [max_n] "r"(max_n)
: "memory", "w3", "cc");
return result;
}
@@ -129,9 +129,9 @@ safe_memcpy_ins_2:
.global safe_memcpy_faulted
safe_memcpy_faulted:
)"
: [result] "+&r"(result), "+&r"(fault_at_in_x3)
: [dest_ptr] "r"(dest_ptr), [src_ptr] "r"(src_ptr), [n] "r"(n)
: "memory", "x4", "w5", "cc");
: [result] "+&r"(result), "+&r"(fault_at_in_x3)
: [dest_ptr] "r"(dest_ptr), [src_ptr] "r"(src_ptr), [n] "r"(n)
: "memory", "x4", "w5", "cc");
return result != 0;
}
@@ -163,9 +163,9 @@ safe_atomic_compare_exchange_relaxed_ins_2:
.global safe_atomic_compare_exchange_relaxed_faulted
safe_atomic_compare_exchange_relaxed_faulted:
)"
: [result] "=&r"(result), "+&r"(error)
: [var_ptr] "r"(var), [expected_ptr] "r"(&expected), [desired] "r"(desired)
: "memory", "w3", "w4", "w5", "cc");
: [result] "=&r"(result), "+&r"(error)
: [var_ptr] "r"(var), [expected_ptr] "r"(&expected), [desired] "r"(desired)
: "memory", "w3", "w4", "w5", "cc");
if (error != 0)
return {};
return static_cast<bool>(result);
@@ -183,9 +183,9 @@ safe_atomic_load_relaxed_ins:
.global safe_atomic_load_relaxed_faulted
safe_atomic_load_relaxed_faulted:
)"
: [result] "=r"(result), "+r"(error)
: [var_ptr] "r"(var)
: "memory");
: [result] "=r"(result), "+r"(error)
: [var_ptr] "r"(var)
: "memory");
if (error != 0)
return {};
return result;
@@ -209,9 +209,9 @@ safe_atomic_fetch_add_relaxed_ins_2:
.global safe_atomic_fetch_add_relaxed_faulted
safe_atomic_fetch_add_relaxed_faulted:
)"
: [result] "=&r"(result), "+&r"(error)
: [val] "r"(val), [var_ptr] "r"(var)
: "memory", "w2", "w3");
: [result] "=&r"(result), "+&r"(error)
: [val] "r"(val), [var_ptr] "r"(var)
: "memory", "w2", "w3");
if (error != 0)
return {};
return result;
@@ -234,9 +234,9 @@ safe_atomic_exchange_relaxed_ins_2:
.global safe_atomic_exchange_relaxed_faulted
safe_atomic_exchange_relaxed_faulted:
)"
: [result] "=&r"(result), "+&r"(error)
: [desired] "r"(desired), [var_ptr] "r"(var)
: "memory", "w2");
: [result] "=&r"(result), "+&r"(error)
: [desired] "r"(desired), [var_ptr] "r"(var)
: "memory", "w2");
if (error != 0)
return {};
return result;
@@ -253,9 +253,9 @@ safe_atomic_store_relaxed_ins:
.global safe_atomic_store_relaxed_faulted
safe_atomic_store_relaxed_faulted:
)"
: "+r"(error)
: [desired] "r"(desired), [var_ptr] "r"(var)
: "memory");
: "+r"(error)
: [desired] "r"(desired), [var_ptr] "r"(var)
: "memory");
return error == 0;
}

View File

@@ -47,8 +47,8 @@ ALWAYS_INLINE FlatPtr read()
{
FlatPtr ret;
asm volatile("csrr %0, %1"
: "=r"(ret)
: "i"(address));
: "=r"(ret)
: "i"(address));
return ret;
}
@@ -63,8 +63,8 @@ ALWAYS_INLINE FlatPtr read_and_set_bits(FlatPtr bit_mask)
{
FlatPtr ret;
asm volatile("csrrs %0, %1, %2"
: "=r"(ret)
: "i"(address), "Kr"(bit_mask));
: "=r"(ret)
: "i"(address), "Kr"(bit_mask));
return ret;
}

View File

@@ -54,7 +54,7 @@ static void store_vector_state(FPUState& fpu_state)
.option pop
)" ::"r"(fpu_state.v)
: "t0", "memory");
: "t0", "memory");
}
static void load_vector_state(FPUState const& fpu_state)
@@ -84,7 +84,7 @@ static void load_vector_state(FPUState const& fpu_state)
.option pop
)" ::"r"(fpu_state.v)
: "t0", "memory");
: "t0", "memory");
RISCV64::CSR::write<RISCV64::CSR::Address::VSTART_>(fpu_state.vstart);
RISCV64::CSR::write<RISCV64::CSR::Address::VCSR>(fpu_state.vcsr);
@@ -230,9 +230,9 @@ void ProcessorBase<T>::flush_tlb_local(VirtualAddress vaddr, size_t page_count)
auto addr = vaddr.get();
while (page_count > 0) {
asm volatile("sfence.vma %0"
:
: "r"(addr)
: "memory");
:
: "r"(addr)
: "memory");
addr += PAGE_SIZE;
page_count--;
}

View File

@@ -24,9 +24,9 @@ static SBIErrorOr<long> sbi_ecall0(EID extension_id, u32 function_id)
register unsigned long a6 asm("a6") = function_id;
register unsigned long a7 asm("a7") = to_underlying(extension_id);
asm volatile("ecall"
: "=r"(a0), "=r"(a1)
: "r"(a6), "r"(a7)
: "memory");
: "=r"(a0), "=r"(a1)
: "r"(a6), "r"(a7)
: "memory");
if (a0 == to_underlying(SBIError::Success))
return static_cast<long>(a1);
@@ -40,9 +40,9 @@ static SBIErrorOr<long> sbi_ecall1(EID extension_id, u32 function_id, unsigned l
register unsigned long a6 asm("a6") = function_id;
register unsigned long a7 asm("a7") = to_underlying(extension_id);
asm volatile("ecall"
: "+r"(a0), "=r"(a1)
: "r"(a0), "r"(a6), "r"(a7)
: "memory");
: "+r"(a0), "=r"(a1)
: "r"(a0), "r"(a6), "r"(a7)
: "memory");
if (a0 == to_underlying(SBIError::Success))
return static_cast<long>(a1);
@@ -56,9 +56,9 @@ static SBIErrorOr<long> sbi_ecall2(EID extension_id, u32 function_id, unsigned l
register unsigned long a6 asm("a6") = function_id;
register unsigned long a7 asm("a7") = to_underlying(extension_id);
asm volatile("ecall"
: "+r"(a0), "+r"(a1)
: "r"(a0), "r"(a1), "r"(a6), "r"(a7)
: "memory");
: "+r"(a0), "+r"(a1)
: "r"(a0), "r"(a1), "r"(a6), "r"(a7)
: "memory");
if (a0 == to_underlying(SBIError::Success))
return static_cast<long>(a1);
@@ -112,9 +112,9 @@ static long sbi_legacy_ecall0(LegacyEID extension_id)
register unsigned long a0 asm("a0");
register unsigned long a7 asm("a7") = to_underlying(extension_id);
asm volatile("ecall"
: "=r"(a0)
: "r"(a7)
: "memory");
: "=r"(a0)
: "r"(a7)
: "memory");
return static_cast<long>(a0);
}
@@ -123,9 +123,9 @@ static long sbi_legacy_ecall1(LegacyEID extension_id, unsigned long arg0)
register unsigned long a0 asm("a0") = arg0;
register unsigned long a7 asm("a7") = to_underlying(extension_id);
asm volatile("ecall"
: "+r"(a0)
: "r"(a0), "r"(a7)
: "memory");
: "+r"(a0)
: "r"(a0), "r"(a7)
: "memory");
return static_cast<long>(a0);
}

View File

@@ -162,9 +162,9 @@ safe_atomic_compare_exchange_relaxed_ins_2:
.global safe_atomic_compare_exchange_relaxed_faulted
safe_atomic_compare_exchange_relaxed_faulted:
)"
: [result] "=&r"(result), "+&r"(error)
: [var_ptr] "r"(var), [expected_ptr] "r"(&expected), [desired] "r"(desired)
: "memory", "t0", "t1", "t2");
: [result] "=&r"(result), "+&r"(error)
: [var_ptr] "r"(var), [expected_ptr] "r"(&expected), [desired] "r"(desired)
: "memory", "t0", "t1", "t2");
if (error != 0)
return {};
return static_cast<bool>(result);
@@ -182,9 +182,9 @@ safe_atomic_load_relaxed_ins:
.global safe_atomic_load_relaxed_faulted
safe_atomic_load_relaxed_faulted:
)"
: [result] "=r"(result), "+r"(error)
: [var_ptr] "r"(var)
: "memory");
: [result] "=r"(result), "+r"(error)
: [var_ptr] "r"(var)
: "memory");
if (error != 0)
return {};
return result;
@@ -202,9 +202,9 @@ safe_atomic_fetch_add_relaxed_ins:
.global safe_atomic_fetch_add_relaxed_faulted
safe_atomic_fetch_add_relaxed_faulted:
)"
: [result] "=r"(result), "+r"(error)
: [val] "r"(val), [var_ptr] "r"(var)
: "memory");
: [result] "=r"(result), "+r"(error)
: [val] "r"(val), [var_ptr] "r"(var)
: "memory");
if (error != 0)
return {};
return result;
@@ -222,9 +222,9 @@ safe_atomic_exchange_relaxed_ins:
.global safe_atomic_exchange_relaxed_faulted
safe_atomic_exchange_relaxed_faulted:
)"
: [result] "=r"(result), "+r"(error)
: [desired] "r"(desired), [var_ptr] "r"(var)
: "memory");
: [result] "=r"(result), "+r"(error)
: [desired] "r"(desired), [var_ptr] "r"(var)
: "memory");
if (error != 0)
return {};
return result;
@@ -241,9 +241,9 @@ safe_atomic_store_relaxed_ins:
.global safe_atomic_store_relaxed_faulted
safe_atomic_store_relaxed_faulted:
)"
: "+r"(error)
: [desired] "r"(desired), [var_ptr] "r"(var)
: "memory");
: "+r"(error)
: [desired] "r"(desired), [var_ptr] "r"(var)
: "memory");
return error == 0;
}

View File

@@ -18,8 +18,8 @@ UNMAP_AFTER_INIT u64 read_xcr0()
{
u32 eax, edx;
asm volatile("xgetbv"
: "=a"(eax), "=d"(edx)
: "c"(XCR_XFEATURE_ENABLED_MASK));
: "=a"(eax), "=d"(edx)
: "c"(XCR_XFEATURE_ENABLED_MASK));
return eax + ((u64)edx << 32);
}
@@ -35,7 +35,7 @@ void stac()
if (!Processor::current().has_feature(CPUFeature::SMAP))
return;
asm volatile("stac" ::
: "cc");
: "cc");
}
void clac()
@@ -43,7 +43,7 @@ void clac()
if (!Processor::current().has_feature(CPUFeature::SMAP))
return;
asm volatile("clac" ::
: "cc");
: "cc");
}
UNMAP_AFTER_INIT void write_cr0(FlatPtr value)
@@ -83,7 +83,7 @@ void write_cr3(FlatPtr cr3)
{
// NOTE: If you're here from a GPF crash, it's very likely that a PDPT entry is incorrect, not this!
asm volatile("mov %%rax, %%cr3" ::"a"(cr3)
: "memory");
: "memory");
}
FlatPtr read_cr4()

View File

@@ -16,12 +16,12 @@ namespace Kernel {
ALWAYS_INLINE void cli()
{
asm volatile("cli" ::
: "memory");
: "memory");
}
ALWAYS_INLINE void sti()
{
asm volatile("sti" ::
: "memory");
: "memory");
}
ALWAYS_INLINE NO_SANITIZE_COVERAGE FlatPtr cpu_flags()
{
@@ -108,7 +108,7 @@ void write_dr7(FlatPtr);
ALWAYS_INLINE void read_tsc(u32& lsw, u32& msw)
{
asm volatile("rdtsc"
: "=d"(msw), "=a"(lsw));
: "=d"(msw), "=a"(lsw));
}
ALWAYS_INLINE u64 read_tsc()

View File

@@ -21,8 +21,8 @@ public:
explicit CPUID(u32 function, u32 ecx = 0)
{
asm volatile("cpuid"
: "=a"(m_eax), "=b"(m_ebx), "=c"(m_ecx), "=d"(m_edx)
: "a"(function), "c"(ecx));
: "=a"(m_eax), "=b"(m_ebx), "=c"(m_ecx), "=d"(m_edx)
: "a"(function), "c"(ecx));
}
u32 eax() const { return m_eax; }

View File

@@ -38,7 +38,7 @@ inline void vmware_out(VMWareCommand& command)
command.si = 0;
command.di = 0;
asm volatile("in %%dx, %0"
: "+a"(command.ax), "+b"(command.bx), "+c"(command.cx), "+d"(command.dx), "+S"(command.si), "+D"(command.di));
: "+a"(command.ax), "+b"(command.bx), "+c"(command.cx), "+d"(command.dx), "+S"(command.si), "+D"(command.di));
}
inline void vmware_high_bandwidth_send(VMWareCommand& command)
@@ -47,7 +47,7 @@ inline void vmware_high_bandwidth_send(VMWareCommand& command)
command.port = VMWARE_PORT_HIGHBANDWIDTH;
asm volatile("cld; rep; outsb"
: "+a"(command.ax), "+b"(command.bx), "+c"(command.cx), "+d"(command.dx), "+S"(command.si), "+D"(command.di));
: "+a"(command.ax), "+b"(command.bx), "+c"(command.cx), "+d"(command.dx), "+S"(command.si), "+D"(command.di));
}
inline void vmware_high_bandwidth_get(VMWareCommand& command)
@@ -55,7 +55,7 @@ inline void vmware_high_bandwidth_get(VMWareCommand& command)
command.magic = VMWARE_MAGIC;
command.port = VMWARE_PORT_HIGHBANDWIDTH;
asm volatile("cld; rep; insb"
: "+a"(command.ax), "+b"(command.bx), "+c"(command.cx), "+d"(command.dx), "+S"(command.si), "+D"(command.di));
: "+a"(command.ax), "+b"(command.bx), "+c"(command.cx), "+d"(command.dx), "+S"(command.si), "+D"(command.di));
}
class VMWareBackdoorDetector {

View File

@@ -23,8 +23,8 @@ inline u8 in8(u16 port)
{
u8 value;
asm volatile("inb %1, %0"
: "=a"(value)
: "Nd"(port));
: "=a"(value)
: "Nd"(port));
return value;
}
@@ -32,8 +32,8 @@ inline u16 in16(u16 port)
{
u16 value;
asm volatile("inw %1, %0"
: "=a"(value)
: "Nd"(port));
: "=a"(value)
: "Nd"(port));
return value;
}
@@ -41,8 +41,8 @@ inline u32 in32(u16 port)
{
u32 value;
asm volatile("inl %1, %0"
: "=a"(value)
: "Nd"(port));
: "=a"(value)
: "Nd"(port));
return value;
}

View File

@@ -37,8 +37,8 @@ public:
{
u32 low, high;
asm volatile("rdmsr"
: "=a"(low), "=d"(high)
: "c"(m_msr));
: "=a"(low), "=d"(high)
: "c"(m_msr));
return ((u64)high << 32) | low;
}

View File

@@ -65,14 +65,14 @@ void ProcessorBase<T>::store_fpu_state(FPUState& fpu_state)
// The specific state components saved correspond to the bits set in the requested-feature bitmap (RFBM), which is the logical-AND of EDX:EAX and XCR0.
// https://www.moritz.systems/blog/how-debuggers-work-getting-and-setting-x86-registers-part-2/
asm volatile("xsave %0\n"
: "=m"(fpu_state)
: "a"(static_cast<u32>(SIMD::StateComponent::AVX | SIMD::StateComponent::SSE | SIMD::StateComponent::X87)), "d"(0u));
: "=m"(fpu_state)
: "a"(static_cast<u32>(SIMD::StateComponent::AVX | SIMD::StateComponent::SSE | SIMD::StateComponent::X87)), "d"(0u));
} else if (Processor::current().has_feature(CPUFeature::FXSR)) {
asm volatile("fxsave %0"
: "=m"(fpu_state));
: "=m"(fpu_state));
} else {
asm volatile("fnsave %0"
: "=m"(fpu_state));
: "=m"(fpu_state));
}
}
@@ -768,7 +768,7 @@ void Processor::flush_gdt()
m_gdtr.address = m_gdt;
m_gdtr.limit = (m_gdt_length * 8) - 1;
asm volatile("lgdt %0" ::"m"(m_gdtr)
: "memory");
: "memory");
}
DescriptorTablePointer const& Processor::get_gdtr()
@@ -848,9 +848,9 @@ void ProcessorBase<T>::flush_tlb_local(VirtualAddress vaddr, size_t page_count)
auto ptr = vaddr.as_ptr();
while (page_count > 0) {
asm volatile("invlpg %0"
:
: "m"(*ptr)
: "memory");
:
: "m"(*ptr)
: "memory");
ptr += PAGE_SIZE;
page_count--;
}

View File

@@ -38,9 +38,9 @@ namespace Kernel {
br %[kernel_entry]
)"
:
: "r"(x0), "r"(sp), [sctlr_el1] "r"(sctlr_el1), [kernel_sp] "r"(kernel_sp), [kernel_entry] "r"(kernel_entry)
: "memory");
:
: "r"(x0), "r"(sp), [sctlr_el1] "r"(sctlr_el1), [kernel_sp] "r"(kernel_sp), [kernel_entry] "r"(kernel_entry)
: "memory");
__builtin_unreachable();
}
@@ -257,10 +257,10 @@ void arch_prepare_boot(void* root_page_table, BootInfo& boot_info)
mov x3, %[boot_info_vaddr]
b enter_kernel_helper
)" ::[current_el] "r"(current_el),
[sctlr_el2] "r"(sctlr_el2), [hcr_el2] "r"(hcr_el2), [spsr_el2] "r"(spsr_el2),
[sctlr_el1] "r"(sctlr_el1), [root_page_table] "r"(root_page_table), [mair_el1] "r"(mair_el1), [tcr_el1] "r"(tcr_el1),
[sctlr_el1_mmu_on] "r"(sctlr_el1_mmu_on), [kernel_entry_vaddr] "r"(kernel_entry_vaddr), [kernel_stack_pointer] "r"(kernel_stack_pointer), [boot_info_vaddr] "r"(boot_info_vaddr)
: "memory", "cc", "x0", "x1", "x2", "x3");
[sctlr_el2] "r"(sctlr_el2), [hcr_el2] "r"(hcr_el2), [spsr_el2] "r"(spsr_el2),
[sctlr_el1] "r"(sctlr_el1), [root_page_table] "r"(root_page_table), [mair_el1] "r"(mair_el1), [tcr_el1] "r"(tcr_el1),
[sctlr_el1_mmu_on] "r"(sctlr_el1_mmu_on), [kernel_entry_vaddr] "r"(kernel_entry_vaddr), [kernel_stack_pointer] "r"(kernel_stack_pointer), [boot_info_vaddr] "r"(boot_info_vaddr)
: "memory", "cc", "x0", "x1", "x2", "x3");
__builtin_unreachable();
}

View File

@@ -49,9 +49,9 @@ namespace Kernel {
wfi
j 1b
)"
:
: "r"(a0), "r"(sp), [satp] "r"(satp), [kernel_sp] "r"(kernel_sp), [kernel_entry] "r"(kernel_entry)
: "t0", "memory");
:
: "r"(a0), "r"(sp), [satp] "r"(satp), [kernel_sp] "r"(kernel_sp), [kernel_entry] "r"(kernel_entry)
: "t0", "memory");
__builtin_unreachable();
}

View File

@@ -76,9 +76,9 @@ namespace Kernel {
.8byte .Lgdt /* base address */
.previous
)"
:
: "r"(rdi), [cr3] "r"(cr3), [kernel_sp] "r"(kernel_sp), [kernel_entry] "r"(kernel_entry)
: "rax", "memory");
:
: "r"(rdi), [cr3] "r"(cr3), [kernel_sp] "r"(kernel_sp), [kernel_entry] "r"(kernel_entry)
: "rax", "memory");
__builtin_unreachable();
}

View File

@@ -12,7 +12,9 @@ namespace Kernel {
static constexpr size_t max_blocks_in_view = 16384; // 2^14
Ext2FSBlockView::Ext2FSBlockView(Ext2FSInode& inode)
: m_inode(inode) {};
: m_inode(inode)
{
}
ErrorOr<void> Ext2FSBlockView::ensure_block(BlockBasedFileSystem::BlockIndex block)
{

View File

@@ -40,7 +40,7 @@ struct nothrow_t {
extern nothrow_t const nothrow;
enum class align_val_t : size_t {};
enum class align_val_t : size_t { };
};
void kmalloc_init();

View File

@@ -22,7 +22,9 @@ public:
: m_local_address(local_address)
, m_local_port(local_port)
, m_peer_address(peer_address)
, m_peer_port(peer_port) {};
, m_peer_port(peer_port)
{
}
IPv4Address local_address() const { return m_local_address; }
u16 local_port() const { return m_local_port; }

View File

@@ -39,7 +39,9 @@ public:
protected:
TCPOption(TCPOptionKind kind, u8 length)
: m_kind(kind)
, m_length(length) {};
, m_length(length)
{
}
private:
TCPOptionKind m_kind { TCPOptionKind::End };

View File

@@ -91,7 +91,7 @@ public:
SignalHandlers::SignalHandlers(int signal_number, CFFileDescriptorCallBack handle_signal)
: m_signal_number(signal_number)
, m_original_handler(signal(signal_number, [](int) {}))
, m_original_handler(signal(signal_number, [](int) { }))
{
m_kevent_fd = kqueue();
if (m_kevent_fd < 0) {
@@ -319,7 +319,7 @@ static void handle_signal(CFFileDescriptorRef f, CFOptionFlags callback_types, v
VERIFY(callback_types & kCFFileDescriptorReadCallBack);
auto* signal_handlers = static_cast<SignalHandlers*>(info);
struct kevent event { };
struct kevent event {};
// returns number of events that have occurred since last call
(void)::kevent(CFFileDescriptorGetNativeDescriptor(f), nullptr, 0, &event, 1, nullptr);

View File

@@ -201,7 +201,7 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
self.tab.titlebarAppearsTransparent = NO;
[delegate createNewTab:OptionalNone {}
[delegate createNewTab:OptionalNone { }
fromTab:[self tab]
activateTab:Web::HTML::ActivateTab::Yes];

View File

@@ -194,7 +194,7 @@
- (void)pageChanged
{
[self.window setSubtitle:
[NSString stringWithFormat:@"Page %d of %d", [_pdfView page], _pdfDocument.pdf->get_page_count()]];
[NSString stringWithFormat:@"Page %d of %d", [_pdfView page], _pdfDocument.pdf->get_page_count()]];
}
#pragma mark - NSToolbarDelegate

View File

@@ -38,7 +38,7 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
switch (header.type_flag()) {
case Archive::TarFileType::GlobalExtendedHeader:
case Archive::TarFileType::ExtendedHeader: {
auto result = tar_stream->for_each_extended_header([&](StringView, StringView) {});
auto result = tar_stream->for_each_extended_header([&](StringView, StringView) { });
if (result.is_error())
return 0;
break;

View File

@@ -18,7 +18,7 @@ static void signal_handler(int)
TEST_CASE(default_handlers)
{
struct sigaction current_action { };
struct sigaction current_action {};
int rc = sigaction(SIGUSR2, nullptr, &current_action);
@@ -37,7 +37,7 @@ TEST_CASE(handlers_after_fork)
pid_t pid = fork();
if (pid == 0) {
struct sigaction current_action { };
struct sigaction current_action {};
rc = sigaction(SIGUSR2, nullptr, &current_action);
EXPECT_EQ(rc, 0);
EXPECT_EQ(current_action.sa_handler, signal_handler);

View File

@@ -25,7 +25,9 @@ public:
private:
CertificateStoreProxyModel(NonnullRefPtr<Model> source, NonnullRefPtr<GUI::TableView> view)
: SortingProxyModel(move(source))
, m_parent_table_view(move(view)) {};
, m_parent_table_view(move(view))
{
}
NonnullRefPtr<GUI::TableView> m_parent_table_view;
};
@@ -60,7 +62,7 @@ public:
virtual ~CertificateStoreWidget() override = default;
static ErrorOr<NonnullRefPtr<CertificateStoreWidget>> try_create();
ErrorOr<void> initialize();
virtual void apply_settings() override {};
virtual void apply_settings() override { }
private:
CertificateStoreWidget() = default;

View File

@@ -245,8 +245,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
g_debug_session = create_debug_session(command, pid_to_debug);
struct sigaction sa {
};
struct sigaction sa {};
sa.sa_handler = handle_sigint;
TRY(Core::System::sigaction(SIGINT, &sa, nullptr));

View File

@@ -19,7 +19,9 @@ public:
virtual StringView filter_name() const override { return "Bloom Filter"sv; }
Bloom(ImageEditor* editor)
: InplaceFilter(editor) {};
: InplaceFilter(editor)
{
}
private:
int m_luma_lower { 128 };

View File

@@ -16,7 +16,9 @@ public:
virtual StringView filter_name() const override { return "Box Blur (3x3)"sv; }
BoxBlur3(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -16,7 +16,9 @@ public:
virtual StringView filter_name() const override { return "Box Blur (5x5)"sv; }
BoxBlur5(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -20,7 +20,9 @@ public:
virtual StringView filter_name() const override { return "Fast Box Blur (& Gauss)"sv; }
FastBoxBlur(ImageEditor* editor)
: InplaceFilter(editor) {};
: InplaceFilter(editor)
{
}
private:
size_t m_radius { 5 };

View File

@@ -17,7 +17,9 @@ public:
virtual StringView filter_name() const override { return "Gaussian Blur (3x3)"sv; }
GaussBlur3(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -16,7 +16,9 @@ public:
virtual StringView filter_name() const override { return "Gaussian Blur (5x5)"sv; }
GaussBlur5(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -16,7 +16,9 @@ public:
virtual StringView filter_name() const override { return "Grayscale"sv; }
Grayscale(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -18,7 +18,9 @@ public:
virtual StringView filter_name() const override { return "Hue/Saturation"sv; }
HueAndSaturation(ImageEditor* editor)
: InplaceFilter(editor) {};
: InplaceFilter(editor)
{
}
private:
float m_hue { 0 };

View File

@@ -16,7 +16,9 @@ public:
virtual StringView filter_name() const override { return "Invert"sv; }
Invert(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -16,7 +16,9 @@ public:
virtual StringView filter_name() const override { return "Laplacian Cardinal"sv; }
LaplaceCardinal(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -16,7 +16,9 @@ public:
virtual StringView filter_name() const override { return "Laplacian Diagonal"sv; }
LaplaceDiagonal(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -18,7 +18,9 @@ public:
virtual StringView filter_name() const override { return "Sepia"sv; }
Sepia(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
private:
float m_amount { 1.0f };

View File

@@ -16,7 +16,9 @@ public:
virtual StringView filter_name() const override { return "Sharpen"sv; }
Sharpen(ImageEditor* editor)
: Filter(editor) {};
: Filter(editor)
{
}
};
}

View File

@@ -42,7 +42,9 @@ void TreeNode::sort_children_by_area() const
struct QueueEntry {
QueueEntry(ByteString path, TreeNode* node)
: path(move(path))
, node(node) {};
, node(node)
{
}
ByteString path;
TreeNode* node { nullptr };
};

View File

@@ -19,7 +19,9 @@ struct MountInfo {
class TreeNode final {
public:
TreeNode(ByteString name)
: m_name(move(name)) {};
: m_name(move(name))
{
}
ByteString name() const { return m_name; }
i64 area() const { return m_area; }
@@ -58,6 +60,8 @@ public:
private:
Tree(ByteString root_name)
: m_root(move(root_name)) {};
: m_root(move(root_name))
{
}
TreeNode m_root;
};

View File

@@ -393,7 +393,7 @@ ErrorOr<void> VideoPlayerWidget::initialize_menubar(GUI::Window& window)
// FIXME: Maybe seek mode should be in an options dialog instead. The playback menu may get crowded.
// For now, leave it here for convenience.
m_use_fast_seeking = GUI::Action::create_checkable("&Fast Seeking", [&](auto&) {});
m_use_fast_seeking = GUI::Action::create_checkable("&Fast Seeking", [&](auto&) { });
playback_menu->add_action(*m_use_fast_seeking);
set_seek_mode(Media::PlaybackManager::DEFAULT_SEEK_MODE);

View File

@@ -36,7 +36,9 @@ struct ClassViewNode {
ClassViewNode* parent { nullptr };
explicit ClassViewNode(StringView name)
: name(name) {};
: name(name)
{
}
};
class ClassViewModel final : public GUI::Model {

View File

@@ -88,13 +88,13 @@ ErrorOr<NonnullRefPtr<GUI::TextDocument>> FileDB::create_from_fd(int fd) const
class DefaultDocumentClient final : public GUI::TextDocument::Client {
public:
virtual ~DefaultDocumentClient() override = default;
virtual void document_did_append_line() override {};
virtual void document_did_insert_line(size_t) override {};
virtual void document_did_remove_line(size_t) override {};
virtual void document_did_remove_all_lines() override {};
virtual void document_did_append_line() override { }
virtual void document_did_insert_line(size_t) override { }
virtual void document_did_remove_line(size_t) override { }
virtual void document_did_remove_all_lines() override { }
virtual void document_did_change(GUI::AllowCallback) override {};
virtual void document_did_set_text(GUI::AllowCallback) override {};
virtual void document_did_set_cursor(const GUI::TextPosition&) override {};
virtual void document_did_set_cursor(const GUI::TextPosition&) override { }
virtual void document_did_update_undo_stack() override { }
virtual bool is_automatic_indentation_enabled() const override { return false; }

View File

@@ -53,7 +53,9 @@ public:
private:
FileEventNode(ByteString const& path, FileEventNode* parent = nullptr)
: m_path(path)
, m_parent(parent) {};
, m_parent(parent)
{
}
ByteString m_path;

View File

@@ -22,7 +22,7 @@ public:
virtual ErrorOr<size_t> write_some(ReadonlyBytes) override;
virtual bool is_eof() const override;
virtual bool is_open() const override { return true; }
virtual void close() override {};
virtual void close() override { }
private:
TarFileStream(TarInputStream& stream);

View File

@@ -35,7 +35,7 @@ ConnectionToServer::ConnectionToServer(NonnullOwnPtr<Core::LocalSocket> socket)
Threading::MutexLocker const locker(m_enqueuer_loop_destruction);
m_enqueuer_loop = nullptr;
}
return (intptr_t) nullptr;
return (intptr_t)nullptr;
}))
{
update_good_sleep_time();

View File

@@ -74,7 +74,7 @@ static RoundingMode get_rounding_mode()
{
size_t rounding_mode;
asm volatile("frrm %0"
: "=r"(rounding_mode));
: "=r"(rounding_mode));
return static_cast<RoundingMode>(rounding_mode);
}
@@ -84,8 +84,8 @@ static RoundingMode set_rounding_mode(RoundingMode frm)
size_t old_rounding_mode;
size_t const new_rounding_mode = to_underlying(frm);
asm volatile("fsrm %0, %1"
: "=r"(old_rounding_mode)
: "r"(new_rounding_mode));
: "=r"(old_rounding_mode)
: "r"(new_rounding_mode));
return static_cast<RoundingMode>(old_rounding_mode);
}
@@ -145,7 +145,7 @@ static AccruedExceptions get_accrued_exceptions()
{
size_t fflags;
asm volatile("frflags %0"
: "=r"(fflags));
: "=r"(fflags));
return static_cast<AccruedExceptions>(fflags);
}
@@ -155,8 +155,8 @@ static AccruedExceptions set_accrued_exceptions(AccruedExceptions exceptions)
size_t old_exceptions;
size_t const new_exceptions = to_underlying(exceptions);
asm volatile("fsflags %0, %1"
: "=r"(old_exceptions)
: "r"(new_exceptions));
: "=r"(old_exceptions)
: "r"(new_exceptions));
return static_cast<AccruedExceptions>(old_exceptions);
}
@@ -174,7 +174,7 @@ int fegetenv(fenv_t* env)
FlatPtr fcsr;
asm volatile("csrr %0, fcsr"
: "=r"(fcsr));
: "=r"(fcsr));
env->fcsr = fcsr;
return 0;

View File

@@ -14,7 +14,7 @@ static u16 read_status_register()
{
u16 status_register;
asm volatile("fnstsw %0"
: "=m"(status_register));
: "=m"(status_register));
return status_register;
}
@@ -22,7 +22,7 @@ static u16 read_control_word()
{
u16 control_word;
asm volatile("fnstcw %0"
: "=m"(control_word));
: "=m"(control_word));
return control_word;
}
@@ -35,7 +35,7 @@ static u32 read_mxcsr()
{
u32 mxcsr;
asm volatile("stmxcsr %0"
: "=m"(mxcsr));
: "=m"(mxcsr));
return mxcsr;
}
@@ -54,7 +54,7 @@ int fegetenv(fenv_t* env)
return 1;
asm volatile("fnstenv %0"
: "=m"(env->__x87_fpu_env)::"memory");
: "=m"(env->__x87_fpu_env)::"memory");
env->__mxcsr = read_mxcsr();
return 0;
@@ -72,7 +72,7 @@ int fesetenv(fenv_t const* env)
}
asm volatile("fldenv %0" ::"m"(env->__x87_fpu_env)
: "memory");
: "memory");
set_mxcsr(env->__mxcsr);
return 0;

View File

@@ -1068,7 +1068,7 @@ char* getpass(char const* prompt)
close(tty);
});
struct termios backup { };
struct termios backup {};
if (tcgetattr(tty, &backup) < 0)
return nullptr;

View File

@@ -27,8 +27,8 @@ public:
virtual Vector<AutocompleteResultEntry> get_suggestions(ByteString const& file, GUI::TextPosition const& autocomplete_position) = 0;
// TODO: In the future we can pass the range that was edited and only re-parse what we have to.
virtual void on_edit([[maybe_unused]] ByteString const& file) {};
virtual void file_opened([[maybe_unused]] ByteString const& file) {};
virtual void on_edit([[maybe_unused]] ByteString const& file) { }
virtual void file_opened([[maybe_unused]] ByteString const& file) { }
virtual Optional<ProjectLocation> find_declaration_of(ByteString const&, GUI::TextPosition const&) { return {}; }

View File

@@ -20,7 +20,9 @@ public:
CanonicalCode() = default;
CanonicalCode(Vector<size_t> codes, Vector<size_t> values)
: m_symbol_codes(move(codes))
, m_symbol_values(move(values)) {};
, m_symbol_values(move(values))
{
}
static ErrorOr<CanonicalCode> read_prefix_code(LittleEndianInputBitStream&, size_t alphabet_size);
static ErrorOr<CanonicalCode> read_simple_prefix_code(LittleEndianInputBitStream&, size_t alphabet_size);

View File

@@ -49,7 +49,7 @@ public:
virtual ErrorOr<size_t> write_some(ReadonlyBytes) override;
virtual bool is_eof() const override;
virtual bool is_open() const override { return true; }
virtual void close() override {};
virtual void close() override { }
static ErrorOr<ByteBuffer> decompress_all(ReadonlyBytes);

View File

@@ -73,7 +73,7 @@ ErrorOr<void> Command::write_lines(Span<ByteString> lines)
// It's possible the process dies before we can write everything to the
// stdin. So make sure that we don't crash but just stop writing.
struct sigaction action_handler { };
struct sigaction action_handler {};
action_handler.sa_handler = SIG_IGN;
struct sigaction old_action_handler;

View File

@@ -284,7 +284,7 @@ ErrorOr<bool> Process::is_being_debugged()
if (sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0) < 0)
return Error::from_syscall("sysctl"sv, -errno);
// We're being debugged if the P_TRACED flag is set.
// We're being debugged if the P_TRACED flag is set.
# if defined(AK_OS_MACOS)
return ((info.kp_proc.p_flag & P_TRACED) != 0);
# elif defined(AK_OS_FREEBSD)

View File

@@ -112,7 +112,7 @@ public:
// Set the callback to be called when the promise is rejected. Setting this callback
// will cause the promise fulfillment to be ready to be handled.
template<CallableAs<void, ErrorType&&> RejectedHandler>
ThreadedPromise& when_rejected(RejectedHandler when_rejected = [](ErrorType&) {})
ThreadedPromise& when_rejected(RejectedHandler when_rejected = [](ErrorType&) { })
{
Threading::MutexLocker locker { m_mutex };
VERIFY(!m_rejection_handler);

View File

@@ -68,7 +68,7 @@ PtraceRegisters Inspector::get_registers() const
return registers;
}
void Inspector::set_registers(PtraceRegisters const&) {};
void Inspector::set_registers(PtraceRegisters const&) { }
void Inspector::for_each_loaded_library(Function<IterationDecision(Debug::LoadedLibrary const&)> func) const
{

View File

@@ -194,8 +194,8 @@ ByteString BigFraction::to_byte_string(unsigned rounding_threshold) const
auto const number_of_digits = [](auto integer) {
unsigned size = 1;
for (auto division_result = integer.divided_by(UnsignedBigInteger { 10 });
division_result.remainder == UnsignedBigInteger { 0 } && division_result.quotient != UnsignedBigInteger { 0 };
division_result = division_result.quotient.divided_by(UnsignedBigInteger { 10 })) {
division_result.remainder == UnsignedBigInteger { 0 } && division_result.quotient != UnsignedBigInteger { 0 };
division_result = division_result.quotient.divided_by(UnsignedBigInteger { 10 })) {
++size;
}
return size;

View File

@@ -99,8 +99,8 @@ private:
template<CPUFeatures>
void expand_decrypt_key_impl(ReadonlyBytes user_key, size_t bits);
static void (AESCipherKey::*const expand_encrypt_key_dispatched)(ReadonlyBytes user_key, size_t bits);
static void (AESCipherKey::*const expand_decrypt_key_dispatched)(ReadonlyBytes user_key, size_t bits);
static void (AESCipherKey::* const expand_encrypt_key_dispatched)(ReadonlyBytes user_key, size_t bits);
static void (AESCipherKey::* const expand_decrypt_key_dispatched)(ReadonlyBytes user_key, size_t bits);
static constexpr size_t MAX_ROUND_COUNT = 14;
u32 m_rd_keys[(MAX_ROUND_COUNT + 1) * 4] { 0 };
@@ -144,8 +144,8 @@ private:
template<CPUFeatures>
void decrypt_block_impl(BlockType const& in, BlockType& out);
static void (AESCipher::*const encrypt_block_dispatched)(BlockType const& in, BlockType& out);
static void (AESCipher::*const decrypt_block_dispatched)(BlockType const& in, BlockType& out);
static void (AESCipher::* const encrypt_block_dispatched)(BlockType const& in, BlockType& out);
static void (AESCipher::* const decrypt_block_dispatched)(BlockType const& in, BlockType& out);
};
}

View File

@@ -71,7 +71,7 @@ private:
template<CPUFeatures>
void transform_impl();
static void (SHA1::*const transform_dispatched)();
static void (SHA1::* const transform_dispatched)();
void transform() { return (this->*transform_dispatched)(); }
u8 m_data_buffer[BlockSize] {};

View File

@@ -119,7 +119,7 @@ private:
template<CPUFeatures>
void transform_impl();
static void (SHA256::*const transform_dispatched)();
static void (SHA256::* const transform_dispatched)();
void transform() { return (this->*transform_dispatched)(); }
u8 m_data_buffer[BlockSize] {};

View File

@@ -428,7 +428,7 @@ bool can_delete_or_move(StringView path)
auto stat_or_empty = [](StringView path) {
auto stat_or_error = Core::System::stat(path);
if (stat_or_error.is_error()) {
struct stat stat { };
struct stat stat {};
return stat;
}
return stat_or_error.release_value();

View File

@@ -85,7 +85,7 @@ protected:
virtual void resize_event(ResizeEvent&) override;
virtual void mousewheel_event(MouseEvent&) override;
virtual void did_scroll() { }
virtual void automatic_scrolling_timer_did_fire() {};
virtual void automatic_scrolling_timer_did_fire() { }
void set_content_size(Gfx::IntSize);
void set_min_content_size(Gfx::IntSize);
void set_size_occupied_by_fixed_elements(Gfx::IntSize);

View File

@@ -50,7 +50,7 @@ protected:
return *m_inactive_window_icon;
}
virtual void palette_changed() {};
virtual void palette_changed() { }
private:
virtual void paint_preview(GUI::PaintEvent&) = 0;

View File

@@ -50,7 +50,7 @@ public:
protected:
explicit DynamicWidgetContainer(Gfx::Orientation = Gfx::Orientation::Vertical);
virtual void paint_event(PaintEvent&) override {};
virtual void paint_event(PaintEvent&) override { }
virtual void second_paint_event(PaintEvent&) override;
virtual void resize_event(ResizeEvent&) override;
virtual void child_event(Core::ChildEvent&) override;

View File

@@ -18,7 +18,9 @@ public:
};
BitmapMixer(Bitmap& bitmap)
: m_bitmap(bitmap) {};
: m_bitmap(bitmap)
{
}
void mix_with(Bitmap&, MixingMethod);

View File

@@ -24,8 +24,8 @@ public:
virtual StringView class_name() const = 0;
virtual void apply(Bitmap&, IntRect const&, Bitmap const&, IntRect const&, Parameters const&) {};
virtual void apply(Bitmap&, IntRect const&, Bitmap const&, IntRect const&) {};
virtual void apply(Bitmap&, IntRect const&, Bitmap const&, IntRect const&, Parameters const&) { }
virtual void apply(Bitmap&, IntRect const&, Bitmap const&, IntRect const&) { }
protected:
Filter() = default;

View File

@@ -13,7 +13,9 @@ namespace Gfx {
class LumaFilter {
public:
LumaFilter(Bitmap& bitmap)
: m_bitmap(bitmap) {};
: m_bitmap(bitmap)
{
}
void apply(u8 lower_bound, u8 upper_bound);

View File

@@ -48,7 +48,7 @@ ErrorOr<BoxList> Reader::read_entire_file()
return OptionalNone {};
}
};
return read_entire_file((ErrorOr<Optional<NonnullOwnPtr<Box>>>(*)(BoxType, ConstrainedStream&))(make_top_level_box));
return read_entire_file((ErrorOr<Optional<NonnullOwnPtr<Box>>> (*)(BoxType, ConstrainedStream&))(make_top_level_box));
}
ErrorOr<BoxList> Reader::read_entire_file(BoxCallback box_factory)

View File

@@ -48,7 +48,7 @@ public:
}
protected:
virtual void fill_main_tags() const {};
virtual void fill_main_tags() const { }
mutable HashMap<StringView, String> m_main_tags;
};

View File

@@ -41,7 +41,7 @@ private:
ALWAYS_INLINE ErrorOr<void> CanonicalCode::write_symbol(LittleEndianOutputBitStream& bit_stream, u32 symbol) const
{
TRY(m_code.visit(
[&](u32 single_code) __attribute__((always_inline))->ErrorOr<void> { VERIFY(symbol == single_code); return {}; },
[&](u32 single_code) __attribute__((always_inline)) -> ErrorOr<void> { VERIFY(symbol == single_code); return {}; },
[&](Compress::CanonicalCode const& code) __attribute__((always_inline)) { return code.write_symbol(bit_stream, symbol); }));
return {};
}

View File

@@ -67,7 +67,9 @@ public:
PathSegment(Command command, ReadonlySpan<FloatPoint> points)
: m_command(command)
, m_points(points) {};
, m_points(points)
{
}
private:
Command m_command;

View File

@@ -101,7 +101,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> ErrorConstructor::construct(FunctionObje
auto message = vm.argument(0); \
auto options = vm.argument(1); \
\
/* 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%NativeError.prototype%", « [[ErrorData]] »). */ \
/* 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%NativeError.prototype%", « [[ErrorData]] »). */ \
auto error = TRY(ordinary_create_from_constructor<ClassName>(vm, new_target, &Intrinsics::snake_name##_prototype)); \
\
/* 3. If message is not undefined, then */ \

View File

@@ -48,7 +48,9 @@ public:
protected:
explicit IndexedPropertyStorage(IsSimpleStorage is_simple_storage)
: m_is_simple_storage(is_simple_storage == IsSimpleStorage::Yes) {};
: m_is_simple_storage(is_simple_storage == IsSimpleStorage::Yes)
{
}
private:
bool m_is_simple_storage { false };
@@ -57,7 +59,9 @@ private:
class SimpleIndexedPropertyStorage final : public IndexedPropertyStorage {
public:
SimpleIndexedPropertyStorage()
: IndexedPropertyStorage(IsSimpleStorage::Yes) {};
: IndexedPropertyStorage(IsSimpleStorage::Yes)
{
}
explicit SimpleIndexedPropertyStorage(Vector<Value>&& initial_values);
virtual bool has_index(u32 index) const override;
@@ -99,7 +103,9 @@ class GenericIndexedPropertyStorage final : public IndexedPropertyStorage {
public:
explicit GenericIndexedPropertyStorage(SimpleIndexedPropertyStorage&&);
explicit GenericIndexedPropertyStorage()
: IndexedPropertyStorage(IsSimpleStorage::No) {};
: IndexedPropertyStorage(IsSimpleStorage::No)
{
}
virtual bool has_index(u32 index) const override;
virtual Optional<ValueAndAttributes> get(u32 index) const override;

View File

@@ -189,7 +189,7 @@ private:
};
struct DurationInstanceComponent {
double Temporal::DurationRecord::*value_slot;
double Temporal::DurationRecord::* value_slot;
DurationFormat::ValueStyle (DurationFormat::*get_style_slot)() const;
void (DurationFormat::*set_style_slot)(StringView);
DurationFormat::Display (DurationFormat::*get_display_slot)() const;

View File

@@ -44,7 +44,7 @@ private:
auto&& _temporary_try_or_reject_result = (expression); \
/* 1. If value is an abrupt completion, then */ \
if (_temporary_try_or_reject_result.is_error()) { \
/* a. Perform ? Call(capability.[[Reject]], undefined, « value.[[Value]] »). */ \
/* a. Perform ? Call(capability.[[Reject]], undefined, « value.[[Value]] »). */ \
CALL_CHECK(JS::call(vm, *(capability)->reject(), js_undefined(), *_temporary_try_or_reject_result.release_error().value())); \
\
/* b. Return capability.[[Promise]]. */ \
@@ -70,7 +70,7 @@ private:
auto&& _temporary_try_or_reject_result = (expression); \
/* 1. If value is an abrupt completion, then */ \
if (_temporary_try_or_reject_result.is_error()) { \
/* a. Perform ? Call(capability.[[Reject]], undefined, « value.[[Value]] »). */ \
/* a. Perform ? Call(capability.[[Reject]], undefined, « value.[[Value]] »). */ \
TRY(JS::call(vm, *(capability)->reject(), js_undefined(), *_temporary_try_or_reject_result.release_error().value())); \
\
/* b. Return capability.[[Promise]]. */ \

View File

@@ -116,7 +116,7 @@ struct RoundedDuration {
template<typename StructT, typename ValueT>
struct TemporalDurationRecordField {
ValueT StructT::*field_name { nullptr };
ValueT StructT::* field_name { nullptr };
PropertyKey property_name;
};

View File

@@ -69,7 +69,7 @@ struct TemporalTimeLikeRecord {
template<typename StructT, typename ValueT>
struct TemporalTimeLikeRecordField {
ValueT StructT::*field_name { nullptr };
ValueT StructT::* field_name { nullptr };
PropertyKey property_name;
};

View File

@@ -2386,8 +2386,8 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
// b. Let ly be the length of py.
// c. For each integer i such that 0 ≤ i < min(lx, ly), in ascending order, do
for (auto k = x_code_points.begin(), l = y_code_points.begin();
k != x_code_points.end() && l != y_code_points.end();
++k, ++l) {
k != x_code_points.end() && l != y_code_points.end();
++k, ++l) {
// i. Let cx be the integer that is the numeric value of the code unit at index i within px.
// ii. Let cy be the integer that is the numeric value of the code unit at index i within py.
if (*k != *l) {

View File

@@ -176,7 +176,7 @@ Result<NonnullGCPtr<SourceTextModule>, Vector<ParserError>> SourceTextModule::pa
[&](ImportEntry const& import_entry) {
return import_entry.local_name == entry.local_or_import_name;
})
.is_end());
.is_end());
default_export = export_statement;
}

View File

@@ -468,10 +468,8 @@ private:
KeyCallbackMachine m_callback_machine;
struct termios m_termios {
};
struct termios m_default_termios {
};
struct termios m_termios {};
struct termios m_default_termios {};
bool m_was_interrupted { false };
bool m_previous_interrupt_was_handled_as_interrupt { true };
bool m_was_resized { false };

View File

@@ -25,7 +25,9 @@ struct Key {
Key(unsigned c)
: modifiers(None)
, key(c) {};
, key(c)
{
}
Key(unsigned c, int modifiers)
: modifiers(modifiers)

View File

@@ -704,7 +704,7 @@ PDFErrorOr<Vector<DocumentParser::PageOffsetHintTableEntry>> DocumentParser::par
auto bits_required_for_greatest_shared_obj_identifier = hint_table.bits_required_for_greatest_shared_obj_identifier;
auto bits_required_for_fraction_numerator = hint_table.bits_required_for_fraction_numerator;
auto parse_int_entry = [&](u32 PageOffsetHintTableEntry::*field, u32 bit_size) -> ErrorOr<void> {
auto parse_int_entry = [&](u32 PageOffsetHintTableEntry::* field, u32 bit_size) -> ErrorOr<void> {
if (bit_size <= 0)
return {};
@@ -716,7 +716,7 @@ PDFErrorOr<Vector<DocumentParser::PageOffsetHintTableEntry>> DocumentParser::par
return {};
};
auto parse_vector_entry = [&](Vector<u32> PageOffsetHintTableEntry::*field, u32 bit_size) -> ErrorOr<void> {
auto parse_vector_entry = [&](Vector<u32> PageOffsetHintTableEntry::* field, u32 bit_size) -> ErrorOr<void> {
if (bit_size <= 0)
return {};

View File

@@ -18,10 +18,10 @@
#define TRY_OR_THROW_PARSE_ERROR(expr) ({ \
/* Ignore -Wshadow to allow nesting the macro. */ \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto&& _value_or_error = expr;) \
auto&& _value_or_error = expr;) \
if (_value_or_error.is_error()) { \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto _error = _value_or_error.release_error();) \
auto _error = _value_or_error.release_error();) \
if (_error.is_errno() && _error.code() == ENOMEM) \
return create<AST::SyntaxError>("OOM"_string); \
return create<AST::SyntaxError>(MUST(String::formatted("Error: {}", _error))); \
@@ -32,11 +32,11 @@
#define TRY_OR_RESOLVE_TO_ERROR_STRING(expr) ({ \
/* Ignore -Wshadow to allow nesting the macro. */ \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto&& _value_or_error = expr; \
String _string_value;) \
auto&& _value_or_error = expr; \
String _string_value;) \
if (_value_or_error.is_error()) { \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto _error = _value_or_error.release_error();) \
auto _error = _value_or_error.release_error();) \
if (_error.is_errno() && _error.code() == ENOMEM) \
_string_value = "OOM"_string; \
else \
@@ -45,16 +45,16 @@
_value_or_error.is_error() ? _string_value : _value_or_error.release_value(); \
})
#define TRY_OR(expr, catch_expr) ({ \
/* Ignore -Wshadow to allow nesting the macro. */ \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto&& _value_or_error = expr;) \
if (_value_or_error.is_error()) { \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto _error = _value_or_error.release_error();) \
catch_expr; \
} \
_value_or_error.release_value(); \
#define TRY_OR(expr, catch_expr) ({ \
/* Ignore -Wshadow to allow nesting the macro. */ \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto&& _value_or_error = expr;) \
if (_value_or_error.is_error()) { \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto _error = _value_or_error.release_error();) \
catch_expr; \
} \
_value_or_error.release_value(); \
})
namespace Shell {

View File

@@ -13,10 +13,10 @@
#define TRY_OR_THROW_PARSE_ERROR_AT(expr, position) ({ \
/* Ignore -Wshadow to allow nesting the macro. */ \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto&& _value_or_error = expr;) \
auto&& _value_or_error = expr;) \
if (_value_or_error.is_error()) { \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
auto _error = _value_or_error.release_error();) \
auto _error = _value_or_error.release_error();) \
if (_error.is_errno() && _error.code() == ENOMEM) \
return make_ref_counted<AST::SyntaxError>(position, "OOM"_string); \
return make_ref_counted<AST::SyntaxError>(position, MUST(String::formatted("Error: {}", _error))); \

View File

@@ -158,12 +158,12 @@ struct Options {
return typ { __VA_ARGS__ }; \
} \
typ name = default_##name(); \
Options& set_##name(typ new_value)& \
Options& set_##name(typ new_value) & \
{ \
name = move(new_value); \
return *this; \
} \
Options&& set_##name(typ new_value)&& \
Options&& set_##name(typ new_value) && \
{ \
name = move(new_value); \
return move(*this); \
@@ -190,8 +190,8 @@ struct Options {
OPTION_WITH_DEFAULTS(bool, validate_certificates, true)
OPTION_WITH_DEFAULTS(bool, allow_self_signed_certificates, false)
OPTION_WITH_DEFAULTS(Optional<Vector<Certificate>>, root_certificates, )
OPTION_WITH_DEFAULTS(Function<void(AlertDescription)>, alert_handler, [](auto) {})
OPTION_WITH_DEFAULTS(Function<void()>, finish_callback, [] {})
OPTION_WITH_DEFAULTS(Function<void(AlertDescription)>, alert_handler, [](auto) { })
OPTION_WITH_DEFAULTS(Function<void()>, finish_callback, [] { })
OPTION_WITH_DEFAULTS(Function<Vector<Certificate>()>, certificate_provider, [] { return Vector<Certificate> {}; })
OPTION_WITH_DEFAULTS(bool, enable_extended_master_secret, true)

View File

@@ -34,7 +34,7 @@ private:
, m_value(value)
{
}
ColumnCount() {};
ColumnCount() { }
Type m_type { Type::Auto };
Optional<int> m_value;

View File

@@ -16,7 +16,9 @@ class Filter {
public:
Filter() = default;
Filter(FilterValueListStyleValue const& filter_value_list)
: m_filter_value_list { filter_value_list } {};
: m_filter_value_list { filter_value_list }
{
}
static Filter make_none()
{

Some files were not shown because too many files have changed in this diff Show More