AK: Add volatile overloads to AK_ENUM_BITWISE_OPERATORS

These overloads return void, since GCC otherwise complains if you
ignore the return value:

implicit dereference will not access object of type
'volatile Kernel::PCI::Registers::Control' in statement [-Werror]
  132 |     registers->control |= Registers::Control::PERST_N;
      |     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Sönke Holz
2025-05-09 11:35:08 +02:00
parent 2c5ca3cd72
commit 320d08efef

View File

@@ -58,6 +58,13 @@
return lhs; \
} \
\
Prefix inline void operator|=(Enum volatile& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
} \
\
Prefix constexpr Enum& operator&=(Enum& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
@@ -66,6 +73,13 @@
return lhs; \
} \
\
Prefix inline void operator&=(Enum volatile& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
} \
\
Prefix constexpr Enum& operator^=(Enum& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
@@ -74,6 +88,13 @@
return lhs; \
} \
\
Prefix inline void operator^=(Enum volatile& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
} \
\
Prefix constexpr bool has_flag(Enum value, Enum mask) \
{ \
using Type = UnderlyingType<Enum>; \