diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0257b7d329b..bac06a2f108 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,7 +18,6 @@ include (../cmake/version.cmake) message (STATUS "Will build ${VERSION_FULL} revision ${VERSION_REVISION} ${VERSION_OFFICIAL}") include (configure_config.cmake) configure_file (Common/config.h.in ${CONFIG_INCLUDE_PATH}/config.h) -configure_file (Common/config_version.h.in ${CONFIG_INCLUDE_PATH}/config_version.h) configure_file (Common/config_version.cpp.in ${CONFIG_INCLUDE_PATH}/config_version.cpp) if (USE_DEBUG_HELPERS) diff --git a/src/Client/Connection.cpp b/src/Client/Connection.cpp index cf25ee6e856..7af9c99f50c 100644 --- a/src/Client/Connection.cpp +++ b/src/Client/Connection.cpp @@ -296,7 +296,7 @@ void Connection::sendHello() "Parameters 'default_database', 'user' and 'password' must not contain ASCII control characters"); writeVarUInt(Protocol::Client::Hello, *out); - writeStringBinary((VERSION_NAME " ") + client_name, *out); + writeStringBinary(std::string(VERSION_NAME) + " " + client_name, *out); writeVarUInt(VERSION_MAJOR, *out); writeVarUInt(VERSION_MINOR, *out); // NOTE For backward compatibility of the protocol, client cannot send its version_patch. diff --git a/src/Common/config_version.cpp.in b/src/Common/config_version.cpp.in index f31e82bf582..26ae0f0f4d7 100644 --- a/src/Common/config_version.cpp.in +++ b/src/Common/config_version.cpp.in @@ -1,3 +1,17 @@ /// This file was autogenerated by CMake +#include "config_version.h" + +const unsigned VERSION_REVISION = @VERSION_REVISION@; +const char * VERSION_NAME = "@VERSION_NAME@"; +const unsigned VERSION_MAJOR = @VERSION_MAJOR@; +const unsigned VERSION_MINOR = @VERSION_MINOR@; +const unsigned VERSION_PATCH = @VERSION_PATCH@; +const char * VERSION_STRING = "@VERSION_STRING@"; +const char * VERSION_STRING_SHORT = "@VERSION_STRING_SHORT@"; +const char * VERSION_OFFICIAL = "@VERSION_OFFICIAL@"; +const char * VERSION_FULL = "@VERSION_FULL@"; +const char * VERSION_DESCRIBE = "@VERSION_DESCRIBE@"; +const unsigned VERSION_INTEGER = @VERSION_INTEGER@; + const char * VERSION_GITHASH = "@VERSION_GITHASH@"; diff --git a/src/Common/config_version.h b/src/Common/config_version.h new file mode 100644 index 00000000000..b1e0ea67a68 --- /dev/null +++ b/src/Common/config_version.h @@ -0,0 +1,23 @@ +/// This file was autogenerated by CMake + +#pragma once + +/// These fields are changing only on every release, but we still don't want to have them in the header file, +/// because it will make build cache less efficient. + +// NOTE: has nothing common with DBMS_TCP_PROTOCOL_VERSION, +// only DBMS_TCP_PROTOCOL_VERSION should be incremented on protocol changes. +extern const unsigned VERSION_REVISION; +extern const char * VERSION_NAME; +extern const unsigned VERSION_MAJOR; +extern const unsigned VERSION_MINOR; +extern const unsigned VERSION_PATCH; +extern const char * VERSION_STRING; +extern const char * VERSION_STRING_SHORT; +extern const char * VERSION_OFFICIAL; +extern const char * VERSION_FULL; +extern const char * VERSION_DESCRIBE; +extern const unsigned VERSION_INTEGER; + +/// These fields are frequently changing and we don't want to have them in the header file to allow caching. +extern const char * VERSION_GITHASH; diff --git a/src/Common/config_version.h.in b/src/Common/config_version.h.in deleted file mode 100644 index aa8ddeeb860..00000000000 --- a/src/Common/config_version.h.in +++ /dev/null @@ -1,24 +0,0 @@ -/// This file was autogenerated by CMake - -#pragma once - -// NOTE: has nothing common with DBMS_TCP_PROTOCOL_VERSION, -// only DBMS_TCP_PROTOCOL_VERSION should be incremented on protocol changes. -#cmakedefine VERSION_REVISION @VERSION_REVISION@ -#cmakedefine VERSION_NAME "@VERSION_NAME@" -#cmakedefine VERSION_MAJOR @VERSION_MAJOR@ -#cmakedefine VERSION_MINOR @VERSION_MINOR@ -#cmakedefine VERSION_PATCH @VERSION_PATCH@ -#cmakedefine VERSION_STRING "@VERSION_STRING@" -#cmakedefine VERSION_STRING_SHORT "@VERSION_STRING_SHORT@" -#cmakedefine VERSION_OFFICIAL "@VERSION_OFFICIAL@" -#cmakedefine VERSION_FULL "@VERSION_FULL@" -#cmakedefine VERSION_DESCRIBE "@VERSION_DESCRIBE@" -#cmakedefine VERSION_INTEGER @VERSION_INTEGER@ - -/// These fields are frequently changing and we don't want to have them in the header file to allow caching. -extern const char * VERSION_GITHASH; - -#if !defined(VERSION_OFFICIAL) -# define VERSION_OFFICIAL "" -#endif diff --git a/src/Daemon/BaseDaemon.cpp b/src/Daemon/BaseDaemon.cpp index f9e402e51ee..dba4b13835d 100644 --- a/src/Daemon/BaseDaemon.cpp +++ b/src/Daemon/BaseDaemon.cpp @@ -485,10 +485,8 @@ private: { SentryWriter::onFault(sig, error_message, stack_trace); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" /// Advice the user to send it manually. - if constexpr (std::string_view(VERSION_OFFICIAL).contains("official build")) + if (std::string_view(VERSION_OFFICIAL).contains("official build")) { const auto & date_lut = DateLUT::instance(); @@ -506,8 +504,6 @@ private: { LOG_FATAL(log, "This ClickHouse version is not official and should be upgraded to the official build."); } -#pragma clang diagnostic pop - } /// ClickHouse Keeper does not link to some part of Settings. diff --git a/src/Interpreters/ClientInfo.cpp b/src/Interpreters/ClientInfo.cpp index 92ef5a0d159..b478daabc08 100644 --- a/src/Interpreters/ClientInfo.cpp +++ b/src/Interpreters/ClientInfo.cpp @@ -196,7 +196,7 @@ void ClientInfo::setInitialQuery() if (client_name.empty()) client_name = VERSION_NAME; else - client_name = (VERSION_NAME " ") + client_name; + client_name = std::string(VERSION_NAME) + " " + client_name; } bool ClientInfo::clientVersionEquals(const ClientInfo & other, bool compare_patch) const diff --git a/src/Processors/Formats/Impl/Parquet/Write.cpp b/src/Processors/Formats/Impl/Parquet/Write.cpp index 340ed5f510c..92d9df9b391 100644 --- a/src/Processors/Formats/Impl/Parquet/Write.cpp +++ b/src/Processors/Formats/Impl/Parquet/Write.cpp @@ -916,7 +916,7 @@ void writeFileFooter(std::vector row_groups, SchemaElements sche meta.row_groups = std::move(row_groups); for (auto & r : meta.row_groups) meta.num_rows += r.num_rows; - meta.__set_created_by(VERSION_NAME " " VERSION_DESCRIBE); + meta.__set_created_by(std::string(VERSION_NAME) + " " + VERSION_DESCRIBE); if (options.write_page_statistics || options.write_column_chunk_statistics) {