1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

Everywhere: Re-format with clang-format-11

Compared to version 10 this fixes a bunch of formatting issues, mostly
around structs/classes with attributes like [[gnu::packed]], and
incorrect insertion of spaces in parameter types ("T &"/"T &&").
I also removed a bunch of // clang-format off/on and FIXME comments that
are no longer relevant - on the other hand it tried to destroy a couple of
neatly formatted comments, so I had to add some as well.
This commit is contained in:
Linus Groh 2020-12-30 22:44:54 +01:00 committed by Andreas Kling
parent 2568a93b5d
commit bbe787a0af
54 changed files with 130 additions and 230 deletions

View file

@ -46,8 +46,7 @@ struct ARPHardwareType {
};
};
class [[gnu::packed]] ARPPacket
{
class [[gnu::packed]] ARPPacket {
public:
u16 hardware_type() const { return m_hardware_type; }
void set_hardware_type(u16 w) { m_hardware_type = w; }

View file

@ -33,6 +33,7 @@
namespace Kernel {
// clang-format off
#define REG_CTRL 0x0000
#define REG_STATUS 0x0008
#define REG_EEPROM 0x0014
@ -139,6 +140,7 @@ namespace Kernel {
#define INTERRUPT_PHYINT (1 << 12)
#define INTERRUPT_TXD_LOW (1 << 15)
#define INTERRUPT_SRPD (1 << 16)
// clang-format on
// https://www.intel.com/content/dam/doc/manual/pci-pci-x-family-gbe-controllers-software-dev-manual.pdf Section 5.2
static bool is_valid_device_id(u16 device_id)

View file

@ -54,8 +54,7 @@ private:
virtual void handle_irq(const RegisterState&) override;
virtual const char* class_name() const override { return "E1000NetworkAdapter"; }
struct [[gnu::packed]] e1000_rx_desc
{
struct [[gnu::packed]] e1000_rx_desc {
volatile uint64_t addr { 0 };
volatile uint16_t length { 0 };
volatile uint16_t checksum { 0 };
@ -64,8 +63,7 @@ private:
volatile uint16_t special { 0 };
};
struct [[gnu::packed]] e1000_tx_desc
{
struct [[gnu::packed]] e1000_tx_desc {
volatile uint64_t addr { 0 };
volatile uint16_t length { 0 };
volatile uint8_t cso { 0 };

View file

@ -31,8 +31,7 @@
#pragma GCC diagnostic ignored "-Warray-bounds"
class [[gnu::packed]] EthernetFrameHeader
{
class [[gnu::packed]] EthernetFrameHeader {
public:
EthernetFrameHeader() { }
~EthernetFrameHeader() { }

View file

@ -36,8 +36,7 @@ struct ICMPType {
};
};
class [[gnu::packed]] ICMPHeader
{
class [[gnu::packed]] ICMPHeader {
public:
ICMPHeader() { }
~ICMPHeader() { }
@ -63,8 +62,7 @@ private:
static_assert(sizeof(ICMPHeader) == 4);
struct [[gnu::packed]] ICMPEchoPacket
{
struct [[gnu::packed]] ICMPEchoPacket {
ICMPHeader header;
NetworkOrdered<u16> identifier;
NetworkOrdered<u16> sequence_number;

View file

@ -47,8 +47,7 @@ enum class IPv4PacketFlags : u16 {
NetworkOrdered<u16> internet_checksum(const void*, size_t);
class [[gnu::packed]] IPv4Packet
{
class [[gnu::packed]] IPv4Packet {
public:
u8 version() const { return (m_version_and_ihl >> 4) & 0xf; }
void set_version(u8 version) { m_version_and_ihl = (m_version_and_ihl & 0x0f) | (version << 4); }

View file

@ -41,8 +41,7 @@ struct TCPFlags {
};
};
class [[gnu::packed]] TCPPacket
{
class [[gnu::packed]] TCPPacket {
public:
TCPPacket() = default;
~TCPPacket() = default;

View file

@ -310,8 +310,7 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size)
NetworkOrdered<u16> TCPSocket::compute_tcp_checksum(const IPv4Address& source, const IPv4Address& destination, const TCPPacket& packet, u16 payload_size)
{
struct [[gnu::packed]] PseudoHeader
{
struct [[gnu::packed]] PseudoHeader {
IPv4Address source;
IPv4Address destination;
u8 zero;

View file

@ -30,8 +30,7 @@
namespace Kernel {
class [[gnu::packed]] UDPPacket
{
class [[gnu::packed]] UDPPacket {
public:
UDPPacket() { }
~UDPPacket() { }