changed extern "C" wrapper to a define to avoid screwing with IDE auto-indent

extensions
Steven Massey 4 years ago
parent b57a2bf8f0
commit c7d4450520

@ -10,15 +10,11 @@
#include "m3_core.h"
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
M3Result m3_LinkLibC (IM3Module io_module);
M3Result m3_LinkSpecTest (IM3Module io_module);
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_api_libc_h

@ -10,14 +10,10 @@
#include "m3_core.h"
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
M3Result m3_LinkWASI (IM3Module io_module);
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_api_wasi_h

@ -10,9 +10,7 @@
#include "m3_core.h"
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
typedef struct M3CodePage
{
@ -48,8 +46,6 @@ void dump_code_page (IM3CodePage i_codePage, pc_t
# define EmitWord64(page, val) EmitWord_impl(page, (void*)(val))
#endif
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_code_h

@ -762,7 +762,7 @@ M3Result Compile_Const_f32 (IM3Compilation o, u8 i_opcode)
{
M3Result result;
union { u64 u; f32 f; } value = {};
union { u64 u; f32 f; } value = {};
_ (Read_f32 (& value.f, & o->wasm, o->wasmEnd)); m3log (compile, d_indent "%s (const f32 = %f)", get_indention_string (o), value);
_ (PushConst (o, value.u, c_m3Type_f32));
@ -775,7 +775,7 @@ M3Result Compile_Const_f64 (IM3Compilation o, u8 i_opcode)
{
M3Result result;
union { u64 u; f64 f; } value = {};
union { u64 u; f64 f; } value = {};
_ (Read_f64 (& value.f, & o->wasm, o->wasmEnd)); m3log (compile, d_indent "%s (const f64 = %lf)", get_indention_string (o), value);
_ (PushConst (o, value.u, c_m3Type_f64));
@ -1363,7 +1363,7 @@ _ (EmitOp (o, op_Branch));
M3Result Compile_If (IM3Compilation o, u8 i_opcode)
{
M3Result result;
_try {
_ (PreserveNonTopRegisters (o));
_ (PreserveArgsAndLocals (o));

@ -11,9 +11,7 @@
#include "m3_code.h"
#include "m3_exec_defs.h"
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
enum
{
@ -167,8 +165,6 @@ M3Result Compile_Function (IM3Function io_function);
bool PeekNextOpcode (IM3Compilation o, u8 i_opcode);
u16 GetMaxExecSlot (IM3Compilation o);
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_compile_h

@ -17,9 +17,15 @@
#include "wasm3.h"
#include "m3_config.h"
#if defined(__cplusplus)
extern "C" {
#endif
# if defined(__cplusplus)
# define d_m3BeginExternC extern "C" {
# define d_m3EndExternC }
# else
# define d_m3BeginExternC
# define d_m3EndExternC
# endif
d_m3BeginExternC
#if !defined(d_m3ShortTypesDefined)
typedef double f64;
@ -227,8 +233,6 @@ size_t SPrintArg (char * o_string, size_t i_n, m3stack_t i_sp
void ReportError (IM3Runtime io_runtime, IM3Module i_module, IM3Function i_function, ccstr_t i_errorMessage, ccstr_t i_file, u32 i_lineNum);
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_core_h

@ -10,9 +10,7 @@
#include "m3_compile.h"
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
M3Result BridgeToNewPageIfNecessary (IM3Compilation o);
M3Result EnsureCodePageNumLines (IM3Compilation o, u32 i_numLines);
@ -20,14 +18,12 @@ M3Result EnsureCodePageNumLines (IM3Compilation o, u32 i_numLines);
M3Result EmitOp (IM3Compilation o, IM3Operation i_operation);
void EmitConstant (IM3Compilation o, const u64 i_immediate);
void EmitConstant64 (IM3Compilation o, const u64 i_const);
void EmitSlotOffset (IM3Compilation o, const i32 i_offset);
void EmitSlotOffset (IM3Compilation o, const i32 i_offset);
void EmitPointer (IM3Compilation o, const void * const i_pointer);
void * ReservePointer (IM3Compilation o);
pc_t GetPC (IM3Compilation o);
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_emit_h

@ -458,14 +458,14 @@ M3Result InitStartFunc (IM3Module io_module)
M3Result result = m3Err_none;
if (io_module->startFunction >= 0)
{
IM3Function function = & io_module->functions [io_module->startFunction];
{
IM3Function function = & io_module->functions [io_module->startFunction];
if (not function->compiled)
{
_ (Compile_Function (function));
}
_ (m3_Call(function));
}

@ -13,9 +13,7 @@
#include "m3_exec.h"
#include "m3_compile.h"
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
typedef struct M3FuncType
{
@ -255,8 +253,6 @@ void ReleaseCodePage (IM3Runtime io_runtime,
M3Result m3Error (M3Result i_result, IM3Runtime i_runtime, IM3Module i_module, IM3Function i_function, const char * const i_file, u32 i_lineNum, const char * const i_errorMessage, ...);
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_env_h

@ -186,8 +186,8 @@ d_m3OpDef (Compile)
d_m3OpDef (Entry)
{
d_m3ClearRegisters
d_m3ClearRegisters
IM3Function function = immediate (IM3Function);
#if defined(d_m3SkipStackCheck)
@ -260,9 +260,9 @@ d_m3OpDef (SetGlobal_i64)
d_m3OpDef (Loop)
{
// regs are unused coming into a loop anyway
// this reduces code size & stack usage
d_m3ClearRegisters
// regs are unused coming into a loop anyway
// this reduces code size & stack usage
d_m3ClearRegisters
m3ret_t r;

@ -29,9 +29,7 @@
#include <math.h>
#include <limits.h>
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
# define rewrite_op(OP) * ((void **) (_pc-1)) = (void*)(OP)
@ -917,8 +915,6 @@ d_m3RetSig profileOp (d_m3OpSig, cstr_t i_operationName)
}
# endif
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_exec_h

@ -10,22 +10,18 @@
#include "m3_core.h"
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
# define d_m3OpSig pc_t _pc, u64 * _sp, M3MemoryHeader * _mem, m3reg_t _r0, f64 _fp0
# define d_m3OpArgs _sp, _mem, _r0, _fp0
# define d_m3OpAllArgs _pc, _sp, _mem, _r0, _fp0
# define d_m3OpDefaultArgs 0, 0.
# define d_m3ClearRegisters _r0 = 0; _fp0 = 0.;
# define d_m3ClearRegisters _r0 = 0; _fp0 = 0.;
# define m3MemData(mem) (u8*)((M3MemoryHeader*)(mem)+1)
typedef m3ret_t (vectorcall * IM3Operation) (d_m3OpSig);
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_exec_defs_h

@ -10,9 +10,7 @@
#include "m3_compile.h"
#if defined(__cplusplus)
extern "C" {
#endif
d_m3BeginExternC
#if d_m3LogOutput
@ -32,8 +30,6 @@ void log_emit (IM3Compilation o, IM3Operation i_operat
#endif // d_m3LogOutput
#if defined(__cplusplus)
}
#endif
d_m3EndExternC
#endif // m3_info_h

@ -237,11 +237,11 @@ M3Result ParseSection_Start (IM3Module io_module, bytes_t i_bytes, cbytes_t i_
u32 startFuncIndex;
_ (ReadLEB_u32 (& startFuncIndex, & i_bytes, i_end)); m3log (parse, "** Start Function: %d", startFunc);
if (startFuncIndex < io_module->numFunctions)
{
io_module->startFunction = startFuncIndex;
}
else result = "start function index out of bounds";
if (startFuncIndex < io_module->numFunctions)
{
io_module->startFunction = startFuncIndex;
}
else result = "start function index out of bounds";
_catch: return result;
}

Loading…
Cancel
Save