From 17f52765e9a38b102e3bff00eb2d923d7c5fc3ad Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Mon, 6 Jan 2025 06:57:13 +0000 Subject: [PATCH] Use uniform pattern for including config Previously, `common.h` would explicitly include a custom config if present, but not explicitly include the default `config.h` otherwise. Instead, this would be left to `params.h`, which _always_ includes the default config `config.h`, but not a custom config. This happens to be OK if custom configs and default configs use the same header guard, but is confusing and non-uniform nonetheless. This commit uniformly uses the pattern ``` #if defined(MLKEM_NATIVE_CONFIG_FILE) #include MLKEM_NATIVE_CONFIG_FILE #else #include "config.h" #endif /* MLKEM_NATIVE_CONFIG_FILE */ ``` to include the configuration. Signed-off-by: Hanno Becker --- mlkem/common.h | 4 +++- mlkem/params.h | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mlkem/common.h b/mlkem/common.h index e86201f86..8253f712a 100644 --- a/mlkem/common.h +++ b/mlkem/common.h @@ -7,11 +7,13 @@ #if defined(MLKEM_NATIVE_CONFIG_FILE) #include MLKEM_NATIVE_CONFIG_FILE +#else +#include "config.h" #endif /* MLKEM_NATIVE_CONFIG_FILE */ +#include "namespacne.h" #include "params.h" #include "sys.h" -#include "namespace.h" /* Include backend metadata */ #if defined(MLKEM_USE_NATIVE) diff --git a/mlkem/params.h b/mlkem/params.h index 586c31d33..ba942faec 100644 --- a/mlkem/params.h +++ b/mlkem/params.h @@ -5,7 +5,11 @@ #ifndef PARAMS_H #define PARAMS_H -#include "config.h" +#if defined(MLKEM_NATIVE_CONFIG_FILE) +#include MLKEM_NATIVE_CONFIG_FILE +#else +#includ "config.h" +#endif /* MLKEM_NATIVE_CONFIG_FILE */ #if !defined(MLKEM_K) #error MLKEM_K is not defined