Skip to content

[WIP] add -Wno-reserved-identifier in necessary places for build with clang-13#27777

Merged
alexey-milovidov merged 3 commits intoClickHouse:masterfrom
syominsergey:fix-build-clang-13-reserved-identifier
Aug 19, 2021
Merged

[WIP] add -Wno-reserved-identifier in necessary places for build with clang-13#27777
alexey-milovidov merged 3 commits intoClickHouse:masterfrom
syominsergey:fix-build-clang-13-reserved-identifier

Conversation

@syominsergey
Copy link
Copy Markdown

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Improve support for build with clang-13.

Detailed description / Documentation draft:
Some time ago building with clang-13 was completely failed.
After #27714 some errors were solved. But not all errors.
Example of errors caused by new diagnostic flag -Wreserved-identifier introduced in clang-13 and not exists in clang-12 (no mentions in doc for clang-12) listed in attached file
cmake-and-ninja-run-clang-13-reserved-identifier.txt. Versions of OS, compiler. cmake and ninja are the same as described in #27705 (comment)

@robot-clickhouse robot-clickhouse added the pr-build Pull request with build/testing/packaging improvement label Aug 17, 2021
@syominsergey
Copy link
Copy Markdown
Author

PR is in draft state, because I haven't already fully check it solves all problems with clang-13.
I will make PR ready for review after successful local build.

@alexey-milovidov
Copy link
Copy Markdown
Member

We should fix the cause of these warnings, not to add suppressions.

@syominsergey
Copy link
Copy Markdown
Author

syominsergey commented Aug 17, 2021 via email

@syominsergey
Copy link
Copy Markdown
Author

I have renamed that const, but some other errors still exists:

[7723/9891] Building CXX object base/common/CMakeFiles/common.dir/LineReader.cpp.o
FAILED: base/common/CMakeFiles/common.dir/LineReader.cpp.o 
/usr/bin/clang++-13  -DBOOST_ASIO_STANDALONE=1 -DPOCO_ENABLE_CPP11 -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX -DSTD_EXCEPTION_HAS_STACK_TRACE=1 -DUSE_REPLXX=1 -DWITH_COVERAGE=0 -I../contrib/sentry-native/include -Iincludes/configs -I../base/common/.. -Ibase/common/.. -I../base/glibc-compatibility/memcpy -I../contrib/cityhash102/include -I../contrib/cctz/include -isystem ../contrib/libcxx/include -isystem ../contrib/libcxxabi/include -isystem ../contrib/libunwind/include -isystem ../contrib/boost -isystem ../contrib/poco/Net/include -isystem ../contrib/poco/Foundation/include -isystem ../contrib/poco/NetSSL_OpenSSL/include -isystem ../contrib/poco/Crypto/include -isystem ../contrib/boringssl/include -isystem ../contrib/poco/Util/include -isystem ../contrib/poco/JSON/include -isystem ../contrib/poco/XML/include -isystem ../contrib/replxx/include -isystem ../contrib/fmtlib-cmake/../fmtlib/include -isystem ../contrib/libc-headers/x86_64-linux-gnu -isystem ../contrib/libc-headers -fdiagnostics-color=always -fsized-deallocation  -gdwarf-aranges -pipe -mssse3 -msse4.1 -msse4.2 -mpclmul -mpopcnt -fasynchronous-unwind-tables -falign-functions=32   -Wall -Wno-unused-command-line-argument  -fdiagnostics-absolute-paths -fexperimental-new-pass-manager -Werror -Wextra -Wframe-larger-than=65536 -Wpedantic -Wno-vla-extension -Wno-zero-length-array -Wno-c11-extensions -Wcomma -Wconditional-uninitialized -Wcovered-switch-default -Wdeprecated -Wembedded-directive -Wempty-init-stmt -Wextra-semi-stmt -Wextra-semi -Wgnu-case-range -Winconsistent-missing-destructor-override -Wnewline-eof -Wold-style-cast -Wrange-loop-analysis -Wredundant-parens -Wreserved-id-macro -Wshadow-field -Wshadow-uncaptured-local -Wshadow -Wstring-plus-int -Wundef -Wunreachable-code-return -Wunreachable-code -Wunused-exception-parameter -Wunused-macros -Wunused-member-function -Wzero-as-null-pointer-constant -Weverything -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-c99-extensions -Wno-conversion -Wno-ctad-maybe-unsupported -Wno-deprecated-dynamic-exception-spec -Wno-disabled-macro-expansion -Wno-documentation-unknown-command -Wno-double-promotion -Wno-exit-time-destructors -Wno-float-equal -Wno-global-constructors -Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-nested-anon-types -Wno-packed -Wno-padded -Wno-shift-sign-overflow -Wno-sign-conversion -Wno-switch-enum -Wno-undefined-func-template -Wno-unused-template -Wno-vla -Wno-weak-template-vtables -Wno-weak-vtables -O2 -g -DNDEBUG -O3  -fno-pie   -D OS_LINUX -nostdinc++ -std=gnu++2a -MD -MT base/common/CMakeFiles/common.dir/LineReader.cpp.o -MF base/common/CMakeFiles/common.dir/LineReader.cpp.o.d -o base/common/CMakeFiles/common.dir/LineReader.cpp.o -c ../base/common/LineReader.cpp
/home/semin-serg/ClickHouse/base/common/LineReader.cpp:34:5: error: identifier '__d0' is reserved because it starts with '__' [-Werror,-Wreserved-identifier]
    FD_ZERO(&fds);
    ^
/home/semin-serg/ClickHouse/contrib/libc-headers/x86_64-linux-gnu/sys/select.h:88:26: note: expanded from macro 'FD_ZERO'
#define FD_ZERO(fdsetp)         __FD_ZERO (fdsetp)
                                ^
/home/semin-serg/ClickHouse/contrib/libc-headers/x86_64-linux-gnu/bits/select.h:35:9: note: expanded from macro '__FD_ZERO'
    int __d0, __d1;                                                           \
        ^
/home/semin-serg/ClickHouse/base/common/LineReader.cpp:34:5: error: identifier '__d1' is reserved because it starts with '__' [-Werror,-Wreserved-identifier]
/home/semin-serg/ClickHouse/contrib/libc-headers/x86_64-linux-gnu/sys/select.h:88:26: note: expanded from macro 'FD_ZERO'
#define FD_ZERO(fdsetp)         __FD_ZERO (fdsetp)
                                ^
/home/semin-serg/ClickHouse/contrib/libc-headers/x86_64-linux-gnu/bits/select.h:35:15: note: expanded from macro '__FD_ZERO'
    int __d0, __d1;                                                           \
              ^
2 errors generated.
[7724/9891] Building CXX object base/common/CMakeFiles/common.dir/phdr_cache.cpp.o
FAILED: base/common/CMakeFiles/common.dir/phdr_cache.cpp.o 
/usr/bin/clang++-13  -DBOOST_ASIO_STANDALONE=1 -DPOCO_ENABLE_CPP11 -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX -DSTD_EXCEPTION_HAS_STACK_TRACE=1 -DUSE_REPLXX=1 -DWITH_COVERAGE=0 -I../contrib/sentry-native/include -Iincludes/configs -I../base/common/.. -Ibase/common/.. -I../base/glibc-compatibility/memcpy -I../contrib/cityhash102/include -I../contrib/cctz/include -isystem ../contrib/libcxx/include -isystem ../contrib/libcxxabi/include -isystem ../contrib/libunwind/include -isystem ../contrib/boost -isystem ../contrib/poco/Net/include -isystem ../contrib/poco/Foundation/include -isystem ../contrib/poco/NetSSL_OpenSSL/include -isystem ../contrib/poco/Crypto/include -isystem ../contrib/boringssl/include -isystem ../contrib/poco/Util/include -isystem ../contrib/poco/JSON/include -isystem ../contrib/poco/XML/include -isystem ../contrib/replxx/include -isystem ../contrib/fmtlib-cmake/../fmtlib/include -isystem ../contrib/libc-headers/x86_64-linux-gnu -isystem ../contrib/libc-headers -fdiagnostics-color=always -fsized-deallocation  -gdwarf-aranges -pipe -mssse3 -msse4.1 -msse4.2 -mpclmul -mpopcnt -fasynchronous-unwind-tables -falign-functions=32   -Wall -Wno-unused-command-line-argument  -fdiagnostics-absolute-paths -fexperimental-new-pass-manager -Werror -Wextra -Wframe-larger-than=65536 -Wpedantic -Wno-vla-extension -Wno-zero-length-array -Wno-c11-extensions -Wcomma -Wconditional-uninitialized -Wcovered-switch-default -Wdeprecated -Wembedded-directive -Wempty-init-stmt -Wextra-semi-stmt -Wextra-semi -Wgnu-case-range -Winconsistent-missing-destructor-override -Wnewline-eof -Wold-style-cast -Wrange-loop-analysis -Wredundant-parens -Wreserved-id-macro -Wshadow-field -Wshadow-uncaptured-local -Wshadow -Wstring-plus-int -Wundef -Wunreachable-code-return -Wunreachable-code -Wunused-exception-parameter -Wunused-macros -Wunused-member-function -Wzero-as-null-pointer-constant -Weverything -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-c99-extensions -Wno-conversion -Wno-ctad-maybe-unsupported -Wno-deprecated-dynamic-exception-spec -Wno-disabled-macro-expansion -Wno-documentation-unknown-command -Wno-double-promotion -Wno-exit-time-destructors -Wno-float-equal -Wno-global-constructors -Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-nested-anon-types -Wno-packed -Wno-padded -Wno-shift-sign-overflow -Wno-sign-conversion -Wno-switch-enum -Wno-undefined-func-template -Wno-unused-template -Wno-vla -Wno-weak-template-vtables -Wno-weak-vtables -O2 -g -DNDEBUG -O3  -fno-pie   -D OS_LINUX -nostdinc++ -std=gnu++2a -MD -MT base/common/CMakeFiles/common.dir/phdr_cache.cpp.o -MF base/common/CMakeFiles/common.dir/phdr_cache.cpp.o.d -o base/common/CMakeFiles/common.dir/phdr_cache.cpp.o -c ../base/common/phdr_cache.cpp
/home/semin-serg/ClickHouse/base/common/phdr_cache.cpp:87:6: error: identifier '__lsan_ignore_object' is reserved because it starts with '__' [-Werror,-Wreserved-identifier]
void __lsan_ignore_object(const void *) {} // NOLINT
     ^
1 error generated.

will rename here too

@syominsergey
Copy link
Copy Markdown
Author

syominsergey commented Aug 18, 2021

but maybe errors in libc-headers need to be suppressed?

@alexey-milovidov
Copy link
Copy Markdown
Member

Yes, but you cannot selectively suppress warnings from macro substitution.
Add something like this to the affected .cpp file:

#if defined(__clang__) && __clang_major__ >= 13
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif

@alexey-milovidov alexey-milovidov self-assigned this Aug 18, 2021
@alexey-milovidov alexey-milovidov marked this pull request as ready for review August 19, 2021 08:29
@alexey-milovidov
Copy link
Copy Markdown
Member

Let's continue in next PR.

@alexey-milovidov alexey-milovidov merged commit 8a6f121 into ClickHouse:master Aug 19, 2021
@syominsergey
Copy link
Copy Markdown
Author

Thank you for advice and review!
I will try to resume at the next week (nowtime I am without notebook).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-build Pull request with build/testing/packaging improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants