diff --git a/renderdoc/common/result.h b/renderdoc/common/result.h index e56332a97..690f171fc 100644 --- a/renderdoc/common/result.h +++ b/renderdoc/common/result.h @@ -55,35 +55,35 @@ DECLARE_REFLECTION_STRUCT(RDResult); // helper macros since we often want to print the error message that gets returned. // one helper returns immediately, the other sets a result and prints - to allow cleanup -#define RETURN_ERROR_RESULT_INTERNAL(code, msg, ...) \ - do \ - { \ - RDResult res##__LINE__(code, StringFormat::Fmt(STRING_LITERAL(msg), __VA_ARGS__)); \ - RDCERR("%s", res##__LINE__.message.c_str()); \ - return res##__LINE__; \ - } while((void)0, 0) +#define RETURN_ERROR_RESULT_INTERNAL(code, msg, ...) \ + do \ + { \ + RDResult CONCAT(res, __LINE__)(code, StringFormat::Fmt(STRING_LITERAL(msg), __VA_ARGS__)); \ + RDCERR("%s", CONCAT(res, __LINE__).message.c_str()); \ + return CONCAT(res, __LINE__); \ + } while(0) #define SET_ERROR_RESULT_INTERNAL(res, code, msg, ...) \ do \ { \ res = RDResult(code, StringFormat::Fmt(STRING_LITERAL(msg), __VA_ARGS__)); \ RDCERR("%s", res.message.c_str()); \ - } while((void)0, 0) + } while(0) -#define RETURN_WARNING_RESULT_INTERNAL(code, msg, ...) \ - do \ - { \ - RDResult res##__LINE__(code, StringFormat::Fmt(STRING_LITERAL(msg), __VA_ARGS__)); \ - RDCWARN("%s", res##__LINE__.message.c_str()); \ - return res##__LINE__; \ - } while((void)0, 0) +#define RETURN_WARNING_RESULT_INTERNAL(code, msg, ...) \ + do \ + { \ + RDResult CONCAT(res, __LINE__)(code, StringFormat::Fmt(STRING_LITERAL(msg), __VA_ARGS__)); \ + RDCWARN("%s", CONCAT(res, __LINE__).message.c_str()); \ + return CONCAT(res, __LINE__); \ + } while(0) #define SET_WARNING_RESULT_INTERNAL(res, code, msg, ...) \ do \ { \ res = RDResult(code, StringFormat::Fmt(STRING_LITERAL(msg), __VA_ARGS__)); \ RDCWARN("%s", res.message.c_str()); \ - } while((void)0, 0) + } while(0) // VS automatically elides any trailing comma if there are no arguments above. GCC/Clang are // stricter and may fail, so we add an extra 0 since it won't get processed by the format anyway