Skip to content

unused parameters in parsers#544

Closed
KostinPavel wants to merge 5 commits into
getml:mainfrom
KostinPavel:main
Closed

unused parameters in parsers#544
KostinPavel wants to merge 5 commits into
getml:mainfrom
KostinPavel:main

Conversation

@KostinPavel
Copy link
Copy Markdown
Contributor

unused parameters in parsers

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @KostinPavel, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on code hygiene by explicitly marking several function and lambda parameters as unused across various parser and validation components within the rfl library. This change primarily aims to eliminate compiler warnings related to unused variables, improving the build output clarity and indicating developer intent without altering the functional behavior of the code.

Highlights

  • Unused Lambda Parameter: The _result parameter within a lambda in rfl::OneOf::validate_impl has been explicitly marked as unused to suppress compiler warnings.
  • Unused Schema Parameters: The _definitions and _types parameters in rfl::parsing::FieldVariantParser::to_schema have been marked as unused, as they are not directly utilized within the function body.
  • Unused Parser Definitions: The _definitions parameters in rfl::parsing::Parser_bytestring::to_schema and rfl::parsing::Parser_vectorstring::to_schema have been explicitly marked as unused.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to address unused parameters in several parser files. The changes are mostly correct, marking unused parameters to avoid compiler warnings. However, I found a critical issue in FieldVariantParser.hpp where a parameter is marked as unused but is actually used, which will lead to a compilation error. Additionally, a default argument for another parameter was incorrectly removed. My review includes a suggestion to fix these issues.

Comment on lines +75 to 78
std::map<std::string, schema::Type>* /*_definitions*/,
std::vector<schema::Type> /*_types = {}*/) {
using VariantType = rfl::Variant<NamedTuple<FieldTypes>...>;
return Parser<R, W, VariantType, ProcessorsType>::to_schema(_definitions);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

There are a couple of issues with the changes to this function signature:

  1. The parameter _definitions is marked as unused by commenting out its name, but it is used on line 78. This will cause a compilation error.
  2. The default value for the _types parameter has been commented out. This changes the function's signature and can break existing calls that rely on the default argument.

To fix this, you should restore the name for _definitions and only comment out the name for _types, keeping its default value.

Suggested change
std::map<std::string, schema::Type>* /*_definitions*/,
std::vector<schema::Type> /*_types = {}*/) {
using VariantType = rfl::Variant<NamedTuple<FieldTypes>...>;
return Parser<R, W, VariantType, ProcessorsType>::to_schema(_definitions);
std::map<std::string, schema::Type>* _definitions,
std::vector<schema::Type> /*_types*/ = {}) {
using VariantType = rfl::Variant<NamedTuple<FieldTypes>...>;
return Parser<R, W, VariantType, ProcessorsType>::to_schema(_definitions);

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

Successfully merging this pull request may close these issues.

1 participant