-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meta: add clang-format and reformat managarm sysdeps #1176
Conversation
6f4ad0e
to
e6f7be2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on a high level but some aspects definitely need fixing. I marked the major issues with ❌.
e98076e
to
b6dbe00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some notes
options/rtld/generic/linker.cpp
Outdated
@@ -643,7 +703,7 @@ void ObjectRepository::_parseDynamic(SharedObject *object) { | |||
object->stringTableOffset = dynamic->d_un.d_ptr; | |||
break; | |||
case DT_STRSZ: | |||
break; // we don't need the size of the string table | |||
break; // we don't need the size of the string table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems weird, why is there an extra space here?
options/rtld/generic/linker.cpp
Outdated
case DT_RELA: case DT_RELASZ: case DT_RELAENT: case DT_RELACOUNT: | ||
case DT_REL: case DT_RELSZ: case DT_RELENT: case DT_RELCOUNT: | ||
case DT_RELR: case DT_RELRSZ: case DT_RELRENT: | ||
case DT_NEEDED: // we handle this later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space here too before we start the comment.
67dfec2
to
9fc3e84
Compare
1afd181
to
3bc3270
Compare
options/ansi/generic/stdio.cpp
Outdated
int fwide(FILE *, int) MLIBC_STUB_BODY wint_t getwc(FILE *) MLIBC_STUB_BODY wint_t | ||
getwchar(void) MLIBC_STUB_BODY wint_t putwc(wchar_t, FILE *) MLIBC_STUB_BODY wint_t | ||
putwchar(wchar_t) | ||
MLIBC_STUB_BODY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
options/ansi/generic/string.cpp
Outdated
case ENOTSUP: s = "Operation not supported (ENOTSUP)"; break; | ||
case ENOTTY: s = "Inappropriate ioctl for device (ENOTTY)"; break; | ||
case EOVERFLOW: s = "Value too large for defined datatype (EOVERFLOW)"; break; | ||
switch (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe disable here
options/ansi/include/stdio.h
Outdated
void setbuf(FILE *__restrict __stream, char *__restrict __buffer); | ||
int setvbuf(FILE *__restrict __stream, char *__restrict __buffer, int __mode, size_t __size); | ||
void setlinebuf(FILE *__stream); | ||
void setbuffer(FILE *__stream, char *__buffer, size_t __size); | ||
|
||
/* [C11-7.21.6] Formatted input/output functions */ | ||
|
||
__attribute__((__format__(__printf__, 2, 3))) | ||
int fprintf(FILE *__restrict __stream, const char *__restrict __format, ...); | ||
__attribute__((__format__(__printf__, 2, 3))) int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yikes
options/glibc/include/err.h
Outdated
__attribute__((__noreturn__, __format__(__printf__, 2, 0))) | ||
void verrx(int __errnum, const char *__format, va_list __args); | ||
__attribute__((__noreturn__, __format__(__printf__, 2, 3))) void | ||
err(int __errnum, const char *__format, ...); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yikes
options/internal/generic/threads.cpp
Outdated
// Otherwise we have to set the waiters flag first. | ||
unsigned int desired = expected | mutex_waiters_bit; | ||
if(__atomic_compare_exchange_n((int *)&mutex->__mlibc_state, | ||
reinterpret_cast<int*>(&expected), desired, false, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) | ||
if (__atomic_compare_exchange_n( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things like this ought to be factored out
options/posix/generic/pwd.cpp
Outdated
p->pw_shell | ||
) < 0 | ||
? -1 | ||
: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cursed ternary
options/rtld/generic/main.cpp
Outdated
switch (*aux) { | ||
case AT_PHDR: | ||
mlibc::infoLogger() << "AT_PHDR: 0x" << frg::hex_fmt{*value} << frg::endlog; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe clang-format off here
34a5b24
to
1bc7598
Compare
13d5bbc
to
b6d540c
Compare
No description provided.