From 8dbdeb7773990bfbd1af5461c4b584cc9b9579ea Mon Sep 17 00:00:00 2001 From: Scott Smith Date: Tue, 16 Nov 2021 23:01:39 -0800 Subject: [PATCH] Remove a bunch of macros from engine_ptr.h (#3562) --- firmware/controllers/core/engine_ptr.h | 25 ++----------------------- unit_tests/global.h | 17 ----------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/firmware/controllers/core/engine_ptr.h b/firmware/controllers/core/engine_ptr.h index 8fc0a3a094..f33e071e63 100644 --- a/firmware/controllers/core/engine_ptr.h +++ b/firmware/controllers/core/engine_ptr.h @@ -23,32 +23,13 @@ struct engine_configuration_s; struct persistent_config_s; #if EFI_UNIT_TEST + #define CONFIG(x) engineConfiguration->x + #define ENGINE(x) engine->x -#ifdef __cplusplus - #define EXTERN_ENGINE extern engine_configuration_s & activeConfiguration - - struct EnginePtr { - void inject() { - } - }; -#endif // def __cplusplus - - #define EXPAND_Engine - - #define CONFIG(x) engineConfiguration->x - #define ENGINE(x) engine->x #else // EFI_UNIT_TEST - // These are the non-unit-test (AKA real firmware) noop versions - -#ifdef __cplusplus #define ENGINE(x) ___engine.x - struct EnginePtr { - void inject() { } - }; -#endif // def __cplusplus - /** * this macro allows the compiled to figure out the complete static address, that's a performance * optimization which is hopefully useful at least for anything trigger-related @@ -58,6 +39,4 @@ struct persistent_config_s; * access in unit tests */ #define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x - - #define EXPAND_Engine #endif // EFI_UNIT_TEST diff --git a/unit_tests/global.h b/unit_tests/global.h index 2837469abb..24919250e3 100644 --- a/unit_tests/global.h +++ b/unit_tests/global.h @@ -62,23 +62,6 @@ void chDbgAssert(int c, char *msg, void *arg); #define CCM_OPTIONAL -/** - * this macro provides references to engine from EngineTestHelper - */ -#define EXPAND_EngineTestHelper \ - -#define WITH_ENGINE_TEST_HELPER_SENS(x, sensorvals) \ - EngineTestHelper eth(x, sensorvals); \ - EXPAND_EngineTestHelper; - -#define WITH_ENGINE_TEST_HELPER(x) \ - EngineTestHelper eth(x, std::unordered_map{}); \ - EXPAND_EngineTestHelper; - -#define WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(x, callback) \ - EngineTestHelper eth(x, callback, std::unordered_map{}); \ - EXPAND_EngineTestHelper; - #ifdef __cplusplus namespace chibios_rt { // Noop for unit tests - this does real lock in FW/sim