-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Fix clang 21 warnings #83499
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
base: master
Are you sure you want to change the base?
Fix clang 21 warnings #83499
Conversation
|
This is a bug in clang 21.1.4, fixed in clang 22 llvm/llvm-project#154493. I think filing a report requesting a backport is preferable to trying to use a language feature that isn't quite here yet (see the failing Windows build). #ifdef __clang__
#define LAMBDA_NORETURN __attribute__( ( noreturn ) )
#else
#define LAMBDA_NORETURN
#end |
|
I wasn't sure were to put the |
|
Could you rename it to |
Due to error: function 'operator()' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn] ref: llvm/llvm-project#154493
|
Did the CI windows build https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/18880894748/job/53883387286?pr=83499 just hit #82635 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
Summary
Build "Fix clang 21 warnings"
Purpose of change
Recently arch linux updated
clangfrom20.1.8to21.1.4.This made a new compilation warning appear.
Describe the solution
Added
__attribute__((noreturn))to lambdas with the warning.Describe alternatives you've considered
I have minimal experience with c++ projects, I'm unsure if this is the correct solution (code quality wise? a better way to set these attributes?), if someone with more experience could provide guidance that would be helpful.
Perhaps it would be better to just disable the warning in the
Makefile?I don't have any preference for a solution, I'm open to amending the commit.
Testing
Game compiles with clang and g++ without warnings, visual studio compilation untested since I'll go feral the moment I'll use f***ing Windows for anything.
Additional context
https://releases.llvm.org/21.1.0/tools/clang/docs/ReleaseNotes.html