From 6f634ae432a857ceaa37b4be6f7ba66bba3ce086 Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Thu, 7 May 2026 02:53:42 -0500 Subject: [PATCH] fix(elb): use clang-only -fbracket-depth flag conditionally gcc rejects -fbracket-depth=1024 with 'unrecognized command-line option'. Use shell subshell to probe cc --version and only pass the flag when the compiler is clang. --- lang/elb.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lang/elb.el b/lang/elb.el index dd9b298..e80eff5 100644 --- a/lang/elb.el +++ b/lang/elb.el @@ -271,7 +271,10 @@ fn link_binary(c_files: [String], out_bin: String, runtime_path: String, out_dir let parts: [String] = native_list_empty() // Include both the runtime dir (for el_runtime.h) and the output dir // (for module.elh cross-module forward declarations). - let parts = native_list_append(parts, "cc -O2 -fbracket-depth=1024 -I " + dirname_of(runtime_path) + " -I " + out_dir) + // Detect clang vs gcc: -fbracket-depth is clang-only; silently ignored + // if unsupported but gcc rejects it with an error. + let bracket_flag: String = "$(cc --version 2>&1 | grep -q clang && printf -- '-fbracket-depth=1024' || true)" + let parts = native_list_append(parts, "cc -O2 " + bracket_flag + " -I " + dirname_of(runtime_path) + " -I " + out_dir) let i = 0 while i < n { let f: String = native_list_get(c_files, i) -- 2.52.0