From fd2e52e60dc8fde7e8e2dc99245e2e7bf852af50 Mon Sep 17 00:00:00 2001 From: "Steffen \"Daode\" Nurpmeso" Date: Tue, 2 Oct 2012 14:56:46 +0200 Subject: [PATCH] Add (hidden) WANT_ASSERTS config support --- makeconfig | 12 ++++++++++++ rcv.h | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/makeconfig b/makeconfig index 36af0e39..c6f5cb6c 100644 --- a/makeconfig +++ b/makeconfig @@ -1,5 +1,6 @@ #!/bin/sh +[ -z "${WANT_ASSERTS}" ] && WANT_ASSERTS=0 if [ -z "${CONFIG}" ]; then [ -f user.conf ] && . user.conf else @@ -579,6 +580,12 @@ else echo "/* #define USE_MD5 */" >> $out fi +if wantfeat ASSERTS; then + echo "#define HAVE_ASSERTS" >> $out +else + echo "/* #define HAVE_ASSERTS */" >> $out +fi + # Since we cat(1) the content of those to cc/"ld", convert them to single line squeeze_em() { < "${1}" > "${2}" awk \ @@ -696,6 +703,11 @@ cat > $tmp2.c << \! : chdir() instead. This is not a problem unless the current working : directory of mailx is moved while the IMAP cache is used. #endif +#ifdef HAVE_ASSERTS +: * WANT_ASSERTS is enabled, the program binary will contain code assertions. +: Such a binary is not meant to be used by end-users, but only for +: development purposes. Thanks! +#endif : ! diff --git a/rcv.h b/rcv.h index 40106381..9f2b9f5e 100644 --- a/rcv.h +++ b/rcv.h @@ -52,12 +52,18 @@ #include #include #include -#ifdef HAVE_ICONV -#include -#endif /* HAVE_ICONV */ -#ifdef HAVE_ALLOCA_H -#include -#endif /* HAVE_ALLOCA_H */ +#ifdef HAVE_ICONV +# include +#endif +#ifdef HAVE_ALLOCA_H +# include +#endif +#ifdef HAVE_ASSERTS +# include +#else +# undef assert +# define assert(X) do {} while (0) +#endif #define SHELL "/bin/sh" -- 2.11.4.GIT