[clang][patch] Modify diagnostic level from err to warn: anyx86_interrupt_regsave
authorMelanie Blower <melanie.blower@intel.com>
Wed, 14 Apr 2021 21:07:54 +0000 (17:07 -0400)
committerMelanie Blower <melanie.blower@intel.com>
Thu, 15 Apr 2021 17:11:33 +0000 (13:11 -0400)
Reviewed By: Aaron Ballman

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

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

index afef86a..c84fd4d 100644 (file)
@@ -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>;
index 2ea5775..38c25ca 100644 (file)
@@ -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;
     }
index 952433e..564704a 100644 (file)
@@ -51,7 +51,7 @@ typedef unsigned int Arg2Type;
 __attribute__((no_caller_saved_registers))
 #else
 // expected-note@+3 {{'foo9' declared here}}
-// expected-error@+4 {{interrupt service routine may only call a function with attribute 'no_caller_saved_registers'}}
+// expected-warning@+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) {