diff options
Diffstat (limited to 'src/libctor.h')
-rw-r--r-- | src/libctor.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libctor.h b/src/libctor.h index 2a10c53..6d3becf 100644 --- a/src/libctor.h +++ b/src/libctor.h @@ -3,6 +3,7 @@ // See accompanying file LICENSE for details. #pragma once +#include <source_location> #include <string> #include <vector> #include <map> @@ -61,7 +62,9 @@ struct BuildConfiguration using BuildConfigurations = std::vector<BuildConfiguration>; -int reg(const char* location, BuildConfigurations (*cb)()); +int reg(BuildConfigurations (*cb)(), + const std::source_location location = std::source_location::current()); + struct ExternalConfiguration { @@ -74,13 +77,14 @@ struct ExternalConfiguration using ExternalConfigurations = std::vector<ExternalConfiguration>; -int reg(const char* location, ExternalConfigurations (*cb)()); +int reg(ExternalConfigurations (*cb)(), + const std::source_location location = std::source_location::current()); // Convenience macro - ugly but keeps things simple(r) #define CONCAT(a, b) CONCAT_INNER(a, b) #define CONCAT_INNER(a, b) a ## b #define UNIQUE_NAME(base) CONCAT(base, __LINE__) -#define REG(cb) namespace { int UNIQUE_NAME(unique) = reg(__FILE__, cb); } +#define REG(cb) namespace { int UNIQUE_NAME(unique) = reg(cb); } // Predefined configuration keys namespace cfg |