From: Joel Rosdahl Date: Tue, 29 Jun 2021 05:42:21 +0000 (+0200) Subject: Use .clang-format regexes instead of comments to group system includes X-Git-Tag: v4.4~174 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b05d8dce70f87df64be4123bb1bc7602e5d4265;p=thirdparty%2Fccache.git Use .clang-format regexes instead of comments to group system includes --- diff --git a/.clang-format b/.clang-format index e101fa468..29f13ad43 100644 --- a/.clang-format +++ b/.clang-format @@ -28,6 +28,10 @@ IncludeCategories: Priority: 1 - Regex: '^["<]third_party/' Priority: 4 + - Regex: '^<(sddl\.h)>$' + Priority: 5 + - Regex: '^<(algorithm|any|array|atomic|bitset|cassert|ccomplex|cctype|cerrno|cfenv|cfloat|chrono|cinttypes|ciso646|climits|clocale|cmath|codecvt|complex|condition_variable|csetjmp|csignal|cstdalign|cstdarg|cstdbool|cstddef|cstdint|cstdio|cstdlib|cstring|ctgmath|ctime|cuchar|cwchar|cwctype|deque|exception|execution|filesystem|forward_list|fstream|functional|future|initializer_list|iomanip|ios|iosfwd|iostream|istream|iterator|limits|list|locale|map|memory|memory_resource|mutex|new|numeric|optional|ostream|queue|random|ratio|regex|scoped_allocator|set|shared_mutex|sstream|stack|stdexcept|streambuf|string|string_view|strstream|system_error|thread|tuple|type_traits|typeindex|typeinfo|unordered_map|unordered_set|utility|valarray|variant|vector)>$' + Priority: 6 - Regex: '^"' Priority: 2 - Regex: '.*' diff --git a/src/Args.hpp b/src/Args.hpp index e58aeb669..48fb77df5 100644 --- a/src/Args.hpp +++ b/src/Args.hpp @@ -26,10 +26,8 @@ #include "third_party/nonstd/optional.hpp" #include "third_party/nonstd/string_view.hpp" -// System headers #include #include -// End of system headers class Args { diff --git a/src/CacheFile.hpp b/src/CacheFile.hpp index 482db96c7..1cea40880 100644 --- a/src/CacheFile.hpp +++ b/src/CacheFile.hpp @@ -24,9 +24,7 @@ #include "third_party/nonstd/optional.hpp" -// System headers #include -// End of system headers class CacheFile { diff --git a/src/Config.cpp b/src/Config.cpp index 995d21f69..2163c68b3 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -31,7 +31,6 @@ #include "third_party/fmt/core.h" -// System headers #include #include #include @@ -39,7 +38,6 @@ #include #include #include -// End of system headers using nonstd::nullopt; using nonstd::optional; diff --git a/src/Config.hpp b/src/Config.hpp index e02a4ef8d..06069bd18 100644 --- a/src/Config.hpp +++ b/src/Config.hpp @@ -25,12 +25,10 @@ #include "third_party/nonstd/optional.hpp" -// System headers #include #include #include #include -// End of system headers enum class CompilerType { auto_guess, clang, gcc, nvcc, other, pump }; diff --git a/src/Context.hpp b/src/Context.hpp index b727cbb5b..856428b4e 100644 --- a/src/Context.hpp +++ b/src/Context.hpp @@ -39,11 +39,9 @@ #include "third_party/nonstd/optional.hpp" #include "third_party/nonstd/string_view.hpp" -// System headers #include #include #include -// End of system headers class SignalHandler; diff --git a/src/Depfile.hpp b/src/Depfile.hpp index 157b61250..050700683 100644 --- a/src/Depfile.hpp +++ b/src/Depfile.hpp @@ -26,10 +26,8 @@ class Hash; #include "third_party/nonstd/optional.hpp" #include "third_party/nonstd/string_view.hpp" -// System headers #include #include -// End of system headers namespace Depfile { diff --git a/src/Digest.hpp b/src/Digest.hpp index ffe27def4..d219d5174 100644 --- a/src/Digest.hpp +++ b/src/Digest.hpp @@ -24,9 +24,7 @@ #include "third_party/fmt/core.h" -// System headers #include -// End of system headers // Digest represents the binary form of the final digest (AKA hash or checksum) // produced by the hash algorithm. diff --git a/src/Lockfile.cpp b/src/Lockfile.cpp index 1afcce437..209b0aac1 100644 --- a/src/Lockfile.cpp +++ b/src/Lockfile.cpp @@ -28,11 +28,9 @@ #include "third_party/fmt/core.h" -// System headers #include #include #include -// End of system headers namespace { diff --git a/src/Logging.hpp b/src/Logging.hpp index a16243392..5c780ec15 100644 --- a/src/Logging.hpp +++ b/src/Logging.hpp @@ -27,10 +27,8 @@ #include "third_party/nonstd/optional.hpp" #include "third_party/nonstd/string_view.hpp" -// System headers #include #include -// End of system headers // Log a raw message (plus a newline character). #define LOG_RAW(message_) \ diff --git a/src/Manifest.hpp b/src/Manifest.hpp index 0d18c9bf7..addf17ec4 100644 --- a/src/Manifest.hpp +++ b/src/Manifest.hpp @@ -22,10 +22,8 @@ #include "third_party/nonstd/optional.hpp" -// System headers #include #include -// End of system headers class Config; class Context; diff --git a/src/Result.hpp b/src/Result.hpp index 1265dcd66..7fcfc95b6 100644 --- a/src/Result.hpp +++ b/src/Result.hpp @@ -23,11 +23,9 @@ #include "third_party/nonstd/expected.hpp" #include "third_party/nonstd/optional.hpp" -// System headers #include #include #include -// End of system headers class CacheEntryReader; class CacheEntryWriter; diff --git a/src/Statistics.hpp b/src/Statistics.hpp index 72a776794..6e5917b43 100644 --- a/src/Statistics.hpp +++ b/src/Statistics.hpp @@ -25,11 +25,9 @@ #include "third_party/nonstd/optional.hpp" -// System headers #include #include #include -// End of system headers class Config; diff --git a/src/TemporaryFile.hpp b/src/TemporaryFile.hpp index 78092d239..624d5937d 100644 --- a/src/TemporaryFile.hpp +++ b/src/TemporaryFile.hpp @@ -22,9 +22,7 @@ #include "third_party/nonstd/string_view.hpp" -// System headers #include -// End of system headers // This class represents a unique temporary file created by mkstemp. The file is // not deleted by the destructor. diff --git a/src/Util.hpp b/src/Util.hpp index 4af271b86..e7ca46009 100644 --- a/src/Util.hpp +++ b/src/Util.hpp @@ -25,7 +25,6 @@ #include "third_party/nonstd/optional.hpp" #include "third_party/nonstd/string_view.hpp" -// System headers #include #include #include @@ -33,7 +32,6 @@ #include #include #include -// End of system headers class Context; diff --git a/src/ccache.cpp b/src/ccache.cpp index 0b3d23f76..f41a323fc 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -74,12 +74,10 @@ extern "C" { # include "Win32Util.hpp" #endif -// System headers #include #include #include #include -// End of system headers #ifndef MYNAME # define MYNAME "ccache" diff --git a/src/ccache.hpp b/src/ccache.hpp index a05469759..da1f342e7 100644 --- a/src/ccache.hpp +++ b/src/ccache.hpp @@ -25,10 +25,8 @@ #include "third_party/nonstd/string_view.hpp" -// System headers #include #include -// End of system headers class Context; diff --git a/src/compress.cpp b/src/compress.cpp index 2050abaf4..157df6a0f 100644 --- a/src/compress.cpp +++ b/src/compress.cpp @@ -34,11 +34,9 @@ #include "third_party/fmt/core.h" -// System headers #include #include #include -// End of system headers using nonstd::optional; diff --git a/src/core/types.hpp b/src/core/types.hpp index 42179c1c0..7cd53da0a 100644 --- a/src/core/types.hpp +++ b/src/core/types.hpp @@ -18,9 +18,7 @@ #pragma once -// System headers #include -// End of system headers namespace core { diff --git a/src/exceptions.hpp b/src/exceptions.hpp index 134f7212d..6f7ccb32f 100644 --- a/src/exceptions.hpp +++ b/src/exceptions.hpp @@ -25,11 +25,9 @@ #include "third_party/fmt/core.h" #include "third_party/nonstd/optional.hpp" -// System headers #include #include #include -// End of system headers // Don't throw or catch ErrorBase directly, use a subclass. class ErrorBase : public std::runtime_error diff --git a/src/hashutil.hpp b/src/hashutil.hpp index 40db14605..51ac36af7 100644 --- a/src/hashutil.hpp +++ b/src/hashutil.hpp @@ -22,9 +22,7 @@ #include "third_party/nonstd/string_view.hpp" -// System headers #include -// End of system headers class Config; class Context; diff --git a/src/storage/SecondaryStorage.hpp b/src/storage/SecondaryStorage.hpp index ce8c373fe..611f78783 100644 --- a/src/storage/SecondaryStorage.hpp +++ b/src/storage/SecondaryStorage.hpp @@ -21,9 +21,7 @@ #include #include -// System headers #include -// End of system headers class Digest; diff --git a/src/storage/Storage.cpp b/src/storage/Storage.cpp index 32229d06f..d4d5d953e 100644 --- a/src/storage/Storage.cpp +++ b/src/storage/Storage.cpp @@ -28,9 +28,7 @@ #include #include -// System headers #include -// End of system headers namespace storage { diff --git a/src/storage/Storage.hpp b/src/storage/Storage.hpp index f4f695b73..f15166aad 100644 --- a/src/storage/Storage.hpp +++ b/src/storage/Storage.hpp @@ -26,11 +26,9 @@ #include -// System headers #include #include #include -// End of system headers class Digest; diff --git a/src/storage/types.hpp b/src/storage/types.hpp index 1a77f5f99..0984971a4 100644 --- a/src/storage/types.hpp +++ b/src/storage/types.hpp @@ -18,11 +18,9 @@ #pragma once -// System headers #include #include #include -// End of system headers namespace storage { diff --git a/src/util/file_utils.hpp b/src/util/file_utils.hpp index cf5bd2871..b5fddda30 100644 --- a/src/util/file_utils.hpp +++ b/src/util/file_utils.hpp @@ -18,9 +18,7 @@ #pragma once -// System headers #include -// End of system headers namespace util { diff --git a/src/util/string_utils.cpp b/src/util/string_utils.cpp index cd15ddcc0..18c36f2a1 100644 --- a/src/util/string_utils.cpp +++ b/src/util/string_utils.cpp @@ -22,9 +22,7 @@ #include #include -// System headers #include -// End of system headers namespace util { diff --git a/src/util/string_utils.hpp b/src/util/string_utils.hpp index 41685798e..5533e683f 100644 --- a/src/util/string_utils.hpp +++ b/src/util/string_utils.hpp @@ -22,10 +22,8 @@ #include #include -// System headers #include #include -// End of system headers namespace util { diff --git a/unittest/test_Config.cpp b/unittest/test_Config.cpp index 84b809b99..7bce90294 100644 --- a/unittest/test_Config.cpp +++ b/unittest/test_Config.cpp @@ -26,11 +26,9 @@ #include "third_party/doctest.h" #include "third_party/fmt/core.h" -// System headers #include #include #include -// End of system headers using doctest::Approx; using TestUtil::TestContext; diff --git a/unittest/test_Util.cpp b/unittest/test_Util.cpp index 04fcd3aa6..92343b966 100644 --- a/unittest/test_Util.cpp +++ b/unittest/test_Util.cpp @@ -25,9 +25,7 @@ #include "third_party/doctest.h" #include "third_party/nonstd/optional.hpp" -// System headers #include -// End of system headers using doctest::Approx; using nonstd::nullopt; diff --git a/unittest/test_argprocessing.cpp b/unittest/test_argprocessing.cpp index 2c0295512..aa4c0550a 100644 --- a/unittest/test_argprocessing.cpp +++ b/unittest/test_argprocessing.cpp @@ -27,9 +27,7 @@ #include "third_party/doctest.h" -// System headers #include -// End of system headers using TestUtil::TestContext; diff --git a/unittest/test_bsdmkstemp.cpp b/unittest/test_bsdmkstemp.cpp index def2f67c9..6ded67403 100644 --- a/unittest/test_bsdmkstemp.cpp +++ b/unittest/test_bsdmkstemp.cpp @@ -23,13 +23,12 @@ #include "third_party/doctest.h" #include "third_party/win32/mktemp.h" -// System headers +#include + #include #include #include -#include #include -// End of system headers using TestUtil::TestContext;