minor portability fixes

This commit is contained in:
ESL 2024-07-28 10:17:13 -04:00
parent 9847b1366b
commit 3f63e27044
5 changed files with 21 additions and 6 deletions

View file

@ -61,6 +61,9 @@ objects = $(sources:%.c=%.o)
all: $(exe) all: $(exe)
clean: clean:
$(RM) $(objects)
realclean:
$(RM) $(objects) $(exe) $(RM) $(objects) $(exe)
install: install:

8
n.c
View file

@ -964,8 +964,7 @@ static void wrdatum(obj o, wenv_t *e) {
wrc('>', e); wrc('>', e);
} else if (isprocedure(o)) { } else if (isprocedure(o)) {
char buf[60]; char buf[60];
if (isobjptr(hblkref(o, 0))) sprintf(buf, "#<vmclosure @%p>", objptr_from_obj(o)); sprintf(buf, "#<procedure @%p>", (void*)objptr_from_obj(o));
else sprintf(buf, "#<procedure @%p>", objptr_from_obj(o));
wrs(buf, e); wrs(buf, e);
} else if (isrecord(o)) { } else if (isrecord(o)) {
int i, n = recordlen(o); int i, n = recordlen(o);
@ -1027,7 +1026,10 @@ extern char *argv_ref(int idx)
#if defined(WIN32) #if defined(WIN32)
#define cxg_envv _environ #define cxg_envv _environ
#elif defined(__linux) || defined(__APPLE__) #elif defined(__linux)
#define cxg_envv environ
#elif defined(__APPLE__)
extern char **environ;
#define cxg_envv environ #define cxg_envv environ
#else /* add more systems? */ #else /* add more systems? */
char **cxg_envv = { NULL }; char **cxg_envv = { NULL };

4
n.h
View file

@ -2,6 +2,10 @@
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic ignored "-Wparentheses-equality" #pragma GCC diagnostic ignored "-Wparentheses-equality"
#pragma GCC diagnostic ignored "-Wignored-attributes"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-value"
#pragma GCC diagnostic ignored "-Woverlength-strings"
#endif #endif
/* this is for MS headers; shouldn't affect others */ /* this is for MS headers; shouldn't affect others */
#define _CRT_SECURE_NO_WARNINGS 1 #define _CRT_SECURE_NO_WARNINGS 1

View file

@ -1479,8 +1479,7 @@ static void wrdatum(obj o, wenv_t *e) {
wrc('>', e); wrc('>', e);
} else if (isprocedure(o)) { } else if (isprocedure(o)) {
char buf[60]; char buf[60];
if (isobjptr(hblkref(o, 0))) sprintf(buf, \"#<vmclosure @%p>\", objptr_from_obj(o)); sprintf(buf, \"#<procedure @%p>\", (void*)objptr_from_obj(o));
else sprintf(buf, \"#<procedure @%p>\", objptr_from_obj(o));
wrs(buf, e); wrs(buf, e);
} else if (isrecord(o)) { } else if (isrecord(o)) {
int i, n = recordlen(o); int i, n = recordlen(o);
@ -1555,7 +1554,10 @@ extern char *argv_ref(int idx)
#if defined(WIN32) #if defined(WIN32)
#define cxg_envv _environ #define cxg_envv _environ
#elif defined(__linux) || defined(__APPLE__) #elif defined(__linux)
#define cxg_envv environ
#elif defined(__APPLE__)
extern char **environ;
#define cxg_envv environ #define cxg_envv environ
#else /* add more systems? */ #else /* add more systems? */
char **cxg_envv = { NULL }; char **cxg_envv = { NULL };

View file

@ -23,6 +23,10 @@
(define *prelude* (define *prelude*
"#if defined(__clang__) "#if defined(__clang__)
#pragma GCC diagnostic ignored \"-Wparentheses-equality\" #pragma GCC diagnostic ignored \"-Wparentheses-equality\"
#pragma GCC diagnostic ignored \"-Wignored-attributes\"
#pragma GCC diagnostic ignored \"-Wunused-function\"
#pragma GCC diagnostic ignored \"-Wunused-value\"
#pragma GCC diagnostic ignored \"-Woverlength-strings\"
#endif #endif
/* this is for MS headers; shouldn't affect others */ /* this is for MS headers; shouldn't affect others */
#define _CRT_SECURE_NO_WARNINGS 1 #define _CRT_SECURE_NO_WARNINGS 1