CLD2Owners/cld2

utf8statetable.cc contains a bunch of unused functions

Opened this issue · 4 comments

Originally reported on Google Code with ID 38

What steps will reproduce the problem?
1. Compile cld2 with clang's -Wunused-function

What is the expected output? What do you see instead?

Expected: No warnings. Instead, warnings.


This patch fixes it:

diff --git a/internal/utf8statetable.cc b/internal/utf8statetable.cc
index aa9a98e..bd1e161 100644
--- a/internal/utf8statetable.cc
+++ b/internal/utf8statetable.cc
@@ -173,34 +173,6 @@ static inline bool InStateZero_2(const UTF8ReplaceObj_2* st,
   return (static_cast<uint32>(Tbl - Tbl0) < st->state0_size);
 }

-// UTF8PropObj, UTF8ScanObj, UTF8ReplaceObj are all typedefs of
-// UTF8MachineObj.
-
-static bool IsPropObj(const UTF8StateMachineObj& obj) {
-  return obj.fast_state == NULL
-      && obj.max_expand == 0;
-}
-
-static bool IsPropObj_2(const UTF8StateMachineObj_2& obj) {
-  return obj.fast_state == NULL
-      && obj.max_expand == 0;
-}
-
-static bool IsScanObj(const UTF8StateMachineObj& obj) {
-  return obj.fast_state != NULL
-      && obj.max_expand == 0;
-}
-
-static bool IsReplaceObj(const UTF8StateMachineObj& obj) {
-  // Normally, obj.fast_state != NULL, but the handwritten tables
-  // in utf8statetable_unittest don't handle fast_states.
-  return obj.max_expand > 0;
-}
-
-static bool IsReplaceObj_2(const UTF8StateMachineObj_2& obj) {
-  return obj.max_expand > 0;
-}
-
 // Look up property of one UTF-8 character and advance over it
 // Return 0 if input length is zero
 // Return 0 and advance one byte if input is ill-formed

Reported by thakis@chromium.org on 2015-07-26 03:27:39

Reported by thakis@chromium.org on 2015-07-26 03:28:57

  • Blocking: #505316
Jason, can you take a look at this?

Reported by andrewhayden@google.com on 2015-07-27 10:29:15

  • Status changed: Accepted

Thanks for the report -- will take a look and patch if necessary.