Skip to content

Commit

Permalink
New macro
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryAWE committed Jan 12, 2024
1 parent ec24bf4 commit db61733
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions example/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ int main()
println("PAPILIO_HAS_MULTIDIMENSIONAL_SUBSCRIPT = {:d}L", PAPILIO_HAS_MULTIDIMENSIONAL_SUBSCRIPT);
#endif

#ifdef PAPILIO_HAS_VA_OPT
println("PAPILIO_HAS_VA_OPT = {:d}L", PAPILIO_HAS_VA_OPT);
#endif

println();

println("Script test:");
Expand Down
10 changes: 9 additions & 1 deletion include/papilio/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
# define PAPILIO_COMPILER_GCC __GNUC__
#endif

#define PAPILIO_ASSERT(expr) assert(expr)

#if defined(_WIN32) || defined(_WIN64)
# define PAPILIO_PLATFORM_WINDOWS 1
#elif defined(__linux__) || defined(__gnu_linux__)
# define PAPILIO_PLATFORM_LINUX 1
#endif

#define PAPILIO_ASSERT(expr) assert(expr)
#define PAPILIO_HAS_VA_OPT_HELPER(_0, _1, result, ...) result
#define PAPILIO_HAS_VA_OPT_IMPL(...) \
PAPILIO_HAS_VA_OPT_HELPER(__VA_OPT__(, ), 1, 0)

#if PAPILIO_HAS_VA_OPT_IMPL(_0) == 1
# define PAPILIO_HAS_VA_OPT 1
#endif

#ifdef __cplusplus // C compatibility
# define PAPILIO_NS ::papilio::
Expand Down

0 comments on commit db61733

Please sign in to comment.