summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-09-05 01:00:46 -0700
committerAndreas Kling <kling@serenityos.org>2021-09-05 20:08:57 +0200
commit3e45c3ed9070209f0114391eb8293fdb4134f14b (patch)
tree06a273a78999863490a0e67ee459225f917f8a35
parent472454cdeda1ab87e879670f44993960013973ff (diff)
downloadserenity-3e45c3ed9070209f0114391eb8293fdb4134f14b.zip
Userland: Switch static_assert of type sizes to AK::AssertSize
-rw-r--r--Userland/DevTools/UserspaceEmulator/SoftFPU.h2
-rw-r--r--Userland/Libraries/LibGfx/BitmapFont.cpp2
-rw-r--r--Userland/Libraries/LibGfx/ICOLoader.cpp4
-rw-r--r--Userland/Libraries/LibGfx/PNGLoader.cpp4
-rw-r--r--Userland/Utilities/ntpquery.cpp2
5 files changed, 7 insertions, 7 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/SoftFPU.h b/Userland/DevTools/UserspaceEmulator/SoftFPU.h
index ff4cfd40d8..b5b8b9672b 100644
--- a/Userland/DevTools/UserspaceEmulator/SoftFPU.h
+++ b/Userland/DevTools/UserspaceEmulator/SoftFPU.h
@@ -28,7 +28,7 @@ union MMX {
i16x4 v16u;
i32x2 v32u;
};
-static_assert(sizeof(MMX) == sizeof(u64));
+static_assert(AssertSize<MMX, sizeof(u64)>());
class SoftFPU final {
public:
diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp
index 6a0da2fd3e..875a13ddda 100644
--- a/Userland/Libraries/LibGfx/BitmapFont.cpp
+++ b/Userland/Libraries/LibGfx/BitmapFont.cpp
@@ -29,7 +29,7 @@ struct [[gnu::packed]] FontFileHeader {
u16 unused;
};
-static_assert(sizeof(FontFileHeader) == 80);
+static_assert(AssertSize<FontFileHeader, 80>());
NonnullRefPtr<Font> BitmapFont::clone() const
{
diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp
index 2bb9d26cc5..cc0ee6dc05 100644
--- a/Userland/Libraries/LibGfx/ICOLoader.cpp
+++ b/Userland/Libraries/LibGfx/ICOLoader.cpp
@@ -23,7 +23,7 @@ struct ICONDIR {
u16 must_be_1 = 0;
u16 image_count = 0;
};
-static_assert(sizeof(ICONDIR) == 6);
+static_assert(AssertSize<ICONDIR, 6>());
struct ICONDIRENTRY {
u8 width;
@@ -35,7 +35,7 @@ struct ICONDIRENTRY {
u32 size;
u32 offset;
};
-static_assert(sizeof(ICONDIRENTRY) == 16);
+static_assert(AssertSize<ICONDIRENTRY, 16>());
struct [[gnu::packed]] BMPFILEHEADER {
u8 signature[2];
diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp
index af507efa35..2f3512a831 100644
--- a/Userland/Libraries/LibGfx/PNGLoader.cpp
+++ b/Userland/Libraries/LibGfx/PNGLoader.cpp
@@ -36,7 +36,7 @@ struct PNG_IHDR {
u8 interlace_method { 0 };
};
-static_assert(sizeof(PNG_IHDR) == 13);
+static_assert(AssertSize<PNG_IHDR, 13>());
struct Scanline {
u8 filter { 0 };
@@ -211,7 +211,7 @@ union [[gnu::packed]] Pixel {
u8 a;
};
};
-static_assert(sizeof(Pixel) == 4);
+static_assert(AssertSize<Pixel, 4>());
template<bool has_alpha, u8 filter_type>
ALWAYS_INLINE static void unfilter_impl(Gfx::Bitmap& bitmap, int y, const void* dummy_scanline_data)
diff --git a/Userland/Utilities/ntpquery.cpp b/Userland/Utilities/ntpquery.cpp
index a4c36ae616..e764853354 100644
--- a/Userland/Utilities/ntpquery.cpp
+++ b/Userland/Utilities/ntpquery.cpp
@@ -46,7 +46,7 @@ struct [[gnu::packed]] NtpPacket {
uint8_t version_number() const { return (li_vn_mode >> 3) & 7; }
uint8_t mode() const { return li_vn_mode & 7; }
};
-static_assert(sizeof(NtpPacket) == 48);
+static_assert(AssertSize<NtpPacket, 48>());
// NTP measures time in seconds since 1900-01-01, POSIX in seconds since 1970-01-01.
// 1900 wasn't a leap year, so there are 70/4 leap years between 1900 and 1970.