From 749d4a3a0304cabd35b2caa07c37dd6903e74310 Mon Sep 17 00:00:00 2001 From: David Hebbeker Date: Thu, 11 Apr 2024 11:38:16 +0200 Subject: [PATCH] Render include paths relative. (#879) By removing `etl/` from include paths (in `#include` statements), the path to the directory `include/` doesn't need to be provided to the preprocessor as an include path if the files in `include/etl/` are included by other means. This has no disadvantages. Actually the form `#include "..."` is intended to be used for relative paths in the first place. This is relevant if one wants to include the source files from `include/etl` only indirectly. For example we use special generated header files which wrap the include statement of the vanilla header files with diagnostic commands. Those commands allow to disable diagnostic for ETL's files and re-enable them after the file inclusion. Wrapper files are generated for every non-private header file. We provide the directory with the wrapper files as include path to the preprocessor instead of the normal `include/` directory. Thus include statements like `#include "etl/private/..."` are invalid in that case. --- include/etl/limits.h | 8 ++++---- include/etl/random.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/etl/limits.h b/include/etl/limits.h index d64f6c57..ac31ca6b 100644 --- a/include/etl/limits.h +++ b/include/etl/limits.h @@ -80,19 +80,19 @@ SOFTWARE. #if defined(ETL_NO_CPP_NAN_SUPPORT) #if defined(NAN) - #include "etl/private/diagnostic_useless_cast_push.h" + #include "private/diagnostic_useless_cast_push.h" #define ETL_NANF NAN #define ETL_NAN static_cast(NAN) #define ETL_NANL static_cast(NAN) #define ETL_HAS_NAN true - #include "etl/private/diagnostic_pop.h" + #include "private/diagnostic_pop.h" #else - #include "etl/private/diagnostic_useless_cast_push.h" + #include "private/diagnostic_useless_cast_push.h" #define ETL_NANF HUGE_VALF #define ETL_NAN HUGE_VAL #define ETL_NANL HUGE_VALL #define ETL_HAS_NAN false - #include "etl/private/diagnostic_pop.h" + #include "private/diagnostic_pop.h" #endif #else #define ETL_NANF nanf("") diff --git a/include/etl/random.h b/include/etl/random.h index e24bb84d..2a480506 100644 --- a/include/etl/random.h +++ b/include/etl/random.h @@ -462,12 +462,12 @@ namespace etl random_pcg() { -#include "etl/private/diagnostic_useless_cast_push.h" +#include "private/diagnostic_useless_cast_push.h" // An attempt to come up with a unique non-zero seed, // based on the address of the instance. uintptr_t n = reinterpret_cast(this); value = static_cast(n); -#include "etl/private/diagnostic_pop.h" +#include "private/diagnostic_pop.h" } //***************************************************************************