diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-12 00:04:56 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-12 00:04:56 -0500 |
| commit | a4d11f51ff409901e92a35983ace8b9b2a7ec2d3 (patch) | |
| tree | 0b2bc4faab88e49b2d9a0f6350280700e359084e /stdlib | |
| parent | 5b8f7179ad28e615d1cc40753125f4f296dd5b59 (diff) | |
Fixes for 'if' blocks with nested 'else if' that declare variables
Diffstat (limited to 'stdlib')
| -rw-r--r-- | stdlib/util.h | 2 |
1 files changed, 2 insertions, 0 deletions
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 |
