This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 561d1f79a4 Upgrades to use LLVM 17 clang-format (#10546) 561d1f79a4 is described below commit 561d1f79a4015bf86ed6301f627a0f7fbe5f63d1 Author: Leif Hedstrom <zw...@apache.org> AuthorDate: Fri Sep 29 14:52:52 2023 -0600 Upgrades to use LLVM 17 clang-format (#10546) --- .clang-format | 19 +++++++++++---- include/api/InkAPIInternal.h | 6 ++++- include/tscore/AtomicBit.h | 6 ++++- include/tscore/Ptr.h | 6 ++++- include/tscore/ink_hrtime.h | 18 +++++++------- include/tscore/ink_queue.h | 4 ++-- include/tscore/ink_resolver.h | 2 +- include/tscpp/api/Continuation.h | 6 ++++- iocore/cache/Cache.cc | 4 ++-- iocore/cache/CacheRead.cc | 4 ++-- iocore/cache/CacheWrite.cc | 2 +- iocore/dns/P_DNSProcessor.h | 2 +- iocore/eventsystem/I_EventProcessor.h | 2 +- iocore/net/quic/QUICTransportParameters.h | 6 ++++- iocore/net/quic/QUICTypes.h | 12 ++++++++-- plugins/experimental/fastcgi/src/ats_fcgi_client.h | 2 +- plugins/experimental/inliner/fetcher.h | 2 +- plugins/multiplexer/fetcher.h | 2 +- src/tscore/unit_tests/test_Extendible.cc | 28 ++++------------------ tools/clang-format.sh | 6 ++--- tools/jtest/jtest.cc | 2 +- 21 files changed, 80 insertions(+), 61 deletions(-) diff --git a/.clang-format b/.clang-format index d6431535bf..e7f07e8db6 100644 --- a/.clang-format +++ b/.clang-format @@ -27,6 +27,11 @@ AlignConsecutiveMacros: AcrossComments: false AlignCompound: false PadOperators: true +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseColons: false AlignEscapedNewlines: Left AlignOperands: Align AlignTrailingComments: @@ -139,6 +144,7 @@ IntegerLiteralSeparator: JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: false +KeepEmptyLinesAtEOF: false LambdaBodyIndentation: Signature LineEnding: DeriveLF MacroBlockBegin: '' @@ -167,6 +173,7 @@ QualifierAlignment: Leave ReferenceAlignment: Pointer ReflowComments: true RemoveBracesLLVM: false +RemoveParentheses: Leave RemoveSemicolon: false RequiresClausePosition: OwnLine RequiresExpressionIndentation: OuterScope @@ -184,6 +191,7 @@ SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false SpaceBeforeParens: ControlStatements SpaceBeforeParensOptions: AfterControlStatements: true @@ -198,16 +206,18 @@ SpaceBeforeParensOptions: SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: Never -SpacesInConditionalStatement: false SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false SpacesInLineCommentPrefix: Minimum: 1 Maximum: -1 -SpacesInParentheses: false +SpacesInParens: Never +SpacesInParensOptions: + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false Standard: Latest StatementAttributeLikeMacros: @@ -217,6 +227,7 @@ StatementMacros: - QT_REQUIRE_VERSION TabWidth: 8 UseTab: Never +VerilogBreakBetweenInstancePorts: true WhitespaceSensitiveMacros: - STRINGIZE - PP_STRINGIZE diff --git a/include/api/InkAPIInternal.h b/include/api/InkAPIInternal.h index ed9452b5c4..6b47bd8d13 100644 --- a/include/api/InkAPIInternal.h +++ b/include/api/InkAPIInternal.h @@ -279,7 +279,11 @@ class TSSslHookInternalID public: explicit constexpr TSSslHookInternalID(TSHttpHookID id) : _id(id - TS_SSL_FIRST_HOOK) {} - constexpr operator int() const { return _id; } + constexpr + operator int() const + { + return _id; + } static const int NUM = TS_SSL_LAST_HOOK - TS_SSL_FIRST_HOOK + 1; diff --git a/include/tscore/AtomicBit.h b/include/tscore/AtomicBit.h index 5744d77951..e76fdd9fc3 100644 --- a/include/tscore/AtomicBit.h +++ b/include/tscore/AtomicBit.h @@ -64,7 +64,11 @@ public: } // allow cast to bool - explicit operator bool() const { return (*_byte_ptr) & _mask; } + explicit + operator bool() const + { + return (*_byte_ptr) & _mask; + } // allows compare with bool bool diff --git a/include/tscore/Ptr.h b/include/tscore/Ptr.h index 97f8d72f8d..43ae72199d 100644 --- a/include/tscore/Ptr.h +++ b/include/tscore/Ptr.h @@ -111,7 +111,11 @@ public: } // Making this explicit avoids unwanted conversions. See https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Safe_bool . - explicit operator bool() const { return m_ptr != nullptr; } + explicit + operator bool() const + { + return m_ptr != nullptr; + } bool operator==(const T *p) diff --git a/include/tscore/ink_hrtime.h b/include/tscore/ink_hrtime.h index 9326b15202..c5b058f254 100644 --- a/include/tscore/ink_hrtime.h +++ b/include/tscore/ink_hrtime.h @@ -71,15 +71,15 @@ char *int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int * // simple macros -#define HRTIME_YEARS(_x) ((_x)*HRTIME_YEAR) -#define HRTIME_WEEKS(_x) ((_x)*HRTIME_WEEK) -#define HRTIME_DAYS(_x) ((_x)*HRTIME_DAY) -#define HRTIME_HOURS(_x) ((_x)*HRTIME_HOUR) -#define HRTIME_MINUTES(_x) ((_x)*HRTIME_MINUTE) -#define HRTIME_SECONDS(_x) ((_x)*HRTIME_SECOND) -#define HRTIME_MSECONDS(_x) ((_x)*HRTIME_MSECOND) -#define HRTIME_USECONDS(_x) ((_x)*HRTIME_USECOND) -#define HRTIME_NSECONDS(_x) ((_x)*HRTIME_NSECOND) +#define HRTIME_YEARS(_x) ((_x) * HRTIME_YEAR) +#define HRTIME_WEEKS(_x) ((_x) * HRTIME_WEEK) +#define HRTIME_DAYS(_x) ((_x) * HRTIME_DAY) +#define HRTIME_HOURS(_x) ((_x) * HRTIME_HOUR) +#define HRTIME_MINUTES(_x) ((_x) * HRTIME_MINUTE) +#define HRTIME_SECONDS(_x) ((_x) * HRTIME_SECOND) +#define HRTIME_MSECONDS(_x) ((_x) * HRTIME_MSECOND) +#define HRTIME_USECONDS(_x) ((_x) * HRTIME_USECOND) +#define HRTIME_NSECONDS(_x) ((_x) * HRTIME_NSECOND) // gratuitous wrappers diff --git a/include/tscore/ink_queue.h b/include/tscore/ink_queue.h index 9875ab3e6c..647b0a1d5c 100644 --- a/include/tscore/ink_queue.h +++ b/include/tscore/ink_queue.h @@ -158,7 +158,7 @@ union head_p { #endif #define FREELIST_VERSION(_x) ((((intptr_t)(_x).data) & 0x7FFF000000000000LL) >> 48) -#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = ((((intptr_t)(_p)) & 0x8000FFFFFFFFFFFFLL) | (((_v)&0x7FFFLL) << 48)) +#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = ((((intptr_t)(_p)) & 0x8000FFFFFFFFFFFFLL) | (((_v) & 0x7FFFLL) << 48)) #elif defined(__aarch64__) /* Layout of FREELIST_POINTER * @@ -177,7 +177,7 @@ union head_p { #endif #define FREELIST_VERSION(_x) ((((intptr_t)(_x).data) & 0x7FF0000000000000LL) >> 52) -#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = ((((intptr_t)(_p)) & 0x800FFFFFFFFFFFFFLL) | (((_v)&0x7FFLL) << 52)) +#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = ((((intptr_t)(_p)) & 0x800FFFFFFFFFFFFFLL) | (((_v) & 0x7FFLL) << 52)) #else #error "unsupported processor" #endif diff --git a/include/tscore/ink_resolver.h b/include/tscore/ink_resolver.h index e0ff536575..8430a9c81b 100644 --- a/include/tscore/ink_resolver.h +++ b/include/tscore/ink_resolver.h @@ -263,7 +263,7 @@ struct ts_imp_res_state { #ifdef sun unsigned pfcode; /*%< RES_PRF_ flags - see below. */ #else - u_long pfcode; /*%< RES_PRF_ flags - see below. */ + u_long pfcode; /*%< RES_PRF_ flags - see below. */ #endif unsigned ndots : 4; /*%< threshold for initial abs. query */ unsigned nsort : 4; /*%< number of elements in sort_list[] */ diff --git a/include/tscpp/api/Continuation.h b/include/tscpp/api/Continuation.h index 259bc67ebd..64480ff6f4 100644 --- a/include/tscpp/api/Continuation.h +++ b/include/tscpp/api/Continuation.h @@ -100,7 +100,11 @@ public: return *this; } - explicit operator bool() const { return _cont != nullptr; } + explicit + operator bool() const + { + return _cont != nullptr; + } int call(TSEvent event, void *edata = nullptr) diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index 508fe1415c..4099e0ea6d 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -1619,7 +1619,7 @@ Vol::handle_recover_from_data(int event, void * /* data ATS_UNUSED */) ink_assert(ink_aio_read(&io)); return EVENT_CONT; -Ldone : { +Ldone: { /* if we come back to the starting position, then we don't have to recover anything */ if (recover_pos == header->write_pos && recover_wrapped) { SET_HANDLER(&Vol::handle_recover_write_dir); @@ -2354,7 +2354,7 @@ CacheVC::handleRead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) return EVENT_CONT; -LramHit : { +LramHit: { f.doc_from_ram_cache = true; io.aio_result = io.aiocb.aio_nbytes; Doc *doc = reinterpret_cast<Doc *>(buf->data()); diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc index e10b2c0c9c..2201ecb39e 100644 --- a/iocore/cache/CacheRead.cc +++ b/iocore/cache/CacheRead.cc @@ -639,7 +639,7 @@ CacheVC::openReadReadDone(int event, Event *e) } } // fall through for truncated documents - Lerror : { + Lerror: { // Keep the lock on vol->mutex, for dir_delete. char tmpstring[CRYPTO_HEX_SIZE]; if (request.valid()) { @@ -819,7 +819,7 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } return EVENT_CONT; } -Lread : { +Lread: { if (vio.ndone >= static_cast<int64_t>(doc_len)) { // reached the end of the document and the user still wants more return calluser(VC_EVENT_EOS); diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc index eeb96cfcc8..24d6104cf6 100644 --- a/iocore/cache/CacheWrite.cc +++ b/iocore/cache/CacheWrite.cc @@ -1539,7 +1539,7 @@ CacheVC::openWriteOverwrite(int event, Event *e) first_buf = buf; goto Ldone; } -Lcollision : { +Lcollision: { CACHE_TRY_LOCK(lock, vol->mutex, this_ethread()); if (!lock.is_locked()) { VC_LOCK_RETRY_EVENT(); diff --git a/iocore/dns/P_DNSProcessor.h b/iocore/dns/P_DNSProcessor.h index 25e10cb05a..3ffca802db 100644 --- a/iocore/dns/P_DNSProcessor.h +++ b/iocore/dns/P_DNSProcessor.h @@ -247,7 +247,7 @@ struct DNSHandler : public Continuation { bool query_id_in_use(uint16_t qid) { - return (qid_in_flight[(uint16_t)(qid) >> 6] & (uint64_t)(0x1ULL << ((uint16_t)(qid)&0x3F))) != 0; + return (qid_in_flight[(uint16_t)(qid) >> 6] & (uint64_t)(0x1ULL << ((uint16_t)(qid) & 0x3F))) != 0; }; DNSHandler(); diff --git a/iocore/eventsystem/I_EventProcessor.h b/iocore/eventsystem/I_EventProcessor.h index e7b019711b..4df0ba9c10 100644 --- a/iocore/eventsystem/I_EventProcessor.h +++ b/iocore/eventsystem/I_EventProcessor.h @@ -38,7 +38,7 @@ constexpr int MAX_THREADS_IN_EACH_TYPE = 3071; #ifdef TS_MAX_NUMBER_EVENT_THREADS constexpr int MAX_EVENT_THREADS = TS_MAX_NUMBER_EVENT_THREADS; #else -constexpr int MAX_EVENT_THREADS = 4096; +constexpr int MAX_EVENT_THREADS = 4096; #endif class EThread; diff --git a/iocore/net/quic/QUICTransportParameters.h b/iocore/net/quic/QUICTransportParameters.h index 4e4cae43fe..5493778032 100644 --- a/iocore/net/quic/QUICTransportParameters.h +++ b/iocore/net/quic/QUICTransportParameters.h @@ -53,7 +53,11 @@ public: RETRY_SOURCE_CONNECTION_ID, }; - explicit operator bool() const { return true; } + explicit + operator bool() const + { + return true; + } bool operator==(const QUICTransportParameterId &x) const { diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h index b4c06d4c3b..bf71908236 100644 --- a/iocore/net/quic/QUICTypes.h +++ b/iocore/net/quic/QUICTypes.h @@ -238,7 +238,11 @@ public: QUICConnectionId(); QUICConnectionId(const uint8_t *buf, uint8_t len); - explicit operator bool() const { return true; } + explicit + operator bool() const + { + return true; + } /** * Note that this returns a kind of hash code so we can use a ConnectionId as a key for a hashtable. */ @@ -513,7 +517,11 @@ class QUICPathValidationData public: QUICPathValidationData(const uint8_t *data) { memcpy(this->_data, data, sizeof(this->_data)); } - inline operator const uint8_t *() const { return this->_data; } + inline + operator const uint8_t *() const + { + return this->_data; + } private: uint8_t _data[8]; diff --git a/plugins/experimental/fastcgi/src/ats_fcgi_client.h b/plugins/experimental/fastcgi/src/ats_fcgi_client.h index ff45506027..d1a328b6ba 100644 --- a/plugins/experimental/fastcgi/src/ats_fcgi_client.h +++ b/plugins/experimental/fastcgi/src/ats_fcgi_client.h @@ -30,7 +30,7 @@ /* Bytes from LSB to MSB 0..3 */ -#define BYTE_0(x) ((x)&0xff) +#define BYTE_0(x) ((x) & 0xff) #define BYTE_1(x) ((x) >> 8 & 0xff) #define BYTE_2(x) ((x) >> 16 & 0xff) #define BYTE_3(x) ((x) >> 24 | 0x80) diff --git a/plugins/experimental/inliner/fetcher.h b/plugins/experimental/inliner/fetcher.h index d5ef0349e5..c241d6abe7 100644 --- a/plugins/experimental/inliner/fetcher.h +++ b/plugins/experimental/inliner/fetcher.h @@ -220,7 +220,7 @@ template <class T> struct HttpTransaction { case TS_EVENT_VCONN_READ_READY: Dbg(dbg_ctl, "HttpTransaction: Read"); - here : { + here: { assert(self->in_ != nullptr); assert(self->in_->reader != nullptr); assert(self->in_->vio != nullptr); diff --git a/plugins/multiplexer/fetcher.h b/plugins/multiplexer/fetcher.h index 626468ee52..48782b614b 100644 --- a/plugins/multiplexer/fetcher.h +++ b/plugins/multiplexer/fetcher.h @@ -201,7 +201,7 @@ template <class T> struct HttpTransaction { case TS_EVENT_VCONN_READ_READY: Dbg(dbg_ctl, "HttpTransaction: Read"); - here : { + here: { assert(self->in_ != NULL); assert(self->in_->reader != NULL); assert(self->in_->vio != NULL); diff --git a/src/tscore/unit_tests/test_Extendible.cc b/src/tscore/unit_tests/test_Extendible.cc index 01af903a0b..79ac4f157a 100644 --- a/src/tscore/unit_tests/test_Extendible.cc +++ b/src/tscore/unit_tests/test_Extendible.cc @@ -94,18 +94,8 @@ public: uint16_t c = {3}; // operator[] - template <typename F> - decltype(auto) - operator[](F field) const - { - return ext::get(*this, field); - } - template <typename F> - decltype(auto) - operator[](F field) - { - return ext::set(*this, field); - } + template <typename F> decltype(auto) operator[](F field) const { return ext::get(*this, field); } + template <typename F> decltype(auto) operator[](F field) { return ext::set(*this, field); } }; ext::FieldId<C, std::atomic<uint16_t>> ext_c_1; @@ -228,18 +218,8 @@ struct Derived : Extendible<Derived> { string m_str; // operator[] for shorthand - template <typename F> - decltype(auto) - operator[](F field) const - { - return ext::get(*this, field); - } - template <typename F> - decltype(auto) - operator[](F field) - { - return ext::set(*this, field); - } + template <typename F> decltype(auto) operator[](F field) const { return ext::get(*this, field); } + template <typename F> decltype(auto) operator[](F field) { return ext::set(*this, field); } static const string testFormat() diff --git a/tools/clang-format.sh b/tools/clang-format.sh index dbfbc8c844..e07816777d 100755 --- a/tools/clang-format.sh +++ b/tools/clang-format.sh @@ -19,7 +19,7 @@ # limitations under the License. # Update the PKGDATE with the new version date when making a new clang-format binary package. -PKGDATE="20230424" +PKGDATE="20230928" function main() { set -e # exit on error @@ -38,7 +38,7 @@ function main() { fi DIR=${@:-.} PACKAGE="clang-format-${PKGDATE}.tar.bz2" - VERSION="clang-format version 16.0.2 (https://github.com/llvm/llvm-project.git 18ddebe1a1a9bde349441631365f0472e9693520)" + VERSION="clang-format version 17.0.1 (https://github.com/llvm/llvm-project.git e19b7dc36bc047b9eb72078d034596be766da350)" URL=${URL:-https://ci.trafficserver.apache.org/bintray/${PACKAGE}} @@ -73,7 +73,7 @@ function main() { ${CURL} -L --progress-bar -o ${ARCHIVE} ${URL} ${TAR} -x -C ${ROOT} -f ${ARCHIVE} cat > ${ROOT}/sha256 << EOF -e6530f9f4ddc61d8de9b6f980ec01656a2c998a83bb9b29323c04ba2232e8f25 ${ARCHIVE} +deb056a30ad968c5b7c8768ffecb382408ad2669dd61f2cc126d267069f0c197 ${ARCHIVE} EOF ${SHASUM} -c ${ROOT}/sha256 chmod +x ${FORMAT} diff --git a/tools/jtest/jtest.cc b/tools/jtest/jtest.cc index 4748aafc41..6bf73e8d87 100644 --- a/tools/jtest/jtest.cc +++ b/tools/jtest/jtest.cc @@ -2081,7 +2081,7 @@ find_href_start(const char *tag, char *base, int len) char *start = base; char *end = base + len; -Lagain : { +Lagain: { start = strncasestr(start, tag, len); if ((start == nullptr) || (end - start < 6)) { return nullptr;