From 3a2013da4eaaa1cba2ec3cc8fce1905724c95b49 Mon Sep 17 00:00:00 2001 From: Armin Date: Tue, 17 Nov 2026 11:08:16 +0100 Subject: [PATCH] Make default compiler builds work with GCC 16 --- APKBUILD | 7 +++---- PKGBUILD | 7 +++---- README.md | 12 ++++++------ murx.c | 16 +++++++++++++++- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/APKBUILD b/APKBUILD index 3250346..7fecb4d 100644 --- a/APKBUILD +++ b/APKBUILD @@ -6,13 +6,12 @@ pkgdesc="Small persistent terminal multiplexer" url="https://codeberg.org/armin/murx" arch="all" license="Apache-2.0" -makedepends="clang" subpackages="$pkgname-doc" source="murx.c Makefile murx.1 README.md LICENSE AUTHORS" builddir="$srcdir" build() { - make CC=clang CFLAGS="$CFLAGS -std=c99 -Wall -Wextra" + make CFLAGS="$CFLAGS -std=c99 -Wall -Wextra" } check() { @@ -27,10 +26,10 @@ package() { } sha512sums=" -f16817759ba74f46d3ab89ae0dda690c6b80febfa50e7a4593b98694e42b2db16b046ad76f1f50101a6d3a1af91df621e8c526afadf7be47aff626174fcbf999 murx.c +86f7e6ac508fd46badde9ad6bba7a31e2cc896d43c0265b8014561ea4f8bea4dd76fa5ebc0df9fef53ae456feb4f5cdc808ee8b7a31ad8f5849c2436fa82687b murx.c 4f52ecfc78bb993f9bdbaa235f671fe54327497fa8e21517805a2696bea9f06d335e4da564d0019ec1fad86986c05bce90e4825dcebc2ef3c0bc66fb9a768030 Makefile 523ac85c9b789a7721c76e8f7691a1a8ab43d7fec2624f43b3850e5135451d94404d8711fa40422a67e9f13b7388470436ab06deb6ad7c87c7e72a37492ae617 murx.1 -78ba1633f449019542df121a876f2af1b0dff0277adbd9e1d0a23b3e396a8cb66bf0ff4509bf26753ad00e541d66a57ac53ce80bbebfd15c551952c2f74caddf README.md +dd4c8734c16b5d454fe638db8ed38d09337e58f89634be5d552cd72757820922207fe36f87ca77087303e8a36dedc269b27620d4c5fb0052f474e1c5892fd38a README.md 2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE 4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS " diff --git a/PKGBUILD b/PKGBUILD index 5085808..4af3419 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -7,18 +7,17 @@ arch=('x86_64' 'aarch64') url='https://codeberg.org/armin/murx' license=('Apache-2.0') depends=('glibc') -makedepends=('clang') source=('murx.c' 'Makefile' 'murx.1' 'README.md' 'LICENSE' 'AUTHORS') -sha256sums=('0267b3d6754fa08737da0d8b1baf175d962d7e3dfee66cb3fe0f818301280deb' +sha256sums=('386ad2bc32092e5380cb6a7e24accffcac72c202d9c926a896e574c2b2fdbd5a' '1d77a97ff77ce6d876baef98e22b06cfa2109a4ae65cef8b75a91df4c02ad8ac' 'f07830b93f78674956a17b108738d52c3d3efd58f431dc29f137cc339d625ee5' - '6e28ec8408619cba0341f148507c4a421733dea12a0ce6dea4e9d0eea9b7c65c' + '141849d70220b501465bd021e71c3b27854162453dc0b18d6859868e1f7eff02' '31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4' 'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb') build() { cd "$srcdir" - make CC=clang CFLAGS="$CFLAGS -std=c99 -Wall -Wextra" + make CFLAGS="$CFLAGS -std=c99 -Wall -Wextra" } check() { diff --git a/README.md b/README.md index 539e44d..74f6922 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A deliberately small terminal multiplexer. One C file, no config file, no dependencies. ```sh -make -B CC=clang +make ./murx # session "0" ./murx work # separate named session ./murx 1 # separate numbered session @@ -362,8 +362,9 @@ This is "very basic" by design: ## Build notes -Requires Clang and POSIX. Build with `make CC=clang`. GCC builds have known -runtime issues; use Clang even if GCC compiles the source successfully. +Requires a C99 compiler and POSIX. Build with `make`. Tested with Clang and +GCC 16; `grid_resize()` carries a guarded workaround for a GCC 16 optimizer bug +that otherwise collapses pane grids to 1x1. ## Linux packages @@ -371,9 +372,8 @@ The root directory includes [APKBUILD](APKBUILD) for Alpine Linux and [PKGBUILD](PKGBUILD) for Arch Linux. Both build the local source files rather than downloading a release. Version `0.20261116` identifies an unreleased snapshot; update the version and release fields when packaging a newer snapshot. -Both recipes declare Clang as a build dependency and explicitly compile with -`CC=clang`. The packages install under `/usr`, including the manual, README -and license. +Both recipes build with the default C compiler, so plain `make` works there too. +The packages install under `/usr`, including the manual, README and license. On Alpine, install `alpine-sdk`, configure your abuild signing key with `abuild-keygen -a -i`, and run as a regular user with abuild configured: diff --git a/murx.c b/murx.c index 226a2d8..7ea28cb 100644 --- a/murx.c +++ b/murx.c @@ -63,6 +63,20 @@ #include #include +/* GCC 16 miscompiles grid_resize() at -O2 when it specializes the function + interprocedurally: grid_init() gets a hard-coded 1x1 size, so pane grids + collapse to one cell and shell prompts render one character at a time. + Keep that function out of interprocedural optimization. Clang ignores it. */ +#if defined(__GNUC__) && !defined(__clang__) && defined(__has_attribute) +#if __has_attribute(noipa) +#define MURX_NOIPA __attribute__((noipa)) +#else +#define MURX_NOIPA +#endif +#else +#define MURX_NOIPA +#endif + #define DEFAULT_PREFIX 0x01 /* client -> server */ @@ -317,7 +331,7 @@ static void grid_clear_line(Grid *g, int y, int32_t bg) { } } -static void grid_resize(Grid *g, int w, int h) { +static void MURX_NOIPA grid_resize(Grid *g, int w, int h) { if (w < 1) w = 1; if (h < 1) h = 1; if (w == g->w && h == g->h) return;