diff --git a/cmake/targets/BuildBun.cmake b/cmake/targets/BuildBun.cmake index f9b60e2dff..60958ceaf2 100644 --- a/cmake/targets/BuildBun.cmake +++ b/cmake/targets/BuildBun.cmake @@ -747,6 +747,18 @@ set_target_properties(${bun} PROPERTIES VISIBILITY_INLINES_HIDDEN YES ) +if (NOT WIN32) + # Enable precompiled headers + # Only enable in these scenarios: + # 1. NOT in CI, OR + # 2. In CI AND BUN_CPP_ONLY is enabled + if(NOT CI OR (CI AND BUN_CPP_ONLY)) + target_precompile_headers(${bun} PRIVATE + "$<$:${CWD}/src/bun.js/bindings/root.h>" + ) + endif() +endif() + # --- C/C++ Includes --- if(WIN32) @@ -901,6 +913,10 @@ if(NOT WIN32) -Werror ) endif() +else() + target_compile_options(${bun} PUBLIC + -Wno-nullability-completeness + ) endif() # --- Linker options --- diff --git a/src/bun.js/bindings/ExceptionOr.h b/src/bun.js/bindings/ExceptionOr.h index 5241d45d5b..9581644f35 100644 --- a/src/bun.js/bindings/ExceptionOr.h +++ b/src/bun.js/bindings/ExceptionOr.h @@ -87,9 +87,6 @@ public: private: Expected m_value; -#if ASSERT_ENABLED - bool m_wasReleased { false }; -#endif }; ExceptionOr isolatedCopy(ExceptionOr&&); diff --git a/src/bun.js/bindings/root.h b/src/bun.js/bindings/root.h index fd32e5868b..de68e2fec8 100644 --- a/src/bun.js/bindings/root.h +++ b/src/bun.js/bindings/root.h @@ -76,6 +76,8 @@ #include #include #include +#include +#include #define ENABLE_WEB_CRYPTO 1 #define USE_OPENSSL 1 diff --git a/src/bun.js/bindings/v8/V8FunctionTemplate.h b/src/bun.js/bindings/v8/V8FunctionTemplate.h index 873b45a0da..4837406c80 100644 --- a/src/bun.js/bindings/v8/V8FunctionTemplate.h +++ b/src/bun.js/bindings/v8/V8FunctionTemplate.h @@ -34,8 +34,8 @@ enum class SideEffectType { // (v8-fast-api-calls.h is not in the headers distribution) class CFunction { private: - const void* address; - const void* type_info; + [[maybe_unused]] const void* address; + [[maybe_unused]] const void* type_info; }; class FunctionTemplate : public Template { diff --git a/src/bun.js/bindings/webcore/EventContext.h b/src/bun.js/bindings/webcore/EventContext.h index 8fbd3c19fe..13f0469eb8 100644 --- a/src/bun.js/bindings/webcore/EventContext.h +++ b/src/bun.js/bindings/webcore/EventContext.h @@ -98,9 +98,9 @@ private: RefPtr m_targetTouches; RefPtr m_changedTouches; #endif - int m_closedShadowDepth { 0 }; - bool m_currentTargetIsInShadowTree { false }; - bool m_contextNodeIsFormElement { false }; + [[maybe_unused]] int m_closedShadowDepth { 0 }; + [[maybe_unused]] bool m_currentTargetIsInShadowTree { false }; + [[maybe_unused]] bool m_contextNodeIsFormElement { false }; Type m_type { Type::Normal }; }; diff --git a/src/bun.js/bindings/webcore/EventNames.h b/src/bun.js/bindings/webcore/EventNames.h index bc6f291f38..600be7daf6 100644 --- a/src/bun.js/bindings/webcore/EventNames.h +++ b/src/bun.js/bindings/webcore/EventNames.h @@ -81,7 +81,7 @@ private: EventNames(); // Private to prevent accidental call to EventNames() instead of eventNames(). // friend class ThreadGlobalData; // Allow ThreadGlobalData to create the per-thread EventNames object. - int dummy; // Needed to make initialization macro work. + [[maybe_unused]] int dummy; // Needed to make initialization macro work. }; const EventNames& eventNames(); diff --git a/src/bun.js/bindings/webcore/Worker.h b/src/bun.js/bindings/webcore/Worker.h index 8d3044f212..1c1c992472 100644 --- a/src/bun.js/bindings/webcore/Worker.h +++ b/src/bun.js/bindings/webcore/Worker.h @@ -137,7 +137,6 @@ private: Deque> m_pendingEvents; Lock m_pendingTasksMutex; Deque> m_pendingTasks; - bool m_didStartWorkerGlobalScope { false }; // Tracks OnlineFlag and ClosingFlag std::atomic m_onlineClosingFlags { 0 }; // Tracks TerminateRequestedFlag and TerminatedFlag diff --git a/src/codegen/bundle-functions.ts b/src/codegen/bundle-functions.ts index d6a0e951da..003b0e2276 100644 --- a/src/codegen/bundle-functions.ts +++ b/src/codegen/bundle-functions.ts @@ -595,7 +595,7 @@ JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) : m_vm(vm) void exportNames(); private: - JSC::VM& m_vm; + [[maybe_unused]] JSC::VM& m_vm; WEBCORE_FOREACH_${basename.toUpperCase()}_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) @@ -638,7 +638,7 @@ JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) : m_vm(vm) template void visit(Visitor&); public: - JSC::VM& m_vm; + [[maybe_unused]] JSC::VM& m_vm; #define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \\ JSC::WriteBarrier m_##functionName##Function; @@ -682,7 +682,7 @@ JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) : m_vm(vm) bundledHeader += ` private: - JSC::VM& m_vm; + [[maybe_unused]] JSC::VM& m_vm; `; for (const { basename } of files) { @@ -708,7 +708,7 @@ JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) : m_vm(vm) bundledHeader += ` private: - JSC::VM& m_vm; + [[maybe_unused]] JSC::VM& m_vm; `; for (const { basename, internal } of files) {