Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 421 by h...@chromium.org: Wrong type used instead of string::size_type
http://code.google.com/p/protobuf/issues/detail?id=421

A recent version of Clang warns about two cases where int is used instead of string::size_type, resulting in comparisons with string::npos which can never be true:


/usr/local/google/work/chrome/src/third_party/protobuf/src/google/protobuf/descriptor.cc:2361:20: warning: comparison of constant 18446744073709551615 with expression of type 'int' is always false [-Wtautological-constant-out-of-range-compare]
  if (name_dot_pos == string::npos) {
      ~~~~~~~~~~~~ ^  ~~~~~~~~~~~~


/usr/local/google/work/chrome/src/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc:894:22: warning: comparison of constant 18446744073709551615 with expression of type 'int' is always false [-Wtautological-constant-out-of-range-compare]
      if (equals_pos == string::npos) {
          ~~~~~~~~~~ ^  ~~~~~~~~~~~~


The attached patch fixes this.

We treat these warnings as errors in Chromium, so this is currently blocking us from moving to the Clang version in question. (See http://crbug.com/151927)

Attachments:
        protobuf.patch  1.1 KB

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to