diff --git a/display/ng.c b/display/ng.c index 1233bb73..7e2c82b5 100644 --- a/display/ng.c +++ b/display/ng.c @@ -25,7 +25,6 @@ */ #include -#include #include "display.h" /* XY plot interface */ #include "ng.h" @@ -123,7 +122,9 @@ int ng_init(void *dev, int debug) { /* Don't change this number. */ - assert (DISPLAYS == 8); +#if (DISPLAYS != 8) +#error "DISPLAYS is not 8" +#endif ng_dptr = dev; ng_dbit = debug; diff --git a/sim_defs.h b/sim_defs.h index 5d78105f..e390be26 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -1093,6 +1093,14 @@ struct MEMFILE { snprintf(buf, sizeof (buf), "%s failed", #_Expression); \ SIM_SCP_ABORT (buf); \ } +#if defined(assert) +#error "Don't use assert(). It is advised to use ASSURE(expression) instead" +#else +#define assert(_Expression) do { \ + fprintf (stderr, "Don't use assert(). It is advised to use ASSURE(expression) instead.\n"); \ + abort(); \ + } while (1) +#endif #if defined(SIM_ASYNCH_IO) #define AIO_CHECK_EVENT sim_aio_check_event() diff --git a/slirp/tftp.c b/slirp/tftp.c index 2d7d5a3d..c6c13709 100644 --- a/slirp/tftp.c +++ b/slirp/tftp.c @@ -387,7 +387,10 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen) } if (nb_options > 0) { - assert(nb_options <= ARRAY_SIZE(option_name)); + if (nb_options > ARRAY_SIZE(option_name)) { + fprintf (stderr, "option_name array bounds: %d\n", nb_options); + abort (); + } tftp_send_oack(spt, option_name, option_value, nb_options, tp); return; } diff --git a/slirp_glue/qemu/osdep.h b/slirp_glue/qemu/osdep.h index c3d33394..81173e71 100644 --- a/slirp_glue/qemu/osdep.h +++ b/slirp_glue/qemu/osdep.h @@ -57,7 +57,6 @@ #include #include #include -#include #include #ifdef __OpenBSD__