From: Aaron Ballman Date: Wed, 23 Jan 2019 18:02:17 +0000 (+0000) Subject: Merge similar target diagnostics for interrupt attribute into one; NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5739ad37a8f1e406ba84e7b80a2815029de5e507;p=clang Merge similar target diagnostics for interrupt attribute into one; NFC Patch by Kristina Bessonova! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351969 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index c55c815976..1a8f5c1307 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -261,22 +261,14 @@ def err_anyx86_interrupt_called : Error< def warn_arm_interrupt_calling_convention : Warning< "call to function without interrupt attribute could clobber interruptee's VFP registers">, InGroup; -def warn_mips_interrupt_attribute : Warning< - "MIPS 'interrupt' attribute only applies to functions that have " - "%select{no parameters|a 'void' return type}0">, +def warn_interrupt_attribute_invalid : Warning< + "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to " + "functions that have %select{no parameters|a 'void' return type}1">, InGroup; def warn_riscv_repeated_interrupt_attribute : Warning< "repeated RISC-V 'interrupt' attribute">, InGroup; def note_riscv_repeated_interrupt_attribute : Note< "repeated RISC-V 'interrupt' attribute is here">; -def warn_riscv_interrupt_attribute : Warning< - "RISC-V 'interrupt' attribute only applies to functions that have " - "%select{no parameters|a 'void' return type}0">, - InGroup; -def warn_msp430_interrupt_attribute : Warning< - "MSP430 'interrupt' attribute only applies to functions that have " - "%select{no parameters|a 'void' return type}0">, - InGroup; def warn_unused_parameter : Warning<"unused parameter %0">, InGroup, DefaultIgnore; def warn_unused_variable : Warning<"unused variable %0">, diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 5e9f27001d..010095da57 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -5543,14 +5543,14 @@ static void handleMSP430InterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) { - S.Diag(D->getLocation(), diag::warn_msp430_interrupt_attribute) - << 0; + S.Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid) + << /*MSP430*/ 1 << 0; return; } if (!getFunctionOrMethodResultType(D)->isVoidType()) { - S.Diag(D->getLocation(), diag::warn_msp430_interrupt_attribute) - << 1; + S.Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid) + << /*MSP430*/ 1 << 1; return; } @@ -5618,14 +5618,14 @@ static void handleMipsInterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) { - S.Diag(D->getLocation(), diag::warn_mips_interrupt_attribute) - << 0; + S.Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid) + << /*MIPS*/ 0 << 0; return; } if (!getFunctionOrMethodResultType(D)->isVoidType()) { - S.Diag(D->getLocation(), diag::warn_mips_interrupt_attribute) - << 1; + S.Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid) + << /*MIPS*/ 0 << 1; return; } @@ -5772,12 +5772,14 @@ static void handleRISCVInterruptAttr(Sema &S, Decl *D, } if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) { - S.Diag(D->getLocation(), diag::warn_riscv_interrupt_attribute) << 0; + S.Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid) + << /*RISC-V*/ 2 << 0; return; } if (!getFunctionOrMethodResultType(D)->isVoidType()) { - S.Diag(D->getLocation(), diag::warn_riscv_interrupt_attribute) << 1; + S.Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid) + << /*RISC-V*/ 2 << 1; return; }