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

Build error with -Werror=return-type #2357

Open
hhrsscc opened this issue Dec 27, 2024 · 1 comment
Open

Build error with -Werror=return-type #2357

hhrsscc opened this issue Dec 27, 2024 · 1 comment

Comments

@hhrsscc
Copy link

hhrsscc commented Dec 27, 2024

Got a build error with -Werror=return-type enabled

folly/folly/settings/Types.cpp: In function ‘std::string_view folly::settings::toString(folly::settings::SetErrorCode)’:
folly/folly/settings/Types.cpp:31:1: error: control reaches end of non-void function [-Werror=return-type]

@Anxueim
Copy link

Anxueim commented Jan 8, 2025

std::string_view folly::settings::toString(folly::settings::SetErrorCode error)
{
switch (error)
{
case SetErrorCode::kSuccess:
return "kSuccess";
case SetErrorCode::kError:
return "kError";
// add a program
}
// Default return (if program doesn't match)
return "Unknown Error";
}
Function of:  toString(folly::settings::SetErrorCode)  is expected to return a value of type  std::string_view . Therefore, we need to ensure that all execution paths within the function return a value

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

No branches or pull requests

2 participants