Skip to content

Instantly share code, notes, and snippets.

View mikdusan's full-sized avatar

Michael Dusan mikdusan

View GitHub Profile
diff --git a/lib/compiler/build_runner.zig b/lib/compiler/build_runner.zig
index 01dc437208..fa836f0df4 100644
--- a/lib/compiler/build_runner.zig
+++ b/lib/compiler/build_runner.zig
@@ -1096,8 +1096,9 @@ fn usage(b: *std.Build, out_stream: anytype) !void {
\\ --prefix-exe-dir [path] Where to install executables
\\ --prefix-include-dir [path] Where to install C header files
\\
- \\ --release[=mode] Request release mode, optionally specifying a
- \\ preferred optimization mode: fast, safe, small
@mikdusan
mikdusan / pipeline.zig
Created March 25, 2024 17:07
Zig pipelines with a ruby-like flexible interface for closes, redirects, pipes, symbolic names, files-by-paths, etc.
test "pipeline" {
// SILLY PIPELINE EXAMPLE
//
// cat /etc/passwd | (code-filter) | sort > /tmp/out.txt
// |-- child[0] ---| |---- child[1] -----|
//
// note: not convinced splitting ChildBuilder/ChildProcess is ideal
var builder = .{
try ChildBuilder.init(testing.allocator),
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c06d24715..26777640d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -906,11 +906,7 @@ if(ZIG_SINGLE_THREADED)
else()
set(ZIG_SINGLE_THREADED_ARG "")
endif()
-if(ZIG_STATIC AND NOT MSVC)
- set(ZIG_STATIC_ARG "-Duse-zig-libcxx")
@mikdusan
mikdusan / z0.zig
Created September 26, 2023 15:08
multi optional pattern
const std = @import("std");
pub fn main() void {
const oa: ?u32 = 0;
const ob: ?u32 = 1;
const oc: ?u32 = 2;
// pattern without "else" codepath
outer: {
const a = oa orelse break :outer;
@mikdusan
mikdusan / macOS Internals.md
Created May 7, 2023 15:08 — forked from kconner/macOS Internals.md
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

rm -fr zig-cache; zig test -Itest test/behavior.zig
lib/std/debug.zig:281:14: error: reached unreachable code
if (!ok) unreachable; // assertion failure
^~~~~~~~~~~
lib/std/math.zig:133:11: note: called from here
assert(tolerance >= 0);
~~~~~~^~~~~~~~~~~~~~~~
test/behavior/floatop.zig:382:36: note: called from here
try expect(math.approxEqAbs(f16, @log(a), 1, epsilon));
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
[jacobly0-mac-f16-abi] tiberius▸ rm -fr zig-cache; zig2 test -Itest test/behavior.zig
Test [26/1667] test.align(@alignOf(T)) T does not force resolution of T... SKIP
Test [70/1667] test.simple coroutine suspend and resume... SKIP
Test [71/1667] test.pass parameter to coroutine... SKIP
Test [72/1667] test.suspend at end of function... SKIP
Test [73/1667] test.local variable in async function... SKIP
Test [74/1667] test.calling an inferred async function... SKIP
Test [75/1667] test.@frameSize... SKIP
Test [76/1667] test.coroutine suspend, resume... SKIP
Test [77/1667] test.coroutine suspend with block... SKIP
/Users/mike/project/zig/work/llvm16c/stage1/zig.h:3215:1: error: use of undeclared identifier 'lo'
zig_float_builtins(128)
^
/Users/mike/project/zig/work/llvm16c/stage1/zig.h:3169:5: note: expanded from macro 'zig_float_builtins'
zig_expand_concat(zig_float_negate_builtin_, zig_has_f##w)(w) \
^
/Users/mike/project/zig/work/llvm16c/stage1/zig.h:254:37: note: expanded from macro 'zig_expand_concat'
#define zig_expand_concat(lhs, rhs) zig_concat(lhs, rhs)
^
/Users/mike/project/zig/work/llvm16c/stage1/zig.h:253:30: note: expanded from macro 'zig_concat'
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -I/opt/llvm-macos13.0-x86_64-16.0.0-release/include -I/Users/mike/project/zig/work/llvm16b -I/Users/mike/project/zig/work/llvm16b/_build -I/Users/mike/project/zig/work/llvm16b/src -I/Users/mike/project/zig/work/llvm16b/stage1 -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -std=c99 -O0 -fno-stack-protector -MD -MT CMakeFiles/zig2.dir/compiler_rt.c.o -MF CMakeFiles/zig2.dir/compiler_rt.c.o.d -o CMakeFiles/zig2.dir/compiler_rt.c.o -c /Users/mike/project/zig/work/llvm16b/_build/compiler_rt.c
/Users/mike/project/zig/work/llvm16b/_build/compiler_rt.c:657:21: error: conflicting types for '__trunctfhf2'
zig_extern uint16_t __trunctfhf2(zig_f128);
^
/Users/mike/project/zig/work/llvm16b/stage1/zig.h:3082:1: note: previous declaration is here
zig_convert_builtin(zig_f16, trunc, zig_f128, 2)
^
/Users/mike/project/zig/work/llvm16b/stage1/zig.h:30
const std = @import("std");
pub fn main() !void {
try one();
}
fn one() !void {
try two();
}