From a4d11f51ff409901e92a35983ace8b9b2a7ec2d3 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 12 Nov 2024 00:04:56 -0500 Subject: Fixes for 'if' blocks with nested 'else if' that declare variables --- stdlib/util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stdlib') diff --git a/stdlib/util.h b/stdlib/util.h index fb708476..310ba905 100644 --- a/stdlib/util.h +++ b/stdlib/util.h @@ -17,6 +17,8 @@ #define check_initialized(var, name) *({ if (!var ## $initialized) fail("The variable " name " is being accessed before it has been initialized!"); \ &var; }) +#define IF_DECLARE(decl, expr, block) if (({ decl; expr ? ({ block; 1; }) : 0; })) {} + #ifndef auto #define auto __auto_type #endif -- cgit v1.2.3