fix build (sparkd): Disable warnings specifically for clang >= 18

The build was broken for clang < 18 (and gcc) because we were blindly disabling
warnings as errors specific to clang 18, without checking the compiler version.
Namely, "-Weffc++" and "-Wenum-constexpr-conversion".
This commit is contained in:
John Colvin committed 2026-01-04 21:19:00 +00:00
1 parent 9ebc282ba5
commit 140e5bb5ee
4 files changed
+30 -11

No files matched your search

+9 -3
View File
@@ -2,7 +2,6 @@
#include "Common.h"
#include "MsgPacking.h"
#include "spark/utils/warn_ctrl.h"
namespace bts {
namespace log {
@@ -10,7 +9,11 @@ namespace log {
using ArgUnpacker =
std::string (*)(ArgBuffer const &b, const char *msg_template);
GCC_DIAG_OFF("-Weffc++")
#if defined(__clang__) and __clang_major__ >= 18
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
struct LogRec {
uint64_t ts;
const char *file;
@@ -32,7 +35,10 @@ struct LogRec {
std::string unpack_msg() { return unpacker(args, msg_template); }
};
GCC_DIAG_RESTORE()
#if defined(__clang__) and __clang_major__ >= 18
#pragma GCC diagnostic pop
#endif
#ifndef _WIN32
// static_assert(sizeof(LogRec) == 256, "LogRec should be 128 bytes");
+7 -3
View File
@@ -4,12 +4,16 @@
#include "spark/md/MDProducerHandle.h"
#include "spark/md/common.h"
#include "spark/utils/bts_no_copy.h"
#include "spark/utils/warn_ctrl.h"
#include <memory>
GCC_DIAG_OFF("-Wenum-constexpr-conversion")
#if defined(__clang__) and __clang_major__ >= 18
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wenum-constexpr-conversion"
#include <tbb/concurrent_hash_map.h>
GCC_DIAG_RESTORE()
#pragma GCC diagnostic pop
#else
#include <tbb/concurrent_hash_map.h>
#endif
#include <tbb/queuing_rw_mutex.h>
#include <unordered_map>
@@ -3,9 +3,14 @@
#include "spark/quickbus/routing/INode.h"
#include "spark/utils/warn_ctrl.h"
GCC_DIAG_OFF("-Wenum-constexpr-conversion")
#if defined(__clang__) and __clang_major__ >= 18
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wenum-constexpr-conversion"
#include <boost/asio.hpp>
GCC_DIAG_RESTORE()
#pragma GCC diagnostic pop
#else
#include <boost/asio.hpp>
#endif
#include <functional>
#include <memory>
+7 -3
View File
@@ -2,11 +2,15 @@
#include "TimeStamp.h"
#include "bts_assert.h"
#include "spark/utils/datetime_common.h"
#include "spark/utils/warn_ctrl.h"
GCC_DIAG_OFF("-Wenum-constexpr-conversion")
#if defined(__clang__) and __clang_major__ >= 18
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wenum-constexpr-conversion"
#include <boost/date_time/gregorian/gregorian.hpp>
GCC_DIAG_RESTORE()
#pragma GCC diagnostic pop
#else
#include <boost/date_time/gregorian/gregorian.hpp>
#endif
#include <boost/date_time/posix_time/posix_time.hpp>
#include <sstream>
#include <time.h>