File tree Expand file tree Collapse file tree
mrbgems/mruby-bigint/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,11 +50,16 @@ typedef struct mpz_context {
5050 mpz_pool_t * pool ; /* NULL for heap-only operations */
5151} mpz_ctx_t ;
5252
53- /* Convenience macros for context creation */
53+ /* Convenience macros for context creation.
54+ * Uses per-member assignment instead of a C99 compound literal with
55+ * designated initializers so the file compiles as C++ on legacy
56+ * toolchains (pre-C++20). */
5457#define MPZ_CTX_INIT (mrb_ptr , ctx , pool_ptr ) \
5558 mpz_pool_t pool ## _storage = {{0}};\
5659 mpz_pool_t *pool_ptr = &pool ## _storage;\
57- mpz_ctx_t ctx ## _struct = ((mpz_ctx_t){.mrb = (mrb_ptr), .pool = (pool_ptr)}); \
60+ mpz_ctx_t ctx ## _struct; \
61+ ctx ## _struct.mrb = (mrb_ptr); \
62+ ctx ## _struct.pool = (pool_ptr); \
5863 mpz_ctx_t *ctx = &(ctx ## _struct);
5964
6065/* Access macros for readability */
You can’t perform that action at this time.
0 commit comments