From 40c8bf257168320a616f4588f7c09e11ffb441cb Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 20 Jul 2026 00:17:26 +0000 Subject: [PATCH 49/71] fix(macos): GCC build errors in the SSH + iTerm2 additions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two compile failures on the PPC GCC-16 build: - TerminalSession ctor used `SshOptions ssh = SshOptions {}` as a default argument, but SshOptions has default member initializers (port = 22, ...), and GCC forbids using such a struct in a default argument of a member function declared inside the still-incomplete class ("default member initializer required before the end of its enclosing class"). Drop all three ctor default arguments (backend/colorPalette/ssh) — the sole caller, bridge_create, passes them explicitly. - decodePngViaImageIO OR'd two CoreGraphics enum constants directly (kCGImageAlphaPremultipliedLast | kCGBitmapByteOrderDefault), tripping -Wdeprecated-enum-enum-conversion. Cast each to uint32_t first, matching the CGBitmapContext usage already in the view. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/TerminalSession.cpp | 20 ++++++++++---------- src/contour_macos/TerminalSession.h | 10 +++++++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/contour_macos/TerminalSession.cpp b/src/contour_macos/TerminalSession.cpp index eb2f17c2..55dd9ce6 100644 --- a/src/contour_macos/TerminalSession.cpp +++ b/src/contour_macos/TerminalSession.cpp @@ -121,18 +121,18 @@ namespace auto const h = static_cast(CGImageGetHeight(image)); if (w != 0 && h != 0) { - // Draw into a known RGBA8, straight-alpha, top-left-origin buffer regardless of the - // source's color space / bit depth / orientation. + // Draw into a known RGBA8, top-left-origin buffer regardless of the source's color + // space / bit depth / orientation. CoreGraphics bitmap contexts only offer + // premultiplied alpha on 10.6 (straight alpha-last is unsupported for drawing); the + // renderer blits image textures verbatim, so this is exact for opaque images and only + // differs at the translucent edges of alpha PNGs — an acceptable minor fidelity gap. + // Cast each flag to uint32_t before OR-ing to avoid the deprecated enum-enum + // conversion, matching the CGBitmapContext usage in the view. vtbackend::Image::Data pixels(w * h * 4, 0); CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); - CGContextRef ctx = CGBitmapContextCreate(pixels.data(), - w, - h, - 8, - w * 4, - cs, - kCGImageAlphaPremultipliedLast - | kCGBitmapByteOrderDefault); + uint32_t const bitmapInfo = static_cast(kCGImageAlphaPremultipliedLast) + | static_cast(kCGBitmapByteOrderDefault); + CGContextRef ctx = CGBitmapContextCreate(pixels.data(), w, h, 8, w * 4, cs, bitmapInfo); if (ctx) { CGContextDrawImage(ctx, CGRectMake(0, 0, (CGFloat) w, (CGFloat) h), image); diff --git a/src/contour_macos/TerminalSession.h b/src/contour_macos/TerminalSession.h index e829ea91..1b07d74a 100644 --- a/src/contour_macos/TerminalSession.h +++ b/src/contour_macos/TerminalSession.h @@ -66,13 +66,17 @@ class TerminalSession: public vtbackend::Terminal::Events OpenGL, }; + // No default arguments: a struct with default member initializers (SshOptions::port, etc.) + // cannot appear in a default argument of a member function declared inside the same class (the + // class is still incomplete there — GCC rejects it). The sole caller (bridge_create) passes all + // arguments explicitly anyway. TerminalSession(vtbackend::PageSize pageSize, vtrasterizer::FontDescriptions fontDescriptions, ImageSize surfaceSize, Callbacks callbacks, - RenderBackend backend = RenderBackend::CPU, - vtbackend::ColorPalette colorPalette = vtbackend::ColorPalette {}, - SshOptions ssh = SshOptions {}); + RenderBackend backend, + vtbackend::ColorPalette colorPalette, + SshOptions ssh); ~TerminalSession() override; /// Spawns the shell and starts the read/parse thread.