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

Warning message when build protobuf lite #4628

Open
yejw5 opened this issue May 15, 2018 · 9 comments
Open

Warning message when build protobuf lite #4628

yejw5 opened this issue May 15, 2018 · 9 comments
Assignees
Labels
c++ cleanup enhancement inactive Denotes the issue/PR has not seen activity in the last 90 days. P3

Comments

@yejw5
Copy link
Contributor

yejw5 commented May 15, 2018

Version: Ubuntu 16.0.4, bazel 0.12.0, protobuf v3.4.0/v3.5.1

When add protobuf lite C++ as deps of my project and build with bazel tools, there are some -Wunused-parameter warnings. We hope to build our project with --copt=-Werror, these warnings will report as errors and terminate building process. Is there any plan to fix this situation?

The total warning log as follows:

INFO: From Compiling external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:325:37: warning: unused parameter 'cached_s
ize' [-Wunused-parameter]
                               int32 cached_size, ArrayOutput* output) {
                                     ^
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:690:73: warning: unused parameter 'tag' [-W
unused-parameter]
 void UnknownFieldSerializerLite(const uint8* ptr, uint32 offset, uint32 tag,
                                                                         ^
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:691:40: warning: unused parameter 'has_offs
et' [-Wunused-parameter]
                                 uint32 has_offset,
                                        ^
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc: In instantiation of 'static void google::p
rotobuf::internal::PackedFieldHelper<9>::Serialize(const void*, const google::protobuf::internal::FieldMetadata&, O*) 
[with O = google::protobuf::io::CodedOutputStream]':
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:610:7:   required from here
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:508:37: warning: unused parameter 'field' [
-Wunused-parameter]
   static void Serialize(const void* field, const FieldMetadata& md, O* output) {
                                     ^
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:508:72: warning: unused parameter 'output' 
[-Wunused-parameter]
   static void Serialize(const void* field, const FieldMetadata& md, O* output) {
                                                                        ^
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc: In instantiation of 'static void google::p
rotobuf::internal::PackedFieldHelper<9>::Serialize(const void*, const google::protobuf::internal::FieldMetadata&, O*) 
[with O = google::protobuf::internal::ArrayOutput]':
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:653:7:   required from here
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:508:37: warning: unused parameter 'field' [
-Wunused-parameter]
   static void Serialize(const void* field, const FieldMetadata& md, O* output) {
                                     ^
external/com_google_protobuf/src/google/protobuf/generated_message_util.cc:508:72: warning: unused parameter 'output' 
[-Wunused-parameter]
   static void Serialize(const void* field, const FieldMetadata& md, O* output) {
@TeBoring TeBoring added this to To Do in Weekly Fixit via automation May 21, 2018
@acozzette
Copy link
Member

I would recommend avoiding using -Werror and strict warnings for protobuf generated code. Since it's machine-generated code, it often has an un-idiomatic style and it would require extra complexity to try to make the code generator smart enough to avoid all warnings.

@hlopko
Copy link
Contributor

hlopko commented Mar 7, 2019

Hello all,

we discussed this internally in the context of this Bazel pull request and we reached the conclusion that protoc should to the best of its efforts not produce warning-triggering code. I expect that protobuf team will reopen this issue (or reference a new tracking issue for this effort) soon.

Thank you!

@yejw5
Copy link
Contributor Author

yejw5 commented Mar 13, 2019

@hlopko @acozzette Many thanks!

@logankaser
Copy link

Any updates?, these warnings are make it very hard to see the warnings in my local code by producing so many errors.

@keith
Copy link
Contributor

keith commented May 18, 2019

These warnings are fixed, and warnings as errors are enabled on CI now. The current RC release should show no warnings.

@logankaser
Copy link

logankaser commented May 18, 2019

I'm getting warnings from:

const char* begin, ParseContext* ctx, MapEntryAccessorType* value) { \

(ctx is unused)
and
PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) {

(value is unused)
Maybe this is a seperate issue?

edit:
RC release..., my mistake I was building off master because I was cross compiling to WASM
and thus had to make my own release.
Those warnings will probably not make it past CI then. (I assume this means CI is only run on releases not on pulls into master)

@keith
Copy link
Contributor

keith commented May 20, 2019

Here's the CI command being run

git submodule update --init --recursive
bazel test :protobuf_test --copt=-Werror --host_copt=-Werror
so it depends if you can reproduce it building this specific target. If not maybe we should add these flags elsewhere too

@BSBandme
Copy link
Contributor

Deprioritize to p3 as this may not happen in the near future.

Copy link

github-actions bot commented Jun 2, 2024

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ cleanup enhancement inactive Denotes the issue/PR has not seen activity in the last 90 days. P3
Projects
No open projects
Weekly Fixit
  
Done
Development

No branches or pull requests

7 participants