Skip to content

Commit

Permalink
fix: compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed May 6, 2024
1 parent eca6b84 commit bcc1369
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
8 changes: 4 additions & 4 deletions include/lime/hooks/convention.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace lime
enum class convention
{
automatic,
cdecl,
stdcall,
fastcall,
thiscall,
c_cdecl,
c_stdcall,
c_fastcall,
c_thiscall,
};

namespace detail
Expand Down
17 changes: 13 additions & 4 deletions include/lime/hooks/convention.inl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ namespace lime
#define LIME_STDCALL __attribute__((stdcall))
#define LIME_FASTCALL __attribute__((fastcall))
#define LIME_THISCALL __attribute__((thiscall))
#endif

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
#endif

template <typename Ret, typename... Args>
struct calling_convention<Ret(Args...), convention::cdecl>
struct calling_convention<Ret(Args...), convention::c_cdecl>
{
using add = Ret LIME_CDECL(Args...);

Expand All @@ -47,7 +52,7 @@ namespace lime
};

template <typename Ret, typename... Args>
struct calling_convention<Ret(Args...), convention::stdcall>
struct calling_convention<Ret(Args...), convention::c_stdcall>
{
using add = Ret LIME_STDCALL(Args...);

Expand All @@ -59,7 +64,7 @@ namespace lime
};

template <typename Ret, typename... Args>
struct calling_convention<Ret(Args...), convention::fastcall>
struct calling_convention<Ret(Args...), convention::c_fastcall>
{
using add = Ret LIME_FASTCALL(Args...);

Expand All @@ -71,7 +76,7 @@ namespace lime
};

template <typename Ret, typename... Args>
struct calling_convention<Ret(Args...), convention::thiscall>
struct calling_convention<Ret(Args...), convention::c_thiscall>
{
using add = Ret LIME_THISCALL(Args...);

Expand All @@ -81,6 +86,10 @@ namespace lime
return Function(std::forward<Args>(args)...);
}
};

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}; // namespace detail

#undef LIME_CDECL
Expand Down
2 changes: 1 addition & 1 deletion include/lime/hooks/hook.inl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace lime
Callable &&target)
{
static hook<Signature, Convention> *rtn;
static auto lambda = std::forward<Callable>(target);
[[maybe_unused]] static auto lambda = std::forward<Callable>(target);

static constexpr auto dispatch = []<typename... T>(T &&...args)
{
Expand Down

0 comments on commit bcc1369

Please sign in to comment.