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

Fix -Wunused-parameter in java_names.h #8601

Merged
merged 2 commits into from May 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/google/protobuf/compiler/java/java_helpers.h
Expand Up @@ -155,6 +155,7 @@ std::string GetOneofStoredType(const FieldDescriptor* field);
// Whether we should generate multiple java files for messages.
inline bool MultipleJavaFiles(const FileDescriptor* descriptor,
bool immutable) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acozzette, these methods are either planned to be rewritten in the future, or correspond to some deprecated approach.

They are just too simple, and can be entirely removed in most cases.
If you suggest a better way to fixing this (i. e. removing these methods entirely), I can take a look onto it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@georgthegreat Thanks for the cleanup! I think this should work except that our internal version of MultipleJavaFiles does use both parameters, so for this particular one I think it would be better to leave the parameter name but add something like (void) immutable;

(void) immutable;
return descriptor->options().java_multiple_files();
}

Expand Down Expand Up @@ -244,15 +245,15 @@ bool IsDefaultValueJavaDefault(const FieldDescriptor* field);
bool IsByteStringWithCustomDefaultValue(const FieldDescriptor* field);

// Does this message class have descriptor and reflection methods?
inline bool HasDescriptorMethods(const Descriptor* descriptor,
inline bool HasDescriptorMethods(const Descriptor* /* descriptor */,
bool enforce_lite) {
return !enforce_lite;
}
inline bool HasDescriptorMethods(const EnumDescriptor* descriptor,
inline bool HasDescriptorMethods(const EnumDescriptor* /* descriptor */,
bool enforce_lite) {
return !enforce_lite;
}
inline bool HasDescriptorMethods(const FileDescriptor* descriptor,
inline bool HasDescriptorMethods(const FileDescriptor* /* descriptor */,
bool enforce_lite) {
return !enforce_lite;
}
Expand Down