]> git.mdlowis.com Git - projs/onward.git/commitdiff
fixed linker errors
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 21 Aug 2024 02:38:43 +0000 (22:38 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 21 Aug 2024 02:38:43 +0000 (22:38 -0400)
Makefile
source/onward.c
source/onward.h

index 09beef92dc39d70c58a3a5f30b975a479a1350fa..bf00ca340423c951903dad1456360b784934cb38 100644 (file)
--- 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
 
index 48e07eb12c6d72e786fb765cda151b25199e9bd3..8e8e2c3648678fdcc2b83fcffc8bcf2f3dba2e26 100644 (file)
@@ -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) {
index d96eeedab06ffaa561f561084ef7e90c51c8f8fb..89f2ec895030371e74b13658e9fd5b002d38f9af 100644 (file)
@@ -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)  \