diff --git a/include/rsl/_impl/macro/compat.hpp b/include/rsl/_impl/macro/compat.hpp new file mode 100644 index 0000000..9832a16 --- /dev/null +++ b/include/rsl/_impl/macro/compat.hpp @@ -0,0 +1,10 @@ +#pragma once +#include + +#include "compiler.hpp" + +#if RSL_COMPILER == RSL_COMPILER_GCC +# define RSL_DEFINE_STATIC_ARRAY(...) [:::std::meta::reflect_constant_array(__VA_ARGS__):] +#else +# define RSL_DEFINE_STATIC_ARRAY(...) (::std::define_static_array(__VA_ARGS__)) +#endif diff --git a/include/rsl/_impl/macro/compiler.hpp b/include/rsl/_impl/macro/compiler.hpp index fc01eb9..ba6505e 100644 --- a/include/rsl/_impl/macro/compiler.hpp +++ b/include/rsl/_impl/macro/compiler.hpp @@ -1,5 +1,4 @@ #pragma once -#include #define RSL_COMPILER_UNKNOWN 0 #define RSL_COMPILER_CLANG 1 @@ -49,4 +48,4 @@ #else # define RSL_STDLIB RSL_STDLIB_UNKNOWN # define RSL_STDLIB_VERSION 0 -#endif \ No newline at end of file +#endif diff --git a/include/rsl/macro b/include/rsl/macro index 37e7e37..6e6900f 100644 --- a/include/rsl/macro +++ b/include/rsl/macro @@ -3,45 +3,40 @@ #include #include #include +#include #include #include // compile environment checks /** - * @param compiler: one of UNKNOWN, CLANG, GCC, MSVC + * @param compiler one of UNKNOWN, CLANG, GCC, MSVC */ #define $compiler_is(compiler) (RSL_COMPILER == RSL_COMPILER_##compiler) /** - * @param stdlib: one of UNKNOWN, LIBCXX, GLIBCXX, MSVC + * @param stdlib one of UNKNOWN, LIBCXX, GLIBCXX, MSVC */ #define $stdlib_is(stdlib) (RSL_STDLIB == RSL_STDLIB_##stdlib) /** - * @param os: one of UNKNOWN, WINDOWS, LINUX, MAC, FREEBSD, ANDROID, IOS + * @param os one of UNKNOWN, WINDOWS, LINUX, MAC, FREEBSD, ANDROID, IOS */ #define $os_is(os) (RSL_OS == RSL_OS_##os) -/// feature macro helper +/// Feature macro helper #define $uses_opt(x) USES_OPT(x) /** - * @param: one of always, never + * @param opt one of always, never */ -#define $inline(...) RSL_INLINE(__VA_ARGS__) +#define $inline(opt) RSL_INLINE(opt) -/** Enable this overload if expr evaluates to true. Clang only. - * @param expr - */ +/// Enable this overload if a given expression evaluates to true. Clang only. #define $enable_if(...) RSL_ENABLE_IF(__VA_ARGS__) //! Workaround for expansion statements in GCC -#if $compiler_is(GCC) -# define $define_static_array(...) [:std::meta::reflect_constant_array(__VA_ARGS__):] -#else -# define $define_static_array(...) std::define_static_array(__VA_ARGS__) -#endif +#define $define_static_array(...) RSL_DEFINE_STATIC_ARRAY(__VA_ARGS__) /** Applies `macro` to every element and inserts delimiters produced by `delim` between elements * @param macro function-like macro applied to every element @@ -62,6 +57,10 @@ */ #define $for_each(macro, ...) RSL_IMPL_FOR_EACH_DELIM(macro, RSL_IMPL_DELIM_NONE, __VA_ARGS__) +/** + * @param op one of push, pop, disable, error + * @param ... optional arguments +*/ #define $diagnostics(op, ...) RSL_DIAG_##op (__VA_ARGS__) /// Introduces an explicit template region