I got a bug report that https://reviews.llvm.org/D97764 which introduced this diagnostic, was causing problems in interrupt service routines, complaining about functions like abort, exit, or the x86intrin routines (that are really just inlined asm). I think modifying the diagnostic level from error to warn is the safest way to deal with the problem. Checking "always inline" attribute on the called function isn't itself enough without knowing that the called function is leaf. (Separately, perhaps x86intrin functions should be decorated with attribute 'no_caller_saved_registers' in their declarations.)
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
299 | Please don't add warnings directly to -Wextra; this should have its own flag so that people who want to do this can turn the warning off without turning off all of -Wextra. |
I removed the diagnostic from InGroup<Extra>, that's the only change from previous revision
clang/include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
299 | Thanks, I had thought about removing InGroup<Extra> before uploading to review but hurrying at the end of my work day and forgot. I was expecting the lit test to fail and I'd have to add Wextra onto the RUN line but I didn't need to do that, the diagnostic was produced without enabling. Anyway I got rid of it like you asked. BTW the only other diagnostic in this file marked Wextra is the arm diagnostic. That was added in https://reviews.llvm.org/D28820 "warn_arm_interrupt_calling_convention" |
clang/include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
295–299 | You still need to add the diagnostic to a diagnostic group, otherwise users don't have a way to selectively disable the diagnostic. Feel free to pick a different group for the -W flag; I just took a stab at a possible name. This should fix the failing CI pipelines too. |
Please don't add warnings directly to -Wextra; this should have its own flag so that people who want to do this can turn the warning off without turning off all of -Wextra.