From af6d4f40e1ecee8a49ca7f998e6aab3f9213faaa Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Mon, 3 Dec 2018 20:13:45 +0100 Subject: [PATCH] utils/gz: Fix compilation on non-x86 archs gen_crc_combine_table is now executed on every build, so it should not fail on unsupported archs. The generated file will not contain data, but this is fine since it should not be used. Another problem is that u32 and u64 aliases were not visible in the #else branch in crc_combine.cc Message-Id: <1543864425-5650-1-git-send-email-tgrabiec@scylladb.com> (cherry picked from commit 9a4c00beb7eb1c381ceecc30a692b89dd7b954ea) --- utils/gz/crc_combine.cc | 6 +++--- utils/gz/gen_crc_combine_table.cc | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/utils/gz/crc_combine.cc b/utils/gz/crc_combine.cc index 814db5cf42..f662597bd3 100644 --- a/utils/gz/crc_combine.cc +++ b/utils/gz/crc_combine.cc @@ -52,13 +52,13 @@ #include "crc_combine_table.hh" #include "utils/clmul.hh" +using u32 = uint32_t; +using u64 = uint64_t; + #if defined(__x86_64__) || defined(__i386__) #include "barett.hh" -using u32 = uint32_t; -using u64 = uint64_t; - /* * Calculates: * diff --git a/utils/gz/gen_crc_combine_table.cc b/utils/gz/gen_crc_combine_table.cc index b3cffb5d17..3b60bf1509 100644 --- a/utils/gz/gen_crc_combine_table.cc +++ b/utils/gz/gen_crc_combine_table.cc @@ -20,12 +20,13 @@ * */ +#include + #if defined(__x86_64__) || defined(__i386__) #include "utils/clmul.hh" #include "barett.hh" -#include #include int main() { @@ -73,8 +74,14 @@ int main() { #else int main() { - std::cerr << "Not implemented for this arch!\n"; - return 1; + std::cout << "/*\n" + " * Generated with gen_crc_combine_table.cc\n" + " * DO NOT EDIT!\n" + " */\n" + "\n" + "/* Not implemented for this CPU architecture. */\n" + "\n"; + return 0; } #endif