From e0724b7cf21f4b68ee02153a99f692d60a06aebe Mon Sep 17 00:00:00 2001 From: erlingrj Date: Tue, 5 Nov 2024 21:11:30 -0800 Subject: [PATCH] remove LF_STRINGIFY stuff --- core/CMakeLists.txt | 13 ++++++++++--- include/core/utils/util.h | 3 --- python/lib/pythontarget.c | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 6d938ae0c..fdcc66118 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -153,6 +153,13 @@ macro(define X) endif(DEFINED ${X}) endmacro() +macro(defineString X) + if(DEFINED ${X}) + message(STATUS ${X}=\"${${X}}\") + target_compile_definitions(reactor-c PUBLIC ${X}=\"${${X}}\") + endif(DEFINED ${X}) +endmacro() + # Search and apply all possible compile definitions message(STATUS "Applying preprocessor definitions...") define(_LF_CLOCK_SYNC_ATTENUATION) @@ -178,9 +185,9 @@ define(NUMBER_OF_WORKERS) define(NUMBER_OF_WATCHDOGS) define(USER_THREADS) define(SCHEDULER) -define(LF_SOURCE_DIRECTORY) -define(LF_SOURCE_GEN_DIRECTORY) -define(LF_PACKAGE_DIRECTORY) define(LF_FILE_SEPARATOR) define(WORKERS_NEEDED_FOR_FEDERATE) define(LF_ENCLAVES) +defineString(LF_SOURCE_DIRECTORY) +defineString(LF_SOURCE_GEN_DIRECTORY) +defineString(LF_PACKAGE_DIRECTORY) diff --git a/include/core/utils/util.h b/include/core/utils/util.h index 351fba3bc..2d9998a72 100644 --- a/include/core/utils/util.h +++ b/include/core/utils/util.h @@ -80,9 +80,6 @@ typedef struct lf_stat_ll { #define LF_MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) #endif -#define LF_STRINGIFY(x) _LF_STRINGIFY(x) -#define _LF_STRINGIFY(x) #x - /** * The ID of this federate. For a non-federated execution, this will * be -1. For a federated execution, it will be assigned when the generated function diff --git a/python/lib/pythontarget.c b/python/lib/pythontarget.c index 3b68add0f..8e41f40f9 100644 --- a/python/lib/pythontarget.c +++ b/python/lib/pythontarget.c @@ -168,7 +168,7 @@ PyObject* py_source_directory(PyObject* self, PyObject* args) { PyErr_SetString(PyExc_RuntimeError, "LF_SOURCE_DIRECTORY constant is not defined."); return NULL; #else - return PyUnicode_DecodeFSDefault(LF_STRINGIFY(LF_SOURCE_DIRECTORY)); + return PyUnicode_DecodeFSDefault(LF_SOURCE_DIRECTORY); #endif } @@ -178,7 +178,7 @@ PyObject* py_package_directory(PyObject* self, PyObject* args) { PyErr_SetString(PyExc_RuntimeError, "LF_PACKAGE_DIRECTORY constant is not defined."); return NULL; #else - return PyUnicode_DecodeFSDefault(LF_STRINGIFY(LF_PACKAGE_DIRECTORY)); + return PyUnicode_DecodeFSDefault(LF_PACKAGE_DIRECTORY); #endif }