From dbd68011363b01f22ab85e11ad52a8e90da9611a Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 6 Nov 2021 11:05:45 +0100 Subject: Use std::source_location instead of __FILE__. --- src/libctor.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/libctor.h') 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 #include #include #include @@ -61,7 +62,9 @@ struct BuildConfiguration using BuildConfigurations = std::vector; -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; -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 -- cgit v1.2.3