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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
#if defined(OS_LINUX)
#include <stdlib.h>
#include <cstdlib>
/// 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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