re2: use C++17 [[fallthrough]] instead of ABSL_FALLTHROUGH_INTENDED According to [1], Google code now depends on C++17, so we can use these directly. [1] https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md Change-Id: Ic475b79bc2153861d6ec2aebc0c55dbcf0c35908 Reviewed-on: https://code-review.googlesource.com/c/re2/+/63770 Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/re2/bitmap256.cc b/re2/bitmap256.cc index 4b9eee4..d3f8087 100644 --- a/re2/bitmap256.cc +++ b/re2/bitmap256.cc
@@ -6,7 +6,6 @@ #include <stdint.h> -#include "absl/base/attributes.h" #include "absl/log/absl_check.h" namespace re2 { @@ -27,15 +26,15 @@ case 1: if (words_[1] != 0) return (1 * 64) + FindLSBSet(words_[1]); - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; case 2: if (words_[2] != 0) return (2 * 64) + FindLSBSet(words_[2]); - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; case 3: if (words_[3] != 0) return (3 * 64) + FindLSBSet(words_[3]); - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; default: return -1; }
diff --git a/re2/dfa.cc b/re2/dfa.cc index 1619614..712a7b6 100644 --- a/re2/dfa.cc +++ b/re2/dfa.cc
@@ -34,7 +34,6 @@ #include <utility> #include <vector> -#include "absl/base/attributes.h" #include "absl/base/call_once.h" #include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" @@ -650,7 +649,7 @@ absl::FPrintF(stderr, " -> FullMatchState\n"); return FullMatchState; } - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; default: // Record iff id is the head of its list, which must // be the case if id-1 is the last of *its* list. :)
diff --git a/re2/parse.cc b/re2/parse.cc index 6f7a561..545b965 100644 --- a/re2/parse.cc +++ b/re2/parse.cc
@@ -24,7 +24,6 @@ #include <string> #include <vector> -#include "absl/base/attributes.h" #include "absl/base/macros.h" #include "absl/log/absl_log.h" #include "absl/strings/ascii.h" @@ -304,7 +303,7 @@ case EvenOddSkip: // even <-> odd but only applies to every other if ((r - f->lo) % 2) return r; - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; case EvenOdd: // even <-> odd if (r%2 == 0) return r + 1; @@ -313,7 +312,7 @@ case OddEvenSkip: // odd <-> even but only applies to every other if ((r - f->lo) % 2) return r; - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; case OddEven: // odd <-> even if (r%2 == 1) return r + 1; @@ -1525,7 +1524,7 @@ // Single non-zero octal digit is a backreference; not supported. if (s->empty() || (*s)[0] < '0' || (*s)[0] > '7') goto BadEscape; - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; case '0': // consume up to three octal digits; already have one. code = c - '0';
diff --git a/re2/prog.cc b/re2/prog.cc index 9f1cc00..c60d930 100644 --- a/re2/prog.cc +++ b/re2/prog.cc
@@ -15,7 +15,6 @@ #include <utility> #include <vector> -#include "absl/base/attributes.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/str_format.h" @@ -820,7 +819,7 @@ flat->back().set_opcode(kInstAltMatch); flat->back().set_out(static_cast<int>(flat->size())); flat->back().out1_ = static_cast<uint32_t>(flat->size())+1; - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; case kInstAlt: stk->push_back(ip->out1());
diff --git a/re2/walker-inl.h b/re2/walker-inl.h index 2283d6d..07c9aef 100644 --- a/re2/walker-inl.h +++ b/re2/walker-inl.h
@@ -192,7 +192,7 @@ s->child_args = &s->child_arg; else if (re->nsub_ > 1) s->child_args = new T[re->nsub_]; - ABSL_FALLTHROUGH_INTENDED; + [[fallthrough]]; } default: { if (re->nsub_ > 0) {