Userspace: Compile programs and libraries with -Wall -Wextra -Werror

This commit is contained in:
Bananymous 2024-09-26 15:20:07 +03:00
parent e6ed5a388d
commit cea6dedccc
6 changed files with 8 additions and 11 deletions

View File

@ -20,7 +20,7 @@ foreach(library ${USERSPACE_LIBRARIES})
# This is to allow cmake to link when libc updates
target_link_options(${library_lower} PRIVATE -nolibc)
# Default compile options
target_compile_options(${library_lower} PRIVATE -g -O2)
target_compile_options(${library_lower} PRIVATE -g -O2 -Wall -Wextra -Werror)
target_compile_definitions(${library_lower} PRIVATE __enable_sse=${BANAN_ENABLE_SSE})
if (NOT BANAN_ENABLE_SSE)

View File

@ -166,7 +166,7 @@ namespace LibGUI
if (amount <= 0)
return;
const uint32_t copy_src_y = BAN::Math::clamp<int32_t>(src_y, 0, height());
const int32_t copy_src_y = BAN::Math::clamp<int32_t>(src_y, 0, height());
const int32_t copy_amount = BAN::Math::clamp<int32_t>(src_y + amount, 0, height()) - copy_src_y;
if (copy_amount > 0)
{

View File

@ -43,7 +43,7 @@ foreach(project ${USERSPACE_PROGRAMS})
# This is to allow cmake to link when libc updates
target_link_options(${project} PRIVATE -nolibc)
# Default compile options
target_compile_options(${project} PRIVATE -g -O2)
target_compile_options(${project} PRIVATE -g -O2 -Wall -Wextra -Werror)
target_compile_definitions(${project} PRIVATE __enable_sse=${BANAN_ENABLE_SSE})
if (NOT BANAN_ENABLE_SSE)

View File

@ -222,13 +222,13 @@ bool Terminal::read_shell()
}
// find the next ansi escape code or end of buffer
size_t non_ansi_end = i;
ssize_t non_ansi_end = i;
while (non_ansi_end < nread && buffer[non_ansi_end] != '\e')
non_ansi_end++;
// we only need to process maximum of `rows()` newlines.
// anything before that would get overwritten anyway
size_t start = non_ansi_end;
ssize_t start = non_ansi_end;
size_t newline_count = 0;
while (start > i && newline_count < rows())
newline_count += (buffer[--start] == '\n');

View File

@ -413,7 +413,7 @@ void WindowServer::invalidate(Rectangle area)
const auto is_rounded_off =
[&](Position pos) -> bool
{
for (size_t i = 0; i < 4; i++)
for (int32_t i = 0; i < 4; i++)
{
if (!corner_areas[i].contains(pos))
continue;
@ -558,8 +558,6 @@ void WindowServer::sync()
dir_y = -dir_y;
}
size_t synced_pages = 0;
for (size_t i = 0; i < m_pages_to_sync_bitmap.size() * 8; i++)
{
size_t byte = i / 8;
@ -582,7 +580,6 @@ void WindowServer::sync()
len * 4096,
MS_SYNC
);
synced_pages += len;
i += len;
}

View File

@ -135,7 +135,7 @@ int list_directory(const BAN::String& path, config_t config)
if (!S_ISDIR(st.st_mode))
{
MUST(entries.emplace_back(path, st));
MUST(entries.emplace_back(path, st, BAN::String()));
if (S_ISLNK(st.st_mode))
{
if (readlink(path.data(), link_buffer, sizeof(link_buffer)) == -1)
@ -166,7 +166,7 @@ int list_directory(const BAN::String& path, config_t config)
continue;
}
MUST(entries.emplace_back(BAN::StringView(dirent->d_name), st));
MUST(entries.emplace_back(BAN::StringView(dirent->d_name), st, BAN::String()));
if (S_ISLNK(st.st_mode))
{
if (readlinkat(dirfd(dirp), dirent->d_name, link_buffer, sizeof(link_buffer)) == -1)