Skip to content

Fix missing direct includes - #2687

Open
Aesthete wants to merge 4 commits into
luau-lang:masterfrom
Aesthete:fix/missing-direct-includes
Open

Fix missing direct includes#2687
Aesthete wants to merge 4 commits into
luau-lang:masterfrom
Aesthete:fix/missing-direct-includes

Conversation

@Aesthete

@Aesthete Aesthete commented Aug 21, 2026

Copy link
Copy Markdown

Problem

Embedding Luau in a project that disables libc++ transitive includes fails to compile because several Luau files use declarations without including the headers that define them.

Reproduced on Linux with Clang 21.1.8, libc++ 21.1.8, C++17, and:

CMAKE_CXX_FLAGS="-stdlib=libc++ -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES"
CMAKE_EXE_LINKER_FLAGS="-stdlib=libc++"

Example errors include undeclared abs, malloc, atoi, strtoull, errno, getenv, free, and exit.

ConditionA64.h uses CODEGEN_ASSERT, defined in CodeGenCommon.h. It's unrelated to the libc includes but it's also not IWYU and appeared during testing.

Fix

Add the required direct includes.

Tests

Luau.UnitTest, Luau.Conformance, and Luau.CLI.Test pass with the same flags.

@Aesthete
Aesthete requested a review from a team as a code owner August 21, 2026 18:11
@Aesthete
Aesthete requested a review from SPY August 21, 2026 18:11
Comment thread Compiler/src/lcode.cpp Outdated
Comment thread Compiler/src/Compiler.cpp Outdated
Comment thread CLI/src/Reduce.cpp Outdated
Comment thread CLI/src/Compile.cpp Outdated
Comment thread CLI/src/Bytecode.cpp Outdated
Comment thread Bytecode/src/BytecodeBuilder.cpp Outdated
Comment thread Ast/src/Parser.cpp Outdated
@Aesthete
Aesthete requested a review from vegorov-rbx August 25, 2026 12:13
@Un1q32

Un1q32 commented Sep 8, 2026

Copy link
Copy Markdown

In libc++ 23, removing transitive includes became the default, and in libc++ 24 it will be mandatory.

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.

4 participants