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

Refactor nested if causing error C1061 on MSVC. #6101

Merged
merged 3 commits into from
Mar 16, 2024

Conversation

dranger003
Copy link
Contributor

This PR refactors the nested if-else using switch-case to resolve error C1061 using MSVC.
Note: there is also a temporary workaround provided by Deacon8 here #6096

Fixes #6093

}

return hash;
}
Copy link
Owner

Choose a reason for hiding this comment

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

This is C++14 - we support just C++11 (https://stackoverflow.com/questions/45097171/the-body-of-constexpr-function-not-a-return-statement)

Probably, just remove the elses from the if-else chain - this is not performance critical code

@ggerganov ggerganov merged commit 15961ec into ggerganov:master Mar 16, 2024
50 of 60 checks passed
@@ -151,13 +151,17 @@ bool gpt_params_parse_ex(int argc, char ** argv, gpt_params & params) {
std::replace(arg.begin(), arg.end(), '_', '-');
}

bool arg_found = false;
Copy link
Owner

Choose a reason for hiding this comment

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

Btw, to avoid this arg_found everywhere, we should move this if-chain in a bool function and return early on success

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll submit another PR.

@dranger003 dranger003 deleted the fix-c1061 branch March 21, 2024 15:13
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
* Refactor nested if causing error C1061 on MSVC.

* Revert back and remove else's.

* Add flag to track found arguments.
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 3, 2024
* Refactor nested if causing error C1061 on MSVC.

* Revert back and remove else's.

* Add flag to track found arguments.
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.

Compilation fails with Cmake on Windows (since #5970): error C1061
2 participants