[PATCH] D100511: [clang] Modify diagnostic level from err to warn: anyx86_interrupt_regsave

Melanie Blower via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 15 09:23:38 PDT 2021


mibintc updated this revision to Diff 337789.
mibintc marked an inline comment as done.
mibintc added a comment.

I added the InGroup rule for the new warning diagnostic like Aaron requested


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100511/new/

https://reviews.llvm.org/D100511

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/attr-x86-interrupt.c


Index: clang/test/Sema/attr-x86-interrupt.c
===================================================================
--- clang/test/Sema/attr-x86-interrupt.c
+++ clang/test/Sema/attr-x86-interrupt.c
@@ -51,7 +51,7 @@
 __attribute__((no_caller_saved_registers))
 #else
 // expected-note at +3 {{'foo9' declared here}}
-// expected-error at +4 {{interrupt service routine may only call a function with attribute 'no_caller_saved_registers'}}
+// expected-warning at +4 {{interrupt service routine should only call a function with attribute 'no_caller_saved_registers'}}
 #endif
 void foo9(int *a, Arg2Type b) {}
 __attribute__((interrupt)) void fooA(int *a, Arg2Type b) {
Index: clang/lib/Sema/SemaExpr.cpp
===================================================================
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -6607,7 +6607,7 @@
     }
     if (Caller->hasAttr<AnyX86InterruptAttr>() &&
         ((!FDecl || !FDecl->hasAttr<AnyX86NoCallerSavedRegistersAttr>()))) {
-      Diag(Fn->getExprLoc(), diag::err_anyx86_interrupt_regsave);
+      Diag(Fn->getExprLoc(), diag::warn_anyx86_interrupt_regsave);
       if (FDecl)
         Diag(FDecl->getLocation(), diag::note_callee_decl) << FDecl;
     }
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -293,9 +293,10 @@
   "a pointer as the first parameter|a %2 type as the second parameter}1">;
 def err_anyx86_interrupt_called : Error<
   "interrupt service routine cannot be called directly">;
-def err_anyx86_interrupt_regsave : Error<
-  "interrupt service routine may only call a function"
-  " with attribute 'no_caller_saved_registers'">;
+def warn_anyx86_interrupt_regsave : Warning<
+  "interrupt service routine should only call a function"
+  " with attribute 'no_caller_saved_registers'">,
+  InGroup<DiagGroup<"interrupt-service-routine">>;
 def warn_arm_interrupt_calling_convention : Warning<
    "call to function without interrupt attribute could clobber interruptee's VFP registers">,
    InGroup<Extra>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100511.337789.patch
Type: text/x-patch
Size: 2166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210415/247f5500/attachment.bin>


More information about the cfe-commits mailing list