From 97f7a7cb4deacbc92a9dbdc1b9394e4e1358e47a Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 10 Apr 2021 14:46:36 +0100 Subject: [PATCH] Enforce that NDEBUG is not defined. PuTTY is a security project, so assertions are important - if an assumption is violated, proceeding anyway may have far worse consequences than simple program termination. This check and #error should arrange that we don't ever accidentally compile assertions out. --- defs.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/defs.h b/defs.h index 3ba43c4f..86f8edde 100644 --- a/defs.h +++ b/defs.h @@ -11,6 +11,17 @@ #ifndef PUTTY_DEFS_H #define PUTTY_DEFS_H +#ifdef NDEBUG +/* + * PuTTY is a security project, so assertions are important - if an + * assumption is violated, proceeding anyway may have far worse + * consequences than simple program termination. This check and #error + * should arrange that we don't ever accidentally compile assertions + * out. + */ +#error Do not compile this code base with NDEBUG defined! +#endif + #include #include #include /* for __MINGW_PRINTF_FORMAT */