The Wayback Machine - https://web.archive.org/web/20211217072808/https://github.com/github/codeql/issues/3327
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

C++ false positive: return statement requested after a call to a [[noreturn]] function #3327

Open
lhmouse opened this issue Apr 23, 2020 · 1 comment

Comments

@lhmouse
Copy link

@lhmouse lhmouse commented Apr 23, 2020

Synopsis

See references below for code.

The macro ASTERIA_THROW() [2] expands to a call to ::rocket::sprintf_and_throw<::std::runtime_error>() [3], which is marked [[noreturn]], so the enclosing function cannot return from this path; a return statement is unnecessary.

References

  1. Original alert: https://lgtm.com/projects/g/lhmouse/asteria/snapshot/125fa22efeb5dd86142984195bc51adbddcd6c5e/files/asteria/src/library/json.cpp#xfc14c5368f329856:1
  2. ASTERIA_THROW: https://lgtm.com/projects/g/lhmouse/asteria/snapshot/125fa22efeb5dd86142984195bc51adbddcd6c5e/files/asteria/src/utilities.hpp?sort=name&dir=ASC&mode=heatmap#x3cb8f8cc1a4b1672:1
  3. ::rocket::sprintf_and_throw<::std::runtime_error>: https://lgtm.com/projects/g/lhmouse/asteria/snapshot/125fa22efeb5dd86142984195bc51adbddcd6c5e/files/asteria/rocket/throw.hpp?sort=name&dir=ASC&mode=heatmap#L16
@lhmouse lhmouse changed the title LGTM.com - false positive C++ false positive: return statement requested after a call to a [[noreturn]] function Apr 23, 2020
@rdmarsh2 rdmarsh2 added the C++ label Apr 24, 2020
@dbartol dbartol self-assigned this Apr 29, 2020
@dbartol
Copy link
Contributor

@dbartol dbartol commented Apr 29, 2020

Thanks for the report. It looks like the analysis is getting confused because we forgot to propagate the [[noreturn]] attribute to instantiations of a function template. I'm working on a fix now.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants