mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:47:35 +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:
parent
2568a93b5d
commit
bbe787a0af
54 changed files with 130 additions and 230 deletions
|
@ -64,8 +64,7 @@ int closedir(DIR* dirp)
|
|||
return rc;
|
||||
}
|
||||
|
||||
struct [[gnu::packed]] sys_dirent
|
||||
{
|
||||
struct [[gnu::packed]] sys_dirent {
|
||||
ino_t ino;
|
||||
u8 file_type;
|
||||
size_t namelen;
|
||||
|
|
|
@ -47,6 +47,8 @@ struct ifreq {
|
|||
void* ifru_data;
|
||||
unsigned int ifru_index;
|
||||
} ifr_ifru;
|
||||
|
||||
// clang-format off
|
||||
#define ifr_addr ifr_ifru.ifru_addr // address
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr // other end of p-to-p link
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr // broadcast address
|
||||
|
@ -63,6 +65,7 @@ struct ifreq {
|
|||
#define ifr_index ifr_ifru.ifru_index // interface index
|
||||
#define ifr_llprio ifr_ifru.ifru_metric // link layer priority
|
||||
#define ifr_hwaddr ifr_ifru.ifru_hwaddr // MAC address
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -101,6 +101,7 @@ enum __RegexAllFlags {
|
|||
__Regex_Last = __Regex_SkipTrimEmptyMatches
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
// Values for the cflags parameter to the regcomp() function:
|
||||
#define REG_EXTENDED __Regex_Extended // Use Extended Regular Expressions.
|
||||
#define REG_ICASE __Regex_Insensitive // Ignore case in match.
|
||||
|
@ -114,6 +115,7 @@ enum __RegexAllFlags {
|
|||
|
||||
//static_assert (sizeof(FlagsUnderlyingType) * 8 >= regex::POSIXFlags::Last << 1), "flags type too small")
|
||||
#define REG_SEARCH __Regex_Last << 1
|
||||
// clang-format on
|
||||
|
||||
int regcomp(regex_t*, const char*, int);
|
||||
int regexec(const regex_t*, const char*, size_t, regmatch_t[], int);
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
|
||||
#include <AK/Types.h>
|
||||
|
||||
struct [[gnu::packed]] PtraceRegisters
|
||||
{
|
||||
struct [[gnu::packed]] PtraceRegisters {
|
||||
u32 eax;
|
||||
u32 ecx;
|
||||
u32 edx;
|
||||
|
|
|
@ -45,8 +45,7 @@ public:
|
|||
static Optional<ByteBuffer> decompress_all(ReadonlyBytes);
|
||||
|
||||
private:
|
||||
struct [[gnu::packed]] BlockHeader
|
||||
{
|
||||
struct [[gnu::packed]] BlockHeader {
|
||||
u8 identification_1;
|
||||
u8 identification_2;
|
||||
u8 compression_method;
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
|
||||
namespace Debug::Dwarf {
|
||||
|
||||
struct [[gnu::packed]] CompilationUnitHeader
|
||||
{
|
||||
struct [[gnu::packed]] CompilationUnitHeader {
|
||||
u32 length;
|
||||
u16 version;
|
||||
u32 abbrev_offset;
|
||||
|
@ -287,8 +286,7 @@ enum class AttributeDataForm : u8 {
|
|||
AddrX4 = 0x2c
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] AttributeSpecification
|
||||
{
|
||||
struct [[gnu::packed]] AttributeSpecification {
|
||||
Attribute attribute;
|
||||
AttributeDataForm form;
|
||||
};
|
||||
|
|
|
@ -57,8 +57,7 @@ private:
|
|||
void handle_standard_opcode(u8 opcode);
|
||||
void handle_sepcial_opcode(u8 opcode);
|
||||
|
||||
struct [[gnu::packed]] UnitHeader32
|
||||
{
|
||||
struct [[gnu::packed]] UnitHeader32 {
|
||||
u32 length;
|
||||
u16 version;
|
||||
u32 header_length;
|
||||
|
|
|
@ -40,6 +40,7 @@ typedef struct
|
|||
} a_un;
|
||||
} auxv_t;
|
||||
|
||||
// clang-format off
|
||||
#define AT_NULL 0 /* No length, last entry's a_type has this value */
|
||||
#define AT_IGNORE 1 /* Entry has no meaning, a_un undefined */
|
||||
#define AT_EXECFD 2 /* a_val contains a file descriptor of the main program image */
|
||||
|
@ -65,6 +66,7 @@ typedef struct
|
|||
#define AT_EXECFN 31 /* a_ptr points to file name of executed program */
|
||||
#define AT_EXE_BASE 32 /* a_ptr holds base address where main program was loaded into memory */
|
||||
#define AT_EXE_SIZE 33 /* a_val holds the size of the main program in memory */
|
||||
// clang-format on
|
||||
|
||||
namespace ELF {
|
||||
|
||||
|
|
|
@ -32,8 +32,7 @@
|
|||
|
||||
namespace ELF::Core {
|
||||
|
||||
struct [[gnu::packed]] NotesEntryHeader
|
||||
{
|
||||
struct [[gnu::packed]] NotesEntryHeader {
|
||||
enum Type : u8 {
|
||||
Null = 0, // Terminates segment
|
||||
ProcessInfo,
|
||||
|
@ -44,28 +43,24 @@ struct [[gnu::packed]] NotesEntryHeader
|
|||
Type type;
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] NotesEntry
|
||||
{
|
||||
struct [[gnu::packed]] NotesEntry {
|
||||
NotesEntryHeader header;
|
||||
char data[];
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] ProcessInfo
|
||||
{
|
||||
struct [[gnu::packed]] ProcessInfo {
|
||||
NotesEntryHeader header;
|
||||
int pid;
|
||||
char executable_path[]; // Null terminated
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] ThreadInfo
|
||||
{
|
||||
struct [[gnu::packed]] ThreadInfo {
|
||||
NotesEntryHeader header;
|
||||
int tid;
|
||||
PtraceRegisters regs;
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] MemoryRegionInfo
|
||||
{
|
||||
struct [[gnu::packed]] MemoryRegionInfo {
|
||||
NotesEntryHeader header;
|
||||
uint32_t region_start;
|
||||
uint32_t region_end;
|
||||
|
@ -83,8 +78,7 @@ struct [[gnu::packed]] MemoryRegionInfo
|
|||
}
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] Metadata
|
||||
{
|
||||
struct [[gnu::packed]] Metadata {
|
||||
NotesEntryHeader header;
|
||||
char json_data[]; // Null terminated
|
||||
};
|
||||
|
|
|
@ -44,8 +44,7 @@
|
|||
|
||||
namespace Gfx {
|
||||
|
||||
struct [[gnu::packed]] FontFileHeader
|
||||
{
|
||||
struct [[gnu::packed]] FontFileHeader {
|
||||
char magic[4];
|
||||
u8 glyph_width;
|
||||
u8 glyph_height;
|
||||
|
|
|
@ -60,8 +60,7 @@ struct ICONDIRENTRY {
|
|||
};
|
||||
static_assert(sizeof(ICONDIRENTRY) == 16);
|
||||
|
||||
struct [[gnu::packed]] BMPFILEHEADER
|
||||
{
|
||||
struct [[gnu::packed]] BMPFILEHEADER {
|
||||
u8 signature[2];
|
||||
u32 size;
|
||||
u16 reserved1;
|
||||
|
@ -85,8 +84,7 @@ struct BITMAPINFOHEADER {
|
|||
};
|
||||
static_assert(sizeof(BITMAPINFOHEADER) == 40);
|
||||
|
||||
struct [[gnu::packed]] BMP_ARGB
|
||||
{
|
||||
struct [[gnu::packed]] BMP_ARGB {
|
||||
u8 b;
|
||||
u8 g;
|
||||
u8 r;
|
||||
|
|
|
@ -64,8 +64,7 @@ struct Scanline {
|
|||
ReadonlyBytes data {};
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] PaletteEntry
|
||||
{
|
||||
struct [[gnu::packed]] PaletteEntry {
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
|
@ -73,23 +72,20 @@ struct [[gnu::packed]] PaletteEntry
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
struct [[gnu::packed]] Tuple
|
||||
{
|
||||
struct [[gnu::packed]] Tuple {
|
||||
T gray;
|
||||
T a;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct [[gnu::packed]] Triplet
|
||||
{
|
||||
struct [[gnu::packed]] Triplet {
|
||||
T r;
|
||||
T g;
|
||||
T b;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct [[gnu::packed]] Quad
|
||||
{
|
||||
struct [[gnu::packed]] Quad {
|
||||
T r;
|
||||
T g;
|
||||
T b;
|
||||
|
@ -227,8 +223,7 @@ ALWAYS_INLINE static u8 paeth_predictor(int a, int b, int c)
|
|||
return c;
|
||||
}
|
||||
|
||||
union [[gnu::packed]] Pixel
|
||||
{
|
||||
union [[gnu::packed]] Pixel {
|
||||
RGBA32 rgba { 0 };
|
||||
u8 v[4];
|
||||
struct {
|
||||
|
|
|
@ -856,7 +856,8 @@ void Editor::handle_read_event()
|
|||
}
|
||||
reverse_tab = false;
|
||||
|
||||
auto completion_mode = m_times_tab_pressed == 1 ? SuggestionManager::CompletePrefix : m_times_tab_pressed == 2 ? SuggestionManager::ShowSuggestions : SuggestionManager::CycleSuggestions;
|
||||
auto completion_mode = m_times_tab_pressed == 1 ? SuggestionManager::CompletePrefix : m_times_tab_pressed == 2 ? SuggestionManager::ShowSuggestions
|
||||
: SuggestionManager::CycleSuggestions;
|
||||
|
||||
auto completion_result = m_suggestion_manager.attempt_completion(completion_mode, token_start);
|
||||
|
||||
|
|
|
@ -34,10 +34,7 @@ namespace AttributeNames {
|
|||
ENUMERATE_HTML_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_ATTRIBUTE
|
||||
|
||||
// clang-format off
|
||||
// FIXME: clang-format gets confused here. Why?
|
||||
[[gnu::constructor]] static void initialize()
|
||||
// clang-format off
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
if (s_initialized)
|
||||
|
|
|
@ -32,10 +32,7 @@ namespace Web::HTML::EventNames {
|
|||
ENUMERATE_HTML_EVENTS
|
||||
#undef __ENUMERATE_HTML_EVENT
|
||||
|
||||
// clang-format off
|
||||
// FIXME: clang-format gets confused here. Why?
|
||||
[[gnu::constructor]] static void initialize()
|
||||
// clang-format on
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
if (s_initialized)
|
||||
|
|
|
@ -32,10 +32,7 @@ namespace Web::HTML::TagNames {
|
|||
ENUMERATE_HTML_TAGS
|
||||
#undef __ENUMERATE_HTML_TAG
|
||||
|
||||
// clang-format off
|
||||
// FIXME: clang-format gets confused here. Why?
|
||||
[[gnu::constructor]] static void initialize()
|
||||
// clang-format on
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
if (s_initialized)
|
||||
|
|
|
@ -32,10 +32,7 @@ namespace Web::Namespace {
|
|||
ENUMERATE_NAMESPACES
|
||||
#undef __ENUMERATE_NAMESPACE
|
||||
|
||||
// clang-format off
|
||||
// FIXME: clang-format gets confused here. Why?
|
||||
[[gnu::constructor]] static void initialize()
|
||||
// clang-format on
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
if (s_initialized)
|
||||
|
|
|
@ -32,10 +32,7 @@ namespace Web::SVG::TagNames {
|
|||
ENUMERATE_SVG_TAGS
|
||||
#undef __ENUMERATE_SVG_TAG
|
||||
|
||||
// clang-format off
|
||||
// FIXME: clang-format gets confused here. Why?
|
||||
[[gnu::constructor]] static void initialize()
|
||||
// clang-format on
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
if (s_initialized)
|
||||
|
|
|
@ -32,10 +32,7 @@ namespace Web::UIEvents::EventNames {
|
|||
ENUMERATE_UI_EVENTS
|
||||
#undef __ENUMERATE_UI_EVENT
|
||||
|
||||
// clang-format off
|
||||
// FIXME: clang-format gets confused here. Why?
|
||||
[[gnu::constructor]] static void initialize()
|
||||
// clang-format on
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
if (s_initialized)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue