Skip to content

Commit 4ee7c5c

Browse files
committed
fix according to reviewer's comments
1 parent 2c02723 commit 4ee7c5c

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,11 @@ def warn_arm_interrupt_vfp_clobber : Warning<
350350
InGroup<DiagGroup<"arm-interrupt-vfp-clobber">>;
351351
def err_arm_interrupt_called : Error<
352352
"interrupt service routine cannot be called directly">;
353-
def warn_interrupt_attribute_invalid : Warning<
354-
"%select{MIPS|MSP430|RISC-V|AVR}0 '%1' attribute only applies to "
355-
"functions that have %select{no parameters|a 'void' return type}2">,
356-
InGroup<IgnoredAttributes>;
353+
def warn_interrupt_signal_attribute_invalid : Warning<
354+
"%select{MIPS|MSP430|RISC-V|AVR}0 '%select{interrupt|signal}1' "
355+
"attribute only applies to functions that have "
356+
"%select{no parameters|a 'void' return type}2">,
357+
InGroup<IgnoredAttributes>;
357358
def warn_riscv_repeated_interrupt_attribute : Warning<
358359
"repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
359360
def note_riscv_repeated_interrupt_attribute : Note<

clang/lib/Sema/SemaAVR.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ void SemaAVR::handleInterruptAttr(Decl *D, const ParsedAttr &AL) {
3232

3333
// AVR interrupt handlers must have no parameter and be void type.
3434
if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) {
35-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
36-
<< /*AVR*/ 3 << "interrupt" << 0;
35+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
36+
<< /*AVR*/ 3 << /*interrupt*/ 0 << 0;
3737
return;
3838
}
3939
if (!getFunctionOrMethodResultType(D)->isVoidType()) {
40-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
41-
<< /*AVR*/ 3 << "interrupt" << 1;
40+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
41+
<< /*AVR*/ 3 << /*interrupt*/ 0 << 1;
4242
return;
4343
}
4444

@@ -57,13 +57,13 @@ void SemaAVR::handleSignalAttr(Decl *D, const ParsedAttr &AL) {
5757

5858
// AVR signal handlers must have no parameter and be void type.
5959
if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) {
60-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
61-
<< /*AVR*/ 3 << "signal" << 0;
60+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
61+
<< /*AVR*/ 3 << /*signal*/ 1 << 0;
6262
return;
6363
}
6464
if (!getFunctionOrMethodResultType(D)->isVoidType()) {
65-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
66-
<< /*AVR*/ 3 << "signal" << 1;
65+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
66+
<< /*AVR*/ 3 << /*signal*/ 1 << 1;
6767
return;
6868
}
6969

clang/lib/Sema/SemaMIPS.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,14 @@ void SemaMIPS::handleInterruptAttr(Decl *D, const ParsedAttr &AL) {
271271
}
272272

273273
if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) {
274-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
275-
<< /*MIPS*/ 0 << "interrupt" << 0;
274+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
275+
<< /*MIPS*/ 0 << /*interrupt*/ 0 << 0;
276276
return;
277277
}
278278

279279
if (!getFunctionOrMethodResultType(D)->isVoidType()) {
280-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
281-
<< /*MIPS*/ 0 << "interrupt" << 1;
280+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
281+
<< /*MIPS*/ 0 << /*interrupt*/ 0 << 1;
282282
return;
283283
}
284284

clang/lib/Sema/SemaMSP430.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ void SemaMSP430::handleInterruptAttr(Decl *D, const ParsedAttr &AL) {
3232
}
3333

3434
if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) {
35-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
36-
<< /*MSP430*/ 1 << "interrupt" << 0;
35+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
36+
<< /*MSP430*/ 1 << /*interrupt*/ 0 << 0;
3737
return;
3838
}
3939

4040
if (!getFunctionOrMethodResultType(D)->isVoidType()) {
41-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
42-
<< /*MSP430*/ 1 << "interrupt" << 1;
41+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
42+
<< /*MSP430*/ 1 << /*interrupt*/ 0 << 1;
4343
return;
4444
}
4545

clang/lib/Sema/SemaRISCV.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,14 +1457,14 @@ void SemaRISCV::handleInterruptAttr(Decl *D, const ParsedAttr &AL) {
14571457
}
14581458

14591459
if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) {
1460-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
1461-
<< /*RISC-V*/ 2 << "interrupt" << 0;
1460+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
1461+
<< /*RISC-V*/ 2 << /*interrupt*/ 0 << 0;
14621462
return;
14631463
}
14641464

14651465
if (!getFunctionOrMethodResultType(D)->isVoidType()) {
1466-
Diag(D->getLocation(), diag::warn_interrupt_attribute_invalid)
1467-
<< /*RISC-V*/ 2 << "interrupt" << 1;
1466+
Diag(D->getLocation(), diag::warn_interrupt_signal_attribute_invalid)
1467+
<< /*RISC-V*/ 2 << /*interrupt*/ 0 << 1;
14681468
return;
14691469
}
14701470

0 commit comments

Comments
 (0)