[clang] 938b863 - [clang][patch] Modify diagnostic level from err to warn: anyx86_interrupt_regsave

Melanie Blower via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 15 10:11:50 PDT 2021


Author: Melanie Blower
Date: 2021-04-15T13:11:33-04:00
New Revision: 938b863bb53f033c916d4e8d9a18cbd063656011

URL: https://github.com/llvm/llvm-project/commit/938b863bb53f033c916d4e8d9a18cbd063656011
DIFF: https://github.com/llvm/llvm-project/commit/938b863bb53f033c916d4e8d9a18cbd063656011.diff

LOG: [clang][patch] Modify diagnostic level from err to warn: anyx86_interrupt_regsave

Reviewed By: Aaron Ballman

Differential Revision: https://reviews.llvm.org/D100511

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index afef86ab5890..c84fd4da0fd4 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -293,9 +293,10 @@ def err_anyx86_interrupt_attribute : Error<
   "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>;

diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 2ea5775eaaa0..38c25ca65374 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6607,7 +6607,7 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
     }
     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;
     }

diff  --git a/clang/test/Sema/attr-x86-interrupt.c b/clang/test/Sema/attr-x86-interrupt.c
index 952433e2cb8a..564704a56477 100644
--- a/clang/test/Sema/attr-x86-interrupt.c
+++ b/clang/test/Sema/attr-x86-interrupt.c
@@ -51,7 +51,7 @@ typedef unsigned int Arg2Type;
 __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) {


        


More information about the cfe-commits mailing list