diff --git a/include/tlibc/errors.h b/include/tlibc/errors.h index b229637..1f6308e 100755 --- a/include/tlibc/errors.h +++ b/include/tlibc/errors.h @@ -73,8 +73,11 @@ typedef struct Result_ { /// Warning can be suppressed by IGNORE_RESULT #define Result(T) Result_ ATTRIBUTE_WARN_UNUSED_RESULT #define ResultVar(T) Result_ + +// for some stupid reason gcc requires more than 3 levels of macros to concat token with line number +#define _ignore_var_name(N) CAT2(__ignored_, N) ///USAGE: IGNORE_RESULT trySomething(); -#define IGNORE_RESULT Result_ __ignored_##__LINE__ ATTRIBUTE_UNUSED = +#define IGNORE_RESULT Result_ _ignore_var_name(__LINE__) ATTRIBUTE_UNUSED = #define RESULT_ERROR_CODE(CODE_PAGE, CODE, MSG, IS_MSG_ON_HEAP) (Result_){ \