[PATCH] D56663: [MSP430] Improve support of 'interrupt' attribute

Kristina Bessonova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 16 07:32:23 PST 2019


krisb added inline comments.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:5388
+
+  if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) {
+    S.Diag(D->getLocation(), diag::warn_msp430_interrupt_attribute)
----------------
aaron.ballman wrote:
> What should happen if the function does not have a prototype? Should that be diagnosed? e.g., a K&R C function in C mode accepts an arbitrary number of arguments (which can include zero).
Currently, in a case like this
```
__attribute__((interrupt(0))) void foo();

void foo(int i) {
  i++;
}
```
frontend reports no warnings, but backend fails with the following error:
```
fatal error: error in backend: ISRs cannot have arguments
```
But definitely, that should be diagnosed early.
I'll take care of this. Thanks! 


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56663





More information about the cfe-commits mailing list