From 3264cf697f5fe996c2a79c6c34181c186fe2f96e Mon Sep 17 00:00:00 2001 From: Michael Panzlaff Date: Sat, 9 May 2020 14:49:51 +0200 Subject: fix aggressive loop optimizations Previously, aggressive loop optimizations with a new compiler were not possible due to undefined behaviour at end of arrays. A macro "UBFIX" is added to allow ifdefs for fixes which resolve undefined behavior. For example newer GCC versions will detect various bugs in the original game code and will otherwise not compile with -Werror. --- include/config.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/config.h') diff --git a/include/config.h b/include/config.h index 318ed39d8..4f97a12a3 100644 --- a/include/config.h +++ b/include/config.h @@ -26,4 +26,12 @@ #define UNITS_METRIC #endif +// Various undefined behavior bugs may or may not prevent compilation with +// newer compilers. So always fix them when using a modern compiler. +#if MODERN +#ifndef UBFIX +#define UBFIX +#endif +#endif + #endif // GUARD_CONFIG_H -- cgit v1.2.3