summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibC/netdb.cpp4
-rw-r--r--Userland/Libraries/LibC/time.cpp3
-rw-r--r--Userland/Libraries/LibGUI/Calendar.cpp13
-rw-r--r--Userland/Libraries/LibGUI/CheckBox.cpp6
-rw-r--r--Userland/Libraries/LibGUI/ColumnsView.cpp6
-rw-r--r--Userland/Libraries/LibGUI/FileIconProvider.cpp5
-rw-r--r--Userland/Libraries/LibGUI/ResizeCorner.cpp8
-rw-r--r--Userland/Libraries/LibGUI/Scrollbar.cpp8
-rw-r--r--Userland/Libraries/LibGfx/ClassicStylePainter.cpp6
-rw-r--r--Userland/Libraries/LibGfx/Color.h2
-rw-r--r--Userland/Libraries/LibGfx/GIFLoader.cpp10
-rw-r--r--Userland/Libraries/LibGfx/JPGLoader.cpp28
-rw-r--r--Userland/Libraries/LibGfx/PNGLoader.cpp16
-rw-r--r--Userland/Libraries/LibGfx/Painter.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp22
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.cpp2
-rw-r--r--Userland/Libraries/LibM/math.cpp30
-rw-r--r--Userland/Libraries/LibPthread/forward.cpp33
-rw-r--r--Userland/Libraries/LibRegex/RegexMatcher.h4
-rw-r--r--Userland/Libraries/LibVT/Attribute.h4
-rw-r--r--Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp3
-rw-r--r--Userland/Libraries/LibX86/Instruction.cpp2
-rw-r--r--Userland/Libraries/LibX86/Instruction.h10
23 files changed, 113 insertions, 114 deletions
diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp
index 33d17b5a21..77d0b790dd 100644
--- a/Userland/Libraries/LibC/netdb.cpp
+++ b/Userland/Libraries/LibC/netdb.cpp
@@ -36,7 +36,7 @@ static constexpr i32 lookup_server_endpoint_magic = 9001;
// Get service entry buffers and file information for the getservent() family of functions.
static FILE* services_file = nullptr;
-static constexpr char services_path[] = "/etc/services";
+static const char* services_path = "/etc/services";
static bool fill_getserv_buffers(const char* line, ssize_t read);
static servent __getserv_buffer;
@@ -50,7 +50,7 @@ static ssize_t service_file_offset = 0;
// Get protocol entry buffers and file information for the getprotent() family of functions.
static FILE* protocols_file = nullptr;
-static constexpr char protocols_path[] = "/etc/protocols";
+static const char* protocols_path = "/etc/protocols";
static bool fill_getproto_buffers(const char* line, ssize_t read);
static protoent __getproto_buffer;
diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp
index 738d8ea594..9add36bb76 100644
--- a/Userland/Libraries/LibC/time.cpp
+++ b/Userland/Libraries/LibC/time.cpp
@@ -70,9 +70,10 @@ char* ctime_r(const time_t* t, char* buf)
return asctime_r(localtime_r(t, &tm_buf), buf);
}
+static const int __seconds_per_day = 60 * 60 * 24;
+
static void time_to_tm(struct tm* tm, time_t t)
{
- constexpr int __seconds_per_day = 60 * 60 * 24;
int year = 1970;
for (; t >= days_in_year(year) * __seconds_per_day; ++year)
t -= days_in_year(year) * __seconds_per_day;
diff --git a/Userland/Libraries/LibGUI/Calendar.cpp b/Userland/Libraries/LibGUI/Calendar.cpp
index 0156109e43..229b036551 100644
--- a/Userland/Libraries/LibGUI/Calendar.cpp
+++ b/Userland/Libraries/LibGUI/Calendar.cpp
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <AK/Array.h>
#include <LibCore/DateTime.h>
#include <LibGUI/Calendar.h>
#include <LibGUI/Painter.h>
@@ -17,21 +16,21 @@ REGISTER_WIDGET(GUI, Calendar);
namespace GUI {
-static constexpr Array long_day_names = {
+static const char* long_day_names[] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
};
-static constexpr Array short_day_names = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
-static constexpr Array mini_day_names = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" };
-static constexpr Array micro_day_names = { "S", "M", "T", "W", "T", "F", "S" };
+static const char* short_day_names[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+static const char* mini_day_names[] = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" };
+static const char* micro_day_names[] = { "S", "M", "T", "W", "T", "F", "S" };
-static constexpr Array long_month_names = {
+static const char* long_month_names[] = {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
-static constexpr Array short_month_names = {
+static const char* short_month_names[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
diff --git a/Userland/Libraries/LibGUI/CheckBox.cpp b/Userland/Libraries/LibGUI/CheckBox.cpp
index 8de1c2f0a4..2cfd26d88c 100644
--- a/Userland/Libraries/LibGUI/CheckBox.cpp
+++ b/Userland/Libraries/LibGUI/CheckBox.cpp
@@ -15,9 +15,9 @@ REGISTER_WIDGET(GUI, CheckBox)
namespace GUI {
-static constexpr int s_box_width = 13;
-static constexpr int s_box_height = 13;
-static constexpr int s_horizontal_padding = 6;
+static const int s_box_width = 13;
+static const int s_box_height = 13;
+static const int s_horizontal_padding = 6;
CheckBox::CheckBox(String text)
: AbstractButton(move(text))
diff --git a/Userland/Libraries/LibGUI/ColumnsView.cpp b/Userland/Libraries/LibGUI/ColumnsView.cpp
index cef7c89cc4..4c198aa652 100644
--- a/Userland/Libraries/LibGUI/ColumnsView.cpp
+++ b/Userland/Libraries/LibGUI/ColumnsView.cpp
@@ -13,7 +13,7 @@
namespace GUI {
-static constexpr char s_arrow_bitmap_data[] = {
+static const char* s_arrow_bitmap_data = {
" "
" # "
" ## "
@@ -24,8 +24,8 @@ static constexpr char s_arrow_bitmap_data[] = {
" # "
" "
};
-static constexpr int s_arrow_bitmap_width = 9;
-static constexpr int s_arrow_bitmap_height = 9;
+static const int s_arrow_bitmap_width = 9;
+static const int s_arrow_bitmap_height = 9;
ColumnsView::ColumnsView()
{
diff --git a/Userland/Libraries/LibGUI/FileIconProvider.cpp b/Userland/Libraries/LibGUI/FileIconProvider.cpp
index 8015596798..bff9ed0b10 100644
--- a/Userland/Libraries/LibGUI/FileIconProvider.cpp
+++ b/Userland/Libraries/LibGUI/FileIconProvider.cpp
@@ -169,10 +169,7 @@ Icon FileIconProvider::icon_for_executable(const String& path)
int image_size;
};
- constexpr Array icon_sections = {
- IconSection { .section_name = "serenity_icon_s", .image_size = 16 },
- IconSection { .section_name = "serenity_icon_m", .image_size = 32 }
- };
+ static const IconSection icon_sections[] = { { .section_name = "serenity_icon_s", .image_size = 16 }, { .section_name = "serenity_icon_m", .image_size = 32 } };
bool had_error = false;
for (const auto& icon_section : icon_sections) {
diff --git a/Userland/Libraries/LibGUI/ResizeCorner.cpp b/Userland/Libraries/LibGUI/ResizeCorner.cpp
index 58ef6eb9c0..d4bb24455f 100644
--- a/Userland/Libraries/LibGUI/ResizeCorner.cpp
+++ b/Userland/Libraries/LibGUI/ResizeCorner.cpp
@@ -12,7 +12,7 @@
namespace GUI {
-static constexpr char s_resize_corner_shadows_data[] = {
+static const char* s_resize_corner_shadows_data = {
" "
" ## "
" # "
@@ -31,7 +31,7 @@ static constexpr char s_resize_corner_shadows_data[] = {
" "
};
-static constexpr char s_resize_corner_highlights_data[] = {
+static const char* s_resize_corner_highlights_data = {
" "
" "
" # "
@@ -52,8 +52,8 @@ static constexpr char s_resize_corner_highlights_data[] = {
static Gfx::CharacterBitmap* s_resize_corner_shadows_bitmap;
static Gfx::CharacterBitmap* s_resize_corner_highlights_bitmap;
-static constexpr int s_resize_corner_bitmap_width = 16;
-static constexpr int s_resize_corner_bitmap_height = 16;
+static const int s_resize_corner_bitmap_width = 16;
+static const int s_resize_corner_bitmap_height = 16;
ResizeCorner::ResizeCorner()
{
diff --git a/Userland/Libraries/LibGUI/Scrollbar.cpp b/Userland/Libraries/LibGUI/Scrollbar.cpp
index 74703b9470..199443e136 100644
--- a/Userland/Libraries/LibGUI/Scrollbar.cpp
+++ b/Userland/Libraries/LibGUI/Scrollbar.cpp
@@ -15,7 +15,7 @@ REGISTER_WIDGET(GUI, Scrollbar)
namespace GUI {
-static constexpr char s_up_arrow_bitmap_data[] = {
+static const char* s_up_arrow_bitmap_data = {
" "
" # "
" ### "
@@ -27,7 +27,7 @@ static constexpr char s_up_arrow_bitmap_data[] = {
" "
};
-static constexpr char s_down_arrow_bitmap_data[] = {
+static const char* s_down_arrow_bitmap_data = {
" "
" ### "
" ### "
@@ -39,7 +39,7 @@ static constexpr char s_down_arrow_bitmap_data[] = {
" "
};
-static constexpr char s_left_arrow_bitmap_data[] = {
+static const char* s_left_arrow_bitmap_data = {
" "
" # "
" ## "
@@ -51,7 +51,7 @@ static constexpr char s_left_arrow_bitmap_data[] = {
" "
};
-static constexpr char s_right_arrow_bitmap_data[] = {
+static const char* s_right_arrow_bitmap_data = {
" "
" # "
" ## "
diff --git a/Userland/Libraries/LibGfx/ClassicStylePainter.cpp b/Userland/Libraries/LibGfx/ClassicStylePainter.cpp
index 8fa1479e3d..6509350f58 100644
--- a/Userland/Libraries/LibGfx/ClassicStylePainter.cpp
+++ b/Userland/Libraries/LibGfx/ClassicStylePainter.cpp
@@ -354,7 +354,7 @@ void ClassicStylePainter::paint_radio_button(Painter& painter, const IntRect& re
painter.blit(rect.location(), bitmap, bitmap.rect());
}
-static constexpr char s_checked_bitmap_data[] = {
+static const char* s_checked_bitmap_data = {
" "
" # "
" ## "
@@ -367,8 +367,8 @@ static constexpr char s_checked_bitmap_data[] = {
};
static Gfx::CharacterBitmap* s_checked_bitmap;
-static constexpr int s_checked_bitmap_width = 9;
-static constexpr int s_checked_bitmap_height = 9;
+static const int s_checked_bitmap_width = 9;
+static const int s_checked_bitmap_height = 9;
void ClassicStylePainter::paint_check_box(Painter& painter, const IntRect& rect, const Palette& palette, bool is_enabled, bool is_checked, bool is_being_pressed)
{
diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h
index 5c0b9b6aa1..f3f2f98a09 100644
--- a/Userland/Libraries/LibGfx/Color.h
+++ b/Userland/Libraries/LibGfx/Color.h
@@ -140,7 +140,7 @@ public:
#endif
}
- Color interpolate(const Color& other, float weight) const
+ constexpr Color interpolate(const Color& other, float weight) const
{
u8 r = red() + roundf(static_cast<float>(other.red() - red()) * weight);
u8 g = green() + roundf(static_cast<float>(other.green() - green()) * weight);
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index 7c1d55ba37..d8b60c0dbb 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -19,6 +19,10 @@
namespace Gfx {
+// Row strides and offsets for each interlace pass.
+static const int INTERLACE_ROW_STRIDES[] = { 8, 8, 4, 2 };
+static const int INTERLACE_ROW_OFFSETS[] = { 0, 4, 2, 1 };
+
struct ImageDescriptor {
u16 x { 0 };
u16 y { 0 };
@@ -108,8 +112,8 @@ enum class GIFFormat {
static Optional<GIFFormat> decode_gif_header(InputMemoryStream& stream)
{
- constexpr char valid_header_87[] = "GIF87a";
- constexpr char valid_header_89[] = "GIF89a";
+ static const char valid_header_87[] = "GIF87a";
+ static const char valid_header_89[] = "GIF89a";
Array<u8, 6> header;
stream >> header;
@@ -374,8 +378,6 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index)
if (pixel_index % image.width == 0) {
if (image.interlaced) {
if (interlace_pass < 4) {
- constexpr Array INTERLACE_ROW_STRIDES = { 8, 8, 4, 2 };
- constexpr Array INTERLACE_ROW_OFFSETS = { 0, 4, 2, 1 };
if (row + INTERLACE_ROW_STRIDES[interlace_pass] >= image.height) {
++interlace_pass;
if (interlace_pass < 4)
diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp
index d2b80a6f55..1c2aefc209 100644
--- a/Userland/Libraries/LibGfx/JPGLoader.cpp
+++ b/Userland/Libraries/LibGfx/JPGLoader.cpp
@@ -861,20 +861,20 @@ static void dequantize(JPGLoadingContext& context, Vector<Macroblock>& macrobloc
static void inverse_dct(const JPGLoadingContext& context, Vector<Macroblock>& macroblocks)
{
- const float m0 = 2.0 * cos(1.0 / 16.0 * 2.0 * M_PI);
- const float m1 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
- const float m3 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
- const float m5 = 2.0 * cos(3.0 / 16.0 * 2.0 * M_PI);
- const float m2 = m0 - m5;
- const float m4 = m0 + m5;
- const float s0 = cos(0.0 / 16.0 * M_PI) / sqrt(8);
- const float s1 = cos(1.0 / 16.0 * M_PI) / 2.0;
- const float s2 = cos(2.0 / 16.0 * M_PI) / 2.0;
- const float s3 = cos(3.0 / 16.0 * M_PI) / 2.0;
- const float s4 = cos(4.0 / 16.0 * M_PI) / 2.0;
- const float s5 = cos(5.0 / 16.0 * M_PI) / 2.0;
- const float s6 = cos(6.0 / 16.0 * M_PI) / 2.0;
- const float s7 = cos(7.0 / 16.0 * M_PI) / 2.0;
+ static const float m0 = 2.0 * cos(1.0 / 16.0 * 2.0 * M_PI);
+ static const float m1 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
+ static const float m3 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
+ static const float m5 = 2.0 * cos(3.0 / 16.0 * 2.0 * M_PI);
+ static const float m2 = m0 - m5;
+ static const float m4 = m0 + m5;
+ static const float s0 = cos(0.0 / 16.0 * M_PI) / sqrt(8);
+ static const float s1 = cos(1.0 / 16.0 * M_PI) / 2.0;
+ static const float s2 = cos(2.0 / 16.0 * M_PI) / 2.0;
+ static const float s3 = cos(3.0 / 16.0 * M_PI) / 2.0;
+ static const float s4 = cos(4.0 / 16.0 * M_PI) / 2.0;
+ static const float s5 = cos(5.0 / 16.0 * M_PI) / 2.0;
+ static const float s6 = cos(6.0 / 16.0 * M_PI) / 2.0;
+ static const float s7 = cos(7.0 / 16.0 * M_PI) / 2.0;
for (u32 vcursor = 0; vcursor < context.mblock_meta.vcount; vcursor += context.vsample_factor) {
for (u32 hcursor = 0; hcursor < context.mblock_meta.hcount; hcursor += context.hsample_factor) {
diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp
index 4cb37a0714..31d62d9e5d 100644
--- a/Userland/Libraries/LibGfx/PNGLoader.cpp
+++ b/Userland/Libraries/LibGfx/PNGLoader.cpp
@@ -25,7 +25,7 @@
namespace Gfx {
-static constexpr Array png_header = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 };
+static const u8 png_header[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 };
struct PNG_IHDR {
NetworkOrdered<u32> width;
@@ -512,7 +512,7 @@ static bool decode_png_header(PNGLoadingContext& context)
return false;
}
- if (memcmp(context.data, png_header.data(), sizeof(png_header)) != 0) {
+ if (memcmp(context.data, png_header, sizeof(png_header)) != 0) {
dbgln_if(PNG_DEBUG, "Invalid PNG header");
context.state = PNGLoadingContext::State::Error;
return false;
@@ -661,14 +661,14 @@ static int adam7_width(PNGLoadingContext& context, int pass)
}
}
+// Index 0 unused (non-interlaced case)
+static int adam7_starty[8] = { 0, 0, 0, 4, 0, 2, 0, 1 };
+static int adam7_startx[8] = { 0, 0, 4, 0, 2, 0, 1, 0 };
+static int adam7_stepy[8] = { 1, 8, 8, 8, 4, 4, 2, 2 };
+static int adam7_stepx[8] = { 1, 8, 8, 4, 4, 2, 2, 1 };
+
static bool decode_adam7_pass(PNGLoadingContext& context, Streamer& streamer, int pass)
{
- // Index 0 unused (non-interlaced case)
- constexpr Array adam7_starty = { 0, 0, 0, 4, 0, 2, 0, 1 };
- constexpr Array adam7_startx = { 0, 0, 4, 0, 2, 0, 1, 0 };
- constexpr Array adam7_stepy = { 1, 8, 8, 8, 4, 4, 2, 2 };
- constexpr Array adam7_stepx = { 1, 8, 8, 4, 4, 2, 2, 1 };
-
PNGLoadingContext subimage_context;
subimage_context.width = adam7_width(context, pass);
subimage_context.height = adam7_height(context, pass);
diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp
index 1ccbbdcf43..89bec0cf58 100644
--- a/Userland/Libraries/LibGfx/Painter.cpp
+++ b/Userland/Libraries/LibGfx/Painter.cpp
@@ -1476,7 +1476,7 @@ void do_draw_text(const IntRect& rect, const TextType& text, const Font& font, T
lines.append(line);
}
- constexpr int line_spacing = 4;
+ static const int line_spacing = 4;
int line_height = font.glyph_height() + line_spacing;
IntRect bounding_rect { 0, 0, 0, (static_cast<int>(lines.size()) * line_height) - line_spacing };
diff --git a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp
index cb935a09f5..cfc793ee09 100644
--- a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp
@@ -5,7 +5,6 @@
*/
#include <AK/Function.h>
-#include <AK/StringView.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/NumberObject.h>
@@ -13,6 +12,17 @@
namespace JS {
+static const u8 max_precision_for_radix[37] = {
+ // clang-format off
+ 0, 0, 52, 32, 26, 22, 20, 18, 17, 16,
+ 15, 15, 14, 14, 13, 13, 13, 12, 12, 12,
+ 12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10,
+ // clang-format on
+};
+
+static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+
NumberPrototype::NumberPrototype(GlobalObject& global_object)
: NumberObject(0, *global_object.object_prototype())
{
@@ -31,8 +41,6 @@ NumberPrototype::~NumberPrototype()
JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
{
- constexpr StringView digits = "0123456789abcdefghijklmnopqrstuvwxyz";
-
Value number_value;
auto this_value = vm.this_value(global_object);
@@ -99,14 +107,6 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
if (decimal_part != 0.0) {
characters.append('.');
- constexpr u8 max_precision_for_radix[37] = {
- // clang-format off
- 0, 0, 52, 32, 26, 22, 20, 18, 17, 16,
- 15, 15, 14, 14, 13, 13, 13, 12, 12, 12,
- 12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10,
- // clang-format on
- };
u8 precision = max_precision_for_radix[radix];
for (u8 i = 0; i < precision; ++i) {
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp
index fef9fb123b..98a8c0eec2 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Value.cpp
@@ -37,7 +37,7 @@
namespace JS {
// Used in various abstract operations to make it obvious when a non-optional return value must be discarded.
-static constexpr double INVALID { 0 };
+static const double INVALID { 0 };
static inline bool same_type_for_equality(const Value& lhs, const Value& rhs)
{
diff --git a/Userland/Libraries/LibM/math.cpp b/Userland/Libraries/LibM/math.cpp
index ed0a62ab50..1ce7cebb53 100644
--- a/Userland/Libraries/LibM/math.cpp
+++ b/Userland/Libraries/LibM/math.cpp
@@ -56,11 +56,11 @@ union FloatExtractor;
// This assumes long double is 80 bits, which is true with GCC on Intel platforms
template<>
union FloatExtractor<long double> {
- static constexpr int mantissa_bits = 64;
- static constexpr unsigned long long mantissa_max = ~0u;
- static constexpr int exponent_bias = 16383;
- static constexpr int exponent_bits = 15;
- static constexpr unsigned exponent_max = 32767;
+ static const int mantissa_bits = 64;
+ static const unsigned long long mantissa_max = ~0u;
+ static const int exponent_bias = 16383;
+ static const int exponent_bits = 15;
+ static const unsigned exponent_max = 32767;
struct {
unsigned long long mantissa;
unsigned exponent : 15;
@@ -72,11 +72,11 @@ union FloatExtractor<long double> {
template<>
union FloatExtractor<double> {
- static constexpr int mantissa_bits = 52;
- static constexpr unsigned long long mantissa_max = (1ull << 52) - 1;
- static constexpr int exponent_bias = 1023;
- static constexpr int exponent_bits = 11;
- static constexpr unsigned exponent_max = 2047;
+ static const int mantissa_bits = 52;
+ static const unsigned long long mantissa_max = (1ull << 52) - 1;
+ static const int exponent_bias = 1023;
+ static const int exponent_bits = 11;
+ static const unsigned exponent_max = 2047;
struct {
unsigned long long mantissa : 52;
unsigned exponent : 11;
@@ -87,11 +87,11 @@ union FloatExtractor<double> {
template<>
union FloatExtractor<float> {
- static constexpr int mantissa_bits = 23;
- static constexpr unsigned mantissa_max = (1 << 23) - 1;
- static constexpr int exponent_bias = 127;
- static constexpr int exponent_bits = 8;
- static constexpr unsigned exponent_max = 255;
+ static const int mantissa_bits = 23;
+ static const unsigned mantissa_max = (1 << 23) - 1;
+ static const int exponent_bias = 127;
+ static const int exponent_bits = 8;
+ static const unsigned exponent_max = 255;
struct {
unsigned long long mantissa : 23;
unsigned exponent : 8;
diff --git a/Userland/Libraries/LibPthread/forward.cpp b/Userland/Libraries/LibPthread/forward.cpp
index f44e2ce329..5d7eae2bc5 100644
--- a/Userland/Libraries/LibPthread/forward.cpp
+++ b/Userland/Libraries/LibPthread/forward.cpp
@@ -6,24 +6,25 @@
#include <LibC/bits/pthread_forward.h>
-[[gnu::constructor]] static void forward_pthread_functions()
-{
- constexpr PthreadFunctions s_functions = {
- .pthread_mutex_trylock = pthread_mutex_trylock,
- .pthread_mutex_destroy = pthread_mutex_destroy,
+static const PthreadFunctions s_functions = {
+ .pthread_mutex_trylock = pthread_mutex_trylock,
+ .pthread_mutex_destroy = pthread_mutex_destroy,
+
+ .pthread_mutexattr_init = pthread_mutexattr_init,
+ .pthread_mutexattr_settype = pthread_mutexattr_settype,
+ .pthread_mutexattr_destroy = pthread_mutexattr_destroy,
- .pthread_mutexattr_init = pthread_mutexattr_init,
- .pthread_mutexattr_settype = pthread_mutexattr_settype,
- .pthread_mutexattr_destroy = pthread_mutexattr_destroy,
+ .pthread_once = pthread_once,
- .pthread_once = pthread_once,
+ .pthread_cond_broadcast = pthread_cond_broadcast,
+ .pthread_cond_init = pthread_cond_init,
+ .pthread_cond_signal = pthread_cond_signal,
+ .pthread_cond_wait = pthread_cond_wait,
+ .pthread_cond_destroy = pthread_cond_destroy,
+ .pthread_cond_timedwait = pthread_cond_timedwait,
+};
- .pthread_cond_broadcast = pthread_cond_broadcast,
- .pthread_cond_init = pthread_cond_init,
- .pthread_cond_signal = pthread_cond_signal,
- .pthread_cond_wait = pthread_cond_wait,
- .pthread_cond_destroy = pthread_cond_destroy,
- .pthread_cond_timedwait = pthread_cond_timedwait,
- };
+[[gnu::constructor]] static void forward_pthread_functions()
+{
__init_pthread_forward(s_functions);
}
diff --git a/Userland/Libraries/LibRegex/RegexMatcher.h b/Userland/Libraries/LibRegex/RegexMatcher.h
index c6a30ff7be..4be02b2ec1 100644
--- a/Userland/Libraries/LibRegex/RegexMatcher.h
+++ b/Userland/Libraries/LibRegex/RegexMatcher.h
@@ -23,8 +23,8 @@
namespace regex {
-static constexpr size_t c_max_recursion = 5000;
-static constexpr size_t c_match_preallocation_count = 0;
+static const constexpr size_t c_max_recursion = 5000;
+static const constexpr size_t c_match_preallocation_count = 0;
struct RegexResult final {
bool success { false };
diff --git a/Userland/Libraries/LibVT/Attribute.h b/Userland/Libraries/LibVT/Attribute.h
index 349fee689c..c5d154e5c0 100644
--- a/Userland/Libraries/LibVT/Attribute.h
+++ b/Userland/Libraries/LibVT/Attribute.h
@@ -16,8 +16,8 @@ namespace VT {
struct Attribute {
Attribute() { reset(); }
- static constexpr u32 default_foreground_color = xterm_colors[7];
- static constexpr u32 default_background_color = xterm_colors[0];
+ static const u32 default_foreground_color = xterm_colors[7];
+ static const u32 default_background_color = xterm_colors[0];
void reset()
{
diff --git a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp
index f5a07bc667..10d37206a9 100644
--- a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp
+++ b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp
@@ -5,7 +5,6 @@
*/
#include "ParsedCookie.h"
-#include <AK/Array.h>
#include <AK/StdLibExtras.h>
#include <AK/Vector.h>
#include <LibIPC/Decoder.h>
@@ -265,7 +264,7 @@ Optional<Core::DateTime> parse_date_time(StringView date_string)
};
auto parse_month = [&](StringView token) {
- constexpr Array months { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" };
+ static const char* months[] { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" };
for (unsigned i = 0; i < 12; ++i) {
if (token.equals_ignoring_case(months[i])) {
diff --git a/Userland/Libraries/LibX86/Instruction.cpp b/Userland/Libraries/LibX86/Instruction.cpp
index cfcdd6b45a..a0d74c23cf 100644
--- a/Userland/Libraries/LibX86/Instruction.cpp
+++ b/Userland/Libraries/LibX86/Instruction.cpp
@@ -100,7 +100,7 @@ static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, Ins
case OP_AX_moff16:
case OP_EAX_moff32:
case OP_NEAR_imm:
- d.imm1_bytes = InstructionDescriptor::CurrentAddressSize;
+ d.imm1_bytes = CurrentAddressSize;
break;
//default:
case InvalidFormat:
diff --git a/Userland/Libraries/LibX86/Instruction.h b/Userland/Libraries/LibX86/Instruction.h
index f34e63ee53..b65b573e26 100644
--- a/Userland/Libraries/LibX86/Instruction.h
+++ b/Userland/Libraries/LibX86/Instruction.h
@@ -28,9 +28,9 @@ protected:
template<typename T>
struct TypeTrivia {
- static constexpr size_t bits = sizeof(T) * 8;
- static constexpr T sign_bit = 1 << (bits - 1);
- static constexpr T mask = MakeUnsigned<T>(-1);
+ static const size_t bits = sizeof(T) * 8;
+ static const T sign_bit = 1 << (bits - 1);
+ static const T mask = MakeUnsigned<T>(-1);
};
template<typename T, typename U>
@@ -159,9 +159,9 @@ enum InstructionFormat {
OP_NEAR_imm,
};
-struct InstructionDescriptor {
- static constexpr unsigned CurrentAddressSize = 0xB33FBABE;
+static const unsigned CurrentAddressSize = 0xB33FBABE;
+struct InstructionDescriptor {
InstructionHandler handler { nullptr };
bool opcode_has_register_index { false };
const char* mnemonic { nullptr };