From 90cbc748d9bc34fa574fff623e957577a4981b35 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 20 Aug 2024 22:38:43 -0400 Subject: [PATCH] fixed linker errors --- Makefile | 2 +- source/onward.c | 2 +- source/onward.h | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 09beef9..bf00ca3 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ AR = ar # flags INCS = -Isource/ -Itests/ CPPFLAGS = -D_XOPEN_SOURCE=700 -CFLAGS += ${INCS} ${CPPFLAGS} +CFLAGS += ${INCS} ${CPPFLAGS} --std=c99 -pedantic -Wall -Wextra LDFLAGS += ${LIBS} ARFLAGS = rcs diff --git a/source/onward.c b/source/onward.c index 48e07eb..8e8e2c3 100644 --- a/source/onward.c +++ b/source/onward.c @@ -192,7 +192,7 @@ defcode("exec", exec, &find, 0u) { do { word_t* current = (word_t*)( onward_pcfetch() ); /* If the current instruction is null then "return" */ - if (0u == current) { + if ((void*)0u == current) { pc = (value_t)onward_rspop(); /* if the instruction is a primitive then execute the c function */ } else if (current->flags & F_PRIMITIVE_MSK) { diff --git a/source/onward.h b/source/onward.h index d96eeed..89f2ec8 100644 --- a/source/onward.h +++ b/source/onward.h @@ -44,8 +44,8 @@ typedef struct { } onward_init_t; #define deccode(c_name) \ - void c_name##_code(void); \ - const word_t c_name + extern void c_name##_code(void); \ + extern const word_t c_name /** Define a built-in word that executes native code */ #define defcode(name_str, c_name, prev, flags) \ @@ -61,7 +61,7 @@ typedef struct { void c_name##_code(void) #define decword(c_name) \ - const word_t c_name + extern const word_t c_name /** Define a built-in word that is defined by references to other words. */ #define defword(name_str, c_name, prev, flags) \ @@ -77,8 +77,8 @@ typedef struct { const value_t c_name##_code[] = #define decvar(c_name) \ - value_t c_name; \ - const word_t c_name##_word + extern value_t c_name; \ + extern const word_t c_name##_word /** Define a built-in word representing a variable with the provided value */ #define defvar(name_str, c_name, initial, prev) \ @@ -88,8 +88,8 @@ typedef struct { value_t c_name = initial #define decconst(c_name) \ - const value_t c_name; \ - const word_t c_name##_word + extern const value_t c_name; \ + extern const word_t c_name##_word /** Define a built-in word representing a constant with the provided value */ #define defconst(name_str, c_name, value, prev) \ -- 2.51.0