switch fail markers to function symbols

This commit is contained in:
2026-04-01 21:17:01 +02:00
parent 353dfae39c
commit 39d2e1c51f
6 changed files with 53 additions and 72 deletions

View File

@ -1,17 +1,23 @@
#include "lib.h"
#include "../lib.h"
void fail_start_trace(void) {}
void fail_stop_trace(void) {}
void fail_marker_positive(void) {}
void fail_marker_negative(void) {}
void fail_marker_detected(void) {}
int wasm_module(void);
MAIN() {
int result;
MARKER(start_trace);
fail_start_trace();
result = wasm_module();
MARKER(stop_trace);
fail_stop_trace();
if (result == 100) {
MARKER(ok_marker);
fail_marker_positive();
} else {
MARKER(fail_marker);
fail_marker_negative();
}
}

View File

@ -1,35 +0,0 @@
#pragma once
#define INLINE __attribute__((always_inline)) inline
#define NOINLINE __attribute__((noinline))
#define __QUOTE(x) #x
#define QUOTE(x) __QUOTE(x)
#ifndef ARCH_ASM_CLOBBER_ALL
#define ARCH_ASM_CLOBBER_ALL "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp"
#endif
#ifndef MARKER
#define MARKER(str) \
__asm__ volatile(QUOTE(str) ":" \
: /* no inputs */ \
: /* no outputs */ \
: "memory", ARCH_ASM_CLOBBER_ALL)
#endif
#ifndef MAIN
#define MAIN() void os_main(void)
#endif
#ifndef POSIX_PRINTF
#define POSIX_PRINTF(...)
#endif
typedef __UINT8_TYPE__ uint8_t;
typedef __UINT16_TYPE__ uint16_t;
typedef __UINT32_TYPE__ uint32_t;
typedef __INT8_TYPE__ int8_t;
typedef __INT16_TYPE__ int16_t;
typedef __INT32_TYPE__ int32_t;