Skip to content

Generated map<string, string> code might trigger unused parameter warning #8494

@georgthegreat

Description

@georgthegreat

What version of protobuf and what language are you using?
Version: master
Language: C++

What operating system (Linux, Windows, ...) and version? Linux, any will do

What runtime / compiler are you using (e.g., python version or gcc version)
clang or gcc, with -Wunused-parameter switch enabled

What did you do?
Steps to reproduce the behavior:

  1. Use map<string, string> field in a message
  2. Use syntax="proto2"; (default behavior)
  3. Don't use optimize_for="lite_runtime"; (default behavior)
  4. Get
error: unused parameter 'p' [-Werror,-Wunused-parameter] static void Check(ConstPtr p) { 

in utf8 key / value validation.

Anything else we should know about your project / environment

The issue is triggered by incorrect check. At the time key / value validation method is invoked if either key or value is string.
However, the Utf8CheckMode must be taken into account and check generation / invokation should be omitted.

The fix will result in a number of pull requests. I am goind to attach them all to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions