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.
## 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
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);
// NOTE: Same as above.
auto rc = cstyle_format(
format, [](char c, void*) -> Result<void> { return TextConsole::putchar(c); }, nullptr, ap);
auto rc = cstyle_format(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"); }

View File

@ -8,7 +8,7 @@
static inline constexpr u32 make_pci_address(const PCI::Device::Address& address, u32 field)
{
return 0x80000000 | (address.bus << 16) | (address.slot << 11) | (address.function << 8) | ((field)&0xFC);
return 0x80000000 | (address.bus << 16) | (address.slot << 11) | (address.function << 8) | ((field) & 0xFC);
}
namespace PCI

View File

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

View File

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

View File

@ -11,7 +11,7 @@
if (value < 0) \
{ \
errno = (int)(-value); \
return (type)-1; \
return (type) - 1; \
} \
return (type)value; \
} while (0)

View File

@ -4,7 +4,7 @@
#include <bits/fixed-size-types.h>
#define luna_dev_major(dev) (__u32_t)((dev) >> 32)
#define luna_dev_minor(dev) (__u32_t)((dev)&0xffffffff)
#define luna_dev_minor(dev) (__u32_t)((dev) & 0xffffffff)
#define luna_dev_makedev(maj, min) (((__u64_t)(maj) << 32) | (__u64_t)(min))
#endif

View File

@ -12,7 +12,7 @@
#define S_IFCHR 050000
#define S_IFSOCK 060000
#define __CHECK_TYPE(mode, type) (((mode)&S_IFMT) == type)
#define __CHECK_TYPE(mode, type) (((mode) & S_IFMT) == type)
#define S_ISREG(mode) __CHECK_TYPE(mode, S_IFREG)
#define S_ISDIR(mode) __CHECK_TYPE(mode, S_IFDIR)

View File

@ -34,12 +34,6 @@ struct timeval
} while (0);
#endif
#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 \
}
#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 }
#endif

View File

@ -6,10 +6,10 @@
#include <bits/waitpid.h>
#include <sys/types.h>
#define WIFEXITED(ret) (((ret)&_SIGBIT) == 0)
#define WEXITSTATUS(ret) ((ret)&0xff)
#define WIFSIGNALED(ret) (((ret)&_SIGBIT) == _SIGBIT)
#define WTERMSIG(ret) ((ret)&0xff)
#define WIFEXITED(ret) (((ret) & _SIGBIT) == 0)
#define WEXITSTATUS(ret) ((ret) & 0xff)
#define WIFSIGNALED(ret) (((ret) & _SIGBIT) == _SIGBIT)
#define WTERMSIG(ret) ((ret) & 0xff)
#ifdef __cplusplus
extern "C"

View File

@ -2,5 +2,5 @@
template <typename T> inline T&& move(T& lvalue)
{
return (T &&) lvalue;
return (T&&)lvalue;
}

View File

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

View File

@ -4,7 +4,7 @@ source $(dirname $0)/env.sh
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 "*.h"))