Skip to content

build: disable exceptions for highway on Windows (clang-cl)#29645

Merged
Jarred-Sumner merged 3 commits into
mainfrom
claude/fervent-chebyshev-103fa2
Apr 23, 2026
Merged

build: disable exceptions for highway on Windows (clang-cl)#29645
Jarred-Sumner merged 3 commits into
mainfrom
claude/fervent-chebyshev-103fa2

Conversation

@dylan-conway

@dylan-conway dylan-conway commented Apr 23, 2026

Copy link
Copy Markdown
Member

Summary

Fixes 9× clang-cl: warning: unknown argument ignored in clang-cl: '-fno-exceptions' [-Wunknown-argument] when building highway on Windows, and restores highway's no-exceptions build that was lost in the DirectBuild conversion.

#29584 converted highway from nested-cmake to DirectBuild and passed -fno-exceptions in the Windows cflags branch. clang-cl doesn't recognize the gcc spelling and was ignoring it, so highway was actually being compiled with exceptions enabled via globalFlags' /EHsc — a behavior change from nested-cmake, where highway's own CMakeLists.txt set /EHs-c- + -D_HAS_EXCEPTIONS=0 in its MSVC branch (vendor/highway/CMakeLists.txt:367-370).

This swaps the unrecognized -fno-exceptions for /EHs-c- -D_HAS_EXCEPTIONS=0, which clang-cl understands. The dep-specific cflags are appended after globalFlags in source.ts:1433, so /EHs-c- overrides /EHsc (later flag wins).

Separately: globalFlags itself has /EHsc with desc "Disable C++ exceptions" (flags.ts:189-191) — the flag enables exceptions but the desc describes /EHs-c-. That's been there since the original Windows CMake (bun 1.0.9) and affects every Windows TU; left for a follow-up.

Test plan

  • bunx tsc --noEmit -p scripts/build/tsconfig.json
  • ninja -C build/debug highway — all 9 objects compile with no warnings
  • Verified /EHs-c- -D_HAS_EXCEPTIONS=0 appear after /EHsc in generated build.ninja
  • Windows CI green

clang-cl doesn't recognize the gcc spelling and warns "unknown argument
ignored in clang-cl: '-fno-exceptions'" once per highway TU (×9).
globalFlags already supplies /EH* and /GR- to all DirectBuild deps on
Windows, and highway's own CMakeLists skips this flag in its MSVC
branch. Follow-up to #29584 which converted highway to DirectBuild.
@robobun

robobun commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator
Updated 2:02 PM PT - Apr 23rd, 2026

@autofix-ci[bot], your commit 9f1f73f has 5 failures in Build #47577 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 29645

That installs a local version of the PR into your bun-29645 executable, so you can run:

bun-29645 --bun

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ae20a224-53fb-49ed-9d6a-b4a2f3f94de1

📥 Commits

Reviewing files that changed from the base of the PR and between 31b9062 and 9f1f73f.

📒 Files selected for processing (1)
  • scripts/build/deps/highway.ts

Walkthrough

Windows build for the highway dependency now disables C++ exceptions using MSVC-style clang-cl flags (/EHs-c- and -D_HAS_EXCEPTIONS=0) instead of -fno-exceptions; non-Windows still uses -fno-exceptions and -fmath-errno. Inline comments explain clang-cl flag support and exception-flag precedence.

Changes

Cohort / File(s) Summary
Highway Build Configuration
scripts/build/deps/highway.ts
On Windows, replaced injection of -fno-exceptions with MSVC-style clang-cl flags /EHs-c- and -D_HAS_EXCEPTIONS=0. Updated inline documentation to note that -fno-exceptions/-fmath-errno are not accepted by clang-cl, that non-Windows still uses -fno-exceptions plus -fmath-errno, and that later exception flags override earlier ones.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: disabling exceptions for highway on Windows using clang-cl flags, which matches the core objective of the PR.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering the problem statement, solution details, test verification, and known follow-up items, though it deviates from the provided template structure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@claude claude Bot left a comment

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.

LGTM — behaviorally a no-op (clang-cl was already ignoring the flag), just silences the warning.

Extended reasoning...

Overview

One-line change in scripts/build/deps/highway.ts that drops -fno-exceptions from the Windows cflags branch (plus an updated comment). The flag was already being ignored by clang-cl with a -Wunknown-argument warning, so this changes no codegen — it just removes 9 build warnings. The non-Windows path is untouched.

Security risks

None. Build-script flag tweak for a vendored SIMD library; no runtime code, auth, crypto, or user-facing surface involved.

Level of scrutiny

Low. This is a mechanical follow-up to #29584's DirectBuild conversion, mirroring the existing -fmath-errno exclusion that was already in place for the same reason. Upstream highway's own CMakeLists also skips -fno-exceptions in its MSVC branch, so this matches vendor intent.

Other factors

The inline comment flags a pre-existing typo in scripts/build/flags.ts:189 (/EHsc vs the documented /EHs-c-) that the new code comment leans on for its rationale. That's worth fixing separately but doesn't affect the correctness of this change — before and after, highway on Windows receives the same effective flags from computeDepFlags(); the only delta is the dropped warning. No CODEOWNERS for this path, no prior reviewer comments, and tsc/ninja checks pass per the test plan.

Comment thread scripts/build/deps/highway.ts Outdated
Pass /EHs-c- and -D_HAS_EXCEPTIONS=0 instead of dropping the cflags.
This overrides globalFlags' /EHsc (later flag wins) so highway is
compiled without exceptions, matching what its own CMakeLists set in
the MSVC branch and restoring the behavior it had under nested-cmake
before #29584.
@dylan-conway dylan-conway changed the title build: drop -fno-exceptions from highway cflags on Windows build: disable exceptions for highway on Windows (clang-cl) Apr 23, 2026

@claude claude Bot left a comment

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.

LGTM — thanks for following up with /EHs-c- -D_HAS_EXCEPTIONS=0; that addresses my earlier note and restores nested-cmake parity.

Extended reasoning...

Overview

Single-file change to scripts/build/deps/highway.ts: swaps the Windows cflags entry from ["-fno-exceptions"] (which clang-cl ignores with a warning) to ["/EHs-c-", "-D_HAS_EXCEPTIONS=0"], plus an updated explanatory comment. Non-Windows branch is byte-identical to before.

Prior feedback addressed

My earlier inline comment was on revision cc84321, which simply dropped the flag and leaned on globalFlags' /EHsc — which actually enables exceptions. The author pushed 31b9062 in response, now explicitly passing /EHs-c- -D_HAS_EXCEPTIONS=0 (matching upstream highway's MSVC branch) and rewrote the PR description to acknowledge the pre-existing flags.ts:189 /EHsc typo as a separate follow-up. That's the right scoping. I verified at source.ts:1433 that dep cflags are appended after computeDepFlags globals, so /EHs-c- correctly overrides /EHsc (later /EH wins per MSVC semantics).

Security risks

None. This is a compiler-flag tweak for a vendored SIMD library's build recipe — no runtime code, auth, crypto, or user-input handling involved.

Level of scrutiny

Low. Mechanical, one-line build-config change in a dependency build script. The intent (disable exceptions for highway on Windows) is clear, the spelling matches what upstream highway and MSVC docs prescribe, and the author verified the generated build.ninja ordering locally.

Other factors

The robobun CI comment shows Linux/macOS build-cpp/build-zig failures, but this diff only touches the cfg.windows ternary arm — the non-Windows arm is unchanged — so those cannot be caused by this change (and notably no Windows job is listed as failing). No bugs from the bug-hunting system. CodeRabbit had no actionable comments.

@Jarred-Sumner Jarred-Sumner merged commit bdae27c into main Apr 23, 2026
57 of 62 checks passed
@Jarred-Sumner Jarred-Sumner deleted the claude/fervent-chebyshev-103fa2 branch April 23, 2026 20:56
dylan-conway added a commit that referenced this pull request Apr 24, 2026
…rhistogram) (#29653)

## Summary

Follow-up to #29584 / #29645. Four Windows build-flag corrections — all
places where the configured flag didn't match the intent (vs. just
suppressing warnings). Clean rebuild goes from **104 warnings → 3**.

### `/EHsc` → `/EHs-c-` in `globalFlags`

The desc has always said "Disable C++ exceptions (s- disables C++, c-
disables C)", `bunDefines` sets `_HAS_EXCEPTIONS=0`, unix gets
`-fno-exceptions`, and link strips unwind sections — but the flag was
`/EHsc` which **enables** synchronous exceptions. This dates back to the
original Windows CMake (bun 1.0.9, `4403c4075`); the TS migration
faithfully copied it.

`rescle.cpp` is the one TU that actually uses `throw`/`catch` (vendored
electron/rcedit; `VersionInfo` ctor throws `std::system_error`, caught
in `OnEnumResourceLanguage`). It now gets a `fileOverrides` entry
restoring `/EHsc` — it's already in `noPchSources` so there's no
PCH-flag mismatch. `extraFlagsFor()` now normalizes `\` → `/` so the
override table matches on Windows (the only prior entry was Linux-only).

### `highway`: drop redundant `/EHs-c-`

Now that `globalFlags` supplies it. Keep `-D_HAS_EXCEPTIONS=0`
(upstream's MSVC branch sets it; `bunDefines` doesn't flow to deps).

### `libarchive`: define `_CRT_SECURE_NO_DEPRECATE` on Windows

Upstream's `CMakeLists.txt:2234` sets this on MSVC; the DirectBuild
conversion missed carrying it over. Restores parity with the
nested-cmake build. (97× `-Wdeprecated-declarations` on
`localtime`/`gmtime`/`strncpy`/etc.)

### `hdrhistogram`: trim to the 3 sources Bun uses + fix
`_BitScanReverse64` arg type

`JSNodePerformanceHooksHistogram.cpp` only uses the in-memory histogram
API from `hdr_histogram.h`; the interval-recorder/thread/time/phaser
modules are never referenced (verified no cross-includes). Dropping them
removes 3× `-Wincompatible-pointer-types` from `hdr_interval_recorder.c`
(the `T**` → `void**` warning).

The 4th warning, in `hdr_histogram.c:149`, is upstream passing
`uint32_t*` to `_BitScanReverse64`'s `unsigned long*` param — same width
on LLP64 but distinct types. Upstream HEAD (we're already on it) still
has this; fixed via a one-line patch changing the local to `unsigned
long`.

## Not in this PR

The 3 remaining warnings are pre-existing and not flag
misconfigurations:
- 2× `-Wunused-value` in `rescle.cpp` from the Windows SDK's
`UnlockResource` no-op macro `((hResData), 0)`
- 1× `-Wmicrosoft-cast` in `JSBundlerPlugin.cpp:383` (`GetProcAddress` →
`void*`)

## Test plan

- [x] `bunx tsc --noEmit -p scripts/build/tsconfig.json`
- [x] Full clean rebuild on Windows: 104 → 3 warnings, link + smoke test
pass
- [x] `bun bd test test/js/bun/perf_hooks/histogram.test.ts` — 38/38
pass (hdrhistogram trim + patch)
- [x] `bun bd test test/cli/install/bun-pack.test.ts` — 70/70 pass
(libarchive)
- [ ] Windows CI green
- [ ] Linux/Darwin CI green (libarchive/hdrhistogram changes are
Windows-only conditioned, but verifying)
Jarred-Sumner pushed a commit that referenced this pull request Apr 24, 2026
…mory' (#29663)

`test/js/bun/net/socket.test.ts` "should not leak memory" has been
hitting `TCPSocket`/`TLSSocket` count `4` on the Windows 2019 agents,
one past the previous `isWindows ? 3` bound. Same flake shipped with
merged #29631 today and has been blocking #29593 through ~15 retriggers.

Non-Windows bound stays at `2` — that's where real retention regressions
are caught. The Windows bound is already loosened for its shared
prototype/structure retention; this just accommodates the one additional
retained instance the Win2019 lane is observing.

## Observed

- Build [#47600 Win2019
x64](https://buildkite.com/bun/bun/builds/47600#019dbc49-ff0c-49c2-afaa-134711815456)
— `Received: 4, Expected: <= 3`
- Build [#47616 Win2019
x64](https://buildkite.com/bun/bun/builds/47616#019dbc99-fc61-4111-8170-080d9729866a)
— same
- Multiple prior PRs:
[#29631](#29631),
[#29651](#29651),
[#29649](#29649),
[#29650](#29650),
[#29645](#29645),
[#29639](#29639) all hit the same
pattern

## Scope

3-line diff + comment. If the Win2019 retention count IS a regression
worth investigating, that's a separate issue; this change is strictly
about not holding other PRs hostage to the shared flake.

Co-authored-by: robobun <robobun@bun.sh>
structwafel pushed a commit to structwafel/bun that referenced this pull request Apr 25, 2026
…29645)

## Summary

Fixes 9× `clang-cl: warning: unknown argument ignored in clang-cl:
'-fno-exceptions' [-Wunknown-argument]` when building highway on
Windows, and restores highway's no-exceptions build that was lost in the
DirectBuild conversion.

oven-sh#29584 converted highway from nested-cmake to DirectBuild and passed
`-fno-exceptions` in the Windows `cflags` branch. clang-cl doesn't
recognize the gcc spelling and was ignoring it, so highway was actually
being compiled **with** exceptions enabled via `globalFlags`' `/EHsc` —
a behavior change from nested-cmake, where highway's own
`CMakeLists.txt` set `/EHs-c-` + `-D_HAS_EXCEPTIONS=0` in its MSVC
branch (`vendor/highway/CMakeLists.txt:367-370`).

This swaps the unrecognized `-fno-exceptions` for `/EHs-c-
-D_HAS_EXCEPTIONS=0`, which clang-cl understands. The dep-specific
`cflags` are appended after `globalFlags` in `source.ts:1433`, so
`/EHs-c-` overrides `/EHsc` (later flag wins).

Separately: `globalFlags` itself has `/EHsc` with desc "Disable C++
exceptions" (`flags.ts:189-191`) — the flag enables exceptions but the
desc describes `/EHs-c-`. That's been there since the original Windows
CMake (bun 1.0.9) and affects every Windows TU; left for a follow-up.

## Test plan

- [x] `bunx tsc --noEmit -p scripts/build/tsconfig.json`
- [x] `ninja -C build/debug highway` — all 9 objects compile with no
warnings
- [x] Verified `/EHs-c- -D_HAS_EXCEPTIONS=0` appear after `/EHsc` in
generated `build.ninja`
- [ ] Windows CI green

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
structwafel pushed a commit to structwafel/bun that referenced this pull request Apr 25, 2026
…rhistogram) (oven-sh#29653)

## Summary

Follow-up to oven-sh#29584 / oven-sh#29645. Four Windows build-flag corrections — all
places where the configured flag didn't match the intent (vs. just
suppressing warnings). Clean rebuild goes from **104 warnings → 3**.

### `/EHsc` → `/EHs-c-` in `globalFlags`

The desc has always said "Disable C++ exceptions (s- disables C++, c-
disables C)", `bunDefines` sets `_HAS_EXCEPTIONS=0`, unix gets
`-fno-exceptions`, and link strips unwind sections — but the flag was
`/EHsc` which **enables** synchronous exceptions. This dates back to the
original Windows CMake (bun 1.0.9, `4403c4075`); the TS migration
faithfully copied it.

`rescle.cpp` is the one TU that actually uses `throw`/`catch` (vendored
electron/rcedit; `VersionInfo` ctor throws `std::system_error`, caught
in `OnEnumResourceLanguage`). It now gets a `fileOverrides` entry
restoring `/EHsc` — it's already in `noPchSources` so there's no
PCH-flag mismatch. `extraFlagsFor()` now normalizes `\` → `/` so the
override table matches on Windows (the only prior entry was Linux-only).

### `highway`: drop redundant `/EHs-c-`

Now that `globalFlags` supplies it. Keep `-D_HAS_EXCEPTIONS=0`
(upstream's MSVC branch sets it; `bunDefines` doesn't flow to deps).

### `libarchive`: define `_CRT_SECURE_NO_DEPRECATE` on Windows

Upstream's `CMakeLists.txt:2234` sets this on MSVC; the DirectBuild
conversion missed carrying it over. Restores parity with the
nested-cmake build. (97× `-Wdeprecated-declarations` on
`localtime`/`gmtime`/`strncpy`/etc.)

### `hdrhistogram`: trim to the 3 sources Bun uses + fix
`_BitScanReverse64` arg type

`JSNodePerformanceHooksHistogram.cpp` only uses the in-memory histogram
API from `hdr_histogram.h`; the interval-recorder/thread/time/phaser
modules are never referenced (verified no cross-includes). Dropping them
removes 3× `-Wincompatible-pointer-types` from `hdr_interval_recorder.c`
(the `T**` → `void**` warning).

The 4th warning, in `hdr_histogram.c:149`, is upstream passing
`uint32_t*` to `_BitScanReverse64`'s `unsigned long*` param — same width
on LLP64 but distinct types. Upstream HEAD (we're already on it) still
has this; fixed via a one-line patch changing the local to `unsigned
long`.

## Not in this PR

The 3 remaining warnings are pre-existing and not flag
misconfigurations:
- 2× `-Wunused-value` in `rescle.cpp` from the Windows SDK's
`UnlockResource` no-op macro `((hResData), 0)`
- 1× `-Wmicrosoft-cast` in `JSBundlerPlugin.cpp:383` (`GetProcAddress` →
`void*`)

## Test plan

- [x] `bunx tsc --noEmit -p scripts/build/tsconfig.json`
- [x] Full clean rebuild on Windows: 104 → 3 warnings, link + smoke test
pass
- [x] `bun bd test test/js/bun/perf_hooks/histogram.test.ts` — 38/38
pass (hdrhistogram trim + patch)
- [x] `bun bd test test/cli/install/bun-pack.test.ts` — 70/70 pass
(libarchive)
- [ ] Windows CI green
- [ ] Linux/Darwin CI green (libarchive/hdrhistogram changes are
Windows-only conditioned, but verifying)
structwafel pushed a commit to structwafel/bun that referenced this pull request Apr 25, 2026
…mory' (oven-sh#29663)

`test/js/bun/net/socket.test.ts` "should not leak memory" has been
hitting `TCPSocket`/`TLSSocket` count `4` on the Windows 2019 agents,
one past the previous `isWindows ? 3` bound. Same flake shipped with
merged oven-sh#29631 today and has been blocking oven-sh#29593 through ~15 retriggers.

Non-Windows bound stays at `2` — that's where real retention regressions
are caught. The Windows bound is already loosened for its shared
prototype/structure retention; this just accommodates the one additional
retained instance the Win2019 lane is observing.

## Observed

- Build [#47600 Win2019
x64](https://buildkite.com/bun/bun/builds/47600#019dbc49-ff0c-49c2-afaa-134711815456)
— `Received: 4, Expected: <= 3`
- Build [#47616 Win2019
x64](https://buildkite.com/bun/bun/builds/47616#019dbc99-fc61-4111-8170-080d9729866a)
— same
- Multiple prior PRs:
[oven-sh#29631](oven-sh#29631),
[oven-sh#29651](oven-sh#29651),
[oven-sh#29649](oven-sh#29649),
[oven-sh#29650](oven-sh#29650),
[oven-sh#29645](oven-sh#29645),
[oven-sh#29639](oven-sh#29639) all hit the same
pattern

## Scope

3-line diff + comment. If the Win2019 retention count IS a regression
worth investigating, that's a separate issue; this change is strictly
about not holding other PRs hostage to the shared flake.

Co-authored-by: robobun <robobun@bun.sh>
xhjkl pushed a commit to xhjkl/bun that referenced this pull request May 14, 2026
…29645)

## Summary

Fixes 9× `clang-cl: warning: unknown argument ignored in clang-cl:
'-fno-exceptions' [-Wunknown-argument]` when building highway on
Windows, and restores highway's no-exceptions build that was lost in the
DirectBuild conversion.

oven-sh#29584 converted highway from nested-cmake to DirectBuild and passed
`-fno-exceptions` in the Windows `cflags` branch. clang-cl doesn't
recognize the gcc spelling and was ignoring it, so highway was actually
being compiled **with** exceptions enabled via `globalFlags`' `/EHsc` —
a behavior change from nested-cmake, where highway's own
`CMakeLists.txt` set `/EHs-c-` + `-D_HAS_EXCEPTIONS=0` in its MSVC
branch (`vendor/highway/CMakeLists.txt:367-370`).

This swaps the unrecognized `-fno-exceptions` for `/EHs-c-
-D_HAS_EXCEPTIONS=0`, which clang-cl understands. The dep-specific
`cflags` are appended after `globalFlags` in `source.ts:1433`, so
`/EHs-c-` overrides `/EHsc` (later flag wins).

Separately: `globalFlags` itself has `/EHsc` with desc "Disable C++
exceptions" (`flags.ts:189-191`) — the flag enables exceptions but the
desc describes `/EHs-c-`. That's been there since the original Windows
CMake (bun 1.0.9) and affects every Windows TU; left for a follow-up.

## Test plan

- [x] `bunx tsc --noEmit -p scripts/build/tsconfig.json`
- [x] `ninja -C build/debug highway` — all 9 objects compile with no
warnings
- [x] Verified `/EHs-c- -D_HAS_EXCEPTIONS=0` appear after `/EHsc` in
generated `build.ninja`
- [ ] Windows CI green

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
xhjkl pushed a commit to xhjkl/bun that referenced this pull request May 14, 2026
…rhistogram) (oven-sh#29653)

## Summary

Follow-up to oven-sh#29584 / oven-sh#29645. Four Windows build-flag corrections — all
places where the configured flag didn't match the intent (vs. just
suppressing warnings). Clean rebuild goes from **104 warnings → 3**.

### `/EHsc` → `/EHs-c-` in `globalFlags`

The desc has always said "Disable C++ exceptions (s- disables C++, c-
disables C)", `bunDefines` sets `_HAS_EXCEPTIONS=0`, unix gets
`-fno-exceptions`, and link strips unwind sections — but the flag was
`/EHsc` which **enables** synchronous exceptions. This dates back to the
original Windows CMake (bun 1.0.9, `4403c4075`); the TS migration
faithfully copied it.

`rescle.cpp` is the one TU that actually uses `throw`/`catch` (vendored
electron/rcedit; `VersionInfo` ctor throws `std::system_error`, caught
in `OnEnumResourceLanguage`). It now gets a `fileOverrides` entry
restoring `/EHsc` — it's already in `noPchSources` so there's no
PCH-flag mismatch. `extraFlagsFor()` now normalizes `\` → `/` so the
override table matches on Windows (the only prior entry was Linux-only).

### `highway`: drop redundant `/EHs-c-`

Now that `globalFlags` supplies it. Keep `-D_HAS_EXCEPTIONS=0`
(upstream's MSVC branch sets it; `bunDefines` doesn't flow to deps).

### `libarchive`: define `_CRT_SECURE_NO_DEPRECATE` on Windows

Upstream's `CMakeLists.txt:2234` sets this on MSVC; the DirectBuild
conversion missed carrying it over. Restores parity with the
nested-cmake build. (97× `-Wdeprecated-declarations` on
`localtime`/`gmtime`/`strncpy`/etc.)

### `hdrhistogram`: trim to the 3 sources Bun uses + fix
`_BitScanReverse64` arg type

`JSNodePerformanceHooksHistogram.cpp` only uses the in-memory histogram
API from `hdr_histogram.h`; the interval-recorder/thread/time/phaser
modules are never referenced (verified no cross-includes). Dropping them
removes 3× `-Wincompatible-pointer-types` from `hdr_interval_recorder.c`
(the `T**` → `void**` warning).

The 4th warning, in `hdr_histogram.c:149`, is upstream passing
`uint32_t*` to `_BitScanReverse64`'s `unsigned long*` param — same width
on LLP64 but distinct types. Upstream HEAD (we're already on it) still
has this; fixed via a one-line patch changing the local to `unsigned
long`.

## Not in this PR

The 3 remaining warnings are pre-existing and not flag
misconfigurations:
- 2× `-Wunused-value` in `rescle.cpp` from the Windows SDK's
`UnlockResource` no-op macro `((hResData), 0)`
- 1× `-Wmicrosoft-cast` in `JSBundlerPlugin.cpp:383` (`GetProcAddress` →
`void*`)

## Test plan

- [x] `bunx tsc --noEmit -p scripts/build/tsconfig.json`
- [x] Full clean rebuild on Windows: 104 → 3 warnings, link + smoke test
pass
- [x] `bun bd test test/js/bun/perf_hooks/histogram.test.ts` — 38/38
pass (hdrhistogram trim + patch)
- [x] `bun bd test test/cli/install/bun-pack.test.ts` — 70/70 pass
(libarchive)
- [ ] Windows CI green
- [ ] Linux/Darwin CI green (libarchive/hdrhistogram changes are
Windows-only conditioned, but verifying)
xhjkl pushed a commit to xhjkl/bun that referenced this pull request May 14, 2026
…mory' (oven-sh#29663)

`test/js/bun/net/socket.test.ts` "should not leak memory" has been
hitting `TCPSocket`/`TLSSocket` count `4` on the Windows 2019 agents,
one past the previous `isWindows ? 3` bound. Same flake shipped with
merged oven-sh#29631 today and has been blocking oven-sh#29593 through ~15 retriggers.

Non-Windows bound stays at `2` — that's where real retention regressions
are caught. The Windows bound is already loosened for its shared
prototype/structure retention; this just accommodates the one additional
retained instance the Win2019 lane is observing.

## Observed

- Build [#47600 Win2019
x64](https://buildkite.com/bun/bun/builds/47600#019dbc49-ff0c-49c2-afaa-134711815456)
— `Received: 4, Expected: <= 3`
- Build [#47616 Win2019
x64](https://buildkite.com/bun/bun/builds/47616#019dbc99-fc61-4111-8170-080d9729866a)
— same
- Multiple prior PRs:
[oven-sh#29631](oven-sh#29631),
[oven-sh#29651](oven-sh#29651),
[oven-sh#29649](oven-sh#29649),
[oven-sh#29650](oven-sh#29650),
[oven-sh#29645](oven-sh#29645),
[oven-sh#29639](oven-sh#29639) all hit the same
pattern

## Scope

3-line diff + comment. If the Win2019 retention count IS a regression
worth investigating, that's a separate issue; this change is strictly
about not holding other PRs hostage to the shared flake.

Co-authored-by: robobun <robobun@bun.sh>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants