1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

Everywhere: Add support for compilation under emscripten

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
This commit is contained in:
Ali Mohammad Pur 2022-11-20 06:53:14 +03:30 committed by Ali Mohammad Pur
parent 84502f53b5
commit 2110e7cf85
9 changed files with 50 additions and 16 deletions

View file

@ -26,7 +26,7 @@
#include <signal.h>
#include <unistd.h>
#ifndef AK_OS_MACOS
#if !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN)
// Only used to disable core dumps
# include <sys/prctl.h>
#endif
@ -560,7 +560,11 @@ void __assertion_failed(char const* assertion)
handle_failed_assert(assertion);
}
#else
# if AK_OS_EMSCRIPTEN
extern "C" __attribute__((__noreturn__)) void __assert_fail(char const* assertion, char const* file, int line, char const* function)
# else
extern "C" __attribute__((__noreturn__)) void __assert_fail(char const* assertion, char const* file, unsigned int line, char const* function)
# endif
{
auto full_message = String::formatted("{}:{}: {}: Assertion `{}' failed.", file, line, function, assertion);
handle_failed_assert(full_message.characters());
@ -588,7 +592,7 @@ int main(int argc, char** argv)
args_parser.add_option(disable_core_dumping, "Disable core dumping", "disable-core-dump", 0);
args_parser.parse(argc, argv);
#ifndef AK_OS_MACOS
#if !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN)
if (disable_core_dumping && prctl(PR_SET_DUMPABLE, 0, 0) < 0) {
perror("prctl(PR_SET_DUMPABLE)");
return exit_wrong_arguments;