Files
zooqueen 0f1e1b5143 merge: ClickHouse 26.6.1.1 into datastore — preserve debrand + ZAP + gRPC/gcloud removal
Merge upstream/changelog-26.6 (9593 commits) into our debranded fork.
- 190 conflicts resolved: 24 delete-side kept-removed (grpc/arrowflight/gcloud), submodules+version→26.6,
  contrib/CMakeLists keeps zap + new libpng, drops capnproto (zap provides kj), Server.cpp/CMakeLists
  re-apply the ZAP wiring + gRPC/arrowflight/gcloud removal.
- Full-tree debrand re-swept over the new 26.6 code (uniform Datastore naming; Azure fork Clickhouse*
  symbols preserved). 0 clickhouse in product src/programs/CMakeLists.
- Version now 26.6.1.1. gRPC/google-cloud/chdig stay removed; ZAP remains the transport.
2026-06-23 12:23:48 -07:00

66 lines
4.3 KiB
CMake

# Our principle is to enable as many warnings as possible and always do it with "warnings as errors" flag.
#
# But it comes with some cost:
# - we have to disable some warnings in 3rd party libraries (they are located in "contrib" directory)
# - we have to include headers of these libraries as -isystem to avoid warnings from headers
# (this is the same behaviour as if these libraries were located in /usr/include)
# - sometimes warnings from 3rd party libraries may come from macro substitutions in our code
# and we have to wrap them with #pragma clang diagnostic ignored
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
# Control maximum size of stack frames. It can be important if the code is run in fibers with small stack size.
# Only in release build because debug has too large stack frames.
if ((NOT CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG") AND (NOT SANITIZE))
add_warning(frame-larger-than=65536)
endif ()
# Add some warnings that are not available even with -Wall -Wextra -Wpedantic.
# We want to get everything out of the compiler for code quality.
add_warning(everything)
add_warning(pedantic)
no_warning(return-type-c-linkage) # Used in some 3rd party libraries like delta-kernel-rs ffi
no_warning(zero-length-array) # Clang extension
no_warning(c++98-compat-pedantic) # We don't care about C++98 compatibility (We use aliases, variadic macros...)
no_warning(c++20-compat) # Use C++20 features incompatible with older standards (consteval, constinit, implicit typename...)
no_warning(sign-conversion) # TODO: Fix the code and enable it
no_warning(deprecated-declarations) # TODO: Fix the code and enable it
# -Wdisabled-macro-expansion is enabled
no_warning(documentation-unknown-command) # Too many false positives from contrib headers (zstd) and backslashes in comments
# -Wdouble-promotion is enabled: avoid implicit float-to-double conversions
no_warning(exit-time-destructors) # We intentionally use global objects with non-trivial destructors (singletons, registries)
no_warning(float-equal) # Exact float comparison is intentional in many places (hash functions, serialization, NaN checks)
no_warning(global-constructors) # We intentionally use global constructors for registration and initialization
# -Wmissing-prototypes is enabled
no_warning(missing-variable-declarations) # TODO: Fix the code and enable it
no_warning(padded) # Padding is a micro-optimization; not actionable as a global warning
no_warning(switch-enum) # Conflicts with having a default case in switches; we prefer explicit defaults
no_warning(undefined-func-template) # Too many template instantiations across TU boundaries to fix; also triggers in contrib
no_warning(unused-template) # Triggers on static template functions in headers included by multiple TUs
no_warning(weak-template-vtables) # Same as weak-vtables but for templates
no_warning(weak-vtables) # Requires out-of-line virtual methods; too many classes across codebase and contrib to fix
no_warning(thread-safety-negative) # experimental flag, too many false positives
no_warning(unsafe-buffer-usage) # too aggressive
no_warning(switch-default) # conflicts with "defaults in a switch covering all enum values"
no_warning(nrvo) # not eliding copy on return - too aggressive
no_warning(missing-noreturn) # too aggressive with no clear benefit, see https://github.com/hanzoai/datastore/pull/86416
# Hard-code knowledge of clang version-specific warnings rather than probing the compiler.
# `lifetime-safety-*` were introduced in clang 23.
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 23)
no_warning(lifetime-safety-intra-tu-suggestions)
no_warning(lifetime-safety-cross-tu-suggestions)
# Too many false positives: it treats mutation of a container captured by
# reference in a lambda (e.g. `push_back`, `clear`, `+=`) as invalidating the
# captured reference to the container variable itself, while in reality only
# references to the container's elements would be invalidated.
no_warning(lifetime-safety-invalidation)
endif ()
if (ARCH_E2K)
# disable "use of GNU statement expression extension from macro expansion" warning
no_warning(gnu-statement-expression-from-macro-expansion)
endif ()
# For __COUNTER__ support (now it is part of C2y)
# Note: right now cmake 4.2.1 does not recognize "set (CMAKE_C_STANDARD 2y)"
no_warning(c2y-extensions)
no_warning(c23-extensions) # For #embed