diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-04-27 00:35:20 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-04-27 12:18:32 +0200 |
commit | 64eec7f90e945696572ee076b75d1f35e8f2248a (patch) | |
tree | f61121e8f89e39787a960e621fc8492e57fc4bc0 /vm.h | |
parent | 4af803d76e4c08ff5661c2b37dbd333f3aba866d (diff) |
treewide: ISO C / pedantic compliance
- Shuffle typedefs to avoid need for non-compliant forward declarations
- Fix non-compliant empty struct initializers
- Remove use of braced expressions
- Remove use of anonymous unions
- Avoid `void *` pointer arithmetic
- Fix several warnings reported by gcc -pedantic mode and clang 11 compilation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'vm.h')
-rw-r--r-- | vm.h | 49 |
1 files changed, 1 insertions, 48 deletions
@@ -23,6 +23,7 @@ #include "chunk.h" #include "util.h" #include "lexer.h" +#include "types.h" #define __insns \ __insn(NOOP) \ @@ -104,54 +105,6 @@ typedef struct { } uc_insn_definition; typedef enum { - EXCEPTION_NONE, - EXCEPTION_SYNTAX, - EXCEPTION_RUNTIME, - EXCEPTION_TYPE, - EXCEPTION_REFERENCE, - EXCEPTION_USER -} uc_exception_type_t; - -typedef struct { - uc_exception_type_t type; - uc_value_t *stacktrace; - char *message; -} uc_exception; - -typedef struct { - uint8_t *ip; - uc_closure_t *closure; - uc_cfunction_t *cfunction; - size_t stackframe; - uc_value_t *ctx; - bool mcall; -} uc_callframe; - -uc_declare_vector(uc_callframes, uc_callframe); -uc_declare_vector(uc_stack, uc_value_t *); - -typedef struct uc_vm { - uc_stack stack; - uc_exception exception; - uc_callframes callframes; - uc_upvalref_t *open_upvals; - uc_parse_config *config; - uc_value_t *globals; - uc_source *sources; - uc_weakref_t values; - union { - uint32_t u32; - int32_t s32; - uint16_t u16; - int16_t s16; - uint8_t u8; - int8_t s8; - } arg; - size_t spread_values; - uint8_t trace; -} uc_vm; - -typedef enum { STATUS_OK, ERROR_COMPILE, ERROR_RUNTIME |