Skip to content

Commit ab33180

Browse files
committed
Strip leading ./ from __FILE__ in __exp__ macro
clang puts a ./ in front of __FILE__, which gcc does not. To remove this difference, we add the constexpr drop_leading_dot_slash() which removes this difference between both compilers.
1 parent a856114 commit ab33180

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/extensions.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,12 @@
146146
__funcname__, __filename__, __line__}; }
147147

148148

149+
constexpr const char * drop_leading_dot_slash(const char * path) {
150+
return path[0] == '.' && path[1] == '/' ? path + 2 : path;
151+
}
152+
149153
// for in-place throw parameter
150-
#define EXP(TROW_REASON) __exp__(TROW_REASON, __func__, __FILE__, __LINE__)
154+
#define EXP(TROW_REASON) __exp__(TROW_REASON, __func__, drop_leading_dot_slash(__FILE__), __LINE__)
151155

152156

153157

0 commit comments

Comments
 (0)