From 8d2617110facddc2ba709db28abd710e7ce2ca38 Mon Sep 17 00:00:00 2001 From: mc78 Date: Sun, 17 Nov 2019 15:57:34 +0100 Subject: [PATCH] Removed additional exit constants definitions from cc65.h to stdlih.h. Guarded the definitions by #ifdef. Removed cc65.h includes from abort and assert implementations. --- include/cc65.h | 8 -------- include/stdlib.h | 11 +++++++++++ libsrc/common/_afailed.c | 1 - libsrc/common/abort.c | 1 - libsrc/geos-common/common/_afailed.c | 1 - libsrc/geos-common/common/abort.c | 1 - 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/cc65.h b/include/cc65.h index 9506cf107..720f1cd04 100644 --- a/include/cc65.h +++ b/include/cc65.h @@ -37,14 +37,6 @@ #define _CC65_H -/* Those cc65 exit constants definitions are in addition the the - constants defined in stdlib.h. The values 0 and 1 are still - reserved for EXIT_SUCCESS and EXIT_FAILURE and should not be - redefined */ -#define EXIT_ASSERT 2 -#define EXIT_ABORT 3 - - /*****************************************************************************/ /* Code */ /*****************************************************************************/ diff --git a/include/stdlib.h b/include/stdlib.h index 3103172d8..638cb475b 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -48,6 +48,17 @@ typedef unsigned size_t; #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 +#if __CC65_STD__ == __CC65_STD_CC65__ + +/* Those non-standard cc65 exit constants definitions are in addition + to the EXIT_SUCCESS and EXIT_FAILURE constants, which should not be + redefined */ +#define EXIT_ASSERT 2 +#define EXIT_ABORT 3 + +#endif + + /* Return type of the div function */ typedef struct { int rem; diff --git a/libsrc/common/_afailed.c b/libsrc/common/_afailed.c index 7df2db60f..ad50a8750 100644 --- a/libsrc/common/_afailed.c +++ b/libsrc/common/_afailed.c @@ -10,7 +10,6 @@ #include #include #include -#include void __fastcall__ _afailed (char* file, unsigned line) diff --git a/libsrc/common/abort.c b/libsrc/common/abort.c index af0d8c314..1dda559bb 100644 --- a/libsrc/common/abort.c +++ b/libsrc/common/abort.c @@ -9,7 +9,6 @@ #include #include #include -#include void abort (void) diff --git a/libsrc/geos-common/common/_afailed.c b/libsrc/geos-common/common/_afailed.c index 63f234962..97727d605 100644 --- a/libsrc/geos-common/common/_afailed.c +++ b/libsrc/geos-common/common/_afailed.c @@ -7,7 +7,6 @@ #include #include #include -#include void _afailed (char* file, unsigned line) { diff --git a/libsrc/geos-common/common/abort.c b/libsrc/geos-common/common/abort.c index 92ed745a0..90a651286 100644 --- a/libsrc/geos-common/common/abort.c +++ b/libsrc/geos-common/common/abort.c @@ -6,7 +6,6 @@ #include #include -#include void abort (void) {