Compare commits

...

2 Commits

Author SHA1 Message Date
5cb4b8b1fe
docs: Add clang-format dependency
All checks were successful
Build and test / build (push) Successful in 1m41s
2024-12-23 22:59:57 +01:00
d9713723c9
tools: Update sources list and run clang-format 2024-12-23 22:56:56 +01:00
13 changed files with 23 additions and 29 deletions

View File

@ -21,6 +21,10 @@ The script provided by the project to run the system, `tools/run.sh`, assumes th
That being said, there's no requirement to use QEMU. If you want to use a different virtualization program, such as Oracle VirtualBox or VMWare, just use `tools/build-iso.sh` instead of `run.sh` and use the built `Luna.iso` in those programs. That being said, there's no requirement to use QEMU. If you want to use a different virtualization program, such as Oracle VirtualBox or VMWare, just use `tools/build-iso.sh` instead of `run.sh` and use the built `Luna.iso` in those programs.
## Formatting/linting
Please make sure you have `clang-format` installed. Additionally, if your editor does not support format-on-save or you do not have it configured, please run `tools/run-clang-format.sh` before committing, to make sure all code follows the same style conventions.
## Source dependencies ## Source dependencies
TLDR: Luna does not depend on any third-party library. TLDR: Luna does not depend on any third-party library.

View File

@ -77,8 +77,7 @@ static void log_text_console(LogLevel level, const char* format, va_list origin)
TextConsole::set_foreground(WHITE); TextConsole::set_foreground(WHITE);
// NOTE: Same as above. // NOTE: Same as above.
auto rc = cstyle_format( auto rc = cstyle_format(format, [](char c, void*) -> Result<void> { return TextConsole::putchar(c); }, nullptr, ap);
format, [](char c, void*) -> Result<void> { return TextConsole::putchar(c); }, nullptr, ap);
if (rc.has_error()) { TextConsole::wprint(L"Invalid UTF-8 in log message"); } if (rc.has_error()) { TextConsole::wprint(L"Invalid UTF-8 in log message"); }

View File

@ -3,8 +3,8 @@
#include "memory/SharedMemory.h" #include "memory/SharedMemory.h"
#include "video/Framebuffer.h" #include "video/Framebuffer.h"
#include <bits/ioctl-defs.h> #include <bits/ioctl-defs.h>
#include <luna/CString.h>
#include <luna/Alignment.h> #include <luna/Alignment.h>
#include <luna/CString.h>
Result<void> FramebufferDevice::create() Result<void> FramebufferDevice::create()
{ {

View File

@ -207,8 +207,8 @@ namespace TextConsole
{ {
va_list ap; va_list ap;
va_start(ap, format); va_start(ap, format);
const usize rc = TRY(cstyle_format( const usize rc =
format, [](char c, void*) -> Result<void> { return putchar(c); }, nullptr, ap)); TRY(cstyle_format(format, [](char c, void*) -> Result<void> { return putchar(c); }, nullptr, ap));
va_end(ap); va_end(ap);
return rc; return rc;
} }

View File

@ -34,12 +34,6 @@ struct timeval
} while (0); } while (0);
#endif #endif
#define TIMEVAL_TO_TIMESPEC(x) \ #define TIMEVAL_TO_TIMESPEC(x) { .tv_sec = (x).tv_sec, .tv_nsec = (x).tv_usec * 1000 }
{ \ #define TIMESPEC_TO_TIMEVAL(x) { .tv_sec = (x).tv_sec, .tv_usec = (x).tv_nsec / 1000 }
.tv_sec = (x).tv_sec, .tv_nsec = (x).tv_usec * 1000 \
}
#define TIMESPEC_TO_TIMEVAL(x) \
{ \
.tv_sec = (x).tv_sec, .tv_usec = (x).tv_nsec / 1000 \
}
#endif #endif

View File

@ -60,16 +60,14 @@ extern "C"
usize strlen(const char* str) usize strlen(const char* str)
{ {
const char* i = str; const char* i = str;
for (; *i; ++i) for (; *i; ++i);
;
return (usize)(i - str); return (usize)(i - str);
} }
usize strnlen(const char* str, usize max) usize strnlen(const char* str, usize max)
{ {
const char* i = str; const char* i = str;
for (; *i && max; ++i, --max) for (; *i && max; ++i, --max);
;
return (usize)(i - str); return (usize)(i - str);
} }
@ -108,8 +106,7 @@ extern "C"
usize wcslen(const wchar_t* str) usize wcslen(const wchar_t* str)
{ {
const wchar_t* i = str; const wchar_t* i = str;
for (; *i; ++i) for (; *i; ++i);
;
return (usize)(i - str); return (usize)(i - str);
} }

View File

@ -4,7 +4,7 @@ source $(dirname $0)/env.sh
cd $LUNA_ROOT cd $LUNA_ROOT
FOLDERS=(kernel libc libos libui libluna apps shell tests) FOLDERS=(kernel libc libos gui libluna utils shell tests system)
SOURCES=($(find ${FOLDERS[@]} -type f -name "*.cpp")) SOURCES=($(find ${FOLDERS[@]} -type f -name "*.cpp"))
SOURCES+=($(find ${FOLDERS[@]} -type f -name "*.h")) SOURCES+=($(find ${FOLDERS[@]} -type f -name "*.h"))