Skip to content

Commit

Permalink
Run bun run clang-format using LLVM 18.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Electroid authored and github-actions[bot] committed Sep 25, 2024
1 parent d8eb60d commit 7b5d0e0
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 143 deletions.
18 changes: 6 additions & 12 deletions src/bun.js/bindings/BunInspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,15 @@ static void addInspector(void* app, JSC::JSGlobalObject* globalObject)
*ws->getUserData() = new SSLBunInspectorConnection(ws, globalObject);
SSLBunInspectorConnection* inspector = *ws->getUserData();
inspector->onOpen(globalObject);
//
},
// },
.message = [](auto* ws, std::string_view message, uWS::OpCode opCode) {
SSLBunInspectorConnection* inspector = *(SSLBunInspectorConnection**)ws->getUserData();
inspector->onMessage(message);
//
},
// },
.drain = [](auto* ws) {
SSLBunInspectorConnection* inspector = *(SSLBunInspectorConnection**)ws->getUserData();
inspector->drain();
//
},
// },
.ping = [](auto* /*ws*/, std::string_view) {
/* Not implemented yet */ },
.pong = [](auto* /*ws*/, std::string_view) {
Expand Down Expand Up @@ -163,18 +160,15 @@ static void addInspector(void* app, JSC::JSGlobalObject* globalObject)
*ws->getUserData() = new BunInspectorConnectionNoSSL(ws, globalObject);
BunInspectorConnectionNoSSL* inspector = *ws->getUserData();
inspector->onOpen(globalObject);
//
},
// },
.message = [](auto* ws, std::string_view message, uWS::OpCode opCode) {
BunInspectorConnectionNoSSL* inspector = *(BunInspectorConnectionNoSSL**)ws->getUserData();
inspector->onMessage(message);
//
},
// },
.drain = [](auto* ws) {
BunInspectorConnectionNoSSL* inspector = *(BunInspectorConnectionNoSSL**)ws->getUserData();
inspector->drain();
//
},
// },
.ping = [](auto* /*ws*/, std::string_view) {
/* Not implemented yet */ },
.pong = [](auto* /*ws*/, std::string_view) {
Expand Down
3 changes: 2 additions & 1 deletion src/bun.js/bindings/BunObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ static JSValue constructBunShell(VM& vm, JSObject* bunObject)

// This value currently depends on a zig feature flag
extern "C" JSC::EncodedJSValue Bun__getTemporaryDevServer(JSC::JSGlobalObject* bunObject);
static JSValue constructBunKit(VM& vm, JSObject* bunObject) {
static JSValue constructBunKit(VM& vm, JSObject* bunObject)
{
return JSC::JSValue::decode(Bun__getTemporaryDevServer(bunObject->globalObject()));
}

Expand Down
66 changes: 33 additions & 33 deletions src/bun.js/bindings/BunProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen,
return JSValue::encode(jsUndefined());
}

JSC::EncodedJSValue (*napi_register_module_v1)(JSC::JSGlobalObject* globalObject,
JSC::EncodedJSValue (*napi_register_module_v1)(JSC::JSGlobalObject * globalObject,
JSC::EncodedJSValue exports);
#if OS(WINDOWS)
#define dlsym GetProcAddress
Expand Down Expand Up @@ -702,82 +702,82 @@ static void loadSignalNumberMap()
signalNameToNumberMap->add(signalNames[9], SIGKILL);
signalNameToNumberMap->add(signalNames[15], SIGTERM);
#else
signalNameToNumberMap->add(signalNames[0], SIGHUP);
signalNameToNumberMap->add(signalNames[1], SIGINT);
signalNameToNumberMap->add(signalNames[2], SIGQUIT);
signalNameToNumberMap->add(signalNames[3], SIGILL);
signalNameToNumberMap->add(signalNames[0], SIGHUP);
signalNameToNumberMap->add(signalNames[1], SIGINT);
signalNameToNumberMap->add(signalNames[2], SIGQUIT);
signalNameToNumberMap->add(signalNames[3], SIGILL);
#ifdef SIGTRAP
signalNameToNumberMap->add(signalNames[4], SIGTRAP);
signalNameToNumberMap->add(signalNames[4], SIGTRAP);
#endif
signalNameToNumberMap->add(signalNames[5], SIGABRT);
signalNameToNumberMap->add(signalNames[5], SIGABRT);
#ifdef SIGIOT
signalNameToNumberMap->add(signalNames[6], SIGIOT);
signalNameToNumberMap->add(signalNames[6], SIGIOT);
#endif
#ifdef SIGBUS
signalNameToNumberMap->add(signalNames[7], SIGBUS);
signalNameToNumberMap->add(signalNames[7], SIGBUS);
#endif
signalNameToNumberMap->add(signalNames[8], SIGFPE);
signalNameToNumberMap->add(signalNames[9], SIGKILL);
signalNameToNumberMap->add(signalNames[8], SIGFPE);
signalNameToNumberMap->add(signalNames[9], SIGKILL);
#ifdef SIGUSR1
signalNameToNumberMap->add(signalNames[10], SIGUSR1);
signalNameToNumberMap->add(signalNames[10], SIGUSR1);
#endif
signalNameToNumberMap->add(signalNames[11], SIGSEGV);
signalNameToNumberMap->add(signalNames[11], SIGSEGV);
#ifdef SIGUSR2
signalNameToNumberMap->add(signalNames[12], SIGUSR2);
signalNameToNumberMap->add(signalNames[12], SIGUSR2);
#endif
#ifdef SIGPIPE
signalNameToNumberMap->add(signalNames[13], SIGPIPE);
signalNameToNumberMap->add(signalNames[13], SIGPIPE);
#endif
#ifdef SIGALRM
signalNameToNumberMap->add(signalNames[14], SIGALRM);
signalNameToNumberMap->add(signalNames[14], SIGALRM);
#endif
signalNameToNumberMap->add(signalNames[15], SIGTERM);
signalNameToNumberMap->add(signalNames[15], SIGTERM);
#ifdef SIGCHLD
signalNameToNumberMap->add(signalNames[16], SIGCHLD);
signalNameToNumberMap->add(signalNames[16], SIGCHLD);
#endif
#ifdef SIGCONT
signalNameToNumberMap->add(signalNames[17], SIGCONT);
signalNameToNumberMap->add(signalNames[17], SIGCONT);
#endif
#ifdef SIGSTOP
signalNameToNumberMap->add(signalNames[18], SIGSTOP);
signalNameToNumberMap->add(signalNames[18], SIGSTOP);
#endif
#ifdef SIGTSTP
signalNameToNumberMap->add(signalNames[19], SIGTSTP);
signalNameToNumberMap->add(signalNames[19], SIGTSTP);
#endif
#ifdef SIGTTIN
signalNameToNumberMap->add(signalNames[20], SIGTTIN);
signalNameToNumberMap->add(signalNames[20], SIGTTIN);
#endif
#ifdef SIGTTOU
signalNameToNumberMap->add(signalNames[21], SIGTTOU);
signalNameToNumberMap->add(signalNames[21], SIGTTOU);
#endif
#ifdef SIGURG
signalNameToNumberMap->add(signalNames[22], SIGURG);
signalNameToNumberMap->add(signalNames[22], SIGURG);
#endif
#ifdef SIGXCPU
signalNameToNumberMap->add(signalNames[23], SIGXCPU);
signalNameToNumberMap->add(signalNames[23], SIGXCPU);
#endif
#ifdef SIGXFSZ
signalNameToNumberMap->add(signalNames[24], SIGXFSZ);
signalNameToNumberMap->add(signalNames[24], SIGXFSZ);
#endif
#ifdef SIGVTALRM
signalNameToNumberMap->add(signalNames[25], SIGVTALRM);
signalNameToNumberMap->add(signalNames[25], SIGVTALRM);
#endif
#ifdef SIGPROF
signalNameToNumberMap->add(signalNames[26], SIGPROF);
signalNameToNumberMap->add(signalNames[26], SIGPROF);
#endif
signalNameToNumberMap->add(signalNames[27], SIGWINCH);
signalNameToNumberMap->add(signalNames[27], SIGWINCH);
#ifdef SIGIO
signalNameToNumberMap->add(signalNames[28], SIGIO);
signalNameToNumberMap->add(signalNames[28], SIGIO);
#endif
#ifdef SIGINFO
signalNameToNumberMap->add(signalNames[29], SIGINFO);
signalNameToNumberMap->add(signalNames[29], SIGINFO);
#endif

#ifndef SIGINFO
signalNameToNumberMap->add(signalNames[29], 255);
signalNameToNumberMap->add(signalNames[29], 255);
#endif
#ifdef SIGSYS
signalNameToNumberMap->add(signalNames[30], SIGSYS);
signalNameToNumberMap->add(signalNames[30], SIGSYS);
#endif
#endif
});
Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4883,7 +4883,7 @@ extern "C" void JSC__VM__getAPILock(JSC::VM* vm)
vm->apiLock().lock();
}

extern "C" void JSC__VM__releaseAPILock(JSC::VM* vm)
extern "C" void JSC__VM__releaseAPILock(JSC::VM* vm)
{
// https://github.com/WebKit/WebKit/blob/6cb5017d237ef7cb898582a22f05acca22322845/Source/JavaScriptCore/runtime/JSLock.cpp#L72
RefPtr<JSLock> apiLock(&vm->apiLock());
Expand Down
3 changes: 2 additions & 1 deletion src/bun.js/modules/BunObjectModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ void generateNativeModule_BunObject(JSC::JSGlobalObject *lexicalGlobalObject,
JSC::MarkedArgumentBuffer &exportValues) {
// FIXME: this does not add each property as a top level export
JSC::VM &vm = lexicalGlobalObject->vm();
Zig::GlobalObject *globalObject = jsCast<Zig::GlobalObject *>(lexicalGlobalObject);
Zig::GlobalObject *globalObject =
jsCast<Zig::GlobalObject *>(lexicalGlobalObject);

JSObject *object = globalObject->bunObject();

Expand Down
72 changes: 34 additions & 38 deletions src/io/io_darwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,26 @@ extern "C" mach_port_t io_darwin_create_machport(uint64_t wakeup, int32_t fd,
kern_return_t kr = mach_port_allocate(self, MACH_PORT_RIGHT_RECEIVE, &port);

if (UNLIKELY(kr != KERN_SUCCESS)) {
return 0;
return 0;
}

// Insert a send right into the port since we also use this to send
kr = mach_port_insert_right(self, port, port, MACH_MSG_TYPE_MAKE_SEND);
if (UNLIKELY(kr != KERN_SUCCESS)) {
return 0;
return 0;
}

// Modify the port queue size to be 1 because we are only
// using it for notifications and not for any other purpose.
mach_port_limits_t limits = { .mpl_qlimit = 1 };
kr = mach_port_set_attributes(self, port, MACH_PORT_LIMITS_INFO, (mach_port_info_t)&limits, MACH_PORT_LIMITS_INFO_COUNT);

mach_port_limits_t limits = {.mpl_qlimit = 1};
kr = mach_port_set_attributes(self, port, MACH_PORT_LIMITS_INFO,
(mach_port_info_t)&limits,
MACH_PORT_LIMITS_INFO_COUNT);

if (UNLIKELY(kr != KERN_SUCCESS)) {
return 0;
return 0;
}


// Configure the event to directly receive the Mach message as part of the
// kevent64() call.
kevent64_s event{};
Expand Down Expand Up @@ -85,37 +86,32 @@ extern "C" bool io_darwin_schedule_wakeup(mach_port_t waker) {
.msgh_id = 0,
};

mach_msg_return_t kr = mach_msg(
&msg,
MACH_SEND_MSG | MACH_SEND_TIMEOUT,
msg.msgh_size,
0,
MACH_PORT_NULL,
0, // Fail instantly if the port is full
MACH_PORT_NULL
);

switch (kr) {
case MACH_MSG_SUCCESS: {
return true;
}

// This means that the send would've blocked because the
// queue is full. We assume success because the port is full.
case MACH_SEND_TIMED_OUT: {
return true;
}

// No space means it will wake up.
case MACH_SEND_NO_BUFFER: {
return true;
}

default: {
ASSERT_NOT_REACHED_WITH_MESSAGE("mach_msg failed with %x", kr);
return false;
}
}
mach_msg_return_t kr = mach_msg(&msg, MACH_SEND_MSG | MACH_SEND_TIMEOUT,
msg.msgh_size, 0, MACH_PORT_NULL,
0, // Fail instantly if the port is full
MACH_PORT_NULL);

switch (kr) {
case MACH_MSG_SUCCESS: {
return true;
}

// This means that the send would've blocked because the
// queue is full. We assume success because the port is full.
case MACH_SEND_TIMED_OUT: {
return true;
}

// No space means it will wake up.
case MACH_SEND_NO_BUFFER: {
return true;
}

default: {
ASSERT_NOT_REACHED_WITH_MESSAGE("mach_msg failed with %x", kr);
return false;
}
}
}

#else
Expand Down
Loading

0 comments on commit 7b5d0e0

Please sign in to comment.