Enable clang-tidy modernize-deprecated-headers & hicpp-deprecated-headers

Official docs:

  Some headers from C library were deprecated in C++ and are no longer
  welcome in C++ codebases. Some have no effect in C++. For more details
  refer to the C++ 14 Standard [depr.c.headers] section. This check
  replaces C standard library headers with their C++ alternatives and
  removes redundant ones.
This commit is contained in:
Robert Schulze 2022-05-08 19:01:47 +02:00
parent ae57e6df9c
commit 1b81bb49b4
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
54 changed files with 66 additions and 68 deletions

View File

@ -45,7 +45,6 @@ Checks: '*,
-hicpp-avoid-c-arrays, -hicpp-avoid-c-arrays,
-hicpp-avoid-goto, -hicpp-avoid-goto,
-hicpp-braces-around-statements, -hicpp-braces-around-statements,
-hicpp-deprecated-headers,
-hicpp-explicit-conversions, -hicpp-explicit-conversions,
-hicpp-function-size, -hicpp-function-size,
-hicpp-invalid-access-moved, -hicpp-invalid-access-moved,
@ -76,7 +75,6 @@ Checks: '*,
-modernize-avoid-c-arrays, -modernize-avoid-c-arrays,
-modernize-concat-nested-namespaces, -modernize-concat-nested-namespaces,
-modernize-deprecated-headers,
-modernize-pass-by-value, -modernize-pass-by-value,
-modernize-return-braced-init-list, -modernize-return-braced-init-list,
-modernize-use-auto, -modernize-use-auto,

View File

@ -1,5 +1,5 @@
#include <string> #include <string>
#include <string.h> #include <cstring>
#include <Poco/UTF8Encoding.h> #include <Poco/UTF8Encoding.h>
#include <Poco/NumberParser.h> #include <Poco/NumberParser.h>

View File

@ -5,7 +5,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <string.h> #include <cstring>
#include <unistd.h> #include <unistd.h>
#include <sys/select.h> #include <sys/select.h>
#include <sys/time.h> #include <sys/time.h>

View File

@ -1,6 +1,6 @@
#include <base/demangle.h> #include <base/demangle.h>
#include <stdlib.h> #include <cstdlib>
#include <cxxabi.h> #include <cxxabi.h>
static DemangleResult tryDemangle(const char * name, int & status) static DemangleResult tryDemangle(const char * name, int & status)

View File

@ -3,7 +3,7 @@
#include <cstddef> #include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <errno.h> #include <cerrno>
void * mremap_fallback( void * mremap_fallback(

View File

@ -169,9 +169,9 @@ obstacle to adoption, that text has been removed.
*/ */
#include <math.h> #include <cmath>
#include <stdint.h> #include <cstdint>
#include <stdio.h> #include <cstdio>
double preciseExp10(double x) double preciseExp10(double x)
{ {

View File

@ -1,7 +1,7 @@
#include <base/sleep.h> #include <base/sleep.h>
#include <time.h> #include <ctime>
#include <errno.h> #include <cerrno>
#if defined(OS_DARWIN) #if defined(OS_DARWIN)
#include <mach/mach.h> #include <mach/mach.h>

View File

@ -1,8 +1,8 @@
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <cstdlib>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <csignal>
#include <time.h> #include <ctime>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>

View File

@ -1,4 +1,4 @@
#include <stdlib.h> #include <cstdlib>
#include <fcntl.h> #include <fcntl.h>
#include <map> #include <map>
#include <iostream> #include <iostream>

View File

@ -1,5 +1,5 @@
#include <signal.h> #include <csignal>
#include <setjmp.h> #include <csetjmp>
#include <unistd.h> #include <unistd.h>
#ifdef __linux__ #ifdef __linux__

View File

@ -5,7 +5,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <errno.h> #include <cerrno>
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
#include <Poco/Version.h> #include <Poco/Version.h>

View File

@ -17,7 +17,7 @@
#include <Common/logger_useful.h> #include <Common/logger_useful.h>
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
#include <boost/range/algorithm/set_algorithm.hpp> #include <boost/range/algorithm/set_algorithm.hpp>
#include <assert.h> #include <cassert>
namespace DB namespace DB

View File

@ -19,7 +19,7 @@
/** This file was edited for ClickHouse. /** This file was edited for ClickHouse.
*/ */
#include <string.h> #include <cstring>
#include <Common/Elf.h> #include <Common/Elf.h>
#include <Common/Dwarf.h> #include <Common/Dwarf.h>

View File

@ -4,7 +4,7 @@
#include <Common/Exception.h> #include <Common/Exception.h>
#include <base/unaligned.h> #include <base/unaligned.h>
#include <string.h> #include <cstring>
namespace DB namespace DB

View File

@ -1,6 +1,6 @@
#include "Exception.h" #include "Exception.h"
#include <string.h> #include <cstring>
#include <cxxabi.h> #include <cxxabi.h>
#include <cstdlib> #include <cstdlib>
#include <Poco/String.h> #include <Poco/String.h>

View File

@ -1,7 +1,7 @@
#include <Common/IO.h> #include <Common/IO.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <cerrno>
#include <cstring> #include <cstring>
bool writeRetry(int fd, const char * data, size_t size) bool writeRetry(int fd, const char * data, size_t size)

View File

@ -3,7 +3,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <ctime>
#include <csignal> #include <csignal>
#include <Common/logger_useful.h> #include <Common/logger_useful.h>

View File

@ -2,7 +2,7 @@
#include <sys/file.h> #include <sys/file.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <cerrno>
#include <Common/logger_useful.h> #include <Common/logger_useful.h>
#include <base/errnoToString.h> #include <base/errnoToString.h>

View File

@ -9,10 +9,10 @@
#include "hasLinuxCapability.h" #include "hasLinuxCapability.h"
#include <base/unaligned.h> #include <base/unaligned.h>
#include <errno.h> #include <cerrno>
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#include <string.h> #include <cstring>
#include <sys/socket.h> #include <sys/socket.h>
#include <linux/genetlink.h> #include <linux/genetlink.h>
#include <linux/netlink.h> #include <linux/netlink.h>

View File

@ -1,4 +1,4 @@
#include <signal.h> #include <csignal>
#include <sys/time.h> #include <sys/time.h>
#if defined(OS_LINUX) #if defined(OS_LINUX)
# include <sys/sysinfo.h> # include <sys/sysinfo.h>

View File

@ -1,4 +1,4 @@
#include <string.h> #include <cstring>
#include <string_view> #include <string_view>
#include <Common/clearPasswordFromCommandLine.h> #include <Common/clearPasswordFromCommandLine.h>

View File

@ -1,6 +1,6 @@
#include <Common/createHardLink.h> #include <Common/createHardLink.h>
#include <Common/Exception.h> #include <Common/Exception.h>
#include <errno.h> #include <cerrno>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>

View File

@ -1,5 +1,5 @@
#if defined(OS_LINUX) #if defined(OS_LINUX)
#include <stdlib.h> #include <cstdlib>
/// Interposing these symbols explicitly. The idea works like this: malloc.cpp compiles to a /// Interposing these symbols explicitly. The idea works like this: malloc.cpp compiles to a
/// dedicated object (namely clickhouse_malloc.o), and it will show earlier in the link command /// dedicated object (namely clickhouse_malloc.o), and it will show earlier in the link command

View File

@ -1,4 +1,4 @@
#include <time.h> #include <ctime>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <Common/Exception.h> #include <Common/Exception.h>

View File

@ -1,5 +1,5 @@
#include <city.h> #include <city.h>
#include <string.h> #include <cstring>
#include <base/unaligned.h> #include <base/unaligned.h>
#include <base/types.h> #include <base/types.h>

View File

@ -13,7 +13,7 @@
#include <IO/BitHelpers.h> #include <IO/BitHelpers.h>
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
#include <string.h> #include <cstring>
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <type_traits> #include <type_traits>

View File

@ -11,7 +11,7 @@
#include <IO/ReadBufferFromMemory.h> #include <IO/ReadBufferFromMemory.h>
#include <IO/BitHelpers.h> #include <IO/BitHelpers.h>
#include <string.h> #include <cstring>
#include <algorithm> #include <algorithm>
#include <type_traits> #include <type_traits>

View File

@ -1,6 +1,6 @@
#include "LZ4_decompress_faster.h" #include "LZ4_decompress_faster.h"
#include <string.h> #include <cstring>
#include <iostream> #include <iostream>
#include <Core/Defines.h> #include <Core/Defines.h>
#include <Common/Stopwatch.h> #include <Common/Stopwatch.h>

View File

@ -22,7 +22,7 @@
#include <typeinfo> #include <typeinfo>
#include <vector> #include <vector>
#include <string.h> #include <cstring>
/// For the expansion of gtest macros. /// For the expansion of gtest macros.
#if defined(__clang__) #if defined(__clang__)

View File

@ -4,7 +4,7 @@
#include <Columns/ColumnArray.h> #include <Columns/ColumnArray.h>
#include <Columns/ColumnMap.h> #include <Columns/ColumnMap.h>
#include <Common/typeid_cast.h> #include <Common/typeid_cast.h>
#include <string.h> #include <cstring>
#include <boost/program_options/options_description.hpp> #include <boost/program_options/options_description.hpp>
namespace DB namespace DB

View File

@ -13,9 +13,9 @@
#if defined(__linux__) #if defined(__linux__)
#include <sys/prctl.h> #include <sys/prctl.h>
#endif #endif
#include <errno.h> #include <cerrno>
#include <string.h> #include <cstring>
#include <signal.h> #include <csignal>
#include <unistd.h> #include <unistd.h>
#include <typeinfo> #include <typeinfo>

View File

@ -21,7 +21,7 @@
#if USE_SENTRY && !defined(KEEPER_STANDALONE_BUILD) #if USE_SENTRY && !defined(KEEPER_STANDALONE_BUILD)
# include <sentry.h> # include <sentry.h>
# include <stdio.h> # include <cstdio>
# include <filesystem> # include <filesystem>
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -1,4 +1,4 @@
#include <string.h> #include <cstring>
#include <Common/typeid_cast.h> #include <Common/typeid_cast.h>
#include <Common/assert_cast.h> #include <Common/assert_cast.h>

View File

@ -24,7 +24,7 @@
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma GCC diagnostic ignored "-Wunused-macros" #pragma GCC diagnostic ignored "-Wunused-macros"
#include <string.h> #include <cstring>
#define TOTAL_KEYWORDS 4942 #define TOTAL_KEYWORDS 4942
#define MIN_WORD_LENGTH 4 #define MIN_WORD_LENGTH 4

View File

@ -3,7 +3,7 @@
#if USE_H3 #if USE_H3
#include <array> #include <array>
#include <math.h> #include <cmath>
#include <Columns/ColumnsNumber.h> #include <Columns/ColumnsNumber.h>
#include <DataTypes/DataTypesNumber.h> #include <DataTypes/DataTypesNumber.h>
#include <Functions/FunctionFactory.h> #include <Functions/FunctionFactory.h>

View File

@ -3,7 +3,7 @@
#if USE_H3 #if USE_H3
#include <array> #include <array>
#include <math.h> #include <cmath>
#include <Columns/ColumnArray.h> #include <Columns/ColumnArray.h>
#include <Columns/ColumnTuple.h> #include <Columns/ColumnTuple.h>
#include <Columns/ColumnsNumber.h> #include <Columns/ColumnsNumber.h>

View File

@ -7,7 +7,7 @@
#include <Functions/extractTimeZoneFromFunctionArguments.h> #include <Functions/extractTimeZoneFromFunctionArguments.h>
#include <time.h> #include <ctime>
namespace DB namespace DB

View File

@ -8,7 +8,7 @@
#include <Common/assert_cast.h> #include <Common/assert_cast.h>
#include <time.h> #include <ctime>
namespace DB namespace DB

View File

@ -3,7 +3,7 @@
#include <IO/AsynchronousReadBufferFromFile.h> #include <IO/AsynchronousReadBufferFromFile.h>
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>
#include <errno.h> #include <cerrno>
namespace ProfileEvents namespace ProfileEvents

View File

@ -1,5 +1,5 @@
#include <errno.h> #include <cerrno>
#include <time.h> #include <ctime>
#include <optional> #include <optional>
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>
#include <Common/Stopwatch.h> #include <Common/Stopwatch.h>

View File

@ -5,7 +5,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <memory> #include <memory>
#include <string> #include <string>
#include <string.h> #include <cstring>
#include <snappy-c.h> #include <snappy-c.h>

View File

@ -3,7 +3,7 @@
#include <IO/ReadBufferFromFile.h> #include <IO/ReadBufferFromFile.h>
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>
#include <errno.h> #include <cerrno>
namespace ProfileEvents namespace ProfileEvents

View File

@ -1,5 +1,5 @@
#include <errno.h> #include <cerrno>
#include <time.h> #include <ctime>
#include <optional> #include <optional>
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>
#include <Common/Stopwatch.h> #include <Common/Stopwatch.h>

View File

@ -9,7 +9,7 @@
#include <IO/readFloatText.h> #include <IO/readFloatText.h>
#include <IO/Operators.h> #include <IO/Operators.h>
#include <base/find_symbols.h> #include <base/find_symbols.h>
#include <stdlib.h> #include <cstdlib>
#ifdef __SSE2__ #ifdef __SSE2__
#include <emmintrin.h> #include <emmintrin.h>

View File

@ -1,7 +1,7 @@
#include <Common/config.h> #include <Common/config.h>
#if USE_SNAPPY #if USE_SNAPPY
#include <string.h> #include <cstring>
#include <snappy.h> #include <snappy.h>

View File

@ -1,6 +1,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <cerrno>
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>

View File

@ -1,5 +1,5 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <cerrno>
#include <cassert> #include <cassert>
#include <sys/stat.h> #include <sys/stat.h>

View File

@ -1,5 +1,5 @@
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
#include <inttypes.h> #include <cinttypes>
#include <Common/hex.h> #include <Common/hex.h>

View File

@ -2,7 +2,7 @@
#pragma clang diagnostic ignored "-Wreserved-identifier" #pragma clang diagnostic ignored "-Wreserved-identifier"
#endif #endif
#include <string.h> #include <cstring>
#include <IO/BitHelpers.h> #include <IO/BitHelpers.h>
#include <base/types.h> #include <base/types.h>

View File

@ -7,7 +7,7 @@
#include <Parsers/parseIdentifierOrStringLiteral.h> #include <Parsers/parseIdentifierOrStringLiteral.h>
#include <Parsers/parseDatabaseAndTableName.h> #include <Parsers/parseDatabaseAndTableName.h>
#include <base/range.h> #include <base/range.h>
#include <assert.h> #include <cassert>
namespace DB namespace DB

View File

@ -1,4 +1,4 @@
#include <stdlib.h> #include <cstdlib>
#include <base/find_symbols.h> #include <base/find_symbols.h>
#include <Processors/Formats/Impl/RegexpRowInputFormat.h> #include <Processors/Formats/Impl/RegexpRowInputFormat.h>
#include <DataTypes/Serializations/SerializationNullable.h> #include <DataTypes/Serializations/SerializationNullable.h>

View File

@ -5,7 +5,7 @@
#include <mutex> #include <mutex>
#include <vector> #include <vector>
#include <string_view> #include <string_view>
#include <string.h> #include <cstring>
#include <base/types.h> #include <base/types.h>
#include <base/scope_guard.h> #include <base/scope_guard.h>
#include <Poco/Net/NetException.h> #include <Poco/Net/NetException.h>

View File

@ -1,6 +1,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <cerrno>
#include <map> #include <map>
#include <optional> #include <optional>

View File

@ -1,6 +1,6 @@
#ifdef OS_LINUX /// Because of 'sigqueue' functions and RT signals. #ifdef OS_LINUX /// Because of 'sigqueue' functions and RT signals.
#include <signal.h> #include <csignal>
#include <poll.h> #include <poll.h>
#include <mutex> #include <mutex>