Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
georgthegreat opened this issue Apr 14, 2021 · 0 comments
Closed

Comments

@georgthegreat
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant