Skip to content

Conversation

@cconvey
Copy link
Contributor

@cconvey cconvey commented May 13, 2022

Ensure that LOG(FATAL) always resolves to calling
[[noreturn]] code. This has two benefits:

  • Helps developers more quickly understand the
    intended/required behavior for LOG(FATAL) calls.

  • May eliminate spurious compiler warnings
    based on control-flow analysis. E.g. gcc's / clang's
    -Wno-return warnings.

@cconvey
Copy link
Contributor Author

cconvey commented May 13, 2022

CC: @areusch

@cconvey
Copy link
Contributor Author

cconvey commented May 13, 2022

Note: one motivation for this PR is to support #11245.

Ensure that `LOG(FATAL)` always resolves to calling
`[[noreturn]]` code.  This has two benefits:

- Helps developers more quickly understand the intended/required
  behavior for `LOG(FATAL)` calls.

- May eliminate spurious compiler warnings based on control-flow
  analysis.  E.g. gcc's / clang's `-Wno-return` warnings.
@cconvey cconvey force-pushed the fatal-logging-noreturn branch from 777d231 to 6074e6e Compare May 13, 2022 14:48
Copy link
Contributor

@tkonolige tkonolige left a comment

Choose a reason for hiding this comment

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

Sounds like this will silence the llvm warnings that force us to put empty returns after LOG(FATAL). Thanks!

@areusch areusch merged commit 80d8270 into apache:main May 13, 2022
@cconvey
Copy link
Contributor Author

cconvey commented May 13, 2022

Sounds like this will silence the llvm warnings that force us to put empty returns after LOG(FATAL). Thanks!

That was my intent, but I'm not sure it's actually effective, at least with the gcc / clang builds I tried. Hopefully newer/future versions of those compilers will be smarter about this.

@cconvey cconvey deleted the fatal-logging-noreturn branch May 13, 2022 16:47
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request May 16, 2022
Ensure that `LOG(FATAL)` always resolves to calling
`[[noreturn]]` code.  This has two benefits:

- Helps developers more quickly understand the intended/required
  behavior for `LOG(FATAL)` calls.

- May eliminate spurious compiler warnings based on control-flow
  analysis.  E.g. gcc's / clang's `-Wno-return` warnings.
shtinsa pushed a commit to Deelvin/tvm that referenced this pull request May 17, 2022
Ensure that `LOG(FATAL)` always resolves to calling
`[[noreturn]]` code.  This has two benefits:

- Helps developers more quickly understand the intended/required
  behavior for `LOG(FATAL)` calls.

- May eliminate spurious compiler warnings based on control-flow
  analysis.  E.g. gcc's / clang's `-Wno-return` warnings.
shingjan pushed a commit to shingjan/tvm that referenced this pull request May 17, 2022
Ensure that `LOG(FATAL)` always resolves to calling
`[[noreturn]]` code.  This has two benefits:

- Helps developers more quickly understand the intended/required
  behavior for `LOG(FATAL)` calls.

- May eliminate spurious compiler warnings based on control-flow
  analysis.  E.g. gcc's / clang's `-Wno-return` warnings.
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.

3 participants