diff --git a/CMakeLists.txt b/CMakeLists.txt index e4227735549..a49af35cce6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,10 @@ if (COMPILER_CLANG) endif() endif () +if (HAS_RESERVED_IDENTIFIER) + add_compile_definitions(HAS_RESERVED_IDENTIFIER) +endif() + # If turned `ON`, assumes the user has either the system GTest library or the bundled one. option(ENABLE_TESTS "Provide unit_test_dbms target with Google.Test unit tests" ON) option(ENABLE_EXAMPLES "Build all example programs in 'examples' subdirectories" OFF) diff --git a/base/base/LineReader.cpp b/base/base/LineReader.cpp index c2786892aeb..8600f4c7b65 100644 --- a/base/base/LineReader.cpp +++ b/base/base/LineReader.cpp @@ -16,7 +16,7 @@ extern "C" } #endif -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/base/base/phdr_cache.cpp b/base/base/phdr_cache.cpp index a642bb7cd59..d2388666f73 100644 --- a/base/base/phdr_cache.cpp +++ b/base/base/phdr_cache.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/base/base/unit.h b/base/base/unit.h index 5bf5e00c049..c6333e41a89 100644 --- a/base/base/unit.h +++ b/base/base/unit.h @@ -1,7 +1,7 @@ #pragma once #include -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/base/daemon/BaseDaemon.cpp b/base/daemon/BaseDaemon.cpp index bbb40ebac63..63ce529eb0b 100644 --- a/base/daemon/BaseDaemon.cpp +++ b/base/daemon/BaseDaemon.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/base/readpassphrase/readpassphrase.c b/base/readpassphrase/readpassphrase.c index 3bcad34e481..b8707770e6c 100644 --- a/base/readpassphrase/readpassphrase.c +++ b/base/readpassphrase/readpassphrase.c @@ -27,7 +27,7 @@ #define _PATH_TTY "/dev/tty" #endif -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/cmake/check_flags.cmake b/cmake/check_flags.cmake index 58605543dff..5d680a8ccbb 100644 --- a/cmake/check_flags.cmake +++ b/cmake/check_flags.cmake @@ -1,6 +1,7 @@ include (CheckCXXCompilerFlag) include (CheckCCompilerFlag) +check_cxx_compiler_flag("-Wreserved-identifier" HAS_RESERVED_IDENTIFIER) check_cxx_compiler_flag("-Wsuggest-destructor-override" HAS_SUGGEST_DESTRUCTOR_OVERRIDE) check_cxx_compiler_flag("-Wshadow" HAS_SHADOW) check_cxx_compiler_flag("-Wsuggest-override" HAS_SUGGEST_OVERRIDE) diff --git a/src/Common/ThreadFuzzer.cpp b/src/Common/ThreadFuzzer.cpp index ee153ad44f4..f0f41e56eaf 100644 --- a/src/Common/ThreadFuzzer.cpp +++ b/src/Common/ThreadFuzzer.cpp @@ -31,7 +31,7 @@ M(int, pthread_mutex_unlock, pthread_mutex_t * arg) #endif -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/src/Common/examples/int_hashes_perf.cpp b/src/Common/examples/int_hashes_perf.cpp index c648c7c0cf2..0fe0141ba1a 100644 --- a/src/Common/examples/int_hashes_perf.cpp +++ b/src/Common/examples/int_hashes_perf.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/src/Compression/CompressionCodecDoubleDelta.cpp b/src/Compression/CompressionCodecDoubleDelta.cpp index 3af43911015..c4561b1fbc8 100644 --- a/src/Compression/CompressionCodecDoubleDelta.cpp +++ b/src/Compression/CompressionCodecDoubleDelta.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/src/Compression/CompressionCodecGorilla.cpp b/src/Compression/CompressionCodecGorilla.cpp index d6ea0267550..8ddb2086ebf 100644 --- a/src/Compression/CompressionCodecGorilla.cpp +++ b/src/Compression/CompressionCodecGorilla.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/src/Functions/FunctionsCodingIP.cpp b/src/Functions/FunctionsCodingIP.cpp index 3a1b04a4790..3e7c8bff4d5 100644 --- a/src/Functions/FunctionsCodingIP.cpp +++ b/src/Functions/FunctionsCodingIP.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/src/IO/ReadBufferFromFileDescriptor.cpp b/src/IO/ReadBufferFromFileDescriptor.cpp index 3d981a48979..a710dfe33fb 100644 --- a/src/IO/ReadBufferFromFileDescriptor.cpp +++ b/src/IO/ReadBufferFromFileDescriptor.cpp @@ -11,7 +11,7 @@ #include -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/src/IO/tests/gtest_bit_io.cpp b/src/IO/tests/gtest_bit_io.cpp index c27525857f9..98db7226b5d 100644 --- a/src/IO/tests/gtest_bit_io.cpp +++ b/src/IO/tests/gtest_bit_io.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/src/Processors/Formats/Impl/ArrowBufferedStreams.cpp b/src/Processors/Formats/Impl/ArrowBufferedStreams.cpp index e461baba7bc..f98e45a4e49 100644 --- a/src/Processors/Formats/Impl/ArrowBufferedStreams.cpp +++ b/src/Processors/Formats/Impl/ArrowBufferedStreams.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif diff --git a/utils/memcpy-bench/memcpy-bench.cpp b/utils/memcpy-bench/memcpy-bench.cpp index d2721acb149..7f8e89b8355 100644 --- a/utils/memcpy-bench/memcpy-bench.cpp +++ b/utils/memcpy-bench/memcpy-bench.cpp @@ -1,4 +1,4 @@ -#if defined(__clang__) && __clang_major__ >= 13 +#ifdef HAS_RESERVED_IDENTIFIER #pragma clang diagnostic ignored "-Wreserved-identifier" #endif