summaryrefslogtreecommitdiff
path: root/src/libctor.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-11-06 11:05:45 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2021-11-06 11:05:45 +0100
commitdbd68011363b01f22ab85e11ad52a8e90da9611a (patch)
tree6d1bec44119ab3fa99ace9298f0ac3575fcdc15a /src/libctor.h
parent92cc25c10bcba1f14cbf28bd0298311b8e81a2ea (diff)
Use std::source_location instead of __FILE__.
Diffstat (limited to 'src/libctor.h')
-rw-r--r--src/libctor.h10
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