Skip to content

Commit 7d785f2

Browse files
committed
chore: add nix.gni fallback for non-Nix builds and fix compiler warnings
CMakeLists.txt previously required a nix.gni file (generated by the Nix shell hook) containing platform-specific GN args. Builds outside Nix failed with "file STRINGS file nix.gni cannot be read". Now falls back to sensible defaults (is_clang=true, use_lld=false, clang_use_chrome_plugins=false) when the file doesn't exist. Also add default cases to two switch statements that triggered -Wswitch-default warnings in rtc_ice_transport.cc and error_factory.cc.
1 parent 0c4792b commit 7d785f2

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,18 @@ set_target_properties(libc++abi PROPERTIES IMPORTED_OBJECTS_DEBUG "${libc++abi_o
185185
# M114: branch-heads/5735
186186
set(WEBRTC_REVISION branch-heads/5735)
187187

188-
file(STRINGS nix.gni NIX_GN_GEN_ARGS)
188+
# nix.gni is generated by the Nix shell hook (shell.nix) with platform-specific
189+
# GN args like clang_base_path and mac_sdk_path. For non-Nix builds, create an
190+
# empty file or one with: is_clang=true\nuse_lld=false\nclang_use_chrome_plugins=false
191+
if(EXISTS "${CMAKE_SOURCE_DIR}/nix.gni")
192+
file(STRINGS nix.gni NIX_GN_GEN_ARGS)
193+
else()
194+
set(NIX_GN_GEN_ARGS
195+
"is_clang=true"
196+
"use_lld=false"
197+
"clang_use_chrome_plugins=false"
198+
)
199+
endif()
189200
list(APPEND GN_GEN_ARGS
190201
rtc_build_examples=false
191202
rtc_use_x11=false

src/interfaces/rtc_ice_transport.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ Napi::Value RTCIceTransport::GetGatheringState(const Napi::CallbackInfo &info) {
172172
state = webrtc::PeerConnectionInterface::IceGatheringState::
173173
kIceGatheringComplete;
174174
break;
175+
default:
176+
break;
175177
}
176178
CONVERT_OR_THROW_AND_RETURN_NAPI(info.Env(), state, result, Napi::Value)
177179
return result;

src/node/error_factory.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
#include "error_factory.hh"
99

10+
#include <cassert>
1011
#include <string>
1112

1213
#include "src/converters.hh"
@@ -94,6 +95,9 @@ node_webrtc::ErrorFactory::DOMExceptionNameToString(DOMExceptionName name) {
9495
return "NetworkError";
9596
case kOperationError:
9697
return "OperationError";
98+
default:
99+
assert(false && "unhandled DOMExceptionName enum value");
100+
return "UnknownError";
97101
}
98102
}
99103

0 commit comments

Comments
 (0)