From 4b9f99bb27f82be1fc267bb92a780f191beb6255 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Tue, 16 Nov 2021 19:24:56 +0530 Subject: [PATCH] Make `ENUM_STRING` function `static` `ENUM_STRING` can be used inside a `class`/`struct`/`union` for `enum`s contained within them. Making the function `static` allows doing this and doesn't require supplying a `this` pointer of the enclosing class for usage. --- app/src/main/cpp/skyline/common/macros.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/cpp/skyline/common/macros.h b/app/src/main/cpp/skyline/common/macros.h index e5ef4684..6a266d09 100644 --- a/app/src/main/cpp/skyline/common/macros.h +++ b/app/src/main/cpp/skyline/common/macros.h @@ -14,14 +14,14 @@ * @brief Creates a function to convert an enumerant to its string representation at runtime * @example ENUM_STRING(Example, { ENUM_CASE(A); ENUM_CASE(B); }) */ -#define ENUM_STRING(name, cases) \ - constexpr const char *ToString(name value) { \ - using ENUM_TYPE = name; \ - switch (value) { \ - cases \ - default: \ - return "Unknown"; \ - } \ +#define ENUM_STRING(name, cases) \ + constexpr static const char *ToString(name value) { \ + using ENUM_TYPE = name; \ + switch (value) { \ + cases \ + default: \ + return "Unknown"; \ + } \ } /** @@ -29,7 +29,7 @@ */ #define ENUM_CASE_PAIR(key, value) \ case ENUM_TYPE::key: \ - return value + return value /** * @brief Creates a switch case statement to convert an enumerant to the given values