]> git.ipfire.org Git - thirdparty/zstd.git/commit
Allow Empty Format Strings in Error Macro Invocations
authorW. Felix Handte <w@felixhandte.com>
Thu, 30 Apr 2020 17:09:14 +0000 (13:09 -0400)
committerW. Felix Handte <w@felixhandte.com>
Mon, 4 May 2020 14:59:15 +0000 (10:59 -0400)
commit450542d3a7ab8922f96e8a334613d871b068c97b
treef027ad6cc1ac51f39826738e48780baf0aacc678
parent6696933b32444cbe63d0384f5407bd3cea265c6b
Allow Empty Format Strings in Error Macro Invocations

`-Wall` implies `-Wformat-zero-length`, which will cause compilation to fail
under `-Werror` when an empty string is passed as the format string to a
`printf`-family function. This commit moves us back to prefixing the provided
format string, which successfully avoids that warning.

However, this removes the failure mode where that `RAWLOG` invocation would
fail to compile when no format string was provided at all (which was desirable
to avoid having code that would successfully compile normally but fail under
`-pedantic`, which *does* require that a non-zero number of args are provided).

So this commit also introduces a function which does nothing at all, but will
fail to compile if not provided with at least one argument, which is a string.
This successfully links the compilability of pedantic and non-pedantic builds.
lib/common/zstd_internal.h