diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2024-06-25 17:31:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-25 17:31:41 +0200 |
commit | 731db06a878f5c8cb29b36d526a54493677ea89f (patch) | |
tree | 2ca6937e35c8152251adf45b50402b40e899ebad /libcxx/src/filesystem | |
parent | 902952ae04afc2dfe28805b949a1e2218affe65e (diff) | |
download | llvm-731db06a878f5c8cb29b36d526a54493677ea89f.zip llvm-731db06a878f5c8cb29b36d526a54493677ea89f.tar.gz llvm-731db06a878f5c8cb29b36d526a54493677ea89f.tar.bz2 |
[libc++] Get the GCC build mostly clean of warnings (#96604)
The GCC build has gotten to the point where it's often hard to find the
actual error in the build log. We should look into enabling these
warnings again in the future, but it looks like a lot of them are
bogous.
Diffstat (limited to 'libcxx/src/filesystem')
-rw-r--r-- | libcxx/src/filesystem/operations.cpp | 4 | ||||
-rw-r--r-- | libcxx/src/filesystem/path.cpp | 28 | ||||
-rw-r--r-- | libcxx/src/filesystem/path_parser.h | 28 |
3 files changed, 30 insertions, 30 deletions
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp index abd8695..a83c1ae 100644 --- a/libcxx/src/filesystem/operations.cpp +++ b/libcxx/src/filesystem/operations.cpp @@ -934,7 +934,7 @@ path __weakly_canonical(const path& p, error_code* ec) { vector<string_view_t> DNEParts; error_code m_ec; - while (PP.State != PathParser::PS_BeforeBegin) { + while (PP.State_ != PathParser::PS_BeforeBegin) { tmp.assign(createView(p.native().data(), &PP.RawEntry.back())); file_status st = __status(tmp, &m_ec); if (!status_known(st)) { @@ -949,7 +949,7 @@ path __weakly_canonical(const path& p, error_code* ec) { DNEParts.push_back(*PP); --PP; } - if (PP.State == PathParser::PS_BeforeBegin) { + if (PP.State_ == PathParser::PS_BeforeBegin) { result = __canonical("", &m_ec); if (m_ec) { return err.report(m_ec); diff --git a/libcxx/src/filesystem/path.cpp b/libcxx/src/filesystem/path.cpp index c89346a..b201952 100644 --- a/libcxx/src/filesystem/path.cpp +++ b/libcxx/src/filesystem/path.cpp @@ -45,23 +45,23 @@ path& path::replace_extension(path const& replacement) { string_view_t path::__root_name() const { auto PP = PathParser::CreateBegin(__pn_); - if (PP.State == PathParser::PS_InRootName) + if (PP.State_ == PathParser::PS_InRootName) return *PP; return {}; } string_view_t path::__root_directory() const { auto PP = PathParser::CreateBegin(__pn_); - if (PP.State == PathParser::PS_InRootName) + if (PP.State_ == PathParser::PS_InRootName) ++PP; - if (PP.State == PathParser::PS_InRootDir) + if (PP.State_ == PathParser::PS_InRootDir) return *PP; return {}; } string_view_t path::__root_path_raw() const { auto PP = PathParser::CreateBegin(__pn_); - if (PP.State == PathParser::PS_InRootName) { + if (PP.State_ == PathParser::PS_InRootName) { auto NextCh = PP.peek(); if (NextCh && isSeparator(*NextCh)) { ++PP; @@ -69,24 +69,24 @@ string_view_t path::__root_path_raw() const { } return PP.RawEntry; } - if (PP.State == PathParser::PS_InRootDir) + if (PP.State_ == PathParser::PS_InRootDir) return *PP; return {}; } static bool ConsumeRootName(PathParser* PP) { static_assert(PathParser::PS_BeforeBegin == 1 && PathParser::PS_InRootName == 2, "Values for enums are incorrect"); - while (PP->State <= PathParser::PS_InRootName) + while (PP->State_ <= PathParser::PS_InRootName) ++(*PP); - return PP->State == PathParser::PS_AtEnd; + return PP->State_ == PathParser::PS_AtEnd; } static bool ConsumeRootDir(PathParser* PP) { static_assert(PathParser::PS_BeforeBegin == 1 && PathParser::PS_InRootName == 2 && PathParser::PS_InRootDir == 3, "Values for enums are incorrect"); - while (PP->State <= PathParser::PS_InRootDir) + while (PP->State_ <= PathParser::PS_InRootDir) ++(*PP); - return PP->State == PathParser::PS_AtEnd; + return PP->State_ == PathParser::PS_AtEnd; } string_view_t path::__relative_path() const { @@ -248,7 +248,7 @@ path path::lexically_relative(const path& base) const { auto PP = PathParser::CreateBegin(__pn_); auto PPBase = PathParser::CreateBegin(base.__pn_); auto CheckIterMismatchAtBase = [&]() { - return PP.State != PPBase.State && (PP.inRootPath() || PPBase.inRootPath()); + return PP.State_ != PPBase.State_ && (PP.inRootPath() || PPBase.inRootPath()); }; if (PP.inRootName() && PPBase.inRootName()) { if (*PP != *PPBase) @@ -267,7 +267,7 @@ path path::lexically_relative(const path& base) const { // Find the first mismatching element auto PP = PathParser::CreateBegin(__pn_); auto PPBase = PathParser::CreateBegin(base.__pn_); - while (PP && PPBase && PP.State == PPBase.State && *PP == *PPBase) { + while (PP && PPBase && PP.State_ == PPBase.State_ && *PP == *PPBase) { ++PP; ++PPBase; } @@ -380,7 +380,7 @@ path::iterator path::begin() const { auto PP = PathParser::CreateBegin(__pn_); iterator it; it.__path_ptr_ = this; - it.__state_ = static_cast<path::iterator::_ParserState>(PP.State); + it.__state_ = static_cast<path::iterator::_ParserState>(PP.State_); it.__entry_ = PP.RawEntry; it.__stashed_elem_.__assign_view(*PP); return it; @@ -396,7 +396,7 @@ path::iterator path::end() const { path::iterator& path::iterator::__increment() { PathParser PP(__path_ptr_->native(), __entry_, __state_); ++PP; - __state_ = static_cast<_ParserState>(PP.State); + __state_ = static_cast<_ParserState>(PP.State_); __entry_ = PP.RawEntry; __stashed_elem_.__assign_view(*PP); return *this; @@ -405,7 +405,7 @@ path::iterator& path::iterator::__increment() { path::iterator& path::iterator::__decrement() { PathParser PP(__path_ptr_->native(), __entry_, __state_); --PP; - __state_ = static_cast<_ParserState>(PP.State); + __state_ = static_cast<_ParserState>(PP.State_); __entry_ = PP.RawEntry; __stashed_elem_.__assign_view(*PP); return *this; diff --git a/libcxx/src/filesystem/path_parser.h b/libcxx/src/filesystem/path_parser.h index 28a8f24..0662369 100644 --- a/libcxx/src/filesystem/path_parser.h +++ b/libcxx/src/filesystem/path_parser.h @@ -50,14 +50,14 @@ struct PathParser { const string_view_t Path; string_view_t RawEntry; - ParserState State; + ParserState State_; private: - PathParser(string_view_t P, ParserState State) noexcept : Path(P), State(State) {} + PathParser(string_view_t P, ParserState State) noexcept : Path(P), State_(State) {} public: PathParser(string_view_t P, string_view_t E, unsigned char S) - : Path(P), RawEntry(E), State(static_cast<ParserState>(S)) { + : Path(P), RawEntry(E), State_(static_cast<ParserState>(S)) { // S cannot be '0' or PS_BeforeBegin. } @@ -84,7 +84,7 @@ public: if (Start == End) return makeState(PS_AtEnd); - switch (State) { + switch (State_) { case PS_BeforeBegin: { PosPtr TkEnd = consumeRootName(Start, End); if (TkEnd) @@ -125,7 +125,7 @@ public: if (RStart == REnd) // we're decrementing the begin return makeState(PS_BeforeBegin); - switch (State) { + switch (State_) { case PS_AtEnd: { // Try to consume a trailing separator or root directory first. if (PosPtr SepEnd = consumeAllSeparators(RStart, REnd)) { @@ -169,7 +169,7 @@ public: /// \brief Return a view with the "preferred representation" of the current /// element. For example trailing separators are represented as a '.' string_view_t operator*() const noexcept { - switch (State) { + switch (State_) { case PS_BeforeBegin: case PS_AtEnd: return PATHSTR(""); @@ -187,7 +187,7 @@ public: __libcpp_unreachable(); } - explicit operator bool() const noexcept { return State != PS_BeforeBegin && State != PS_AtEnd; } + explicit operator bool() const noexcept { return State_ != PS_BeforeBegin && State_ != PS_AtEnd; } PathParser& operator++() noexcept { increment(); @@ -199,21 +199,21 @@ public: return *this; } - bool atEnd() const noexcept { return State == PS_AtEnd; } + bool atEnd() const noexcept { return State_ == PS_AtEnd; } - bool inRootDir() const noexcept { return State == PS_InRootDir; } + bool inRootDir() const noexcept { return State_ == PS_InRootDir; } - bool inRootName() const noexcept { return State == PS_InRootName; } + bool inRootName() const noexcept { return State_ == PS_InRootName; } bool inRootPath() const noexcept { return inRootName() || inRootDir(); } private: void makeState(ParserState NewState, PosPtr Start, PosPtr End) noexcept { - State = NewState; + State_ = NewState; RawEntry = string_view_t(Start, End - Start); } void makeState(ParserState NewState) noexcept { - State = NewState; + State_ = NewState; RawEntry = {}; } @@ -224,7 +224,7 @@ private: /// \brief Return a pointer to the first character after the currently /// lexed element. PosPtr getNextTokenStartPos() const noexcept { - switch (State) { + switch (State_) { case PS_BeforeBegin: return Path.data(); case PS_InRootName: @@ -241,7 +241,7 @@ private: /// \brief Return a pointer to the first character in the currently lexed /// element. PosPtr getCurrentTokenStartPos() const noexcept { - switch (State) { + switch (State_) { case PS_BeforeBegin: case PS_InRootName: return &Path.front(); |