Skip to content

CmdLineParser: return enum from parseFromArgs() instead of using additional member#5698

Merged
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:cmd-ret
Nov 27, 2023
Merged

CmdLineParser: return enum from parseFromArgs() instead of using additional member#5698
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:cmd-ret

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

No description provided.

@firewave
Copy link
Copy Markdown
Collaborator Author

Requires #5676 to be merged first.

}

// add specialization so the enums can be compared without a cast
template<typename T, typename U>
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I had to add the general version because I cannot create a specialization for the template in the parent class.

Comment thread test/testcmdlineparser.cpp Outdated
}

template<>
bool assertEquals<CmdLineParser::Result, CmdLineParser::Result>(const char* const filename, const unsigned int linenr, const CmdLineParser::Result& expected, const CmdLineParser::Result& actual) const
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I added the specialization so I didn't have to introduce hundreds of static_cast into the asserts.

Copy link
Copy Markdown
Collaborator Author

@firewave firewave Nov 24, 2023

Choose a reason for hiding this comment

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

If we find a way to simply this specialization we can clean up other tests.

@firewave firewave force-pushed the cmd-ret branch 2 times, most recently from 866868a to 2b48af7 Compare November 25, 2023 20:13
@firewave firewave marked this pull request as ready for review November 25, 2023 20:13
@firewave firewave marked this pull request as draft November 25, 2023 21:13
@firewave firewave marked this pull request as ready for review November 26, 2023 13:41
@firewave firewave merged commit a937862 into cppcheck-opensource:main Nov 27, 2023
@firewave firewave deleted the cmd-ret branch November 27, 2023 11:06
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.

2 participants