Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/source-lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ on:
branches: [main]
paths:
- "src/**/*.rs"
- "src/**/*.cpp"
- "src/**/*.h"
- "src/jsc/bindings/**"
- "packages/bun-usockets/src/crypto/**"
- "scripts/build/**"
- "scripts/glob-sources.ts"
- "test/harness.ts"
Expand All @@ -25,7 +28,10 @@ on:
pull_request:
paths:
- "src/**/*.rs"
- "src/**/*.cpp"
- "src/**/*.h"
- "src/jsc/bindings/**"
- "packages/bun-usockets/src/crypto/**"
- "scripts/build/**"
- "scripts/glob-sources.ts"
- "test/harness.ts"
Expand Down
6 changes: 3 additions & 3 deletions src/jsc/bindings/BunProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ namespace JSCastingHelpers = JSC::JSCastingHelpers;
JSC_DECLARE_HOST_FUNCTION(Process_functionCwd);

extern "C" uint8_t Bun__getExitCode(void*);
extern "C" uint8_t Bun__setExitCode(void*, uint8_t);
extern "C" bool Bun__closeChildIPC(JSGlobalObject*);
extern "C" void Bun__setExitCode(void*, uint8_t);
extern "C" void Bun__closeChildIPC(JSGlobalObject*);

extern "C" bool Bun__GlobalObject__connectedIPC(JSGlobalObject*);
extern "C" bool Bun__GlobalObject__hasIPC(JSGlobalObject*);
extern "C" bool Bun__ensureProcessIPCInitialized(JSGlobalObject*);
extern "C" void Bun__ensureProcessIPCInitialized(JSGlobalObject*);
extern "C" const char* Bun__githubURL;
extern "C" const char* Bun__sqlite3_version();
BUN_DECLARE_HOST_FUNCTION(Bun__Process__send);
Expand Down
4 changes: 2 additions & 2 deletions src/jsc/bindings/JSEnvironmentVariableMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ bool JSEnvironmentVariableMap::deleteProperty(JSCell* cell, JSGlobalObject* glob
}

extern "C" int Bun__getTLSRejectUnauthorizedValue();
extern "C" int Bun__setTLSRejectUnauthorizedValue(int value);
extern "C" void Bun__setTLSRejectUnauthorizedValue(int value);
extern "C" int Bun__getVerboseFetchValue();
extern "C" int Bun__setVerboseFetchValue(int value);
extern "C" void Bun__setVerboseFetchValue(int value);

ALWAYS_INLINE static Identifier NODE_TLS_REJECT_UNAUTHORIZED_PRIVATE_PROPERTY(VM& vm)
{
Expand Down
4 changes: 2 additions & 2 deletions src/jsc/bindings/ZigSourceProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SourceOrigin toSourceOrigin(const String& sourceURL, bool isBuiltin)
return SourceOrigin(WTF::URL::fileURLWithFileSystemPath(sourceURL));
}

extern "C" int ByteRangeMapping__getSourceID(void* mappings, BunString sourceURL);
extern "C" int ByteRangeMapping__getSourceID(void* mappings);
extern "C" void* ByteRangeMapping__find(BunString sourceURL);

extern "C" void ByteRangeMapping__generate(BunString sourceURL, BunString code, int sourceID);
Expand All @@ -52,7 +52,7 @@ JSC::SourceID sourceIDForSourceURL(const WTF::String& sourceURL)
return 0;
}

return ByteRangeMapping__getSourceID(mappings, Bun::toString(sourceURL));
return ByteRangeMapping__getSourceID(mappings);
}

extern "C" bool BunTest__shouldGenerateCodeCoverage(BunString sourceURL);
Expand Down
5 changes: 1 addition & 4 deletions src/jsc/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5966,15 +5966,12 @@ extern "C" void WebCore__AbortSignal__decrementPendingActivity(WebCore::AbortSig
abortSignal->decrementPendingActivityCount();
}

extern "C" WebCore::AbortSignal* WebCore__AbortSignal__signal(WebCore::AbortSignal* arg0, JSC::JSGlobalObject* globalObject, uint8_t reason)
extern "C" void WebCore__AbortSignal__signal(WebCore::AbortSignal* arg0, JSC::JSGlobalObject* globalObject, uint8_t reason)
{

WebCore::AbortSignal* abortSignal = reinterpret_cast<WebCore::AbortSignal*>(arg0);
abortSignal->signalAbort(
globalObject,
static_cast<WebCore::CommonAbortReason>(reason));
;
return arg0;
}

extern "C" JSC::EncodedJSValue WebCore__AbortSignal__reasonIfAborted(WebCore::AbortSignal* signal, JSC::JSGlobalObject* globalObject, CommonAbortReason* reason)
Expand Down
2 changes: 1 addition & 1 deletion src/jsc/bindings/headers.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/jsc/virtual_machine_exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub fn is_bun_main(global: &JSGlobalObject, str: &BunString) -> bool {
}

// HOST_EXPORT(Bun__reportUnhandledError, c)
pub fn report_unhandled_error(global: &JSGlobalObject, value: JSValue) -> JSValue {
pub fn report_unhandled_error(global: &JSGlobalObject, value: JSValue) {
crate::mark_binding!();

if !value.is_termination_exception() {
Expand All @@ -81,7 +81,6 @@ pub fn report_unhandled_error(global: &JSGlobalObject, value: JSValue) -> JSValu
.as_mut()
.uncaught_exception(global, value, false);
}
JSValue::UNDEFINED
}

/// `ScriptExecutionContext::postTask` — the context addresses the thread's VM
Expand Down
9 changes: 6 additions & 3 deletions src/runtime/ffi/ffi_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,18 @@ impl Source {
mod stdarg {
use super::*;

// Defined in c-bindings.cpp. Only their addresses are taken (handed to
// TinyCC below); the `ap` parameter of the `v*` variants is a `va_list`,
// declared here as an opaque pointer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need a paragraph-long comment to justify why the workaround is OK, the code is wrong — fix the code

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cut down to one line in 79e1d6e.

unsafe extern "C" {
pub(super) fn ffi_vfprintf(_: *mut c_void, _: *const c_char, ...) -> c_int;
pub(super) fn ffi_vprintf(_: *const c_char, ...) -> c_int;
pub(super) fn ffi_vfprintf(_: *mut c_void, _: *const c_char, ap: *mut c_void) -> c_int;
pub(super) fn ffi_vprintf(_: *const c_char, ap: *mut c_void) -> c_int;
pub(super) fn ffi_fprintf(_: *mut c_void, _: *const c_char, ...) -> c_int;
pub(super) fn ffi_printf(_: *const c_char, ...) -> c_int;
pub(super) fn ffi_fscanf(_: *mut c_void, _: *const c_char, ...) -> c_int;
pub(super) fn ffi_scanf(_: *const c_char, ...) -> c_int;
pub(super) fn ffi_sscanf(_: *const c_char, _: *const c_char, ...) -> c_int;
pub(super) fn ffi_vsscanf(_: *const c_char, _: *const c_char, ...) -> c_int;
pub(super) fn ffi_vsscanf(_: *const c_char, _: *const c_char, ap: *mut c_void) -> c_int;
pub(super) fn ffi_fopen(_: *const c_char, _: *const c_char) -> *mut c_void;
pub(super) fn ffi_fclose(_: *mut c_void) -> c_int;
pub(super) fn ffi_fgetc(_: *mut c_void) -> c_int;
Expand Down
2 changes: 0 additions & 2 deletions src/runtime/test_runner/expect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,6 @@ impl Expect {
&raw const matcher_name,
host_fn_ptr,
matcher_fn,
true,
)
};

Expand Down Expand Up @@ -3257,7 +3256,6 @@ unsafe extern "C" {
// Rust's `JSHostFn` is already the pointer type, so no extra `*const`.
function_pointer: bun_jsc::JSHostFn,
wrapped_fn: JSValue,
strong: bool,
) -> JSValue;
fn Bun__JSWrappingFunction__getWrappedFunction(this: JSValue, global_this: *const JSGlobalObject) -> JSValue;

Expand Down
4 changes: 2 additions & 2 deletions src/url/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub mod whatwg {
safe fn URL__getFileURLString(input: &mut String) -> String;
safe fn URL__getHrefJoin(base: &mut String, relative: &mut String) -> String;
safe fn URL__fragmentIdentifier(url: &URL) -> String;
fn URL__originLength(latin1_slice: *const u8, len: usize) -> u32;
fn URL__originLength(latin1_slice: *const u8, len: usize) -> usize;
}

// The C ABI wants a mutable address. We take `&String` (matching existing call sites
Expand Down Expand Up @@ -106,7 +106,7 @@ pub mod whatwg {
// to hand C++ only the leading ASCII prefix (latin1-safe).
let first_non_ascii = strings::first_non_ascii(slice).map_or(slice.len(), |i| i as usize);
// SAFETY: ptr/len derived from a valid slice prefix; C++ only reads.
let len = unsafe { URL__originLength(slice.as_ptr(), first_non_ascii) } as usize;
let len = unsafe { URL__originLength(slice.as_ptr(), first_non_ascii) };
if len == 0 || len > first_non_ascii {
return None;
}
Expand Down
Loading
Loading