From: W. Felix Handte Date: Thu, 30 Apr 2020 16:26:29 +0000 (-0400) Subject: Make Error Macro Invocation Without Info String Fail to Compile X-Git-Tag: v1.4.5^2~50^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2745f7a7d56a5cf73d41e274ad522045e9c6f920;p=thirdparty%2Fzstd.git Make Error Macro Invocation Without Info String Fail to Compile Even without `-pedantic`, these macros will now fail to compile unless you provide an info string argument. This will prevent us from regressing. --- diff --git a/lib/common/zstd_internal.h b/lib/common/zstd_internal.h index 950b789cf..05225e32e 100644 --- a/lib/common/zstd_internal.h +++ b/lib/common/zstd_internal.h @@ -62,8 +62,8 @@ extern "C" { */ #define RETURN_ERROR_IF(cond, err, ...) \ if (cond) { \ - RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", __FILE__, __LINE__, ZSTD_QUOTE(cond), ZSTD_QUOTE(ERROR(err))); \ - RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s: ", __FILE__, __LINE__, ZSTD_QUOTE(cond), ZSTD_QUOTE(ERROR(err))); \ + RAWLOG(3, __VA_ARGS__); \ RAWLOG(3, "\n"); \ return ERROR(err); \ } @@ -75,8 +75,8 @@ extern "C" { */ #define RETURN_ERROR(err, ...) \ do { \ - RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", __FILE__, __LINE__, ZSTD_QUOTE(ERROR(err))); \ - RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s: ", __FILE__, __LINE__, ZSTD_QUOTE(ERROR(err))); \ + RAWLOG(3, __VA_ARGS__); \ RAWLOG(3, "\n"); \ return ERROR(err); \ } while(0); @@ -90,8 +90,8 @@ extern "C" { do { \ size_t const err_code = (err); \ if (ERR_isError(err_code)) { \ - RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", __FILE__, __LINE__, ZSTD_QUOTE(err), ERR_getErrorName(err_code)); \ - RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s: ", __FILE__, __LINE__, ZSTD_QUOTE(err), ERR_getErrorName(err_code)); \ + RAWLOG(3, __VA_ARGS__); \ RAWLOG(3, "\n"); \ return err_code; \ } \