Skip to content

[WTF] OSAllocatorPOSIX: test BUN_MACOSX with defined() - #568

Merged
dylan-conway merged 1 commit into
mainfrom
claude/osallocator-wundef
Sep 7, 2026
Merged

dylan-conway merged 1 commit into
mainfrom
claude/osallocator-wundef

Conversation

@dylan-conway

Copy link
Copy Markdown
Member

BUN_MACOSX is only #defined under OS(DARWIN) (line 62). Line 197 evaluates the bare identifier in #if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK) || BUN_MACOSX; on every other OS that is an undefined identifier in a preprocessor conditional — value 0, so behavior is correct, but it triggers -Wundef (part of WTF's warning set) on each non-Darwin compile of this file. The other use in the file (line 66) already uses #ifdef.

One-line change: || defined(BUN_MACOSX). No functional change on any platform.

BUN_MACOSX is only #define'd under OS(DARWIN); evaluating the bare
identifier in #if on other platforms is well-defined (0) but trips
-Wundef, which WTF builds with, on every non-Darwin compile of this file.
Use defined(), as the other use in this file already does.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — one-token preprocessor fix with no behavioral change.

What was reviewed:

  • Confirmed BUN_MACOSX is only ever #defined to 1 inside #if OS(DARWIN) (line 62), so defined(BUN_MACOSX) and the bare token evaluate identically on every platform.
  • Matches the existing #ifdef BUN_MACOSX guard at line 66; no other uses in the file.
  • No CODEOWNERS entry covers Source/WTF/wtf/posix/.
Extended reasoning...

Overview

This PR changes a single preprocessor token in Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp, line 197: || BUN_MACOSX becomes || defined(BUN_MACOSX) inside the #if guard that selects the mach-vm-based aligned reservation path in OSAllocator::tryReserveUncommittedAligned. The macro BUN_MACOSX is a file-local sentinel defined to 1 at line 62, itself inside #if OS(DARWIN). On non-Darwin builds the bare identifier was undefined and evaluated to 0 in the preprocessor conditional — behaviorally correct, but a -Wundef trigger.

Security risks

None. This is a preprocessor guard adjustment that does not alter which code path is taken on any platform: on Darwin the macro is defined to 1 so both forms are truthy; elsewhere it is undefined so both forms are falsy. No memory, permission, or allocation semantics change.

Level of scrutiny

Low. The change is a one-token warning-hygiene fix that mirrors the existing #ifdef BUN_MACOSX at line 66 in the same file. There is no scenario in which BUN_MACOSX is defined to 0 (it is only set once, locally, to 1), so defined() cannot diverge from the bare-token evaluation. The exit reason was dry_streak, and no candidate issues were surfaced or ruled out beyond the direct verification above.

Other factors

Checked .github/CODEOWNERS: no pattern matches Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp, so no owner sign-off is required for this path. The PR conversation timeline shows only the initial commit with no outstanding third-party reviews or objections. The root CLAUDE.md contains no review rules that bear on this change.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: 3a0ae4b1-79fd-44f7-8626-b32f42665354

📥 Commits

Reviewing files that changed from the base of the PR and between 983055f and ff287c3.

📒 Files selected for processing (1)
  • Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp

Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.


Walkthrough

The macOS-specific allocator condition now explicitly checks whether BUN_MACOSX is defined. Other allocation behavior is unchanged.

Changes

Allocator guard update

Layer / File(s) Summary
macOS allocation guard
Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp
The macOS/internal-SDK Mach allocation path now uses defined(BUN_MACOSX) in its preprocessor condition.

Merge Risk: ⚪ Minimal · up to ff287

The macOS allocator guard now avoids undefined-macro warnings on non-Darwin builds without a supported indication of changed allocation behavior or remaining merge risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the warning and the one-line fix, but it does not follow the required template. It omits the bug title and Bugzilla link, the review line, and the changed-file/function list. Add the bug title and Bugzilla URL, include “Reviewed by NOBODY (OOPS!).” or the applicable review information, provide the required bug explanation, and list the changed file and relevant function or class sections using the repository tem…
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the file and the primary change: testing BUN_MACOSX with defined().
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.
Full details: Description check

Resolution

Add the bug title and Bugzilla URL, include “Reviewed by NOBODY (OOPS!).” or the applicable review information, provide the required bug explanation, and list the changed file and relevant function or class sections using the repository template.

  • Fix all pre-merge checks with AI

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


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

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Preview Builds

Commit Release Date
ff287c39 autobuild-preview-pr-568-ff287c39 2026-09-06 06:29:02 UTC

@dylan-conway
dylan-conway merged commit 94c549b into main Sep 7, 2026
48 checks passed
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.

1 participant