From 8f97a194ae8d91bf2bf476cb497630e8ade000ce Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Mon, 8 Apr 2024 23:08:16 +0200 Subject: [PATCH] Add m_volatile --- m-core.h | 4 ++++ m-try.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/m-core.h b/m-core.h index 21755fa3..b02c08fb 100644 --- a/m-core.h +++ b/m-core.h @@ -4550,6 +4550,10 @@ m_core_parse2_enum (const char str[], const char **endptr) Do nothing if exceptions are not enabled. */ #define M_IF_EXCEPTION(...) (void) 0 +/* Declare a variable as volatile if exceptions are enabled */ +#define m_volatile /* nothing */ + + /* Declare a variable, initialize it, continue if the initialization succeeds, and clears the variable afterwards. Otherwise, stop the execution and execute else_code if defined. diff --git a/m-try.h b/m-try.h index b252e74f..cb7eed61 100644 --- a/m-try.h +++ b/m-try.h @@ -585,5 +585,9 @@ m_try_jump_final(m_try_t state) #undef M_MEMORY_FULL #define M_MEMORY_FULL(size) M_THROW(M_ERROR_MEMORY, (intptr_t)(size)) +// Add attribute volatile if exceptions are enabled +#undef m_volatile +#define m_volatile volatile + #endif