]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Avoid compiler warning without creating extra symbol.
authorJia Tan <jiat0218@gmail.com>
Tue, 26 Sep 2023 16:02:11 +0000 (00:02 +0800)
committerJia Tan <jiat0218@gmail.com>
Tue, 31 Oct 2023 10:44:59 +0000 (18:44 +0800)
When the generic fast crc64 method is used, then we omit
lzma_crc64_table[][].

The C standards don't allow an empty translation unit which can be
avoided by declaring something, without exporting any symbols.

src/liblzma/check/crc64_table.c

index 241adcd4a5cbeba2251fd078fc8a3914f8baf411..688e527b0fd1264292be0f3e93773a2a203d934b 100644 (file)
 #if (defined(__x86_64__) && defined(__SSSE3__) \
                        && defined(__SSE4_1__) && defined(__PCLMUL__)) \
                || (defined(__e2k__) && __iset__ >= 6)
-// No table needed but something has to be exported to keep some toolchains
-// happy. Also use a declaration to silence compiler warnings.
-extern const char lzma_crc64_dummy;
-const char lzma_crc64_dummy;
+// No table needed. Use a typedef to avoid an empty translation unit.
+typedef void lzma_crc64_dummy;
 
 #else
 // Having the declaration here silences clang -Wmissing-variable-declarations.